-
Notifications
You must be signed in to change notification settings - Fork 1
fix(scripts): pin self-update + SPM dependency to immutable revision (DEVA11Y-475,478,477) #30
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
base: main
Are you sure you want to change the base?
Changes from all commits
fc2a1ef
12fc128
870b4f7
4293136
796017a
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 |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Verify self-update checksums | ||
|
|
||
| # Self-update fetches each launcher script from `main` and verifies it against a | ||
| # committed `<script>.sha256` sidecar. If a script is edited without regenerating | ||
| # its sidecar, self-update silently breaks for every user (checksum mismatch → | ||
| # update refused). This workflow fails the PR/push when a sidecar is missing or | ||
| # out of sync, keeping the two in lockstep. (DEVA11Y-475 review follow-up.) | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - 'scripts/**' | ||
| - '.github/workflows/verify-selfupdate-checksums.yml' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'scripts/**' | ||
| - '.github/workflows/verify-selfupdate-checksums.yml' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| verify-sidecars: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Verify scripts and .sha256 sidecars are in sync | ||
| run: | | ||
| set -uo pipefail | ||
| shopt -s globstar nullglob | ||
| status=0 | ||
| # 1. Every self-updating script must have a sidecar. | ||
| for script in scripts/**/*.sh; do | ||
|
Collaborator
Author
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. [Low] Add a zero-scripts guard (defensive) With Suggestion: Before the loop, collect into an array and Reviewer: stack:code-reviewer |
||
| if [ ! -f "${script}.sha256" ]; then | ||
| echo "::error file=${script}::Missing checksum sidecar ${script}.sha256. Generate it from the script's directory: shasum -a 256 <name>.sh | awk '{print \$1\" <name>.sh\"}' > <name>.sh.sha256" | ||
| status=1 | ||
| fi | ||
| done | ||
| # 2. Every sidecar must match its script. | ||
| sidecars=(scripts/**/*.sha256) | ||
| if [ ${#sidecars[@]} -eq 0 ]; then | ||
| echo "::error::No .sha256 sidecars found under scripts/." | ||
| exit 1 | ||
| fi | ||
| for sidecar in "${sidecars[@]}"; do | ||
| dir=$(dirname "$sidecar") | ||
| script="${sidecar%.sha256}" | ||
| if [ ! -f "$script" ]; then | ||
| echo "::error file=${sidecar}::Sidecar references missing script ${script}." | ||
| status=1 | ||
| continue | ||
| fi | ||
| # Sidecars store "<sha256> <basename>", so verify from the script's dir. | ||
| if ( cd "$dir" && sha256sum -c "$(basename "$sidecar")" ); then | ||
|
Collaborator
Author
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. [Low] Silence
Suggestion: Redirect the check's stdout to Reviewer: stack:code-reviewer |
||
| echo "OK: $sidecar" | ||
| else | ||
| echo "::error file=${script}::Checksum mismatch — regenerate ${sidecar} after editing ${script} (run from ${dir}): shasum -a 256 <name>.sh | awk '{print \$1\" <name>.sh\"}' > <name>.sh.sha256" | ||
| status=1 | ||
| fi | ||
| done | ||
| if [ "$status" -ne 0 ]; then | ||
| echo "::error::Self-update checksum verification failed. Regenerate the affected .sha256 sidecar(s) and commit them." | ||
| fi | ||
| exit "$status" | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9af5ce77ada28741e91d2323e4664c47e7e7531e10b34168cfe6bc50a74f5d62 cli.sh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| dceb8b3a2f8b464bcd8e6c1894ee605b3fbc9714e2cbb874ccfdcacc19240232 spm.sh |
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.
[Low] Pin
actions/checkoutto a full SHA (repo convention)The existing
Semgrep.ymlSHA-pins all actions (actions/checkout@c85c95e3… # v3.5.3). This@v4floating tag breaks that convention and GitHub's supply-chain hardening guidance.Suggestion:
Reviewer: stack:code-reviewer