Skip to content

Log more claims for OIDC login - #520

Merged
Shiying Chen (MoChilia) merged 3 commits into
masterfrom
sy/claims
Mar 3, 2025
Merged

Log more claims for OIDC login#520
Shiying Chen (MoChilia) merged 3 commits into
masterfrom
sy/claims

Conversation

@MoChilia

@MoChilia Shiying Chen (MoChilia) commented Mar 3, 2025

Copy link
Copy Markdown
Member

As suggested in issue #505, adding more claim logs for OIDC login would be beneficial. This pr logs audience and job_workflow_ref in addition to issuer and subject. For details on the GitHub federated token format, refer to https://token.actions.githubusercontent.com/.well-known/openid-configuration, and https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect#understanding-the-oidc-token

Close #505

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PR Overview

This pull request enhances logging for OIDC logins by capturing additional claims from the federated token as suggested in issue #505.

  • Updated error messaging for token fetching
  • Added logging for 'audience' and 'job_workflow_ref' claims
  • Extended the jwtParser function to return additional claims

Reviewed Changes

File Description
src/common/LoginConfig.ts Updated token fetching and parsing to include more claims and improved logging of error messages

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/common/LoginConfig.ts:90

  • Consider including error details (e.g. error.message) in the warning log to aid in debugging token parsing issues.
            core.warning("Failed to parse the federated token. Missing necessary claims.");

Comment thread src/common/LoginConfig.ts Outdated
Comment thread src/common/LoginConfig.ts Outdated
let bufferObj = Buffer.from(tokenPayload, "base64");
let decodedPayload = JSON.parse(bufferObj.toString("utf8"));
return [decodedPayload['iss'], decodedPayload['sub']];
const requiredClaims = ['iss', 'sub', 'aud', 'job_workflow_ref'];

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.

define a const value for this.

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.

Log more claims (at least job_workflow_ref)

3 participants