Our ~35 own rules left whole languages without SAST findings. Three permissively licensed community packs now run next to them, on the same semgrep invocation (--metrics=off, local files only): - GitLab sast-rules v2.10.1 (53bf5cf6): 148 rules for C#, Java, JavaScript/TypeScript, Python and one Go rule; only files whose header says "License: MIT (c) GitLab Inc.". Not vendored: c/ (every file GPL-2.0, generated from flawfinder), go/ apart from one file (Apache-2.0 gosec ports), scala/, rules/lgpl, rules/lgpl-cc (Commons Clause), rules/gitlab (EE). - 0xdea semgrep-rules (dae50da6, MIT): 35 C/C++ rules. - elttam semgrep-rules (24426856, MIT; its LICENSE carries the Semgrep template's copyright line): 34 rules for Java, Go and Struts/Spring XML. Each pack lives in compliance-agent/rules/vendor/<source>/ with LICENSE, NOTICE (provenance, what was left out and why) and UPSTREAM (pinned commit): upstream/ holds the selected files unchanged with their tests, pack.yaml the rules the agent runs, ids prefixed per source (gitlab-, 0xdea-, elttam-), rules.json an index for the tests. scripts/vendor-semgrep-rules.py regenerates all of it deterministically. Provenance: every candidate rule was compared with the Semgrep registry (semgrep/semgrep-rules, read only for the comparison). Eight GitLab Python/JS rules with the same message or the same patterns are not vendored, nor are elttam's Kubernetes rules (registry-derived). Also left out: elttam's entrypoint enumerators, its ORM-leak hints, three files whose upstream tests fail on semgrep 1.177 and a join-mode rule. Noise budget: run over the nightly fixtures, the public samples and FreeRTOS-Kernel, lwIP, OpenRA, eShopOnWeb, requests, express and spring-petclinic. 15 rules that flood real code (0xdea missing-return 1514 hits, typos 989, interesting-api-calls 718, signed-unsigned-conversion 221, suspicious-assert 176, format-string-bugs 61 ...; GitLab assert-used) are dropped from the pack, each listed with its reason in NOTICE. CPU time of the semgrep run roughly doubles on C-heavy trees (FreeRTOS-Kernel 70 s -> 136 s, lwIP 18 s -> 68 s), well inside the 10-minute stage timeout. Ids stay bare (#473 logic covers the vendored ids, fingerprint() unchanged). The control map gets one vendored semgrep binding per control, by CWE (by rule id for the few elttam rules without one), with exactly the languages of the rules behind it; a test checks every vendored rule maps to a control that claims its languages. Guard: semgrep_args() builds the one invocation; a test fails if any --config is not a staged local pack, or is auto, p/, r/ or a URL, and another scans the agent source, scripts, docker/, CI and Dockerfile.agent for a registry config. Nightly baselines with C, Python, C# or JS code change and need a bless run after the image is deployed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2 lines
80 B
Plaintext
2 lines
80 B
Plaintext
https://github.com/0xdea/semgrep-rules dae50da6e6e629750f1daec73a01ef9206a372ab
|