You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
safe-outputs.jobs custom jobs are not gated on threat detection (built-in safe_outputs is) #69404
Custom safe-output jobs (safe-outputs.jobs.<name>) run even when threat detection fails; the built-in safe_outputs job does not.
buildSafeJobs in pkg/workflow/safe_jobs.go (v0.92.3) adds needs: [agent, detection] with the comment "so that the condition can gate on needs.detection.result == 'success'", but only adds that gate when IsConditionalDetection(...) is true. With ordinary always-on detection the compiled condition is:
!cancelled() lets the job run after a failed detection job, so any custom write (Slack, an external API) bypasses detection. safe_outputs uses ... && needs.detection.result == 'success'.
Reproduce: compile any workflow with a safe-outputs.jobs entry and default detection; compare jobs.<name>.if with jobs.safe_outputs.if in the lock.
Implementation Plan
pkg/workflow/safe_jobs.go (buildSafeJobs): when threatDetectionEnabled and not IsConditionalDetection, AND the base condition with buildDetectionSuccessCondition() (same gate as safe_outputs).
Pass GH_AW_DETECTION_CONCLUSION: ${{ needs.detection.outputs.detection_conclusion }} to custom job steps, as the built-in job receives it.
Tests next to the existing safe-jobs tests: the condition contains needs.detection.result == 'success' when detection is enabled, and is unchanged when detection is disabled or expression-controlled.
Run make agent-finish before completing.
Acceptance Criteria
With threat detection enabled, a failed detection job skips every safe-outputs.jobs.* job, as it skips safe_outputs; the new tests pass.
Activity