Skip to content

[log] oidc: add debug logging to provider.go#4246

Merged
lpcox merged 1 commit intomainfrom
log/oidc-provider-debug-logging-dc7e28dc7d91ff26
Apr 21, 2026
Merged

[log] oidc: add debug logging to provider.go#4246
lpcox merged 1 commit intomainfrom
log/oidc-provider-debug-logging-dc7e28dc7d91ff26

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Adds logOIDC debug logging calls to internal/oidc/provider.go to improve traceability for OIDC token lifecycle operations.

Changes

File modified: internal/oidc/provider.go (4 new log calls)

Location Log call Purpose
NewProvider logOIDC.Printf("Creating OIDC provider: requestURL=%s, hasToken=%v", ...) Log provider initialization
fetchToken logOIDC.Printf("OIDC token HTTP response: status=%d, bodyLen=%d", ...) Log HTTP response before error check
extractJWTExpiry logOIDC.Printf("Parsing JWT expiry: partCount=%d, payloadLen=%d", ...) Log JWT parsing entry point
extractJWTExpiry logOIDC.Printf("JWT expiry parsed: exp=%d, expiresAt=%s", ...) Log successful expiry extraction

The extractJWTExpiry function previously had zero debug visibility — these additions make it much easier to diagnose JWT parsing failures and token expiry edge cases.

Existing logger reused

The file already declares var logOIDC = logger.New("oidc:provider") — no new logger was added.

Enable with: DEBUG=oidc:* ./awmg --config config.toml

Validation

  • go build ./...
  • go vet ./...
  • go test ./internal/oidc/... ✅ (all 10 tests pass)
  • go test ./internal/... ✅ (one pre-existing unrelated failure in internal/config)

Warning

⚠️ Firewall blocked 1 domain

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

  • invalidhostthatdoesnotexist12345.com

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

network:
  allowed:
    - defaults
    - "invalidhostthatdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Go Logger Enhancement · ● 4.2M ·

Add logOIDC debug logging calls to improve traceability for OIDC
token lifecycle operations:

- NewProvider: log provider creation with requestURL and token presence
- fetchToken: log HTTP response status and body length after each request
- extractJWTExpiry: log JWT parsing entry with part/payload counts, and
  log the parsed exp claim and resolved expiry timestamp on success

The extractJWTExpiry function previously had no debug visibility; these
additions make it easier to diagnose JWT parsing failures and token
expiry edge cases during development and troubleshooting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Apr 21, 2026
@lpcox lpcox marked this pull request as ready for review April 21, 2026 14:17
Copilot AI review requested due to automatic review settings April 21, 2026 14:17
@lpcox lpcox merged commit d61f10e into main Apr 21, 2026
21 checks passed
@lpcox lpcox deleted the log/oidc-provider-debug-logging-dc7e28dc7d91ff26 branch April 21, 2026 14:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds additional debug logging to the OIDC provider implementation to improve traceability around provider initialization, token HTTP responses, and JWT expiry parsing.

Changes:

  • Log provider construction inputs (request URL + whether a token is present).
  • Log token HTTP response metadata (status code and response body length).
  • Log JWT expiry parsing entry/exit (payload sizing and parsed expiry time).
Show a summary per file
File Description
internal/oidc/provider.go Adds new logOIDC.Printf calls around provider initialization, token fetch response handling, and JWT expiry extraction to aid debugging.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread internal/oidc/provider.go
// These values come from the ACTIONS_ID_TOKEN_REQUEST_URL and
// ACTIONS_ID_TOKEN_REQUEST_TOKEN environment variables respectively.
func NewProvider(requestURL, requestToken string) *Provider {
logOIDC.Printf("Creating OIDC provider: requestURL=%s, hasToken=%v", requestURL, requestToken != "")
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

Logging the raw requestURL can leak potentially sensitive environment-provided data (e.g., internal hostnames or query parameters) and is inconsistent with the repo’s guidance to sanitize/truncate env values before logging. Consider logging only that the URL is set (and maybe its host/path), or pass it through sanitize.SanitizeString/sanitize.TruncateSecret before printing.

Suggested change
logOIDC.Printf("Creating OIDC provider: requestURL=%s, hasToken=%v", requestURL, requestToken != "")
requestURLLogValue := "set=false"
if requestURL != "" {
requestURLLogValue = "set=true"
if parsedURL, err := url.Parse(requestURL); err == nil {
requestURLLogValue = fmt.Sprintf(
"set=true, scheme=%s, host=%s, path=%s",
parsedURL.Scheme,
parsedURL.Host,
parsedURL.Path,
)
}
}
logOIDC.Printf("Creating OIDC provider: requestURL={%s}, hasToken=%v", requestURLLogValue, requestToken != "")

Copilot uses AI. Check for mistakes.
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.

2 participants