Add CodeQL analysis workflow with correct job-level security permissions #32
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 a CodeQL analysis workflow to ensure comprehensive security scanning of the Go codebase while following GitHub's recommended security permission patterns.
Changes Made
.github/workflows/codeql.yml
: New CodeQL analysis workflow that:github/codeql-action/analyze
for comprehensive code scanningsecurity-events: write
permission at the job level (not root level)contents: read
only)Security Compliance
✅ Job-level permissions:
security-events: write
is defined at the job level (lines 19-25), not at the root level✅ Minimal root permissions: Only
contents: read
at root level (line 12)✅ Pinned action versions: Uses same versions as existing workflows for consistency
✅ Best practices: Follows GitHub's recommended CodeQL workflow patterns
Verification
The existing OSSF Scorecard workflow was already compliant with the permission requirements. This new workflow ensures that any CodeQL analysis jobs in the repository follow the same secure permission model.
Fixes #31.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.