Skip to content

ci: harden GitHub Actions workflows with least-privilege permissions#15772

Open
FredKSchott wants to merge 1 commit intomainfrom
security-hardening/workflow-improvements
Open

ci: harden GitHub Actions workflows with least-privilege permissions#15772
FredKSchott wants to merge 1 commit intomainfrom
security-hardening/workflow-improvements

Conversation

@FredKSchott
Copy link
Member

Changes

  • Pin actions/labeler to commit SHA and add explicit permissions block
  • Enable Renovate automated updates for actions/labeler
  • Replace secrets: inherit with explicit secret passing in format.yml workflow
  • Add explicit permissions blocks to workflows that were inheriting default permissions (check.yml, cleanup-cache.yml, scripts.yml, test-hosts.yml)
  • Remove unused actions: write, checks: write, and statuses: write permissions from workflows
  • Add persist-credentials: false to diff-dependencies.yml checkout step
  • Use environment variables instead of direct secret interpolation in shell commands for VSCE_TOKEN, OVSX_TOKEN, and Netlify webhook
  • Replace third-party Discord notification action with direct curl call for better supply chain management

Testing

No functional changes to workflow behavior. All changes follow GitHub Actions security best practices for:

  • Principle of least privilege (explicit permissions)
  • Secure credential handling (environment variables vs direct interpolation)
  • Supply chain hardening (SHA-pinned actions, reduced third-party dependencies)

Docs

No docs changes needed - these are internal CI/CD workflow improvements.

@changeset-bot
Copy link

changeset-bot bot commented Mar 5, 2026

⚠️ No Changeset found

Latest commit: 71658df

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added the 🚨 action Modifies GitHub Actions label Mar 5, 2026
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to split these changes if possible. Can you accommodate that, please?

  • permissions and labeler
  • discord
  • environment variables

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Send a POST request to Netlify to rebuild preview.astro.new
run: 'curl -X POST -d {} ${{ env.BUILD_HOOK }}'
run: 'curl -X POST -d {} "$BUILD_HOOK"'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we changing here? I think this isn't mentioned in the PR description

OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
run: |
npx ovsx publish -p ${{ secrets.OVSX_TOKEN }} --target win32-x64 win32-arm64 linux-x64 linux-arm64 linux-armhf darwin-x64 darwin-arm64 alpine-x64 alpine-arm64
npx ovsx publish -p "$OVSX_TOKEN" --target win32-x64 win32-arm64 linux-x64 linux-arm64 linux-armhf darwin-x64 darwin-arm64 alpine-x64 alpine-arm64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This. I didn't know it was possible, is there some GitHub reference about it?

Comment on lines +120 to +125
DISCORD_MESSAGE: ${{ steps.message.outputs.DISCORD_MESSAGE }}
run: |
jq -n --arg content "$DISCORD_MESSAGE" '{content: $content}' | \
curl -X POST "$DISCORD_WEBHOOK" \
-H "Content-Type: application/json" \
-d @-
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this change to another PR? We don't know if this change will work

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

Labels

🚨 action Modifies GitHub Actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants