Skip to content

Scope down GitHub token permissions for swift.yml#143

Closed
AdnaneKhan wants to merge 1 commit into
amzn:mainfrom
AdnaneKhan:update/token-scopedown
Closed

Scope down GitHub token permissions for swift.yml#143
AdnaneKhan wants to merge 1 commit into
amzn:mainfrom
AdnaneKhan:update/token-scopedown

Conversation

@AdnaneKhan

Copy link
Copy Markdown

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.

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"
}
@AdnaneKhan AdnaneKhan closed this by deleting the head repository Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant