-
Notifications
You must be signed in to change notification settings - Fork 558
docs(OIDC): Document OIDC trust relationships and token exchange #8045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
74b1a5f
7e97bbb
f3b5de9
605cd09
faaae62
1891631
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,25 @@ import { TrustRelationship } from 'common/types/responses' | |
| export const GITHUB_ISSUER = 'https://token.actions.githubusercontent.com' | ||
|
|
||
| // Claims the GitHub form can round-trip; anything else edits as freeform. | ||
| const GITHUB_FORM_CLAIMS = ['repository', 'repository_id', 'environment'] | ||
| const GITHUB_FORM_CLAIMS = [ | ||
| 'repository', | ||
| 'repository_id', | ||
| 'environment', | ||
| 'workflow_ref', | ||
| ] | ||
|
|
||
| // The repository rule already pins the repository, so the workflow rule only | ||
| // needs to enforce the path — a wildcard prefix survives repository renames, | ||
| // and the wildcard ref leaves branch filtering to the environment rule. | ||
| export const githubWorkflowRefPattern = (filename: string): string => | ||
| `*/.github/workflows/${filename}@*` | ||
|
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Reject wildcard syntax in workflow filenames. Line 17 inserts Accept only literal workflow filenames, or escape all claim-matcher metacharacters before creating the pattern. Add cases for |
||
|
|
||
| const GITHUB_WORKFLOW_REF_REGEX = /^\*\/\.github\/workflows\/(.+)@\*$/ | ||
|
|
||
| export const parseGithubWorkflowFilename = ( | ||
| workflowRef: string | undefined, | ||
| ): string | undefined => | ||
| workflowRef ? GITHUB_WORKFLOW_REF_REGEX.exec(workflowRef)?.[1] : undefined | ||
|
|
||
| export const isGithubFormEditable = ( | ||
| trustRelationship: TrustRelationship, | ||
|
|
@@ -21,7 +39,10 @@ export const isGithubFormEditable = ( | |
| repositorySelectors.length === 1 && | ||
| trustRelationship.claim_rules.every( | ||
| (rule) => | ||
| GITHUB_FORM_CLAIMS.includes(rule.claim) && rule.values.length === 1, | ||
| GITHUB_FORM_CLAIMS.includes(rule.claim) && | ||
| rule.values.length === 1 && | ||
| (rule.claim !== 'workflow_ref' || | ||
| !!parseGithubWorkflowFilename(rule.values[0])), | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.