-
Notifications
You must be signed in to change notification settings - Fork 2
[StepSecurity] ci: Harden GitHub Actions #260
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
[StepSecurity] ci: Harden GitHub Actions #260
Conversation
Co-authored-by: reactive-firewall <[email protected]> Signed-off-by: StepSecurity Bot <[email protected]>
WalkthroughThis pull request focuses on updating GitHub Actions workflow configurations across multiple files in the Changes
Possibly related PRs
Suggested labels
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Here's the code health analysis summary for commits Analysis Summary
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/Tests.yml (1)
Line range hint
1-20
: Consider adding timeout to the workflow.While individual jobs have timeouts set, the workflow itself doesn't have a global timeout. This could be important for security and resource management.
Add a workflow-level timeout:
name: CI-TESTS # Continuous Integration workflow for post-MATs additional testing, and validating of the project. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
.github/workflows/CI-BUILD.yml
(2 hunks).github/workflows/CI-DOCS.yml
(2 hunks).github/workflows/CI-MATs.yml
(1 hunks).github/workflows/Labeler.yml
(1 hunks).github/workflows/Tests.yml
(13 hunks).github/workflows/bandit.yml
(1 hunks).github/workflows/codeql-analysis.yml
(3 hunks).github/workflows/makefile-lint.yml
(1 hunks).github/workflows/markdown-lint.yml
(1 hunks).github/workflows/yaml-lint.yml
(2 hunks)
✅ Files skipped from review due to trivial changes (5)
- .github/workflows/Labeler.yml
- .github/workflows/bandit.yml
- .github/workflows/CI-MATs.yml
- .github/workflows/codeql-analysis.yml
- .github/workflows/CI-BUILD.yml
🧰 Additional context used
📓 Path-based instructions (5)
.github/workflows/makefile-lint.yml (1)
Pattern .github/**
: * When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.
- 'actionlint' erroneously generates false positives when dealing with GitHub's
${{ ... }}
syntax in conditionals. - 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid
${{ ... }}
syntax.
.github/workflows/markdown-lint.yml (1)
Pattern .github/**
: * When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.
- 'actionlint' erroneously generates false positives when dealing with GitHub's
${{ ... }}
syntax in conditionals. - 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid
${{ ... }}
syntax.
.github/workflows/CI-DOCS.yml (1)
Pattern .github/**
: * When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.
- 'actionlint' erroneously generates false positives when dealing with GitHub's
${{ ... }}
syntax in conditionals. - 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid
${{ ... }}
syntax.
.github/workflows/yaml-lint.yml (1)
Pattern .github/**
: * When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.
- 'actionlint' erroneously generates false positives when dealing with GitHub's
${{ ... }}
syntax in conditionals. - 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid
${{ ... }}
syntax.
.github/workflows/Tests.yml (1)
Pattern .github/**
: * When the project is hosted on GitHub: All GitHub-specific configurations, templates, and tools should be found in the '.github' directory tree.
- 'actionlint' erroneously generates false positives when dealing with GitHub's
${{ ... }}
syntax in conditionals. - 'actionlint' erroneously generates incorrect solutions when suggesting the removal of valid
${{ ... }}
syntax.
🔇 Additional comments (10)
.github/workflows/yaml-lint.yml (2)
Line range hint 9-11
: LGTM: Proper permissions configuration
The empty permissions block at workflow level with specific read/write permissions at job level follows the principle of least privilege.
23-23
: LGTM: Actions properly pinned to commit hashes
All actions are correctly pinned to their full-length commit hashes with version comments:
- actions/checkout@11bd719 (v4.2.2)
- ibiqlik/action-yamllint@2576378 (v3.1.1)
Also applies to: 27-27, 51-51
.github/workflows/markdown-lint.yml (3)
Line range hint 9-15
: LGTM: Proper permissions configuration
The empty permissions block at workflow level with specific read/write permissions at job level follows the principle of least privilege.
21-21
: LGTM: Action properly pinned to commit hash
The checkout action is correctly pinned to its full-length commit hash with version comment:
- actions/checkout@11bd719 (v4.2.2)
Line range hint 26-39
: LGTM: Improved error handling with detailed messages
Good improvement in error handling:
- Clear error messages with file and line information
- Proper exit codes for installation failures
- Separate validation for npm and yamllint
.github/workflows/CI-DOCS.yml (2)
Line range hint 11-11
: LGTM: Comprehensive permissions and environment configuration
Excellent security configuration:
- Empty permissions block at workflow level
- Detailed job-level permissions following principle of least privilege
- Environment conditions properly set based on branch/tag context
Also applies to: 23-29
46-46
: LGTM: Actions properly pinned to commit hashes
All actions are correctly pinned to their full-length commit hashes with version comments:
- actions/checkout@11bd719 (v4.2.2)
- actions/setup-python@0b93645 (v5.3.0)
- actions/upload-artifact@b4b15b8 (v4.4.3)
Also applies to: 48-48, 74-74
.github/workflows/makefile-lint.yml (1)
35-35
: LGTM: Action pinned to specific commit hash.
The actions/checkout
action has been correctly pinned to commit hash 11bd71901bbe5b1630ceea73d27597364c9af683
(v4.2.2), which aligns with security best practices.
.github/workflows/Tests.yml (2)
88-90
: LGTM: Actions consistently pinned to specific commit hashes.
All GitHub Actions have been correctly pinned to specific commit hashes:
actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
(v4.2.2)actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
(v5.3.0)codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e
(v5.1.1)actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
(v4.4.3)codecov/test-results-action@9739113ad922ea0a9abb4b2c0f8bf6a4aa8ef820
(v1.0.1)
This consistent approach across all jobs enhances security by preventing supply chain attacks through mutable tags.
Also applies to: 120-120, 130-130, 173-175, 226-228, 270-270, 280-280, 295-295, 345-347, 370-370, 380-380, 421-423, 474-476
Line range hint 28-31
: LGTM: Secure default permissions.
The workflow follows the principle of least privilege by setting default permissions to none and explicitly declaring required permissions for each job.
9ceacca
into
reactive-firewall-org:master
Summary
This pull request is created by StepSecurity at the request of @reactive-firewall. Please merge the Pull Request to incorporate the requested changes. Please tag @reactive-firewall on your message if you have any questions related to the PR.
Security Fixes
Pinned Dependencies
GitHub Action tags and Docker tags are mutable. This poses a security risk. GitHub's Security Hardening guide recommends pinning actions to full length commit.
Feedback
For bug reports, feature requests, and general feedback; please email [email protected]. To create such PRs, please visit https://app.stepsecurity.io/securerepo.Co-authored-by: reactive-firewall [email protected]
Signed-off-by: StepSecurity Bot [email protected]
Summary by CodeRabbit
New Features
Bug Fixes
Chores