fix(scan): a Semgrep rule pack with its samples is test data
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m25s
CI / Check (pull_request) Successful in 17m16s
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m25s
CI / Check (pull_request) Successful in 17m16s
A repository that ships Semgrep rules keeps, next to each rule X.yaml, the sample X.py or X.cs it is tested on, written to hold the flaws the rule must find. Vendored packs bring their own manifests (a pom.xml naming old Struts and Spring versions). Scanned as product code, the samples become code findings and the manifests SBOM components with CVEs. test_data_dirs now also lists a directory with a Semgrep rule file and a sample of the same name (Semgrep's test convention), with everything below it, never the tree itself. A YAML file counts as a rule file when it has a rules list naming id, languages and message, and is at most 1 MiB. As test data, the pack leaves the working copy before any stage, and findings an earlier scan stored there close as test data (#904). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b079cf9267
commit
e88fa8524d
2 files changed
+186
-8
No files matched your search
@@ -28,7 +28,10 @@ names while the scan runs.
|
||||
`fixtures`, `__fixtures__`, `testdata`, `test_data`, `test-data`,
|
||||
`test-fixtures` or `test_fixtures` (at any depth) hold sample projects and
|
||||
lockfiles that are not what the product ships, so they produce no code
|
||||
findings, no SBOM components and no CVEs. `tests/`, `spec/` and
|
||||
findings, no SBOM components and no CVEs. A Semgrep rule pack counts as
|
||||
test data too, with everything below it: a directory that holds a rule
|
||||
file `X.yaml` next to the sample it is tested on (`X.py`, `X.cs`), as
|
||||
`semgrep --test` expects. `tests/`, `spec/` and
|
||||
`examples/` are scanned as usual. Paths the target's settings exclude are
|
||||
left out the same way (see
|
||||
[Leaving Paths out of the Scan](/guide/repositories#leaving-paths-out-of-the-scan)).
|
||||
|
||||
Reference in new issue
Block a user