Skip to content

Commit 5c479b1

Browse files
committed
fix(stuff): working on next release
♬ Rebūke - Chaos (feat. P.T. Adamczyk)
1 parent 530ab1c commit 5c479b1

108 files changed

Lines changed: 3834 additions & 267 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Taint-mode semgrep presets for JavaScript (`presets/javascript.toml`) and Go (`presets/go.toml`), with taint-source/sink rules for SQLi, command injection, and path traversal
12+
- Taint-mode rules added to existing PHP and Python presets
13+
- `max_target_bytes` config field under `[scanner.semgrep]` to cap file size passed to semgrep via `--max-target-bytes`
14+
- Graduated verification gate: individual check results (reachability, controllability, preconditions, context, impact) are recorded separately instead of a single binary kill
15+
16+
### Changed
17+
- Default `project.languages` in `config.example.toml` expanded from `["c", "python"]` to include `go`, `javascript`, `php`
18+
- Semgrep runner no longer aborts the entire scan on a non-zero exit code; partial JSON findings from stdout are preserved
19+
- Verification gate downgrades to `NeedsReview` instead of `FalsePositive` when a single check fails, preserving incremental evidence
20+
21+
### Fixed
22+
- Finding ID collisions: `generate_id` now includes `rule_id` and a snippet discriminator byte in the hash, preventing distinct vulnerabilities on the same file/line/CWE from sharing an ID
23+
- `generate_id` distinguishes `None` from `Some("")` snippets via a discriminator byte
1024

1125
## [1.1.0] - 2026-09-15
1226

‎config.example.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ name = "libxml2"
1818
# Path to the target directory to scan (must exist)
1919
path = "./libxml2-test"
2020
# Languages to scan (file extensions will be detected automatically)
21-
languages = ["c", "python"]
21+
# BACO supports: C, Python, JavaScript, TypeScript, Go, PHP, and Ruby.
22+
# Only languages with installed presets will be scanned.
23+
languages = ["c", "python", "javascript", "typescript", "go"]
2224

2325
# Output configuration
2426
[output]
@@ -51,6 +53,7 @@ rulesets = [
5153
# "p/javascript", # Example: JavaScript security rules
5254
]
5355
exclude_rules = ["html.security.plaintext-http-link", "html.security.plaintext-http-link.plaintext-http-link"]
56+
# force_scan = false # pass --no-git-ignore: scan git-ignored/untracked files (does NOT bypass .semgrepignore, so tests/ stays skipped)
5457

5558
[scanner.performance]
5659
# Maximum number of parallel tasks for scanning operations

‎docs/configuration.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ rulesets = [
9898
]
9999
# Rules to exclude (supports exact match and prefix match)
100100
exclude_rules = ["html.security.plaintext-http-link"]
101+
# Max file size (in bytes) passed to semgrep via --max-target-bytes.
102+
# Files larger than this are skipped by semgrep without aborting the scan.
103+
# When unset, semgrep uses its own default (~1 MiB).
104+
# max_target_bytes = 1048576
101105
# Inline rule YAML documents (full `rules:` blocks) - materialized to temp files at scan time
102106
custom_rules = ['''
103107
rules:

‎presets/go.toml‎

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# BACO preset — Go
2+
[project]
3+
name = "go"
4+
languages = ["go"]
5+
6+
[scanner]
7+
max_file_size_kb = 512
8+
exclude_paths = [
9+
"vendor/*",
10+
"node_modules/*",
11+
"tests/*",
12+
"test/*",
13+
"spec/*",
14+
"cypress/*",
15+
"playwright/*",
16+
"*.min.js",
17+
"*.min.css",
18+
"*.map",
19+
]
20+
21+
[scanner.semgrep]
22+
rulesets = ["p/go"]
23+
custom_rules = ['''
24+
rules:
25+
- id: go-template-html-high
26+
languages: [go]
27+
severity: ERROR
28+
message: >
29+
template.HTML conversion without escaping, XSS risk if user input flows here.
30+
metadata:
31+
cwe:
32+
- "CWE-79: Improper Neutralization of Input During Web Page Generation"
33+
pattern: template.HTML($VAR)
34+
35+
- id: go-weak-hash-md5-medium
36+
languages: [go]
37+
severity: WARNING
38+
message: >
39+
MD5 hash used for security purposes, cryptographically broken.
40+
metadata:
41+
cwe:
42+
- "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
43+
pattern-either:
44+
- pattern: md5.New()
45+
- pattern: md5.Sum($VAR)
46+
47+
- id: go-exec-command-high
48+
languages: [go]
49+
severity: ERROR
50+
message: >
51+
exec.Command() with variable input, command injection risk.
52+
metadata:
53+
cwe:
54+
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
55+
pattern-either:
56+
- pattern: exec.Command($CMD)
57+
- pattern: exec.CommandContext($CTX, $CMD)
58+
59+
- id: go-taint-sqli-high
60+
languages: [go]
61+
mode: taint
62+
severity: ERROR
63+
message: >
64+
User input flows into database query without sanitization, SQL injection risk.
65+
metadata:
66+
cwe:
67+
- "CWE-89: Improper Neutralization of Special Elements used in an SQL Command"
68+
pattern-sources:
69+
- pattern: r.URL.Query().Get($KEY)
70+
- pattern: r.FormValue($KEY)
71+
- pattern: r.PostFormValue($KEY)
72+
pattern-sinks:
73+
- pattern: db.Query($SQL)
74+
- pattern: db.Exec($SQL)
75+
- pattern: db.QueryRow($SQL)
76+
- pattern: db.Prepare($SQL)
77+
78+
- id: go-taint-cmdi-high
79+
languages: [go]
80+
mode: taint
81+
severity: ERROR
82+
message: >
83+
User input flows into command execution without sanitization, command injection risk.
84+
metadata:
85+
cwe:
86+
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command"
87+
pattern-sources:
88+
- pattern: r.URL.Query().Get($KEY)
89+
pattern-sinks:
90+
- pattern: exec.Command($CMD)
91+
92+
- id: go-taint-path-traversal-high
93+
languages: [go]
94+
mode: taint
95+
severity: ERROR
96+
message: >
97+
User input flows into file operations without validation, path traversal risk.
98+
metadata:
99+
cwe:
100+
- "CWE-22: Improper Limitation of a Pathname to a Restricted Directory"
101+
pattern-sources:
102+
- pattern: r.URL.Query().Get($KEY)
103+
pattern-sinks:
104+
- pattern: os.Open($PATH)
105+
- pattern: os.ReadFile($PATH)
106+
- pattern: os.Create($PATH)
107+
- pattern: os.Remove($PATH)
108+
''']
109+
110+
[scanner.performance]
111+
enable_variant_search = true
112+
enable_cve_bootstrap = true
113+
114+
[llm]
115+
temperature = 0.2
116+
max_concurrent = 4
117+
enable_llm_cache = true
118+
119+
[llm.phases.discovery]
120+
models = ["mistral-small"]
121+
122+
[llm.phases.verification]
123+
model = "mistral-medium"
124+
125+
[llm.phases.aggregation]
126+
model = "mistral-medium"
127+
128+
[triage]
129+
enabled = true
130+
model = "mistral-small"
131+
batch_size = 8
132+
suspicion_threshold = 0.30
133+
134+
[priority]
135+
entry_point_patterns = [
136+
"http.HandleFunc",
137+
"router.",
138+
"gin.",
139+
"echo.",
140+
"main.go",
141+
"cmd/",
142+
"handlers/",
143+
"controllers/",
144+
]
145+
sink_patterns = [
146+
"template.HTML(",
147+
"md5.New(",
148+
"md5.Sum(",
149+
"exec.Command(",
150+
"exec.CommandContext(",
151+
"db.Query(",
152+
"db.Exec(",
153+
"os.Open(",
154+
"os.ReadFile(",
155+
]
156+
157+
[budget]
158+
enabled = true
159+
max_llm_calls = 250
160+
161+
[knowledge.fp_patterns]
162+
"CWE-79" = [
163+
"template.HTMLEscapeString(",
164+
"template.HTMLAttr(",
165+
"html.EscapeString(",
166+
"HTMLEscapeString(",
167+
]
168+
"CWE-89" = [
169+
"?",
170+
"$1",
171+
"sql.Named(",
172+
]
173+
"CWE-352" = [
174+
"csrf",
175+
"CSRF",
176+
"token",
177+
"nonce",
178+
]
179+
"CWE-862" = [
180+
"Auth(",
181+
"Authenticate(",
182+
"IsAuthenticated(",
183+
"CheckAuth(",
184+
"RequireAuth(",
185+
]
186+
187+
[knowledge.required_security_primitives]
188+
"go" = ["template.HTMLEscapeString", "template.HTMLAttr", "html.EscapeString", "HTMLEscapeString"]
189+
190+
[agent]
191+
enabled = false

0 commit comments

Comments
 (0)