Skip to content

Ask for baseline scans run with the same scan settings - #214

Open
Ibrahimrahhal wants to merge 1 commit into
mainfrom
baseline-same-settings
Open

Ibrahimrahhal wants to merge 1 commit into
mainfrom
baseline-same-settings

Conversation

@Ibrahimrahhal

Copy link
Copy Markdown
Member

Why

corgea scan picks 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-type values, 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 exact scan_configs value 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.

  • The value is worked out once, by uploaded_scan_configs, and both the lookup and the upload read it, so they cannot disagree. The blast to base translation moved there from the upload form.
  • The parameter is always sent, empty for a default run: its presence is what turns the filter on.
  • No settings check was added on the client. The scan list does not report a scan's settings.

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-recently uses 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

  • Unit tests for the three cases: a --scan-type run, a default run (parameter present and empty), and --scan-type blast (sends base, the same as the upload).
  • Two end-to-end tests assert the parameter on both lookups and the matching scan_configs form field.
  • cargo test, cargo clippy --all-targets -- -D warnings and ./harness lint pass.
  • Not run against a live server.

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.
Comment thread src/utils/api.rs
Comment on lines +587 to +591
Some(if scan_type.contains("blast") {
"base".to_string()
} else {
scan_type.to_string()
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 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.
Suggested change
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 corgea-security added the dennis-reviewed Dennis completed an automated review label Nov 29, 2026

@corgea-security corgea-security left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 corgea-security left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by Dennis: high policy risk and automated risk 2/5.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dennis-reviewed Dennis completed an automated review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants