Skip to content

Commit

Permalink
feat: exported customDetector validation function
Browse files Browse the repository at this point in the history
  • Loading branch information
iamnasirudeen committed Feb 10, 2025
1 parent bad991c commit 143ebdb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "securelog-scan",
"version": "3.0.22",
"version": "3.0.23",
"description": "A CLI tool to scan codebases for potential secrets.",
"main": "dist/index.js",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion src/regexHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const isWhitelisted = (input: string): boolean => {
* Validates a custom detector configuration and throws detailed errors if invalid.
* @param config - The custom detector configuration to validate.
*/
const validateDetectorConfig = (config: DetectorConfig): void => {
export const validateDetectorConfig = (config: DetectorConfig): void => {
const { regex, keywords, detectorType, group } = config;
const errors: string[] = [];

Expand Down
4 changes: 3 additions & 1 deletion src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import axios from "axios";
import { AhoCorasickCore } from "../ahocorasick";
import { decay } from "../decay";
import { buildCustomDetectors } from "../regexHandler";
import { buildCustomDetectors, validateDetectorConfig } from "../regexHandler";
import { DataFormat, ScanStringOptions } from "../types";
import { DetectorConfig } from "../types/detector";
import { maskString } from "../util";
Expand Down Expand Up @@ -203,3 +203,5 @@ export class DataFormatHandlers {
this.formats.set(name, handler);
}
}

export const validateCustomDetectorConfig = validateDetectorConfig;

0 comments on commit 143ebdb

Please sign in to comment.