Let the config choose which external scanners run and which Semgrep rules they use

Aperta
#122 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
62/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
security, tooling

Direzione di ricerca

Start at internal/engine/run.go:174-180, where seed.All() is narrowed only for --offline, and copy how offlineSeeders reports a skip. Then read internal/seed/external.go:106 and :172 for the Semgrep invocation and the stale error text, and add the new keys beside exclude/include/disable_rules in internal/config/config.go:121-130, mirroring them in internal/cli/doctor.go:122 and docs/config.md. Done when go test ./internal/seed ./internal/config ./internal/engine passes and skipped scanners appear as disabled in the report and doctor output.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement help wanted severity: medium

Summary

A scan runs every external scanner it finds on PATH, and Semgrep always runs the p/default registry pack. There is no setting to choose which scanners run, and no way to point Semgrep at the repository's own rules. One error message even tells the user to "remove it from the seeder list", but no such list exists.

Where

  • internal/engine/run.go:174-180 (seed.All(), narrowed only for --offline)
  • internal/seed/external.go:106 ("--config", "p/default")
  • internal/seed/external.go:172 ("remove it from the seeder list")
  • internal/config/config.go:121-130 ([scan] has exclude, include and disable_rules only)
  • internal/cli/doctor.go:122

Details

seeders := opts.Seeders
if seeders == nil {
    seeders = seed.All()
}
if opts.Config.Offline {
    seeders = offlineSeeders(seeders)
}

disable_rules drops leads only after a scanner has run and spent its wall time.

Impact

Today the only way to drop a scanner is to take it off PATH or go fully --offline. That hurts a team that wants gitleaks but not Trivy's database download, or a team whose Trivy is slow on a monorepo. Teams with their own Semgrep rules, which is common, get the generic pack instead, so Spackle repeats generic coverage and misses their project-specific rules.

Suggested fix

  • Add [scan] scanners = [...] (an allowlist; empty means every available scanner) and/or skip_scanners. Filter seeders in run.go before RunAll, and report a skipped scanner as "not run: disabled by configuration", the way offlineSeeder reports its skip.
  • Add [scan.semgrep] config = ["p/default"], accepting registry packs or repository-relative paths resolved with walk.Resolve so a path cannot leave the target. A local path also makes Semgrep usable offline.
  • Reword external.go:172 to name the real setting.
  • Mirror the selection in doctor and the dry-run seeder list.

Open question: whether target-relative Semgrep rule paths should be allowed by default, since the target is untrusted content.

Acceptance criteria

  • A config key limits which external scanners run, and skipped ones show as disabled in the report and doctor.
  • Semgrep can run a configured pack or a rules path inside the target.
  • The "not on PATH" error names a setting that exists.

Getting started

  • Relevant files: internal/engine/run.go, internal/seed/external.go, internal/config/config.go, docs/config.md
  • How to run tests: go test ./internal/seed ./internal/config ./internal/engine
  • Related docs: docs/config.md

Filed by repo-audit/full-audit at fffef43. Severity: medium. Effort: M. audit-key: enhancement|internal/engine/run.go|seed.All

Lingua principale
Go
Stelle
0
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/Spackle

Tutte le issue di TMHSDigital/Spackle

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.