Skip to content

Handle gh-aw offline BYOK sentinel in Copilot auth selection for Business/Enterprise targets - #6237

Merged
lpcox merged 2 commits into
mainfrom
copilot/fix-authorization-header-issue
Jul 15, 2026
Merged

Handle gh-aw offline BYOK sentinel in Copilot auth selection for Business/Enterprise targets#6237
lpcox merged 2 commits into
mainfrom
copilot/fix-authorization-header-issue

Conversation

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

On GHES/GHEC workflows using --copilot-api-target api.business.githubcopilot.com, requests could still send a malformed auth header and get 400 Authorization header is badly formatted. The remaining gap was that gh-aw’s offline dummy BYOK value was treated as a real provider key, suppressing GitHub-token auth formatting logic.

  • Auth token selection fix (api-proxy)

    • Updated Copilot auth resolution to treat dummy-byok-key-for-offline-mode as a non-credential sentinel (same class as AWF placeholder tokens).
    • This preserves fallback to COPILOT_GITHUB_TOKEN when the dummy BYOK value is present, allowing Business/Enterprise targets to use the expected GitHub token auth format.
  • Regression coverage for the reported path

    • Added focused cases to assert that with:

      • COPILOT_API_TARGET=api.business.githubcopilot.com
      • AWF_PLATFORM_TYPE=ghec
      • GITHUB_SERVER_URL=*.ghe.com
      • COPILOT_PROVIDER_API_KEY=dummy-byok-key-for-offline-mode

      auth headers are still derived from COPILOT_GITHUB_TOKEN (not dummy BYOK).

  • Auth matrix alignment

    • Updated credential-isolation auth-matrix expectations so the offline dummy sentinel is explicitly treated as absent, avoiding accidental BYOK precedence in this scenario.
// before: dummy BYOK sentinel was treated as a real BYOK key
resolveApiKey({ COPILOT_PROVIDER_API_KEY: 'dummy-byok-key-for-offline-mode' }) // => 'dummy-byok-key-for-offline-mode'

// after: sentinel is ignored, so GitHub token path remains active
resolveApiKey({ COPILOT_PROVIDER_API_KEY: 'dummy-byok-key-for-offline-mode' }) // => undefined

Copilot AI changed the title [WIP] Fix malformed authorization header for api.business.githubcopilot.com Handle gh-aw offline BYOK sentinel in Copilot auth selection for Business/Enterprise targets Jul 14, 2026
Copilot AI requested a review from lpcox July 14, 2026 23:46
Copilot finished work on behalf of lpcox July 14, 2026 23:46
@lpcox
lpcox marked this pull request as ready for review July 14, 2026 23:46
Copilot AI review requested due to automatic review settings July 14, 2026 23:46

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

Updates Copilot API proxy authentication so gh-aw’s offline BYOK sentinel falls back to GitHub-token authentication.

Changes:

  • Treats the offline dummy BYOK value as absent.
  • Preserves Business/Enterprise token authorization formatting.
  • Adds focused unit and auth-matrix regressions.
Show a summary per file
File Description
containers/api-proxy/providers/copilot-auth.js Filters the offline BYOK sentinel during credential resolution.
containers/api-proxy/copilot-auth.test.js Tests token fallback and sentinel filtering.
containers/api-proxy/copilot-adapter-enterprise.test.js Covers Business/GHEC authorization formatting.
containers/api-proxy/server.auth-matrix.test.js Aligns credential-isolation expectations.

Review details

Tip

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

  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Medium

@github-actions

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@copilot Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude passed

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) reports failed. AOAI BYOK (api-key) mode investigation needed...

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Security Guard failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Contribution Check completed successfully!

PR #6237 follows the applicable CONTRIBUTING.md guidelines: it includes focused regression tests alongside the container code, uses appropriate file organization, has a clear description, and does not require documentation updates for this internal auth-handling fix.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 14, 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 14, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) reports failed. AOAI BYOK (Entra) mode investigation needed...

@github-actions

github-actions Bot commented Jul 14, 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 14, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🌑 The shadows whisper... Smoke Codex failed. The oracle requires further meditation...

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🐳🔮 Smoke Docker Sbx Codex completed. Docker sbx + Codex smoke test passed. ✅

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🦎🏗️ Smoke gVisor Build Test completed. gVisor build test passed. ✅

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🐳🟣 Smoke Docker Sbx Claude completed. Docker sbx + Claude smoke test passed. ✅

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

🦎🔮 Smoke gVisor Codex completed. gVisor + Codex smoke test passed. ✅

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

Test Status
GitHub MCP connectivity
GitHub.com HTTP ⚠️ (pre-step vars not injected)
File write/read ⚠️ (pre-step vars not injected)

Overall: PASS — MCP reachable; pre-computed template vars were unresolved.

Author: @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: Claude Engine Validation

Check Result
API Status ✅ PASS
GH Check ✅ PASS
File Status ✅ PASS

Overall Result: 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 Smoke Claude for #6237 · 35 AIC · ⊞ 5.9K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Services Connectivity

  • Redis PING: ❌ Network unreachable
  • PostgreSQL pg_isready: ❌ No response
  • PostgreSQL SELECT 1: ❌ Network unreachable

Overall: FAILhost.docker.internal is not reachable from this runner environment.

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: Copilot BYOK (Direct) Mode

Test Result
1. GitHub MCP connectivity ⚠️ Pre-fetched data not rendered
2. GitHub.com connectivity ⚠️ Pre-fetched data not rendered
3. File write/read ⚠️ Pre-fetched data not rendered
4. BYOK inference (this response)

Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy → api.githubcopilot.com

Overall: FAIL — pre-fetched template variables were not expanded; tests 1–3 unverifiable.

@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 report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🦎 gVisor Smoke Test Results

  • 🦎 gVisor runtime: unconfirmed (running runc, not gVisor)
  • ✅ GitHub.com connectivity: HTTP 200
  • ✅ Network isolation: example.com blocked (timeout)
  • ✅ MCP connectivity: reachable

Overall: PASS

cc @lpcox

Warning

Firewall blocked 2 domains

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

  • example.com
  • host.docker.internal

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

network:
  allowed:
    - defaults
    - "example.com"
    - "host.docker.internal"

See Network Configuration for more information.

🦎 gVisor smoke test by Smoke gVisor
Add label test-gvisor to run again

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for including focused regression coverage and updating the auth matrix. One contribution guideline remains: please reference the related issue in the PR description, as required under CONTRIBUTING.md's Pull Request Process ("Pull request requirements"). If no issue exists, please note that explicitly.

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 Contribution Check for #6237 · 3.04 AIC · ⊞ 19.2K ·
Add label ready-for-aw to run again

@github-actions

Copy link
Copy Markdown
Contributor

🦎🟣 gVisor + Claude Smoke Test

  • 🦎🟣 gVisor runtime: unconfirmed (kernel reports Linux 4.4.0, no gVisor marker)
  • ✅ GitHub.com connectivity: HTTP 200
  • ⚠️ GitHub MCP: tool unavailable in this environment
  • ⚠️ File write/read: pre-step template vars not substituted
  • ✅ Network isolation: example.com blocked (000 timeout)

Overall: FAIL (gVisor runtime not confirmed)

Warning

Firewall blocked 2 domains

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

  • example.com
  • host.docker.internal

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

network:
  allowed:
    - defaults
    - "example.com"
    - "host.docker.internal"

See Network Configuration for more information.

🦎🟣 gVisor + Claude smoke test by Smoke gVisor Claude
Add label test-gvisor-claude 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, + internals
S2: Test Suite ✅ Pass 59 tests passed across otel.test.js + otel-fanout.test.js (0 failed)
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, OTEL_SERVICE_NAME
S4: Token Tracker Integration ✅ Pass onUsage callback exists in token-tracker-http.js (line 285/343) as the OTEL hook point
S5: OTEL Diagnostics ✅ Pass Span creation with gen_ai.usage.* attributes confirmed; parent context propagation via GITHUB_AW_OTEL_TRACE_ID/GITHUB_AW_OTEL_PARENT_SPAN_ID in otel.js

All 5 scenarios pass. OTEL integration is fully implemented and tested.

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

Smoke Test: Copilot PAT Auth

Test Status
GitHub MCP connectivity ✅ reachable
GitHub.com HTTP ⚠️ pre-step data unavailable
File write/read ⚠️ pre-step data unavailable

Overall: PARTIAL${{ steps.smoke-data.outputs.* }} vars were not interpolated.
Auth mode: PAT (COPILOT_GITHUB_TOKEN) | Actor: @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

Smoke Test Results: FAIL

Overall: 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

🦎🏗️ gVisor Build Test Results

Test Status
gVisor runtime unconfirmed
GitHub.com connectivity
Node.js build (npm ci && npm run build)
Node.js tests (Jest subset)
Go build (color, uuid)
Go tests (color, uuid)
Network isolation

Overall: FAIL

Warning

Firewall blocked 1 domain

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

  • host.docker.internal

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

network:
  allowed:
    - defaults
    - "host.docker.internal"

See Network Configuration for more information.

🦎🏗️ gVisor build test by Smoke gVisor Build Test
Add label test-gvisor-build to run again

@github-actions

Copy link
Copy Markdown
Contributor

🦎🔮 gVisor + Codex runtime: confirmed\n✅ /proc/version gVisor\n✅ file write/read proof\n✅ github.com reachable (200)\n✅ example.com blocked (000)\n❌ GitHub MCP PR listing failed (Squid 403)\nOverall status: FAIL

Warning

Firewall blocked 2 domains

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

  • 172.30.0.1
  • example.com

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

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

See Network Configuration for more information.

🦎🔮 gVisor + Codex smoke test by Smoke gVisor Codex
Add label test-gvisor-codex 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

Result: Not all versions match — smoke-chroot label not applied.

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

🐳🏗️ Docker Sbx Build Test Results

Test Status
GitHub.com connectivity
Node.js build (npm ci && npm run build)
Node.js tests (Jest subset)
Go build (color, uuid)
Go tests (color, uuid)
Network isolation

Overall: FAIL

🐳🏗️ Docker sbx build test by Smoke Docker Sbx Build Test
Add label test-docker-sbx-build 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 #6237 · 40.8 AIC · ⊞ 6.9K ·
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 connectivity
File write/read

Overall: PASS@lpcox

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

@github-actions

Copy link
Copy Markdown
Contributor

🐳🔮 Docker sbx + Codex
GitHub MCP: ❌ filtered empty PR result; exact pre-fetched data not visible
GitHub.com: ❌ HTTP code not available in this run
File read: ✅ /tmp/gh-aw/agent/smoke-test-docker-sbx-codex-29380073129.txt
Network isolation: ❌ curl not available here
Overall: FAIL

🐳🔮 Docker sbx + Codex smoke test by Smoke Docker Sbx Codex
Add label test-docker-sbx-codex to run again

@github-actions

Copy link
Copy Markdown
Contributor

🐳🟣 Docker sbx + Claude

  • ✅ GitHub MCP connectivity
  • ✅ github.com reachable (HTTP 200)
  • ✅ File write/read
  • ❌ Network isolation: example.com returned HTTP 200 (expected block)

Overall: FAIL — non-allowlisted domain example.com was reachable via the proxy tunnel.

🐳🟣 Docker sbx + Claude smoke test by Smoke Docker Sbx Claude
Add label test-docker-sbx-claude to run again

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test

  • fix: update CI workflow tests for new compiler action path format: ✅
  • chore: recompile workflows with compiler 5a10da88 + fix raw-IP allow rules: ✅
  • GitHub PR query: ✅
  • Discussion comment: ✅
  • github.com title check: ✅
  • File write/read: ✅
  • npm ci && npm run 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

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