-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ci): pin third-party actions to full commit SHAs #84
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 9202
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 10976
🌐 Web query:
official gh-actions-lock lockfile format workflow entries commit SHA direct uses reference startup enforcement💡 Result:
<search_synthesis>
The official GitHub Actions lockfile format, managed by the
gh-actions-locktool and defined in theactions-lockfilerepository, is a YAML document located at.github/workflows/actions.lock[1][2]. It is designed to record the resolved transitive dependency graph for a repository's workflows, allowing for auditing and verification of action pins [1][3]. The lockfile format (currently versionv0.0.2) consists of three primary top-level keys [1][4]: 1. version: The schema version string (e.g., "v0.0.2") [4]. 2. workflows: A mapping of repo-relative workflow paths to a flat, transitive list of canonical pin keys (OWNER/REPO@REF) used by that workflow [1][4]. 3. dependencies: A mapping of canonical pin keys to resolved action metadata [1][4]. Each entry in the dependencies map includes [4]: - ref: The original git reference (e.g., a tag or branch) [4]. - commit: The resolved commit SHA, represented in an algorithm-prefixed format (e.g., "sha1-...") [1][4]. - owner_id and repo_id: GitHub numeric IDs used to detect repository transfers [1][4]. - uses: A list of direct nested dependencies (empty for leaf actions, populated for composite actions) [4]. Regarding startup enforcement and usage: - Workflow Dependency Pinning: The system encourages using symbolic version references (tags/branches) in workflow YAML files, while the lockfile holds the resolved commit SHAs [5]. - Enforcement: Some environments enforce that workflows use symbolic refs rather than bare 40-character SHAs in theiruses:entries, requiring the lockfile to act as the source of truth for the exact commit executed on the runner [5]. - Verification: Thegh-actions-locktool verifies that the locked commit for an action is what is executed on the runner, and it checks for forgeries by ensuring the SHA exists within the recorded reference [2]. It also records repository identity to block redirects or mismatches at runtime [2]. Note:gh-actions-lockis currently in a technical preview phase, and the format and behavior are subject to change [2].</search_synthesis>
<source_evidence>
Citations:
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 4504
🌐 Web query:
github gh-actions-lock source full 40 character SHA uses reference lockfile workflow key matching missing dependency💡 Result:
<search_synthesis>
The term "gh-actions-lock" refers to an official GitHub CLI extension (github/gh-actions-lock) designed to generate and verify a dependency lockfile for GitHub Actions [1]. This tool is part of GitHub&
#39;s effort to improve workflow security by pinning dependencies to verified, immutable commit SHAs [1]. Regarding your query about the 40-character SHA, reference lockfile workflow keys, and dependency matching: 1. Full 40-character SHA usage: The primary purpose of the gh-actions-lock tool is to resolve action references (like tags or branches) to their full 40-character commit SHAs [1]. Once a workflow is onboarded, the lockfile (located at.github/workflows/actions.lock) records these SHAs to ensure that the exact code intended is executed on the runner [1]. 2. Workflow Key Matching: The lockfile uses a specific structure to map workflows to their dependencies [2][3]. It contains a workflows section that maps a repository-relative workflow path (e.g.,.github/workflows/main.yml) to a flat, transitive list of "pin keys" [2][4]. A pin key is typically formatted as OWNER/REPO@REF [2][4]. 3. Missing Dependency Handling: If a workflow is onboarded to the lockfile, the system enforces that all dependencies are present in the lockfile [1]. If a dependency is missing or if there is a mismatch between the recorded SHA and the upstream reference, the tool will flag this as an error [1]. The tool provides commands like --relock to re-resolve references that have moved and --accept-moved to handle cases where recorded commits are no longer reachable [1]. Note: There is a separate, community-maintained project called gh-actions-lockfile (gjtorikian/gh-actions-lockfile) which also provides lockfile generation and verification [5][6]. This tool includes a specific --require-sha flag that forces all action references in workflows to use full 40-character commit SHAs, failing the process if tags or branches are used instead [5][7]. This is distinct from the official GitHub-maintained tool [1][2].</search_synthesis>
<source_evidence>
Citations:
🌐 Web query:
site:github.com/github/gh-actions-lock full SHA uses lockfile workflow dependency matching symbolic ref💡 Result:
<search_synthesis>
The gh-actions-lock tool is a GitHub CLI extension designed to enhance the security of GitHub Actions by pinning workflow dependencies to exact commit SHAs [1]. It generates a lockfile (typically located at.github/workflows/actions.lock) that records the specific commit SHA for every action used in a workflow [1]. Key aspects of its dependency matching and symbolic ref handling include: 1. Pinning and Resolution: When a workflow is onboarded to the lockfile, the tool scans for actions and pins them to their full commit SHA [1]. This ensures that the code executed on the runner is exactly what was locked, protecting against unauthorized changes to tags or branches [1]. 2. Symbolic Refs: References to branches or partial versions (e.g., v4, main) are resolved to a specific SHA during the initial locking process [1]. Once locked, these symbolic refs are trusted from the lockfile and are not re-resolved during normal workflow runs [1]. 3. Relocking: To update dependencies, the --relock command is used to re-resolve refs that have moved upstream and update the lockfile with the new SHAs [1]. If a pin is deemed suspicious (e.g., the recorded commit is no longer reachable), the tool flags it as an error, requiring explicit intervention (such as --accept-moved) to resolve [1]. 4. Same-Repository References: References to actions or reusable workflows within the same repository (using the $/ syntax) are treated as inherently pinned to the running commit [1]. Because these always resolve to the repository&
#39;s running SHA, they do not require an entry in the lockfile [1]. 5. Security Verification: The lockfile system includes verification to prevent forgeries [1]. It ensures that the recorded SHA exists within the specified reference, and it blocks repository identity mismatches or redirects at runtime [1].</search_synthesis>
<source_evidence>
Citations:
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 2607
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 41927
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 37863
🏁 Script executed:
Repository: hyperpolymath/fraying-model-computational-testbed
Length of output: 2274
Refresh the lock entries for the changed
mainaction commits.gh-actions-lockintentionally permits a workflow to use a full SHA while the lockfile retains the symbolic ref. It skips full SHA refs incheckRefChangedand matches them against the lockfile SHA incheckStale.The
mainaction commits indogfood-gate.ymlandmain-estate-audit.ymldiffer from the commits recorded formain, so lock verification can report those entries as stale. The versioned action entries do not need literal SHA keys, and this does not prevent workflow startup.Run
gh actions-lockto refresh the changedmaindependencies. Do not replace every human-readable lock key with a SHA.🤖 Prompt for AI Agents