Skip to content

✨ Adds support for Actions lock files to detect pinning - #5247

Open
jessehouwing wants to merge 11 commits into
ossf:mainfrom
jessehouwing:main
Open

jessehouwing wants to merge 11 commits into
ossf:mainfrom
jessehouwing:main

Conversation

@jessehouwing

@jessehouwing jessehouwing commented Sep 22, 2026 •

Copy link
Copy Markdown

What kind of change does this PR introduce?

Feature: detect pinning via GitHub Actions lock files.

What is the current behavior?

scorecard only detects pinned actions using @sha, but ignores the new actions lock files, flooding my security tab with 100's of unpinned actions warnings.

What is the new behavior (if this is a feature change)?

  • Tests for the changes have been added (for bug fixes/features)

Reads .github/workflows/actions.lock if present and treats a uses: reference recorded for that workflow as pinned.

  • Uses github/actions-lockfile v0.0.6, which reads lockfile schemas v0.0.1 through v0.0.3. v0.0.3 adds a per-dependency hostname (empty = the home host, e.g. the GHE.com tenant; github.com = a github.com-bound pin on a GHE.com instance).
  • Pins are authoritative regardless of hostname: matching is done on the OWNER/REPO@REF pin key from the lockfile and makes no network call to any host. A pin that belongs to a GHE.com tenant is never looked up on public github.com, and no enterprise credentials are ever sent anywhere by this code path.
  • A lockfile with a schema version newer than this build understands is assumed to be backwards compatible: its per-workflow pins are still honored and a warning is logged. A malformed lockfile is ignored with a warning and standard SHA-based detection applies.
  • A pin only counts as pinned when its dependencies entry exists with a recorded commit (offline check; no network lookups).
  • Tests cover v0.0.3 (github.com-bound and home-host pins), v0.0.2 compatibility, unrecorded refs, newer (unsupported) versions with a warning, and malformed files.

Which issue(s) this PR fixes

NONE

Special notes for your reviewer

Generated with copilot, tested against all my own repos on Windows (which required additional fixes to make it work on Windows).

Windows-only test failures seen locally (file handle leaks, path vs filepath, CRLF fixtures) are addressed in #5342, and the pkg/scorecard rate-limit stall is addressed in #5343; they can be ignored here. The path fixes in this PR overlap with #5342 and will merge cleanly.

Relationship to #5248 (immutable release pinning): that PR performs release lookups; any lookup there must skip pins that are covered by a lockfile entry (in particular GHE.com home-host pins), so enterprise tokens are never sent to github.com.

Tested on Ubuntu-latest using CI.

Does this PR introduce a user-facing change?

Adds support for actions lock files (schema up to v0.0.3, including per-dependency hostnames) for pinning.

@jessehouwing
jessehouwing requested a review from a team as a code owner September 22, 2026 19:05
@jessehouwing
jessehouwing requested review from justaugustus and spencerschrock and removed request for a team September 22, 2026 19:05
@jessehouwing
jessehouwing force-pushed the main branch 2 times, most recently from 02d9f49 to f4957c7 Compare September 24, 2026 11:31
jessehouwing and others added 2 commits October 1, 2026 16:28
- Detect actions pinned via github/gh-actions-lock lockfiles (.github/workflows/actions.lock)
- Treat \\$/...\ self-repository references as inherently pinned
- Fix filepath.Dir/Clean usage on repo-relative (forward-slash) paths in IsWorkflowFile, fileIsInVendorDir, and shell_download_validate
- Fix clients/localdir trimPrefix to correctly normalize paths to forward slashes on Windows, fixing --local scans
- Add .gitattributes to clients/localdir/testdata to prevent CRLF corruption of binary-compared fixtures

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
@jessehouwing

Copy link
Copy Markdown
Author

@JamieMagee you might be interested in this one as well then

jessehouwing and others added 9 commits October 18, 2026 12:19
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Bump github/actions-lockfile to v0.0.6, which reads schema v0.0.1-v0.0.3, and add tests for v0.0.3 (github.com and home-host pins), v0.0.2 and unsupported future versions. Lockfile pins are treated as authoritative regardless of hostname, so no lookup (and no credential use) against any host happens for them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Schema versions newer than the library supports are read best-effort (workflow pin keys only) and a warning is logged, instead of ignoring the lockfile. Malformed lockfiles are ignored with a warning too.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
A workflow pin only counts as pinned when its dependency entry exists in the lockfile and resolves to a well-formed sha1/sha256 commit. This is an offline integrity check; no network lookups are made.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>
Restore the checked yaml.Unmarshal error (errcheck check-blank) and make the ListFiles mock honor its predicate so non-lockfile fixtures are not parsed as actions.lock.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Jesse Houwing <jesse.houwing@gmail.com>

This branch has not been deployed

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant