Skip to content

Fix nil dereference on invalid OIDC refresh token#80

Open
gmolto wants to merge 1 commit intodevelfrom
fix-token-management
Open

Fix nil dereference on invalid OIDC refresh token#80
gmolto wants to merge 1 commit intodevelfrom
fix-token-management

Conversation

@gmolto
Copy link
Copy Markdown
Member

@gmolto gmolto commented Mar 25, 2026

This PR fixes a crash when oidc_refresh_token is present in the config but is not a valid refresh token.

Previously, oscar-cli could hit a nil pointer dereference in pkg/cluster/cluster.go (line 329) while trying to extract claims from an invalid token. With this change, the refresh token is validated before its claims are used, and the CLI now returns a proper error instead of panicking.

Changes

  • Hardened OIDC refresh token handling in pkg/cluster/cluster.go (line 329).
  • Added explicit validation for required claims such as issuer, scope, and client ID.
  • Improved error handling for malformed tokens, invalid issuer URLs, non-2xx OIDC token endpoint responses, and missing access_token fields.
  • Added regression and happy-path tests in pkg/cluster/cluster_test.go (line 263)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant