Scope down GitHub token permissions for swift.yml#143
Closed
AdnaneKhan wants to merge 1 commit into
Closed
Conversation
This PR adds minimal required permissions to the workflow following the principle of least privilege.
Analysis:
This workflow is a Swift build, test, and linting pipeline with no operations requiring GitHub repository write permissions. Analysis of all jobs: (1) LatestVersionBuild job - runs across multiple matrix configurations (Swift 5.9 on ubuntu-22.04 and ubuntu-20.04): swift-actions/setup-swift@v1.25.0 sets up Swift toolchain, actions/checkout@v2 reads repository contents (requires 'contents: read'), swift build -c release compiles the project locally in release configuration, swift test runs tests locally; (2) OlderVersionBuild job - runs on older Swift versions (5.8.1 and 5.7.3 on ubuntu-20.04): swift-actions/setup-swift@v1.25.0 sets up Swift toolchain, actions/checkout@v2 reads repository contents, swift build -c release compiles the project locally, swift test runs tests locally; (3) SwiftLint job - runs code linting: actions/checkout@v1 reads repository contents, norio-nomura/action-swiftlint@3.2.1 runs SwiftLint linting locally. The workflow does not perform any git operations, does not create/update issues or PRs, does not modify repository contents, does not upload artifacts, and does not interact with external services. All operations are local to the workspace. The workflow tests compatibility across multiple Swift versions and OS versions. The workflow only needs to read the repository contents to perform the build, test, and linting operations.
Required permissions:
{
"contents": "read"
}
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.
This PR adds minimal required permissions to the workflow following the principle of least privilege.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.