Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Deploy documentation

on:
release:
types: [published]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

jobs:
deploy:
uses: react-component/rc-test/.github/workflows/deploy-pages.yml@main

Copy link
Copy Markdown

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:

#!/bin/bash
set -eu

sha="$(git ls-remote https://github.com/react-component/rc-test.git refs/heads/main | awk '{print $1}')"
test "${`#sha`}" -eq 40

workflow="$(curl -fsSL \
  "https://raw.githubusercontent.com/react-component/rc-test/${sha}/.github/workflows/deploy-pages.yml")"

printf '%s\n' "$workflow" | grep -Eq '^[[:space:]]+workflow_call:'
echo "Verified workflow SHA: ${sha}"

Repository: react-component/progress

Length of output: 226


🏁 Script executed:

#!/bin/bash
set -eu

sha="1afe200f7e3a6ccbafbc6ed0142cb5762ae9ce02"
workflow_file=".github/workflows/deploy-pages.yml"

printf '%s\n' "--- workflow_call/in-permissions/inputs section ---"
python3 - <<'PY'
import pathlib, re
p = pathlib.Path('.github/workflows/deploy-pages.yml')
text = p.read_text()
for pat in [r'(?m)^[ \t]*workflow_call:[ \t]*[\s\S]*?(?=^\S|\Z)',
            r'(?m)^[ \t]*permissions:([\s\S]*?)(?=^    [^ ]|^\Z)',
            r'(?m)^[ \t]*on:([\s\S]*?)(?=^    [^ ]|^\Z)']:
    m = re.search(pat, text)
    print(m.group(0) if m else '--- pattern not found: ' + pat + ' ---')
PY

printf '%s\n' "--- current use directive ---"
rg -n 'uses: react-component/rc-test/.github/workflows/deploy-pages.yml' "$workflow_file" -C 3

printf '%s\n' "--- target workflow relevant sections ---"
curl -fsSL "https://raw.githubusercontent.com/react-component/rc-test/${sha}/.github/workflows/deploy-pages.yml" | sed -n '1,220p'

Repository: react-component/progress

Length of output: 2003


将外部可复用工作流固定到完整 commit SHA。

当前使用 @main,上游分支后续变更仍会直接获得本仓库的 pages: writeid-token: write 权限。已确认可复用工作流声明了 workflow_call 且无必需输入,可直接替换为完整 SHA(1afe200f7e3a6ccbafbc6ed0142cb5762ae9ce02),避免上游变更或供应链攻击影响 Pages 部署。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/deploy-pages.yml at line 15, 将 deploy-pages 可复用工作流的引用从不固定的
`@main` 更新为完整 commit SHA
1afe200f7e3a6ccbafbc6ed0142cb5762ae9ce02,保持现有工作流调用方式和权限配置不变。

Loading