Repository navigation
chore: update harden-runner to v2.23.0 (int) - #515
Conversation
step-security-bot-int
left a comment
There was a problem hiding this comment.
Please find StepSecurity AI-CodeWise code comments below.
Code Comments
.github/workflows/codeql-analysis.yml
- [High]Pin specific versions of dependencies to immutable commit hashes
While the patch updates the 'step-security/harden-runner' action from one commit hash to another, it is important that the commit hash used is immutable and verified. Using SHA commit hashes for GitHub Actions is recommended by GitHub documentation to avoid supply chain attacks from third-party action updates (https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions). Confirm that the commit hash 'aebdcf6156ab6691adf63218240e476564a1ed4c' is immutable and thoroughly reviewed before use. Avoid using branch names or tags that can move. This change already pins to a commit SHA which is appropriate. - [Medium]Limit the egress-policy scope to minimize network exposure
The 'harden-runner' step specifies 'egress-policy: audit'. According to the minimal privilege principle from OWASP Application Security (https://owasp.org/www-project-top-ten/), policies should minimize open network access to only necessary endpoints to reduce attack surface. Review and tighten the 'egress-policy' setting if possible. Instead of 'audit', consider restrictive policies that only allow specific egress traffic required for the action and workflow operation. Update the 'egress-policy' parameter accordingly. - [Low]Verify action compatibility before upgrading versions
Upgrading to a newer commit hash of an external action may introduce breaking changes or incompatible behavior. Following semantic versioning and release notes from maintainers helps prevent unexpected failures (https://semver.org/). Test the new version 'v2.23.0' of 'step-security/harden-runner' in a controlled environment before pushing to production workflows. Review changelogs and documentation of the action for any breaking changes.
.github/workflows/dependency-review.yml
- [High]Pin third-party GitHub Actions to a specific, immutable commit SHA to ensure reproducible and secure workflows
Referencing GitHub Actions via commit SHA rather than a branch or tag ensures that the exact same version of the action is used every time the workflow runs. This practice prevents unexpected changes or malicious code injections because the action cannot be altered after the SHA is set. (Source: GitHub Docs - "Workflow syntax for GitHub Actions", https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-specific-commit-sha-for-an-action). Continue using immutable commit SHAs to reference actions, as seen here referencing @aebdcf6156ab6691adf63218240e476564a1ed4c, and avoid using floating tags or branch names (e.g., 'latest' or 'v2'). - [Medium]Add versioning information or commit message annotations in the workflow to document updates to third-party actions
Maintaining clear versioning or comments about the action upgrade helps future maintainers understand why the upgrade was made and which vulnerabilities or features are addressed. This aligns with best practices around change management and auditability. (Source: OWASP ASVS 14.1.5 - "Use version control for all code and configuration files"). Add a comment above the 'uses: step-security/harden-runner@aebdcf6' line indicating the action version, the reason for upgrade, or relevant release notes. - [Low]Define the egress-policy parameter explicitly and ensure that 'audit' mode aligns with organizational security policies
Egress policies control outbound network connections for the runner. Using 'audit' mode means the runner logs egress but does not block it. Confirming this matches the security posture prevents misconfigurations that could allow unintended data leakage. (Source: CIS Controls v8 - Control 14.4 Authorized use of Administrative Privileges). Review organizational policies related to network egress and confirm 'audit' is appropriate; if stricter controls are needed, consider enforcing a block or limit policy instead.
.github/workflows/int.yml
- [High]Pin Action Versions to Commit SHA
GitHub Actions workflows should pin action versions to immutable commit SHAs instead of tags or branches to avoid unexpected behavior or malicious code injections. This is recommended by GitHub security best practices: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions. Continue using the full commit SHA for the action reference as done in the patch. Avoid using tags like '@v2' which can be updated to point to different commits. - [Medium]Use Explicit Version Tags with SHAs for Clarity
Using both the version tag and commit SHA together provides clarity and traceability in workflow files. This approach aligns with guidelines on maintaining clear versioning: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-an-action. Maintain the comment indicating the version corresponding to the commit SHA to give context to maintainers, e.g.,# v2.23.0next to the pinned SHA. - [Low]Consider Using a Workflow Lockfile to Track Action Versions
Lockfiles help lock all action dependencies, preventing accidental updates and improving reproducibility, as suggested in security best practices: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#use-a-github-actions-lock-file. Create and maintain aworkflow-lock.ymlfile and update it using tools or GitHub's dependency review features to lock action versions explicitly.
.github/workflows/release.yml
-
[Medium]Pin GitHub Action dependencies to specific commit SHAs, not tags or floating references
Using a floating tag like 'v2.8.0' instead of a specific commit SHA can lead to non-deterministic builds if the tag is moved or updated. Pinning to a commit hash ensures reproducible and secure workflows as described in GitHub's official documentation on pinning actions: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions. Ensure you always pin GitHub Actions to a specific commit SHA instead of tags or branches. In this patch, you correctly moved from a tag to a commit SHA, which is the recommended best practice. -
[Low]Explicitly specify semantic versioning for the used GitHub Action in addition to the commit SHA for better clarity
While pinning to a commit SHA is most secure, including the semantic version in comments or as part of the usage string helps maintain readability and clarity about which version is used. This practice is recommended in community best practices for action versioning. Add a comment to explicitly mention the semantic version alongside the SHA as shown: -
uses: step-security/harden-runner@aebdcf6 # v2.23.0
.github/workflows/code-review.yml
- [High]Pin to an explicit version tag instead of a commit SHA for better traceability and reproducibility
Using a commit SHA directly for the GitHub Action version can make it harder to track which version is in use and could lead to accidental upgrades if the action is repointed. According to the GitHub Actions best practices, it is recommended to use a semantic version or explicit release tag to improve maintainability and security auditing (GitHub Docs: https://docs.github.com/en/actions/using-workflows/reusing-workflows#best-practices-for-reusing-workflows). Change the 'uses' field from the commit SHA to an explicit version tag such as 'step-security/harden-runner@v2.23.0' to maintain clarity on the version and facilitate easier upgrades and audits. - [Medium]Add explicit versions for all dependent actions to prevent unintended changes
While the patch updates the harden-runner action version, make sure that all GitHub actions used in the workflow specify explicit versions to avoid silent upgrades. This aligns with the principle of immutable dependencies for security and stability (OWASP Dependency Management: https://owasp.org/www-project-dependency-check/). Review the entire workflow's actions usage and replace any floating tags like 'latest' or commit SHAs without version tags to explicit releases or fixed commit SHAs. - [Medium]Document the reason for the specific settings passed to the hardened runner action
Explicitly documenting disabling sudo and blocking egress gives maintainers better context about security policies in place. Clear documentation reduces errors due to misunderstandings (SEI CERT: https://wiki.sei.cmu.edu/confluence/display/c/Code+Security+Best+Practices). Add comments above or alongside the action to explain why 'disable-sudo' is set to true and 'egress-policy' is set to block, describing the security objective behind these configurations. - [Low]Add a hash or checksum verification if the action supports it to avoid tampering
Ensuring action integrity by verifying a cryptographic hash prevents supply-chain attacks as recommended by GitHub security best practices (GitHub Blog: https://github.blog/2021-03-09-improving-github-actions-security-with-verification/). If supported, include a verified digest or checksum for 'step-security/harden-runner@v2.23.0' or the commit SHA to guarantee that the action used is exactly what is expected.
Feedback
We appreciate your feedback in helping us improve the service! To provide feedback, please use emojis on this comment. If you find the comments helpful, give them a 👍. If they aren't useful, kindly express that with a 👎. If you have questions or detailed feedback, please create n GitHub issue in StepSecurity/AI-CodeWise.
Updates
step-security/harden-runnerto v2.23.0 in all workflows, pinned to commit SHAaebdcf6156ab6691adf63218240e476564a1ed4c.