Skip to content

Conversation

@MoChilia
Copy link
Member

@MoChilia MoChilia commented Mar 3, 2025

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

@MoChilia MoChilia requested review from YanaXu and Copilot March 3, 2025 02:07
Copy link

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.

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.");

@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 02:31 — with GitHub Actions Inactive
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
Collaborator

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.

@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia temporarily deployed to Automation test March 3, 2025 05:35 — with GitHub Actions Inactive
@MoChilia MoChilia merged commit 877e2b4 into master Mar 3, 2025
20 checks passed
@MoChilia MoChilia deleted the sy/claims branch March 3, 2025 07:30
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