-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: CI/CD hooks follow-up fixes #771
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
Changes from all commits
621df6b
073b031
6ca91af
1271a32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,21 +19,21 @@ validate_file() { | |||||||||
|
|
||||||||||
| # If staged files provided, only check those | ||||||||||
| if [ -n "$STAGED_FILES" ]; then | ||||||||||
| echo "$STAGED_FILES" | tr ' ' '\n' | while read -r file; do | ||||||||||
| while IFS=$'\n' read -r file; do | ||||||||||
| [ -z "$file" ] && continue | ||||||||||
| # Only check workflow files | ||||||||||
| [[ "$file" == *.yml || "$file" == *.yaml ]] || continue | ||||||||||
| [[ "$file" == *".github/workflows/"* ]] || continue | ||||||||||
| [ -f "$file" ] || continue | ||||||||||
| validate_file "$file" | ||||||||||
| done | ||||||||||
| done <<< "$STAGED_FILES" | ||||||||||
| else | ||||||||||
| for workflow in $(find "$SCAN_PATH" -path '*/.git/*' -prune -o \ | ||||||||||
| -path '*/.github/workflows/*.yml' -o -path '*/.github/workflows/*.yaml' \ | ||||||||||
| -print 2>/dev/null || true); do | ||||||||||
| while IFS= read -r workflow; do | ||||||||||
| [ -f "$workflow" ] || continue | ||||||||||
| validate_file "$workflow" | ||||||||||
| done | ||||||||||
| done < <(find "$SCAN_PATH" -path '*/.git/*' -prune -o \ | ||||||||||
| -path '*/.github/workflows/*.yml' -o -path '*/.github/workflows/*.yaml' \ | ||||||||||
| -print 2>/dev/null || true) | ||||||||||
|
Comment on lines
+35
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Group the workflow path predicates before
Proposed fix- -path '*/.github/workflows/*.yml' -o -path '*/.github/workflows/*.yaml' \
- -print 2>/dev/null || true)
+ \( -path '*/.github/workflows/*.yml' -o -path '*/.github/workflows/*.yaml' \) \
+ -print 2>/dev/null || true)📝 Committable suggestion
Suggested change
📍 Affects 2 files
🤖 Prompt for AI Agents |
||||||||||
| fi | ||||||||||
|
|
||||||||||
| [ $ERRORS -gt 0 ] && exit 1 | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,7 +29,7 @@ | |
| types: [refresh-githooks] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| contents: write # Required to push hook updates to target repos | ||
|
Check warning on line 32 in .github/workflows/propagate-hooks.yml
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
file=".github/workflows/propagate-hooks.yml"
sed -n '1,180p' "$file"
printf '\n--- permission and job references ---\n'
rg -n -C 3 'permissions:|contents:|^ [A-Za-z0-9_-]+:|actions/checkout|git push|signed-push' "$file"Repository: hyperpolymath/standards Length of output: 9074 🤖 get_repo_knowledge executed:
Length of output: 6797 🏁 Script executed: #!/bin/bash
set -eu
sed -n '180,330p' .github/workflows/propagate-hooks.ymlRepository: hyperpolymath/standards Length of output: 6228 Security Misconfiguration Reachability: External Scope
Proposed permission scope permissions:
- contents: write
+ contents: read
propagate:
+ permissions:
+ contents: write🧰 Tools🪛 GitHub Check: Scorecard[failure] 32-32: Token-Permissions 🪛 GitHub Check: SonarCloud Code Analysis[warning] 32-32: Move this write permission from workflow level to job level. 🪛 zizmor (1.29.0)[error] 32-32: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level (excessive-permissions) 🤖 Prompt for AI Agents |
||
| pull-requests: write | ||
| actions: read | ||
|
|
||
|
|
@@ -186,10 +186,10 @@ | |
|
|
||
| echo "📝 Copying hooks from $SOURCE to $DEST..." | ||
|
|
||
| # Copy all hook files | ||
| # Copy all hook files - safe because SOURCE is controlled | ||
| cp -v $SOURCE/* $DEST/ 2>&1 || true | ||
|
|
||
| # Ensure all hooks are executable | ||
| # Make all hooks executable - required for git hooks to function | ||
| chmod +x $DEST/* | ||
|
|
||
| # List what was copied | ||
|
|
||
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Derive files from all ref updates.
Line 32 validates only
HEAD~1..HEAD. A multi-commit push omits files from earlier commits. An initial branch push makesHEAD~1fail, and the cached fallback normally has no committed files. Read the pre-push ref tuples from standard input and diff each remote SHA against its local SHA.🤖 Prompt for AI Agents