Feature/intercom token detection#7
Merged
Merged
Conversation
Add utility functions for file path handling: - IsHiddenFile checks if a file is hidden (starts with .) - GetBaseName returns the base name of a file path - Add walk_additional_test.go with comprehensive tests
Extract countBySeverity function to be shared between ConsoleReporter and SummaryReporter - Remove duplicate function definition - Improve code organization and maintainability
Add tests for EnvDetector to verify: - Case insensitive detection of .env files - Detection with full file paths - Finding message content validation
Add tests for ConfigDetector to verify detection of: - All config file extensions (.yaml, .yml, .json, .xml, .toml, .ini, .cfg, .conf, .properties) - All config filenames (config, configuration, settings, application, appsettings, package.json, requirements.txt, gemfile, dockerfile) - Non-config files that should not be detected
Add Size method to ScanCache to return the number of cached entries - Add cache_additional_test.go with tests for Size method - Test Size with enabled and disabled cache states
Add SetFile method to allow changing the output file for CSVReporter - Enables testing with different output files - Add csv_additional_test.go with tests for SetFile and file content verification
Add AddRule method to programmatically add custom rules Add RuleCount method to get the number of loaded rules Add custom_additional_test.go with tests for new methods
Add ToJSON method to return JSON string representation of findings - Enables testing and programmatic access to report data - Add json_additional_test.go with tests for ToJSON method
Add exported versions of internal functions for better testability - Add more dangerous function patterns (eval, compile, ioutil, osopen) - Add ast_additional_test.go with comprehensive tests
Add ToSARIF method to return SARIF JSON string representation of findings - Enables testing and programmatic access to report data - Add sarif_additional_test.go with tests for ToSARIF method
Add ToAnnotations method to return GitHub Actions annotations as strings - Enables testing and programmatic access to annotation data - Add github_additional_test.go with tests for ToAnnotations method
Add WorkerPool for managing concurrent file processing: - NewWorkerPool creates a pool with specified worker count - Start begins processing jobs - Submit adds jobs to the pool - Stop stops the pool - GetWorkerCount returns the number of workers - Add parallel_additional_test.go with tests for WorkerPool
Add methods to Scanner for better introspection: - GetCache returns the scanner's cache for inspection - GetDetectorCount returns the number of configured detectors - Add scanner_additional_test.go with tests for new methods
Add test for Intercom token detection in auth detector - Verify intercomTokenPattern correctly detects Intercom tokens - Add test case for intercom_token format
Add Format method to return console output as a string - Enables testing and programmatic access to report data - Add console_additional_test.go with tests for Format method
Add count methods to Config for better introspection: - CustomRuleCount returns the number of custom rules - IgnoreRuleCount returns the number of ignore rules - IgnorePathCount returns the number of ignore paths - AllowlistCount returns the number of allowlist entries - Add config_additional_test.go with tests for count methods
Add methods to Logger for checking log level at runtime: - GetLevel returns the current log level - IsDebugEnabled returns true if debug logging is enabled - IsInfoEnabled returns true if info logging is enabled - IsWarnEnabled returns true if warn logging is enabled - IsErrorEnabled returns true if error logging is enabled - Add logger_additional_test.go with tests for level methods
The Finding struct is already defined in internal/detectors/detector.go. Removed the duplicate definition and test file that were causing build failures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Describe the changes in this PR.
Which detectors does it affect?
Testing done
Checklist
Screenshots (if applicable)
Add screenshots to help explain your changes.