Repository navigation
fix: stop threat detection from inheriting the agent's provider settings - #396
Merged
Merged
Conversation
gh-aw copies the main engine's env into the threat detection step, even when detection runs on a different engine. The docs review (Claude through OpenRouter) and project metadata (Codex through OpenRouter) both detect with Copilot, so detection inherited ANTHROPIC_BASE_URL or OPENAI_BASE_URL. The firewall then set up a custom proxy target and its health check failed before the scan started: [health-check][ERROR] Cannot connect to Anthropic API proxy at https://openrouter.ai/api Detection fails open, so every run posted without a threat scan. Seen in every docs review run checked since at least 2026-10-02 and in recent project metadata runs. Override the inherited provider settings with empty values on the detection engine, as gh-aw-issue-scope already does. gh-aw treats an empty base URL as no custom target. This also stops the OpenRouter API key from reaching the detection step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Sandbox result: detection works on this branch. In run 37485133515 (the docs review on a replica of elastic/docs-content#8643), the detection log shows {"prompt_injection": false, "secret_leak": false, "malicious_patch": false, "reasons": [], "warnings": []}Before this change, every run failed with Generated by Claude Code |
There was a problem hiding this comment.
Approved: no actionable issues found.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
theletterf
added a commit
that referenced
this pull request
Oct 8, 2026
Restore the empty-string detection overrides from #396. Changing them to unusable values belongs in its own PR, so project metadata goes back to main. Escape leading code fences in summary fields so a field cannot open a code block that swallows the later sections and the footer. Merge main to resolve conflicts with #409 and #410. Related to elastic/docs-eng-team#757 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
While testing #395, I noticed that threat detection never produces a verdict in the docs review. In every run I checked, including production docs-content runs on October 2 and 5, the detection job fails before the scan starts:
Detection fails open (
GH_AW_DETECTION_CONTINUE_ON_ERROR: true), and thesafe_outputsjob only checks that the detection job finished. So every review has posted without a threat scan, and nothing on the PR shows it. Project metadata has the same problem with OpenAI:Cannot connect to OpenAI API proxy.The cause is in gh-aw:
mergeThreatDetectionEngineEnvcopies the main engine'sengine.envinto the detection step, even when detection runs on a different engine. The docs review runs Claude through OpenRouter and detects with Copilot, so detection inheritedANTHROPIC_BASE_URL. The firewall then set up an Anthropic proxy target that the Copilot sandbox can't use, and the health check killed the container. This behavior is the same in gh-aw v0.89.17, v0.91.1, andmain. The model inheritance from elastic's earlier report (github/gh-aw#54047) is fixed, but the env inheritance isn't.This PR applies the workaround that
gh-aw-issue-scopealready uses: empty values for the inherited provider settings on the detection engine. gh-aw treats an empty base URL as no custom target. I also blanked the API keys, so the OpenRouter key no longer reaches the detection step.gh-aw-docs-review:ANTHROPIC_BASE_URL,ANTHROPIC_API_KEY,ANTHROPIC_CUSTOM_HEADERS,ANTHROPIC_DEFAULT_SONNET_MODELgh-aw-project-metadata:OPENAI_BASE_URL,OPENAI_API_KEYThe compiled lock files confirm that the detection step gets empty values and no custom proxy target, and that the agent jobs keep their OpenRouter settings.
Testing: a sandbox run of the docs review on this branch is in progress. It passes if the detection log shows
[threat-detect] run startand the detection artifact containsdetection_result.json. I'll add the result here. Project metadata uses the same mechanism that thegh-aw-issue-scopefix verified in sandbox run 34480489074, but I haven't run it separately.Upstream: github/gh-aw#66203 asks gh-aw to stop inheriting another engine's provider settings. Follow-up: a guard that makes a missing detection verdict visible instead of failing open.
🤖 Generated with Claude Code
Related to #402