Repository navigation
Ask for baseline scans run with the same scan settings - #214
Ibrahimrahhal wants to merge 1 commit into
Conversation
The server refuses a base whose scan settings differ from the upload's and scans every file. The baseline lookup never said which settings this run uses, so two jobs scanning one branch with different --scan-type values kept naming each other's scan and never ran incrementally. Every baseline lookup now sends comparable_scan_configs, the scan_configs value the upload will carry (empty when it carries none), so the server answers only with scans this run can use. Both read one value worked out by uploaded_scan_configs. A server predating the parameter ignores it and behaves as before.
| Some(if scan_type.contains("blast") { | ||
| "base".to_string() | ||
| } else { | ||
| scan_type.to_string() | ||
| }) |
There was a problem hiding this comment.
🔴 High · 🧹 Quality — Preserve other scan types when translating blast
uploaded_scan_configs replaces the entire scan configuration with "base" whenever the input contains "blast". For a realistic --scan-type blast,secrets run, the upload and baseline lookup therefore both omit secrets, so the server can accept a baseline that does not match the requested scan settings; translate only the blast component while preserving the other components.
View in Corgea ↗
More Details
🪄Fix Explanation: The function now handles comma-separated scan configurations individually, replacing only the exact "blast" entry with "base". This avoids incorrectly treating the entire input as one configuration.
- "split(',')" processes each configuration separately, so mixed inputs such as "blast,other" retain their other entries.
- Exact equality in "config == "blast"" avoids replacing unrelated names that merely contain the substring “blast.”
- Joining the mapped entries preserves the comma-separated format expected by callers.
| Some(if scan_type.contains("blast") { | |
| "base".to_string() | |
| } else { | |
| scan_type.to_string() | |
| }) | |
| Some( | |
| scan_type | |
| .split(',') | |
| .map(|config| if config == "blast" { "base" } else { config }) | |
| .collect::<Vec<_>>() | |
| .join(","), | |
| ) |
corgea-security
left a comment
There was a problem hiding this comment.
Automated review risk: 2/5.
Baseline lookup and upload now share one scan_configs value, including the existing blast→base rewrite, and every lookup path sends comparable_scan_configs (empty when the upload omits the field). I do not see a client-side correctness bug that must change; residual risk is the server treating that parameter, especially the empty value, differently than these comments assume.
No critical or high-priority changes were found.
corgea-security
left a comment
There was a problem hiding this comment.
Approved by Dennis: high policy risk and automated risk 2/5.
Why
corgea scanpicks its own incremental base: it lists the project's scans, takes the nearest one and names it on upload. The server refuses a base whose scan types differ from the upload's, and the scan then analyzes every file. The lookup never said which scan types this run uses, so when two jobs scan one branch with different--scan-typevalues, each keeps naming the other's scan and neither runs incrementally, although an older scan with its own settings exists.Change
Every baseline lookup now sends
comparable_scan_configs: the exactscan_configsvalue the upload will carry, or empty when it will carry none. The server (Corgea/doghouse#2910) answers only with scans run with those scan types.uploaded_scan_configs, and both the lookup and the upload read it, so they cannot disagree. Theblasttobasetranslation moved there from the upload form.Compatibility: a server without Corgea/doghouse#2910 ignores the parameter and behaves as today, so this is safe to release before or after it.
Not covered:
--policy. The server does not compare target policies when it accepts a base, so runs that differ only by policy can still use each other's scan.--skip-if-commit-scanned-recentlyuses a different lookup and does not check the earlier scan's settings. A default run can reuse a same-commit scan that ran fewer scan types.Testing
--scan-typerun, a default run (parameter present and empty), and--scan-type blast(sendsbase, the same as the upload).scan_configsform field.cargo test,cargo clippy --all-targets -- -D warningsand./harness lintpass.