Skip safe output jobs when threat detection fails#3840
Merged
Conversation
- Detection job now sets a success output (true/false) in parse_results step - Safe output jobs check needs.detection.outputs.success == 'true' before running - Update_reaction job still runs with always() condition (not affected by detection failure) - Added tests to verify the new behavior Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
approved these changes
Nov 13, 2025
Copilot
AI
changed the title
[WIP] Update compiler to skip safe outputs on detection failure
Skip safe output jobs when threat detection fails
Nov 13, 2025
Collaborator
|
@copilot lint |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical security vulnerability where safe output jobs were executing even when the threat detection job failed, allowing potentially malicious outputs to be created. The fix ensures that safe output jobs only run when threat detection explicitly passes by checking a success output from the detection job.
Key changes:
- Detection job now outputs a
successfield that is set to'true'or'false'based on threat verdict - All safe output jobs check
needs.detection.outputs.success == 'true'before executing - Helper function
AddDetectionSuccessCheck()consistently applies the check across all safe output types - The
update_reactionjob preserves itsalways()behavior to update emoji regardless of detection status
Reviewed Changes
Copilot reviewed 71 out of 71 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/threat_detection.go |
Adds success output to detection job and sets it in the parsing step based on threat verdict |
pkg/workflow/expressions.go |
Implements AddDetectionSuccessCheck() helper to consistently add detection success checks to job conditions |
pkg/workflow/compiler_jobs.go |
Applies detection success check to all 12 safe output job types when threat detection is enabled |
pkg/workflow/detection_success_test.go |
Adds test coverage verifying detection job has success output and safe output jobs check it |
.github/workflows/*.lock.yml |
Auto-generated workflow files reflecting the compiler changes (consistent application across all workflows) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update compiler to skip safe output jobs when detection job fails ✅
Problem
When the detection job fails (due to threat detection), safe output jobs still run because they only check if the agent job completed, not if detection succeeded.
Reference: https://github.com/githubnext/gh-aw/actions/runs/19301864310
Solution Implemented
1. Detection Job Success Output ✅
File:
pkg/workflow/threat_detection.goid: parse_resultsto the "Parse threat detection results" stepcore.setOutput('success', 'true')when no threats detectedcore.setOutput('success', 'false')beforecore.setFailed()when threats detectedOutputsfield to detection job:success: ${{ steps.parse_results.outputs.success }}2. Safe Output Job Conditions ✅
Files:
pkg/workflow/compiler_jobs.go,pkg/workflow/expressions.goAddDetectionSuccessCheck()to add detection success check to job conditionsneeds.detection.outputs.success == 'true'3. Update_reaction Job ✅
File:
pkg/workflow/notify_comment.goalways()condition4. Tests Added ✅
File:
pkg/workflow/detection_success_test.goTestDetectionJobHasSuccessOutput- Verifies detection job sets success outputTestSafeOutputJobsCheckDetectionSuccess- Verifies safe output jobs check detection successVerification
Compiled Workflow Example
Test Results
✅ All 340+ unit tests pass
✅ New tests verify detection success output
✅ Existing workflows recompile successfully
✅ Detection job has success output
✅ Safe output jobs check detection success
✅ Code formatted and linted successfully
Behavior
When detection succeeds:
When detection fails:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.