-
Notifications
You must be signed in to change notification settings - Fork 0
ci: attach extension zip to GitHub Releases #237
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
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 | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -17,10 +17,40 @@ jobs: | |||||||||||||||||||||||||||||||||||
| github.event_name == 'workflow_dispatch' || | ||||||||||||||||||||||||||||||||||||
| github.event.pull_request.merged == true | ||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||||||||||||||
| tag_name: ${{ steps.drafter.outputs.tag_name }} | ||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||
| - uses: release-drafter/release-drafter@v6 | ||||||||||||||||||||||||||||||||||||
| id: drafter | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| publish: true | ||||||||||||||||||||||||||||||||||||
| config-name: release-drafter.yml | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| upload-extension: | ||||||||||||||||||||||||||||||||||||
| needs: update-release-draft | ||||||||||||||||||||||||||||||||||||
| if: needs.update-release-draft.outputs.tag_name | ||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
Comment on lines
+31
to
+37
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. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/release.yml | head -60Repository: bd73-com/fetchthechange Length of output: 1871 🏁 Script executed: # Get the full upload-extension job to see what it does
rg -A 30 "upload-extension:" .github/workflows/release.ymlRepository: bd73-com/fetchthechange Length of output: 853 🏁 Script executed: rg "run:|node|npm|yarn" .github/workflows/release.yml | head -20Repository: bd73-com/fetchthechange Length of output: 247 Disable credential persistence and restrict job permissions before executing repository build scripts. The 🛡️ Proposed least-privilege adjustment upload-extension:
needs: update-release-draft
if: needs.update-release-draft.outputs.tag_name
runs-on: ubuntu-latest
+ permissions:
+ contents: write
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| - uses: actions/setup-node@v4 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| node-version: 20 | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||||||||
| working-directory: extension | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Build and package extension | ||||||||||||||||||||||||||||||||||||
| run: NODE_ENV=production node scripts/build.js && node scripts/package.js | ||||||||||||||||||||||||||||||||||||
| working-directory: extension | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+46
to
+48
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. 🧹 Nitpick | 🔵 Trivial Use the existing npm script to avoid command drift. Call ♻️ Proposed refactor - name: Build and package extension
- run: NODE_ENV=production node scripts/build.js && node scripts/package.js
+ run: npm run package
working-directory: extension🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Upload extension zip to release | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||
| run: >- | ||||||||||||||||||||||||||||||||||||
| gh release upload "${{ needs.update-release-draft.outputs.tag_name }}" | ||||||||||||||||||||||||||||||||||||
| extension/fetchthechange-extension.zip | ||||||||||||||||||||||||||||||||||||
| --clobber | ||||||||||||||||||||||||||||||||||||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: bd73-com/fetchthechange
Length of output: 127
🏁 Script executed:
Repository: bd73-com/fetchthechange
Length of output: 98
🏁 Script executed:
Repository: bd73-com/fetchthechange
Length of output: 96
🏁 Script executed:
# Read the release.yml file to see the current state cat -n .github/workflows/release.ymlRepository: bd73-com/fetchthechange
Length of output: 1871
🏁 Script executed:
Repository: bd73-com/fetchthechange
Length of output: 228
🌐 Web query:
GitHub Actions pinning commit SHA security best practices 2024 2025💡 Result:
GitHub Actions: commit-SHA pinning security best practices (2024–2025)
Pin all third‑party actions to a full‑length commit SHA (not
@v1,@main, or other movable tags/branches). This is GitHub’s recommended way to consume an action immutably and reduces supply‑chain risk from tag retargeting or repo compromise. [1][2]uses: actions/checkout@<40-hex-sha>Pin reusable workflows too (
uses: org/repo/.github/workflows/workflow.yml@<sha>), for the same “immutable dependency” reason. [2]Prefer “immutable releases,” but treat tags as mutable in practice: GitHub’s guidance emphasizes commit SHAs as the reliable immutable reference for third‑party actions. [2]
Enforce SHA pinning with policy where possible: GitHub Actions policy can be configured to require full commit SHAs (workflows that reference unpinned actions can be blocked/fail), which helps scale the practice across orgs/enterprises. [3]
Automate verification in CI: Add a check that fails PRs if any
uses:reference isn’t a full SHA (e.g., “Ensure SHA Pinned Actions” / similar linters). [4]Operationalize updates safely: Because SHA pinning trades “auto-updates” for immutability, use an updater process (e.g., Dependabot for GitHub Actions updates, plus review/testing) to regularly advance pinned SHAs. (GitHub’s security hardening guidance is the basis for this workflow.) [2]
Sources: GitHub Docs security hardening guidance [2], GitHub Well‑Architected Actions security recommendations [1], GitHub Changelog for SHA‑pinning enforcement policy [3], and an example enforcement action [4].
🌐 Web query:
release-drafter GitHub Actions v6 tag pinning supply chain risk💡 Result:
Using
release-drafter/release-drafter@v6is a floating (mutable) major tag. If the tag is moved (accidentally, maliciously, or after a maintainer compromise), your workflow will silently start running different code—this is a classic GitHub Actions supply-chain risk. The official Marketplace example still shows@v6usage, which is convenient but not immutable. [1]What to do instead (recommended)
Pin to a full commit SHA (immutable), optionally keeping the human-readable version in a comment:
GitHub explicitly recommends pinning actions to a specific commit SHA to reduce the impact of a compromised dependency. [2] OpenSSF guidance similarly notes SHA pinning prevents “tag renaming/retargeting” style attacks. [3]
Operationalizing it (so it stays updated)
Bottom line:
@v6is normal but not tamper-resistant; pinrelease-drafterto a full commit SHA to materially reduce supply-chain risk. [2][3]References:
[1] Release Drafter – GitHub Marketplace (example shows
release-drafter/release-drafter@v6) (github.com)[2] GitHub Changelog – Actions policy supports blocking and SHA pinning; GitHub recommends pinning to commit SHA (github.blog)
[3] OpenSSF – Mitigating Attack Vectors in GitHub Workflows (SHA pinning reduces tag-retargeting risk) (openssf.org)
[4] StepSecurity secure-repo – notes action tags are mutable; automates pinning to full SHAs (github.com)
Citations:
Pin GitHub Actions to immutable commit SHAs to reduce supply-chain attack surface.
Using floating tags (
@v6,@v4, etc.) creates a mutable dependency that could execute different code if the tag is retargeted—either through maintainer compromise, accident, or malicious activity. GitHub's security hardening guidance and OpenSSF recommendations explicitly advise pinning all third-party actions to their full commit SHA.Update the following:
release-drafter/release-drafter@v6→ pin to commit SHAactions/checkout@v4→ pin to commit SHAactions/setup-node@v4→ pin to commit SHAConsider automating SHA updates via Dependabot or similar tooling to keep pinned dependencies current without sacrificing immutability.
🤖 Prompt for AI Agents