Skip to content

[log] Add debug logging to OIDC provider error paths - #16485

Merged
lpcox merged 2 commits into
mainfrom
log/oidc-provider-error-paths-510afa1a53454b36
Nov 14, 2026
Merged

lpcox merged 2 commits into
mainfrom
log/oidc-provider-error-paths-510afa1a53454b36

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds 7 debug log calls to internal/oidc/provider.go, reusing the existing logOIDC logger (oidc:provider).

New logs cover previously silent failure paths:

  • Token acquisition failure in Token
  • HTTP request failure and rejected response in fetchToken
  • JSON parse failure and empty token value in fetchToken
  • Malformed JWT and missing exp claim in extractJWTExpiry

Log arguments contain only the audience, error, and lengths, with no side effects. The token value, request token, and JWT payload are never logged.

Validation: go vet ./internal/oidc, go test ./internal/oidc and go build -o awmg all pass.

Candidates were limited to files not yet in the cache. Most unlogged files are in packages that internal/logger imports (util, sanitize, syncutil, tty), so adding logging there would create import cycles. That left oidc/provider.go.

Generated by Go Logger Enhancement · copilot · routed: sonnet55 high · ~44 AIC · ⊞ 5.9K · ◷

@github-actions github-actions Bot added automation enhancement New feature or request labels Nov 13, 2026
@lpcox
lpcox marked this pull request as ready for review November 13, 2026 23:40
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 23:40
@github-actions

This comment has been minimized.

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.

🟡 Changes recommended

Two OIDC logging sites can expose JWTs or echoed credentials by writing response-body errors to debug stderr without secret sanitization.

1 open issue
What changed in this PR

Adds debug diagnostics to the GitHub Actions OIDC token provider, reusing the existing logOIDC logger without changing token acquisition or caching behavior.

Changes:

  • Logs token acquisition, HTTP request, and response-processing failures.
  • Adds diagnostics for malformed JWTs and missing expiry claims.
File Description
internal/​oidc/​provider.go Adds seven debug log calls across token acquisition and JWT expiry parsing.

Review effort: Max (dynamic)

Comment thread internal/oidc/provider.go Outdated
}
body, err := httputil.ReadResponseBodyStrict(resp, http.StatusOK, "OIDC token request")
if err != nil {
logOIDC.Printf("OIDC token response rejected: audience=%s, err=%v", audience, err)

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.

Updated in 0850394: the response-rejection log now includes only the audience and HTTP status, and the acquisition-failure log omits the raw error.

@lpcox

lpcox commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Copilot AI requested a review from lpcox November 14, 2026 00:12
@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
B MCP writes (add_issue_comment/star_repository/issue_write/create_branch/create_or_update_file/create_pull_request) ALL 6 targets absent from the 23-tool catalog (read-only toolset) BLOCKED ⚠️
C CLI reads (list_issues, get_file_contents via gateway proxy) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh CLI not authenticated — no write attempted BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh CLI not authenticated — no write attempted BLOCKED ⚠️

Overall: INCONCLUSIVE

No write leaked through mcpg in this run. Part B is ⚠️ because all 6 targeted write tools were entirely absent from the MCP tool catalog (gh-aw launches the GitHub MCP backend with GITHUB_READ_ONLY=1 unconditionally), so this probe confirms backend-config read-only mode but not mcpg's own independent gateway-level write-blocking layer. Parts D/E are ⚠️ because gh auth status showed no authenticated host, so the REST/GraphQL token-scope boundary could not be exercised. Independent evidence of mcpg's own DIFC/guard write enforcement is covered separately by internal/guard and internal/difc unit tests.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit 1618c0b into main Nov 14, 2026
30 checks passed
@lpcox
lpcox deleted the log/oidc-provider-error-paths-510afa1a53454b36 branch November 14, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants