Skip to content

Feature/intercom token detection#7

Merged
StephenJarso merged 18 commits into
mainfrom
feature/intercom-token-detection
Jun 22, 2026
Merged

Feature/intercom token detection#7
StephenJarso merged 18 commits into
mainfrom
feature/intercom-token-detection

Conversation

@StephenJarso

Copy link
Copy Markdown
Owner

What does this PR do?

Describe the changes in this PR.

Which detectors does it affect?

  • Secrets
  • Environment
  • Auth
  • Config
  • New detector: _______

Testing done

  • Unit tests added
  • Manually tested with a real codebase
  • All existing tests pass

Checklist

  • Code follows the style guide
  • Self-review completed
  • Documentation updated (if applicable)
  • CHANGELOG.md updated under [Unreleased]

Screenshots (if applicable)

Add screenshots to help explain your changes.

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.
@StephenJarso StephenJarso reopened this Jun 22, 2026
@StephenJarso StephenJarso merged commit a406251 into main Jun 22, 2026
6 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant