Skip to content

Isolate threat detection provider settings across engines - #66533

Merged
pelikhan merged 7 commits into
mainfrom
copilot/fix-threat-detection-integration
Oct 7, 2026
Merged

pelikhan merged 7 commits into
mainfrom
copilot/fix-threat-detection-integration

Conversation

Copilot AI commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Threat detection inherited the main engine’s provider environment even when using a different engine, leaking credentials and causing firewall health checks to fail before analysis. Missing verdicts could remain unnoticed while safe outputs were published.

  • Provider isolation: Inherit engine.env, API targets, and custom model aliases only when engines match. Preserve explicit detector overrides and built-in aliases; use the detector’s default model when an inherited alias is discarded.
  • Consistent configuration: Apply isolation to execution, firewall domain propagation, job dependencies, and authentication checks.
  • Missing-verdict visibility: Warn in the conclusion job on engine failures, unparseable results, or absent conclusions—even after an output comment is posted. Preserve duplicate-comment suppression and continue-on-error behavior.

This split-engine configuration no longer requires empty provider-env overrides:

engine:
  id: claude
  env:
    ANTHROPIC_BASE_URL: https://openrouter.ai/api
    ANTHROPIC_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
safe-outputs:
  threat-detection:
    engine:
      id: copilot
      model: sonnet

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

pelikhan commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

@copilot automatically match the main agent provider if the agentic engine do not match (OpenAI/anthropic/copilot...).
A user of the pi engine should NOT have to reconfigure the threat detection job. Good default must be in place.

…model aliases

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix threat detection inheritance from main engine provider env Isolate threat detection provider settings across engines Oct 7, 2026
Copilot AI requested a review from pelikhan October 7, 2026 12:06
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot automatically match the main agent provider if the agentic engine do not match (OpenAI/anthropic/copilot...).
A user of the pi engine should NOT have to reconfigure the threat detection job. ...

Implemented in 5568fd15: default detection now follows the main engine’s effective provider, and matching provider settings are inherited across engine IDs. Pi workflows automatically select the corresponding built-in detector; explicit detection-engine configuration still takes precedence.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 7, 2026 13:27
Copilot AI balanced review requested due to automatic review settings October 7, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Same-provider credentials and API targets still cross differing engine identities, contradicting the documented security contract.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

This PR isolates threat-detection provider configuration and surfaces missing security verdicts.

Changes:

  • Restricts provider configuration inheritance and updates firewall/auth resolution.
  • Warns when detection produces no verdict.
  • Documents behavior and regenerates compiled workflows.
File Description
pkg/​workflow/​compiler_validators.go Uses effective detector environment for auth validation.
pkg/​workflow/​evals_steps.go Applies engine-aware firewall-domain resolution.
pkg/​workflow/​threat_detection_firewall_test.go Updates firewall helper tests.
docs/​src/​content/​docs/​reference/​threat-detection.md Documents isolation and missing-verdict warnings.
295 .github/​workflows/​*.lock.yml files Propagate the generated conclusion warning.


When the resolved detection engine matches the main engine, detection inherits `engine.env`, `api-target`, and model aliases. Detection-specific environment values take precedence, including empty values.

When the engines differ, detection does not inherit the main engine's environment, API target, or custom model aliases. This prevents provider URLs, API keys, and custom headers from reaching an unrelated engine. Configure any required provider settings under `safe-outputs.threat-detection.engine.env`; built-in model aliases remain available.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 9329e85f: main-engine environment and API-target settings now inherit only when the resolved engine IDs match. Regression coverage confirms Pi/OpenAI settings do not reach Codex detection while provider-based detector selection and explicit detector overrides remain supported.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot address the following outstanding work in one pass:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (docs/src/content/docs/reference/threat-detection.md:249): This documented isolation is not what the implementation enforces. mergeThreatDetectionEngineEnv still copies provider-prefixed credentials and headers when different engine IDs resolve to the same provider, and both detector paths also inherit APITarget through sameThreatDetectionProvider. For example, a Pi/OpenAI main engine running Codex detection receives the main OPENAI_API_KEY by design in the new test. That leaves credentials crossing the engine boundary, contrary to this line, the PR description, and issue Threat detection inherits the main engine's provider env when it runs on a different engine #66203. Please restrict environment/API-target inheritance to matching engine IDs (while keeping detector-specific overrides), or revise the stated security contract if cross-engine provider inheritance is actually intended. - Isolate threat detection provider settings across engines #66533 (comment)

Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI.

Sous-chef head: 9fd53c8
Sous-chef work: 2ee654c89d8eb9fd5d652a665b5da0464b4005b587887582215b0555dfe6f95b
Sous-chef state: 75156fe1b8f656934acf11c6ea9250ed4e1d4776574b41e284ffa953c8262492

Generated by 👨‍🍳 PR Sous Chef · pi · haiku45 · 7.92 AIC · ⌖ 6.03 AIC · ⊞ 1K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits October 7, 2026 14:00
…tection-integration

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot October 7, 2026 14:20
@pelikhan
pelikhan merged commit 9bb87b2 into main Oct 7, 2026
36 checks passed
@pelikhan
pelikhan deleted the copilot/fix-threat-detection-integration branch October 7, 2026 15:49
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.91.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Threat detection inherits the main engine's provider env when it runs on a different engine

4 participants