Improve GitHub Actions security with token restrictions#2
Open
Improve GitHub Actions security with token restrictions#2
Conversation
- Add `permissions: read-all` at the workflow level to restrict the GITHUB_TOKEN to read-only by default for all jobs - Add `permissions: contents: read` on the publish job as the only explicitly needed permission (PyPI upload uses secrets, not GITHUB_TOKEN) - Flag the two @master-pinned reusable workflows (python3_sdist_workflow.yml and failure_notify_workflow.yml) with SECURITY NOTEs explaining the risk; Drakkar-Software/.github has no version tags yet so the @master refs cannot be replaced with a tag at this time — the comments document the remediation path No functional changes to existing version tags or workflow logic. https://claude.ai/code/session_01CHRbcdCqJVRaXuhD7v2Chg
Keep the permission hardening but drop the verbose comment blocks per user request. https://claude.ai/code/session_01CHRbcdCqJVRaXuhD7v2Chg
GuillaumeDSM
approved these changes
Mar 5, 2026
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.
Summary
Restrict GitHub Actions GITHUB_TOKEN to read-only by default and add security notes about workflow pinning.
Changelog
permissions: read-allat workflow level to restrict GITHUB_TOKEN to read-only access by defaultcontents: readpermission for the publish jobWhat's new?
This PR enhances the security posture of the GitHub Actions workflow by implementing the principle of least privilege for token permissions:
Default read-only permissions: The workflow now sets
permissions: read-allat the top level, restricting the GITHUB_TOKEN to read-only access for all jobs by default. This prevents accidental or malicious token misuse.Explicit permission declaration: The publish job explicitly declares the
contents: readpermission it needs, making the permission requirements transparent and auditable.Security documentation: Added SECURITY NOTE comments documenting the risk of pinning reusable workflows to @master, which can be silently changed via force-push. These notes include guidance for migrating to version tags once they become available in the Drakkar-Software/.github repository.
These changes follow GitHub's security best practices for workflow token management and improve the overall security of the CI/CD pipeline.
https://claude.ai/code/session_01CHRbcdCqJVRaXuhD7v2Chg