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.
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: react-component/util
Length of output: 218
🌐 Web query:
GitHub Actions reusable workflows workflow_file use commit full SHA security mutable refs security hardening💡 Result:
To securely reference GitHub Actions reusable workflows, you must use a full-length commit SHA [1][2][3]. When calling a reusable workflow with the syntax {owner}/{repo}/.github/workflows/{filename}@{ref}, the {ref} component is mutable if it is a branch name or a tag [2][4]. A mutable reference allows the owner of the workflow repository to modify the code, which immediately impacts every downstream caller [2]. Using a full-length commit SHA (e.g.,
@a1b2c3d...) makes the reference immutable, ensuring that callers always execute the exact same version of the workflow [1][2]. Security Hardening Recommendations: 1. Pin Everything: Use full-length commit SHAs for all reusable workflows and actions [2][5][3]. This mitigates the risk of supply chain attacks where a tag or branch is overwritten with malicious code [2][5]. 2. Maintain Readability: While the pin must be a SHA, you can (and should) include the human-readable version tag as a comment in the same line for easier tracking (e.g., uses: owner/repo/.github/workflows/file.yml@a1b2c3d... # v1.2.3) [2][6]. 3. Automate Maintenance: Use dependency management tools like Dependabot or Renovate to automatically update these SHA pins as new versions are released [2]. 4. Enable Enterprise/Organization Policies: If your organization uses GitHub Enterprise or GitHub Team, enable the "Require actions to be pinned to a full-length commit SHA" policy [4][5][3]. Note that while this policy is essential, it may not recursively validate every nested reference in a complex reusable workflow chain, so manual audits or custom "pin-check" workflows are recommended to ensure comprehensive coverage [4][6][7]. 5. Audit Transitive Dependencies: Because reusable workflows inherit the caller's secrets and execution context, a compromise in the reusable workflow—or any action it calls—effectively compromises the caller's environment [2][4]. Ensure the reusable workflow itself also pins all its internal actions to full SHAs [2]. If you omit the @{ref} and reference a file within the same repository (e.g.,./.github/workflows/{filename}), GitHub automatically uses the workflow file from the same commit as the caller, which provides an immutable, secure binding by default [1].Citations:
🏁 Script executed:
Repository: react-component/util
Length of output: 1161
将复用工作流固定到完整 commit SHA。
这里通过
@main复用第三方工作流,而它配置了pages: write和id-token: write,上游分支的后续变更会直接影响发布流程。应改为经过审阅的完整 commit SHA,例如@<reviewed-full-commit-sha> # vX.Y.Z。🤖 Prompt for AI Agents