Run Secrets FP detection on tracked tags
What does this MR do and why?
Runs Secret Detection false-positive (FP) detection automatically for new findings on tracked tags. Builds on !267156 (merged), which did the same for tracked non-default branches and left tags out on purpose.
Uses the same gate as !267156 (merged): the secrets_fp_detection_non_default_branches feature flag (beta, off by default) and VAC must both be enabled.
This is the Secrets version of !262141 (merged), which did the same for SAST.
- Ingestion (
Security::Ingestion::Tasks::HooksExecution): drops the branch-only check for Secret Detection, so new Secret Detection findings on tracked tags now trigger FP detection. Untracked refs and other report types are still skipped. - FP flow: no change.
Vulnerability#fp_detection_source_branchalready returnsnilfor tags, so the agent's local checkout is the default branch, and the flow reads the flagged file through the API at the commit where the finding was detected. This matches manual Secrets FP runs on tags today.
Before (!267156 (merged), VAC + secrets_fp_detection_non_default_branches on)
| SAST FP | Secret Detection FP | |
|---|---|---|
| Default branch | Runs on default branch | Runs on default branch |
| Tracked non-default branches | Runs on the finding's own branch | Runs on the finding's own branch |
| Untracked non-default branches | Not triggered | Not triggered |
| Tracked tags | Runs; reads code at the tag's commit | Not triggered |
| Untracked tags | Not triggered | Not triggered |
After (VAC + secrets_fp_detection_non_default_branches on)
| SAST FP | Secret Detection FP | |
|---|---|---|
| Default branch | Unchanged | Unchanged |
| Tracked non-default branches | Unchanged | Unchanged |
| Untracked non-default branches | Unchanged: not triggered | Unchanged: not triggered |
| Tracked tags | Unchanged | |
| Untracked tags | Unchanged: not triggered | Unchanged: not triggered |
Note: For tag findings, the agent's local checkout is still the default branch, because the workflow only accepts a branch name. Making the local checkout match the finding's ref is tracked for SAST in #633758, and applies to Secrets too.
References
- Epic: gitlab-org#23514
- Builds on: !267156 (merged)
- SAST equivalent: !262141 (merged)
- Spike and technical analysis: #628109 (closed)
- Follow-up (local checkout at the finding's ref): #633758
Screenshots or screen recordings
Not applicable: backend only, no UI changes.
How to set up and validate locally
-
Make sure VAC is enabled for your project, Secret Detection false positive detection is turned on, and experiment and beta GitLab Duo features are on for the group.
-
In the Rails console, enable the feature flag:
Feature.enable(:secrets_fp_detection_non_default_branches) -
Create a tag in the project (for example
v1.0.0) and track it:mutation { securityRefsTrack(input: { projectPath: "<group>/<project>" refs: [{ name: "v1.0.0", refType: TAG }] }) { trackedRefs { name } errors } } -
Run a pipeline on the tag that produces a new Critical or High Secret Detection finding.
-
Confirm an FP detection session starts for the tag finding, and that the session reads the flagged file at the tag's commit.
-
Untrack the tag, or disable the flag, and run a new pipeline. Confirm no FP detection session starts for new tag findings.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.