-
Notifications
You must be signed in to change notification settings - Fork 8
Add permissions configuration to workflows and enable npm provenance #64
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
Conversation
… npm publish Co-authored-by: dgreif <3026298+dgreif@users.noreply.github.com>
Co-authored-by: dgreif <3026298+dgreif@users.noreply.github.com>
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.
Pull Request Overview
This PR enhances the security posture of GitHub Actions workflows by implementing explicit permissions configuration following the principle of least privilege and enabling npm package provenance attestation for supply chain transparency.
- Added explicit permission declarations to all three workflow files to limit access rights
- Enabled npm provenance attestation with
--provenanceflag for published packages - Configured
id-token: writepermissions to support OIDC token generation for cryptographic signing
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/nodejs.yml | Added read-only contents permission for CI builds |
| .github/workflows/publish.yml | Added contents read and id-token write permissions, enabled npm provenance |
| .github/workflows/release.yml | Added contents write and id-token write permissions, enabled npm provenance |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| env: | ||
| TAG_NAME: ${{ github.event.release.tag_name }} | ||
| - run: npm whoami; npm --ignore-scripts publish | ||
| - run: npm whoami; npm --ignore-scripts publish --provenance |
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.
Why do we need to use --provenance here?
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.
This is a newer feature with npm which we've turned on in most of our OSS packages. It provides hard links back to the action which built the published version, improving trust and integrity of npm packages.
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.
Cool! Thanks for the context!
This PR enhances the security posture of the repository's GitHub Actions workflows by implementing explicit permissions configuration and enabling npm package provenance attestation.
Changes
Security Improvements
All workflows now follow the principle of least privilege by explicitly declaring required permissions:
permissions: contents: readfor CI buildspermissions: contents: read, id-token: writefor automated publishingpermissions: contents: write, id-token: writefor manual releasesnpm Provenance
Both publishing workflows now include the
--provenanceflag when publishing to npm:The
id-token: writepermission allows GitHub Actions to mint an OIDC token that npm uses to cryptographically sign and attest to the package's build provenance.Benefits
Published packages will now include verifiable attestations showing:
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
accounts.google.com/opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3623 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-45352262 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4908381743801459248,9728653737246464431,262144 --disable-features=PaintHolding --variations-seed-version(dns block)/opt/google/chrome/chrome --user-data-dir=/tmp/karma-45352262 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=45352262(dns block)clients2.google.com/opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3623 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-45352262 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4908381743801459248,9728653737246464431,262144 --disable-features=PaintHolding --variations-seed-version(dns block)/opt/google/chrome/chrome --user-data-dir=/tmp/karma-45352262 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=45352262(dns block)clientservices.googleapis.com/opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3623 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-45352262 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4908381743801459248,9728653737246464431,262144 --disable-features=PaintHolding --variations-seed-version(dns block)/opt/google/chrome/chrome --user-data-dir=/tmp/karma-45352262 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=45352262(dns block)redirector.gvt1.com/opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3623 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-45352262 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4908381743801459248,9728653737246464431,262144 --disable-features=PaintHolding --variations-seed-version(dns block)/opt/google/chrome/chrome --user-data-dir=/tmp/karma-45352262 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=45352262(dns block)safebrowsingohttpgateway.googleapis.com/opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3623 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-45352262 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4908381743801459248,9728653737246464431,262144 --disable-features=PaintHolding --variations-seed-version(dns block)/opt/google/chrome/chrome --user-data-dir=/tmp/karma-45352262 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=45352262(dns block)www.google.com/opt/google/chrome/chrome --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --disable-dev-shm-usage --use-angle=swiftshader-webgl --crashpad-handler-pid=3623 --enable-crash-reporter=, --noerrdialogs --user-data-dir=/tmp/karma-45352262 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,4908381743801459248,9728653737246464431,262144 --disable-features=PaintHolding --variations-seed-version(dns block)/opt/google/chrome/chrome --user-data-dir=/tmp/karma-45352262 --enable-automation --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-REDACTED-timer-throttling --disable-renderer-REDACTEDing --disable-device-discovery-notifications --headless --disable-gpu --disable-dev-shm-usage --remote-debugging-port=9222 --noerrdialogs --ozone-platform=headless --ozone-override-screen-size=800,600 --use-angle=swiftshader-webgl http://localhost:9876/?id=45352262(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.