Skip to content

Protect ANTHROPIC_AUTH_TOKEN in AWF credential isolation paths#6410

Merged
lpcox merged 3 commits into
mainfrom
copilot/fix-anthropic-auth-token-protection
Jul 19, 2026
Merged

Protect ANTHROPIC_AUTH_TOKEN in AWF credential isolation paths#6410
lpcox merged 3 commits into
mainfrom
copilot/fix-anthropic-auth-token-protection

Conversation

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

ANTHROPIC_AUTH_TOKEN could reach the agent container without the protections already applied to sibling Anthropic credentials. That left a gap in AWF’s credential isolation model: the token was neither scrubbed by one-shot token handling nor consistently excluded/redacted in Claude workflow paths.

  • Runtime token protection

    • Add ANTHROPIC_AUTH_TOKEN to AWF_ONE_SHOT_TOKENS so unexpected real values are cleared on first access.
    • Update the one-shot token defaults in both implementations (one-shot-token.c and Rust src/lib.rs) to keep fallback behavior aligned.
    • Extend the agent entrypoint sensitive-token cleanup list to include ANTHROPIC_AUTH_TOKEN.
    • Update the binary hardening check so cleartext ANTHROPIC_AUTH_TOKEN fails the one-shot library build.
  • Agent environment isolation

    • Add ANTHROPIC_AUTH_TOKEN to the API-proxy exclusion set so host-provided values do not pass through under --env-all or env-file forwarding.
    • Preserve the existing placeholder behavior for Claude compatibility while preventing a real host token from replacing it.
  • Workflow secret handling

    • Update Claude-related workflow locks to:
      • pass --exclude-env ANTHROPIC_AUTH_TOKEN
      • include ANTHROPIC_AUTH_TOKEN in GH_AW_SECRET_NAMES
      • wire SECRET_ANTHROPIC_AUTH_TOKEN into log redaction
  • Docs and regression coverage

    • Update the documented protected-token lists and credential-isolation notes to include ANTHROPIC_AUTH_TOKEN.
    • Add focused tests for:
      • exclusion-set coverage
      • AWF_ONE_SHOT_TOKENS contents
      • --env-all isolation when a host ANTHROPIC_AUTH_TOKEN is present
      • Claude workflow lock protection/redaction

Example of the effective change:

awf ... \
  --env-all \
  --exclude-env ANTHROPIC_API_KEY \
  --exclude-env ANTHROPIC_AUTH_TOKEN \
  -- ...

GH_AW_SECRET_NAMES='ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN,...'

Copilot AI changed the title [WIP] Fix Anthropic_AUTH_TOKEN exposure in agent container Protect ANTHROPIC_AUTH_TOKEN in AWF credential isolation paths Jul 19, 2026
Copilot finished work on behalf of lpcox July 19, 2026 20:16
Copilot AI requested a review from lpcox July 19, 2026 20:16
@lpcox
lpcox marked this pull request as ready for review July 19, 2026 20:18
Copilot AI review requested due to automatic review settings July 19, 2026 20:18

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.

Pull request overview

Protects ANTHROPIC_AUTH_TOKEN across AWF credential isolation, runtime cleanup, and Claude workflows.

Changes:

  • Adds token exclusion, one-shot protection, and entrypoint cleanup.
  • Updates Claude workflow exclusion and redaction.
  • Adds regression tests and documentation.
Show a summary per file
File Description
src/services/api-proxy-service-key-isolation.test.ts Tests host-token isolation.
src/services/agent-environment/excluded-vars.ts Excludes the token from agent forwarding.
src/services/agent-environment/excluded-vars.test.ts Tests exclusion behavior.
src/services/agent-environment/core-environment.ts Adds one-shot protection.
src/services/agent-environment-credentials.test.ts Tests the one-shot list.
scripts/ci/anthropic-auth-token-workflow-protection.test.ts Checks workflow protection.
docs/awf-config-spec.md Updates protected-token specification.
docs/authentication-architecture.md Documents protection and cleanup.
containers/agent/one-shot-token/src/lib.rs Updates Rust defaults.
containers/agent/one-shot-token/README.md Documents the new default.
containers/agent/one-shot-token/one-shot-token.c Updates obfuscated C defaults.
containers/agent/one-shot-token/encode-tokens.sh Updates token generation input.
containers/agent/one-shot-token/build.sh Extends cleartext hardening checks.
containers/agent/entrypoint.sh Clears the token from PID 1.
.github/workflows/smoke-gvisor-claude.lock.yml Adds exclusion and redaction.
.github/workflows/smoke-docker-sbx-claude.lock.yml Adds exclusion and redaction.
.github/workflows/smoke-claude.lock.yml Adds exclusion and redaction.
.github/workflows/secret-digger-claude.lock.yml Protects both Claude execution paths.
.github/workflows/red-team-benchmark.lock.yml Adds exclusion and redaction.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

scripts/ci/anthropic-auth-token-workflow-protection.test.ts:19

  • These assertions only freeze hand-edited generated artifacts. Each changed lock says DO NOT EDIT, while the documented regeneration path is gh aw compile followed by postprocess-smoke-workflows.ts (.github/skills/pr-finisher/SKILL.md:107-114), and neither the source .md files nor that postprocessor recreates these additions. The next normal recompile will remove the protection and leave the suite failing until all five locks are manually patched again. Encode the change in workflow source or in the postprocessor (with a transformation test), then regenerate the locks.
  it.each(workflowLocks)('%s excludes and redacts ANTHROPIC_AUTH_TOKEN', (workflowLock) => {
    const lock = fs.readFileSync(path.join(workflowsDir, workflowLock), 'utf-8');

    expect(lock).toContain('--exclude-env ANTHROPIC_AUTH_TOKEN');
    expect(lock).toContain('GH_AW_SECRET_NAMES: \'ANTHROPIC_API_KEY,ANTHROPIC_AUTH_TOKEN');
    expect(lock).toContain('SECRET_ANTHROPIC_AUTH_TOKEN: ${{ secrets.ANTHROPIC_AUTH_TOKEN }}');
  • Files reviewed: 19/19 changed files
  • Comments generated: 3
  • Review effort level: Medium

Comment on lines +5 to +11
const workflowLocks = [
'red-team-benchmark.lock.yml',
'secret-digger-claude.lock.yml',
'smoke-claude.lock.yml',
'smoke-docker-sbx-claude.lock.yml',
'smoke-gvisor-claude.lock.yml',
];
"GITHUB_PERSONAL_ACCESS_TOKEN"
"OPENAI_API_KEY" "OPENAI_KEY"
"ANTHROPIC_API_KEY" "CLAUDE_API_KEY" "CLAUDE_CODE_OAUTH_TOKEN"
"ANTHROPIC_API_KEY" "ANTHROPIC_AUTH_TOKEN" "CLAUDE_API_KEY" "CLAUDE_CODE_OAUTH_TOKEN"
static const unsigned char OBF_9[] = { 0x19, 0x16, 0x1b, 0x0f, 0x1e, 0x1f, 0x05, 0x1b, 0x0a, 0x13, 0x05, 0x11, 0x1f, 0x03 }; /* length=14 */
static const unsigned char OBF_10[] = { 0x19, 0x15, 0x1e, 0x1f, 0x02, 0x05, 0x1b, 0x0a, 0x13, 0x05, 0x11, 0x1f, 0x03 }; /* length=13 */
static const unsigned char OBF_11[] = { 0x19, 0x15, 0x0a, 0x13, 0x16, 0x15, 0x0e, 0x05, 0x0a, 0x08, 0x15, 0x0c, 0x13, 0x1e, 0x1f, 0x08, 0x05, 0x1b, 0x0a, 0x13, 0x05, 0x11, 0x1f, 0x03 }; /* length=24 */
static const unsigned char OBF_9[] = { 0x1b, 0x14, 0x0e, 0x12, 0x08, 0x15, 0x0a, 0x13, 0x19, 0x05, 0x1b, 0x0f, 0x0e, 0x12, 0x05, 0x0e, 0x15, 0x11, 0x1f, 0x14 }; /* length=20 */
@lpcox

lpcox commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedbac

Copilot AI commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedbac

Addressed in f96c130.

Copilot finished work on behalf of lpcox July 19, 2026 20:29
@lpcox
lpcox enabled auto-merge (squash) July 19, 2026 20:36
@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Docker Sbx has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

PR only changes generated workflow lock files; no missing tests/docs/description issues were apparent from the provided context.

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test results (Auth mode: PAT / COPILOT_GITHUB_TOKEN)

  • MCP connectivity: ✅
  • GitHub.com HTTP: ❌ (template vars not expanded — pre-step data missing)
  • File write/read: ❌ (template vars not expanded — pre-step data missing)

Overall: FAIL — workflow ran with unresolved ${{ steps.smoke-data.outputs.* }} placeholders. CC @lpcox

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔑 PAT report filed by Smoke Copilot PAT
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Copilot Smoke Test — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

Overall: PASS@lpcox

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅ PASS

Tests:

  • ✅ GitHub MCP connectivity
  • ✅ GitHub.com connectivity (HTTP 200)
  • ✅ File write/read test
  • ✅ BYOK inference (direct key → api-proxy → api.githubcopilot.com)

Running in direct BYOK mode via COPILOT_PROVIDER_API_KEY. All connectivity and credential routing tests passed.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test: Copilot network-isolation egress enforcement

EGRESS_RESULT allow=pass deny=pass

✅ Test 1 (allowed domain api.github.com): HTTP 200
✅ Test 2 (blocked domain example.com): blocked (403 proxy denial)

Overall: PASS@lpcox

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • awmgmcpg
  • example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"
    - "example.com"

See Network Configuration for more information.

🛡️ Egress verdict from Smoke Copilot Network Isolation
Add label ready-for-aw to run again

@github-actions github-actions Bot added the smoke-copilot-network-isolation Copilot network-isolation egress smoke test label Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test

  • PR: Protect ANTHROPIC_AUTH_TOKEN in AWF credential isolation paths
  • GitHub PR read: ✅
  • Discussion query: ✅
  • Playwright browser check: ❌
  • File write/read: ✅
  • Build: ✅
  • Overall: FAIL

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • awmgmcpg
  • registry.npmjs.org

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"
    - "registry.npmjs.org"

See Network Configuration for more information.

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results:

  • GitHub MCP Testing: ✅
  • GitHub.com Connectivity: ✅
  • File Write/Read: ✅
  • BYOK Inference: ✅
    Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL)
    Overall: PASS
    cc @lpcox

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity

  • Redis PING: ❌ (host.docker.internal — name resolution failed; 172.17.0.1 — network unreachable)
  • PostgreSQL pg_isready: ❌ (no response on either address)
  • PostgreSQL SELECT 1: ❌ (connection failed)

Overall: FAIL

host.docker.internal DNS does not resolve in this environment, and the Docker bridge 172.17.0.1 is unreachable. Service containers appear not to be accessible from this sandbox.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results\n\n- GitHub MCP Testing: ❌ (PRs #6409, #6407 filtered by secrecy policy)\n- GitHub.com Connectivity: ❌ (HTTP 000, Exit Code 7)\n- File Writing Testing: ✅\n- Bash Tool Testing: ✅\n\nOverall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Result Notes
S1: Module Loading ✅ Pass otel.js loads successfully; exports: startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled, and internal helpers
S2: Test Suite ✅ Pass 59 tests passed, 0 failed across otel.test.js and otel-fanout.test.js (2 suites)
S3: Env Var Forwarding ✅ Pass src/services/api-proxy-env-config.ts forwards OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, and OTEL_SERVICE_NAME to the api-proxy container
S4: Token Tracker Integration ✅ Pass onUsage callback exists in token-tracker-http.js (line 285, invoked at line 343) as the OTEL hook point
S5: OTEL Diagnostics ⚠️ N/A No live container run; when OTEL_EXPORTER_OTLP_ENDPOINT is unset, spans fall back to /var/log/api-proxy/otel.jsonl (graceful degradation confirmed in config)

Overall: ✅ All scenarios pass — OTEL integration is fully functional. The 59-test suite covers span creation, token/budget attributes (GenAI semantic conventions), OTLP export via proxy, serialization, and graceful no-op behavior when unconfigured.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3 ❌ NO
Node.js v24.18.0 v22.23.1 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

⚠️ Not all runtimes match — Python and Node.js versions differ between host and chroot.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

✅ GitHub MCP connectivity (pre-fetched PR data)
✅ GitHub.com connectivity
✅ File write/read
✅ Direct BYOK inference
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: PASS
@lpcox

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color passed ✅ PASS
Go env passed ✅ PASS
Go uuid passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Build Test Suite for #6410 · 53.5 AIC · ⊞ 7.1K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🔥 Smoke Test: Docker Sbx — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP (200)
File write/read

Overall: PASS@lpcox

📰 BREAKING: Report filed by Smoke Docker Sbx
Add label ready-for-aw to run again

@lpcox
lpcox merged commit 6d25856 into main Jul 19, 2026
142 of 144 checks passed
@lpcox
lpcox deleted the copilot/fix-anthropic-auth-token-protection branch July 19, 2026 20:48
github-actions Bot added a commit that referenced this pull request Jul 20, 2026
Update authentication-architecture.md to explicitly mention ANTHROPIC_AUTH_TOKEN
alongside ANTHROPIC_API_KEY in the security design warning. This reflects the
recent changes in PR #6410 that protect ANTHROPIC_AUTH_TOKEN through the same
credential isolation mechanism.

Related to commit 6d25856 (Protect `ANTHROPIC_AUTH_TOKEN` in AWF credential isolation paths).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lpcox added a commit that referenced this pull request Jul 20, 2026
#6414)

* docs: Document ANTHROPIC_AUTH_TOKEN protection in API proxy isolation

Update authentication-architecture.md to explicitly mention ANTHROPIC_AUTH_TOKEN
alongside ANTHROPIC_API_KEY in the security design warning. This reflects the
recent changes in PR #6410 that protect ANTHROPIC_AUTH_TOKEN through the same
credential isolation mechanism.

Related to commit 6d25856 (Protect `ANTHROPIC_AUTH_TOKEN` in AWF credential isolation paths).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Landon Cox <landon.cox@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions Bot mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ANTHROPIC_AUTH_TOKEN readable in agent container — missing from AWF_ONE_SHOT_TOKENS protection

3 participants