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 -euo pipefail

echo "== files =="
git ls-files | rg '(^|/)\.github/workflows/deploy-pages\.yml$|\.github/workflows/' || true

echo "== deploy-pages.yml =="
if [ -f .github/workflows/deploy-pages.yml ]; then
  cat -n .github/workflows/deploy-pages.yml
else
  echo "not found"
fi

echo "== search reusable workflow uses refs =="
rg -n "uses:\s*[^#]+\.github/workflows/[^@]+@[^ ]+" .github/workflows || true

echo "== try resolve upstream ref =="
ref="react-component/rc-test:.github/workflows/deploy-pages.yml@main"
json="$(gh api "repos/react-component/rc-test/contents/.github/workflows/deploy-pages.yml?ref=main" --jq '{ref,sha,download_url}' 2>/dev/null || true)"
echo "$json" || true

Repository: react-component/menu

Length of output: 1191


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect repository configuration for branch protection / pinning policies if present.
for f in .github/dependabot.yml .github/pinned-actions.txt .github/workflows/.gitignore 2>/dev/null; do
  [ -f "$f" ] && { echo "== $f =="; cat -n "$f"; }
done

# List workflow files and whether they use refs other than commit SHAs in reusable workflow calls.
python3 - <<'PY'
from pathlib import Path
import re
for p in sorted(Path('.github/workflows').glob('*.yml')) + sorted(Path('.github/workflows').glob('*.yaml')):
    text = p.read_text(errors='replace')
    for m in re.finditer(r'uses:\s*(.+)@(.+)(?:\s*(#.*)?)?', text):
        workflow, ref, comment = m.groups()
        print(f"{p}: uses={workflow} ref={ref} comment={comment}")
PY

Repository: react-component/menu

Length of output: 211


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

当前 @main 会随上游分支变化;该工作流拥有 pages: writeid-token: write 权限,若上游代码被意外或恶意修改,发布流程会直接执行新代码。将其固定到完整 40 位 commit SHA 可保证调用版本不可变。

建议修改
-    uses: react-component/rc-test/.github/workflows/deploy-pages.yml@main
+    uses: react-component/rc-test/.github/workflows/deploy-pages.yml@<完整的40位commit SHA>
🤖 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.yml
中引用的外部可复用工作流从可变的 `@main` 更新为对应版本的完整 40 位 commit SHA,确保调用的工作流版本不可变;仅修改 uses
引用,保留现有工作流路径和权限配置不变。

Source: MCP tools

Loading