Repository navigation
Harden OpenAI WIF detection and firewall wiring - #76236
Conversation
|
Thanks for starting this work, A few things as this moves forward:
The [WIP] status and agentic checklist approach looks perfect for this style of development. Looking forward to the next update!
|
Co-authored-by: pelikhan <[email protected]>
|
@copilot also support configuring evals |
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
❌ Design Decision Gate 🏗️ failed to deliver outputs during design decision gate check.
|
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
Warning The 🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (146 new lines under 📄 Draft ADR committed:
📋 What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify that the implementation matches the decision. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete: Context, Decision, Alternatives Considered, and Consequences. The draft has all four.
|
Comment MemoryPeek at saved memory (pr-code-quality-reviewer)Note This comment is managed by comment memory.Expand the saved memory block to view or edit the persistent context for this thread.
|
There was a problem hiding this comment.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
| detectionData := *workflowData | ||
| detectionData.EngineConfig = cloneThreatDetectionEngineConfig(engineID, detectionConfig) | ||
| if workflowData.SafeOutputs.ThreatDetection.Model != "" { | ||
| detectionData.Model = workflowData.SafeOutputs.ThreatDetection.Model |
There was a problem hiding this comment.
When the detector override omits model, this validator copies workflowData.Model directly, but the runtime path in buildExternalDetectorWorkflowData subsequently forces EngineConfig.LLMProvider = openai for a Codex detector whose effective provider is not GitHub. For example, a Copilot main workflow with a Codex detector and an inherited copilot/... model is rejected here as requiring the OpenAI provider, even though the generated detector config is explicitly OpenAI at runtime. Please derive the effective provider/model using the same detector setup as the runtime before validating, and add a regression test for a cross-engine detector.
There was a problem hiding this comment.
Detector validation now uses the selected detector’s runtime configuration, including its effective model and provider normalization. Added cross-engine inherited-model coverage in faed3e0.
There was a problem hiding this comment.
Found one correctness issue in detection-only OpenAI WIF validation: cross-engine Codex detectors can be rejected based on the main workflow model/provider even though runtime setup forces the detector provider to OpenAI. Please align validation with runtime detector configuration and add coverage.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~6 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
There was a problem hiding this comment.
🟡 Changes recommended
Same-engine detector overrides without explicit auth can omit the required OIDC token permission despite inheriting OIDC settings, causing detector authentication to fail.
3 open issues
What changed in this PR
Hardens OpenAI workload identity federation (WIF) configuration in gh-aw’s compiler for agents and threat detectors. End-to-end authentication still depends on a supporting AWF release.
Changes:
- Validate detector-only OpenAI WIF settings and derive token permissions from detector configuration.
- Add
auth.openai.comto agent and detector firewall allowlists. - Extend regression coverage and document the current AWF limitation.
| File | Description |
|---|---|
pkg/workflow/threat_detection_job.go |
Derives OIDC permissions from detector authentication. |
pkg/workflow/threat_detection_helpers.go |
Adds the OpenAI exchange host to detector allowlists. |
pkg/workflow/threat_detection_firewall_test.go |
Tests exchange-host access for inherited WIF. |
pkg/workflow/compiler_validators.go |
Validates detector-only OpenAI WIF configuration. |
pkg/workflow/codex_engine.go |
Allows the exchange host for Codex WIF. |
pkg/workflow/codex_azure_oidc_test.go |
Tests detector validation, permissions, and firewall wiring. |
docs/src/content/docs/reference/auth.mdx |
Updates the allowlist example and explains the AWF support blocker. |
Review effort: Max (auto)
| if detectionAuthData.EngineConfig != nil && detectionAuthData.EngineConfig.Auth != nil && detectionAuthData.EngineConfig.Auth.Type == "github-oidc" { | ||
| perms.Set(PermissionIdToken, PermissionWrite) | ||
| } |
| detectionData := *workflowData | ||
| detectionData.EngineConfig = cloneThreatDetectionEngineConfig(engineID, detectionConfig) |
| detectionData.Model = workflowData.SafeOutputs.ThreatDetection.Model | ||
| } | ||
| if err := validateOpenAIWIFEngineAuth(&detectionData); err != nil { | ||
| return fmt.Errorf("safe-outputs.threat-detection.engine.auth: %w", err) |
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs and /tdd. Two inline comments, no blocking issues.
📋 Key Themes & Highlights
Key Themes
- Possible false positive: a
copilot/main model with a codex detector and nothreat-detection.modelis rejected at compile time. The error does not name the fix. - Test gap: the new WIF table always includes a main
engine: codexblock, so the detector-only config is not tested.
Positive Highlights
- ✅ Detection job sets
id-token: writefrom the resolved detector config, so the main-job OIDC validator does not need to change. - ✅ Detector-only compile output checked:
id-token: write,auth.openai.comin the AWF allowlist, andAWF_AUTH_OPENAI_*env mapping are all present. - ✅ Docs note that AWF v0.29.10 does not support OpenAI WIF.
Verification
Targeted WIF/threat-detection tests and gofmt pass. Five unrelated pkg/workflow tests fail in this sandbox for environmental reasons (temp-dir permissions, inherited token, clock-dependent expiry, fixture mismatches). I did not confirm they also fail on main.
@copilot please address the review comments above.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~8 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again
| if engineID == "" { | ||
| engineID = ResolveEngineID(workflowData) | ||
| } | ||
| detectionData := *workflowData |
There was a problem hiding this comment.
[/diagnosing-bugs] Possible false positive. With engine: copilot/gpt-5 on the main workflow and a codex detector that has no threat-detection.model, compile fails with engine.auth with provider=openai requires the OpenAI inference provider. The cause is inheritedDetectionModel (threat_detection_helpers.go:356), which passes the main copilot/ model to a codex detector. The detection job inherits the same value, so validator and job agree, but the error does not say to set threat-detection.model. Setting an explicit detector model compiles successfully.
💡 Suggested fix
Confirm whether cross-engine model inheritance is intended. If not, skip inheritance when the detector engine differs from the main engine. If it is intended, make the error name threat-detection.model as the fix.
@copilot please address this.
There was a problem hiding this comment.
Validation now mirrors the runtime detector path and applies inherited or explicit detector models before checking the effective provider. The cross-engine inherited-model regression is in faed3e0.
| assert.NotContains(t, detectionSection, `env_key = "CODEX_API_KEY"`) | ||
| } | ||
|
|
||
| func TestCodexOpenAIWIFDetectionValidationAndPermissions(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] The table covers detector-only OpenAI WIF only with a main engine: codex block, so the detector-only config from the PR description is untested. Add a case with no main engine: block and threat-detection.engine set to codex with github-oidc/openai auth.
💡 Suggested test cases
- No main
engine:block, detector-only codex + github-oidc/openai: expectid-token: writeon the detection job andauth.openai.comin the AWF allowlist. - Main
engine: copilotwithmodel: copilot/gpt-5, plus an explicitthreat-detection.model: pins the model-override path that the validator uses.
@copilot please address this.
There was a problem hiding this comment.
Added compile regressions for detector-only OpenAI WIF without a main engine and for a Copilot main model with an explicit detector model override. Both verify the exchange host and id-token: write; included in faed3e0.
I checked the evals path: it calls the Decisions API directly and does not run through the AWF proxy. The current OpenAI WIF setup only supplies auth to that proxy, and the proxy version in this PR does not yet support the OpenAI exchange. Should evals gain their own auth configuration while remaining blocked on proxy support, or should this include moving eval requests through a proxy/token-exchange path? |
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data
|
…oxy-support Co-authored-by: gh-aw-bot <[email protected]>
Co-authored-by: gh-aw-bot <[email protected]>
|
🎉 This pull request is included in a new release. Release: |



OpenAI WIF still depends on OpenAI support in the AWF API proxy; the current default, AWF
v0.29.10, does not provide it. This change addresses gh-aw’s detector validation, permissions, and firewall allowlists while documenting the dependency.Detection auth and permissions
id-token: writebased on the effective detection engine configuration.Firewall and documentation
auth.openai.comto the agent and detection allowlists for OpenAI WIF.Remaining dependency