QOL Changes to File Index and Defaults - #64
Merged
Conversation
…e default probes and detectors
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes “default” wiring for detectors, probes, and file-index patterns, and adds an injection point so callers can provide a prebuilt FileIndex to the collector (skipping internal build/cache). This aligns the CLI, config defaults, and tests around single sources of truth for default ordering.
Changes:
- Add
detector.NewDefaultRegistry()+ test to pin built-in detector set/order. - Add
probe.DefaultProbes(cfg, registry)+ tests to pin built-in probe set/order and confirmEnabledwiring. - Add
Collectorsupport for an injected*fileindex.FileIndexand refactor CLI probe initialization to use the new default registries/probe set. - Refactor file-index pattern defaults into
config.DefaultPatterns()and add a test asserting loaded defaults match.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/probe/defaults.go | Centralizes the built-in probe set and order. |
| pkg/probe/defaults_test.go | Pins default probe names/order and validates enabled wiring from config. |
| pkg/detector/defaults.go | Centralizes default detector registration order via NewDefaultRegistry. |
| pkg/detector/defaults_test.go | Pins default detector names/order to keep redaction behavior stable. |
| pkg/config/config.go | Makes DefaultPatterns() the single source of truth for file-index patterns and feeds it into viper defaults. |
| pkg/config/defaults_test.go | Adds a test asserting loaded config patterns match DefaultPatterns() (needs hermeticity fix). |
| pkg/collector/collector.go | Adds support for caller-supplied FileIndex to skip internal build/cache. |
| pkg/collector/collector_test.go | Adds coverage for injected file index being passed through to file-index-aware probes. |
| cmd/bagel/scan.go | Refactors CLI probe initialization to use the new centralized defaults and preserve ordering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+16
to
+23
| func TestDefaultPatterns_MatchesLoadedConfig(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| defaults := DefaultPatterns() | ||
| require.NotEmpty(t, defaults) | ||
|
|
||
| cfg, err := Load("") | ||
| require.NoError(t, err) |
fproulx-boostsecurity
approved these changes
Jul 21, 2026
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.
qol changes to be able to set an existing file index and better manage default probes and detectors