Migrate threat detection to external threat-detect binary behind feature flag#40166
Migrate threat detection to external threat-detect binary behind feature flag#40166Copilot wants to merge 23 commits into
threat-detect binary behind feature flag#40166Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ure flag gh-aw-detection) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
threat-detect binary behind feature flag
|
@copilot the release is https://github.com/github/gh-aw-threat-detection/releases |
…inux-amd64 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated |
|
@copilot enable feature flag for smoke-copilot and changeset generator agentic workflows |
…rkflows Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added |
|
@copilot not seeing the new codegen in compiled changeset lock.yml file |
…nable detection job Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
The root cause was |
|
@copilot do not inject Python script in detection. Use bash or actions/github-script |
…n runs Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in the latest commit. Added |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in |
|
/smoke-copilot |
|
📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing... |
There was a problem hiding this comment.
Smoke pass. Two tiny notes left.
Warning
Firewall blocked 6 domains
The following domains were blocked by the firewall during workflow execution:
accounts.google.comandroid.clients.google.comclients2.google.comcontentautofill.googleapis.comsafebrowsingohttpgateway.googleapis.comwww.google.com
To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
📰 BREAKING: Report filed by Smoke Copilot · 236 AIC · ⊞ 19.9K
|
@copilot the agentic engine in detection job needs to be configured like the agent job See error https://github.com/github/gh-aw/actions/runs/27806430889/job/82288105896#step:18:1 |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in ec7e8ac. The external detection path now reuses the engine’s generated execution env block, so detection installs and configures the engine like the agent job (including auth/runtime env such as Copilot token/model vars). I also added a regression test asserting detection env contains engine auth configuration. |
|
@copilot recompile |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Recompiled on commit |
|
/smoke-copilot |
|
📰 BREAKING: Smoke Copilot is now investigating this issue comment. Sources say the story is developing... |
|
Caution agentic threat detected DetailsThe threat detection engine failed to produce results. Review the workflow run logs for details. Migrate threat detection to external Warning Firewall blocked 6 domainsThe following domains were blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
|
There was a problem hiding this comment.
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
The threat detection engine failed to produce results.
Review the workflow run logs for details.
Smoke review completed.
Warning
Firewall blocked 6 domains
The following domains were blocked by the firewall during workflow execution:
accounts.google.comandroid.clients.google.comclients2.google.comcontentautofill.googleapis.comsafebrowsingohttpgateway.googleapis.comwww.google.com
To allow these domains, add them to the
network.allowedlist in your workflow frontmatter:
network:
allowed:
- defaults
- "accounts.google.com"
- "android.clients.google.com"
- "clients2.google.com"
- "contentautofill.googleapis.com"
- "safebrowsingohttpgateway.googleapis.com"
- "www.google.com"See Network Configuration for more information.
📰 BREAKING: Report filed by Smoke Copilot · 353.1 AIC · ⊞ 19.9K
|
@copilot the detection ran successfully but is marked as failed. https://github.com/github/gh-aw/actions/runs/27808280974/job/82293839697#step:18:1 |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in |
gh-aw currently runs threat detection inline — invoking the workflow's engine inside AWF and scraping the transcript for a
THREAT_DETECTION_RESULT:line, concluded byparse_threat_detection_results.cjs. This migrates to the standalone versionedthreat-detectbinary fromgithub/gh-aw-threat-detection, gated behindfeatures: gh-aw-detection: truefor incremental rollout.What changes
Feature flag & version pin
GHAWDetectionFeatureFlag = "gh-aw-detection"— opt-in, default off; existing compiled workflows unchangedDefaultThreatDetectVersion = "v0.2.2"inversion_constants.go— hard-pinned like AWF/mcpg, no lifecycle registryNew constants
ThreatDetectionDir = "/tmp/gh-aw/threat-detection"ThreatDetectionResultPath = ".../detection_result.json"Install script (
actions/setup/sh/install_threat_detect_binary.sh)threat-detectfrom GitHub Releases, SHA256-verified, Linux amd64/arm64 and macOS x64/arm64; followsinstall_awf_binary.shpatternthreat-detect-linux-amd64matching the published release assetsCompiler (
threat_detection.go)buildDetectionJobStepsbranches at step 7 on the feature flagthreat-detect→ AWF execute with/tmp/gh-aw/threat-detectionmountedrw→ uploaddetection_result.json+detection.log→threat-detect conclude --result-file.cjs) unchangedEarly adopter workflows
smoke-copilot.mdopts in viafeatures: gh-aw-detection: truechangeset.mdopts in viafeatures: gh-aw-detection: true; the pre-existingthreat-detection: engine: falseconfig was replaced withthreat-detection: {}so the detection job is compiled (when the inline engine is disabled with no custom steps,HasRunnableDetection()returnsfalseand skips the job entirely, making the feature flag a no-op)Gate contract preserved
The downstream interface is byte-identical to the inline path:
detection_conclusion/detection_reason/detection_successjob outputsGH_AW_DETECTION_CONCLUSION/GH_AW_DETECTION_REASONenv varsGH_AW_DETECTION_CONTINUE_ON_ERRORwarn-vs-strict semanticsOnly the producer changes: structured
detection_result.json+threat-detect concludeinstead of transcript-scrapedTHREAT_DETECTION_RESULT:+.cjs.Example
Compiled detection job (new path):
Notes
parse_threat_detection_results.cjsis not referenced in new-flag workflows but is not yet deleted (per rollout plan)✨ PR Review Safe Output Test - Run 27801033543
> [!WARNING]
>
> 💥 THE END] — Illustrated by [Smoke Claude · 84.3 AIC · ⌖ 27.9 AIC · ⊞ 8.5K · ◷
PR Review Safe Output Test - Run 27801991864
> [!WARNING]
>
> 💥 THE END] — Illustrated by [Smoke Claude · 122.4 AIC · ⌖ 28 AIC · ⊞ 8.5K · ◷