Skip to content

QOL Changes to File Index and Defaults - #64

Merged
fproulx-boostsecurity merged 1 commit into
mainfrom
maint/exportImprove
Jul 21, 2026
Merged

QOL Changes to File Index and Defaults#64
fproulx-boostsecurity merged 1 commit into
mainfrom
maint/exportImprove

Conversation

@SUSTAPLE117

Copy link
Copy Markdown
Contributor

qol changes to be able to set an existing file index and better manage default probes and detectors

Copilot AI review requested due to automatic review settings July 10, 2026 15:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 confirm Enabled wiring.
  • Add Collector support for an injected *fileindex.FileIndex and 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
fproulx-boostsecurity merged commit dd8e4d3 into main Jul 21, 2026
7 checks passed
@fproulx-boostsecurity
fproulx-boostsecurity deleted the maint/exportImprove branch July 21, 2026 20:17
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.

3 participants