Pin-down external GHA to SHA refs to protect against compromise#339
Merged
knuton merged 1 commit intodividat:mainfrom Apr 28, 2026
Merged
Pin-down external GHA to SHA refs to protect against compromise#339knuton merged 1 commit intodividat:mainfrom
knuton merged 1 commit intodividat:mainfrom
Conversation
Collaborator
Author
|
Whoops, short SHA's don't work, need to fix. |
knuton
approved these changes
Apr 28, 2026
Member
knuton
left a comment
There was a problem hiding this comment.
Confirmed that the original refs resolve to those commits with an ad hoc AI-gen bash script:
#!/bin/bash
# Check if an argument was provided
if [ -z "$1" ]; then
echo "Usage: $0 <user/repo@sha>"
echo "Example: $0 torvalds/linux@1bd9238"
exit 1
fi
# Check if jq is installed
if ! command -v jq &> /dev/null; then
echo "Error: 'jq' is required but not installed. Please install it (e.g., apt install jq, brew install jq)."
exit 1
fi
# Parse the input format (user/repo@sha)
# IFS (Internal Field Separator) splits the string at '/' and '@'
IFS='@/' read -r user repo sha <<< "$1"
if [ -z "$user" ] || [ -z "$repo" ] || [ -z "$sha" ]; then
echo "Error: Invalid format. Please use user/repo@sha"
exit 1
fi
echo "Fetching commit info for $user/$repo at $sha..."
echo "--------------------------------------------------"
# Fetch data from GitHub API
response=$(curl -s -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$user/$repo/commits/$sha")
# Check if the API returned a "Not Found" message
message=$(echo "$response" | jq -r '.message // empty')
if [ "$message" = "Not Found" ]; then
echo "Error: Commit or repository not found."
exit 1
fi
# Extract and print relevant information using jq
echo "$response" | jq -r '
"Author: " + .commit.author.name + " <" + .commit.author.email + ">",
"Date: " + .commit.author.date,
"URL: " + .html_url,
"--------------------------------------------------\n" +
.commit.message
'
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Been meaning to do this, but this was the final trigger: https://socket.dev/blog/bitwarden-cli-compromised
Doing this for e.g.
actions/checkoutmight be overkill, but I think it is more hygienic if it is identical for alluses: