fix(test): permit Stage 3 executor SYSTEM_ACCESSTOKEN env mapping#887
Conversation
The trust-boundary test test_execution_context_pr_does_not_leak_system_accesstoken (added in #865) walks the compiled YAML and asserts that every step env: block declaring SYSTEM_ACCESSTOKEN is the exec-context PR prepare step. That was correct on #865's PR branch, but #873 ("default executor to System.AccessToken") landed first and added a legitimate SYSTEM_ACCESSTOKEN: $(System.AccessToken) mapping to the Stage 3 SafeOutputs executor step. The two compose into a semantic conflict on main: each PR passes its own CI, but the combined tree fails. Stage 3 runs in its own non-agent job and needs the token to apply safe outputs (PRs, work items, etc.) — this is the same allow-list documented by the sibling test test_agent_job_steps_do_not_map_system_access_token, which scopes its check to the Agent job. The cross-stage trust boundary (no SYSTEM_ACCESSTOKEN inside the AWF-sandboxed Agent step) is unaffected. Replace the single-allowed-displayName whitelist with an explicit, audited ALLOWED_DISPLAY_NAMES list covering: 1. "Stage PR execution context (aw-context/pr/*)" — owned here. 2. "Execute safe outputs (Stage 3)" — per #873. Also keep an explicit assertion that the exec-context prepare step is present so we don't silently regress to a state where the PR contributor fails to activate but the test still passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🔍 Rust PR ReviewSummary: Looks good — correct fix for the CI break, logic is sound. Findings
|
Summary
CI on
mainis broken after the v0.32.0 release (run 27087796410) — the trust-boundary test added in #865 is failing because of a semantic conflict with #873 ("default executor to System.AccessToken"), which landed in between.Root cause
feat(compile): add execution-context plugin) added a YAML walker that requires the only step mappingSYSTEM_ACCESSTOKENto be the exec-context PR prepare step.feat(compile): default executor to System.AccessToken) had landed first and added a legitimateSYSTEM_ACCESSTOKEN: $(System.AccessToken)mapping to theExecute safe outputs (Stage 3)step.main, the test (correctly) flags Stage 3's env block — but Stage 3 is a non-agent job that legitimately needs the token.The sibling test
test_agent_job_steps_do_not_map_system_access_tokenalready documents the right allow-list ("Only Setup-job filter-gate and Stage 3 executor are allowed to map it") and stays scoped to the Agent job. This PR brings the new test in line with that policy.What this PR does
Replaces the single-
displayNamewhitelist with an explicitALLOWED_DISPLAY_NAMESlist:Stage PR execution context (aw-context/pr/*)— owned by the exec-context extension.Execute safe outputs (Stage 3)— Stage 3 SafeOutputs executor (per feat(compile): default executor to System.AccessToken and add always-on Azure CLI #873).Also keeps an explicit
saw_exec_context_stepassertion so the test cannot silently regress to passing when the PR contributor fails to activate at all.The cross-stage trust boundary (no
SYSTEM_ACCESSTOKENinside the AWF-sandboxed Agent step) is unchanged — that's enforced by the agent-job-scoped sibling test.Verification
Follow-up: re-publishing v0.32.0 assets
The v0.32.0 release tag was created, but no asset binaries were uploaded because the Build matrix failed on this test. After this PR merges, the Release workflow can be re-triggered against the existing tag via
workflow_dispatch: