-
Notifications
You must be signed in to change notification settings - Fork 1
fix: audit workflow permissions across Actions files #328
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
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 |
|---|---|---|
|
|
@@ -2,6 +2,10 @@ name: JS CI | |
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
Comment on lines
+5
to
+8
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 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git ls-files .github/workflows/ci-js.yml
echo '---'
cat -n .github/workflows/ci-js.yml | sed -n '1,80p'Repository: welshDog/HyperCode-V2.4 Length of output: 3472 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Check GitHub Actions schema docs in the workflow file context if needed
rg -n "permissions|workflow_call|inputs|secrets|outputs" .github/workflows/ci-js.ymlRepository: welshDog/HyperCode-V2.4 Length of output: 1560 🏁 Script executed: #!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
p=Path('.github/workflows/ci-js.yml')
print(p.exists())
if p.exists():
txt=p.read_text()
print(txt)
PYRepository: welshDog/HyperCode-V2.4 Length of output: 4089 🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n .github/workflows/ci-js.yml | sed -n '1,80p'Repository: welshDog/HyperCode-V2.4 Length of output: 3440 Move 🤖 Prompt for AI Agents |
||
| inputs: | ||
| node_version: | ||
| description: Node version | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| name: CI — Python | ||
| permissions: | ||
| contents: readname: CI — Python | ||
|
Comment on lines
+1
to
+2
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 | 🔴 Critical | ⚡ Quick win Restore a valid workflow header and remove the duplicate permissions block.
- contents: readname: CI — Python
+ contents: read
+name: CI — Python
...
-permissions:
- contents: readAlso applies to: 17-18 🤖 Prompt for AI Agents |
||
|
|
||
| on: | ||
| push: | ||
|
|
@@ -13,6 +14,9 @@ on: | |
| - 'backend/**' | ||
| - 'requirements*.txt' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ci-python-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| name: \uD83D\uDD12 Security Scan | ||
|
|
||
| permissions read | ||
| on: | ||
| read | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Docker Build & Test | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Docker Push to Registry | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Docker Build & Verify | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
|
Comment on lines
+5
to
+6
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 | 🔴 Critical | ⚡ Quick win Remove invalid The
📍 Affects 8 files
🤖 Prompt for AI Agents |
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Docs Check | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| pull_request: | ||
| paths: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Docs Lint | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| pull_request: | ||
| paths: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: 💚 HyperCode Health Check | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
|
Comment on lines
+5
to
+6
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 | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
for f in .github/workflows/health-check.yml .github/workflows/trivy-weekly.yml; do
echo "== $f =="
nl -ba "$f" | sed -n '1,80p'
echo
doneRepository: welshDog/HyperCode-V2.4 Length of output: 242 🏁 Script executed: #!/bin/bash
set -euo pipefail
for f in .github/workflows/health-check.yml .github/workflows/trivy-weekly.yml; do
echo "== $f =="
cat -n "$f" | sed -n '1,120p'
echo
doneRepository: welshDog/HyperCode-V2.4 Length of output: 8806 🌐 Web query:
💡 Result: In GitHub Actions, the presence of duplicate top-level keys or duplicate keys within any mapping in a workflow YAML file is treated as a critical syntax error [1][2]. Unlike some standard YAML parsers—which may silently accept duplicates by either using the first occurrence or overwriting it with the last—GitHub Actions uses a strict parser that will reject the file entirely [1][2]. If your workflow contains duplicate keys, it will fail to load, and no jobs will be triggered [1][2]. You will typically encounter an error message indicating that a specific key is already defined [2]. Key aspects of this behavior include: 1. Case-insensitivity: For certain keys in GitHub Actions, the parser treats keys as case-insensitive [3][4]. Consequently, you cannot have duplicate keys even if the capitalization differs (e.g., matrix and MATRIX are treated as the same key) [3][4]. 2. Strict Parsing: Because GitHub Actions employs a strict parser, you cannot rely on local linting tools that use permissive YAML parsers (like standard Python PyYAML) to validate your workflow, as those tools might not flag the duplicates that GitHub will [2]. 3. Prevention: To avoid this issue, it is recommended to use specialized linting tools such as actionlint, which are specifically designed to catch GitHub Actions-compliant syntax errors, including duplicate keys, before you commit or push your code [3][4]. Alternatively, configuring a generic YAML linter like yamllint with the key-duplicates rule enabled is an effective way to detect these errors in your CI pipeline [5]. Citations:
Fix the workflow keys
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Health Checks | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Hyper Agents CI | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
|
Comment on lines
+3
to
+6
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 | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
files=(
.github/workflows/hyper-agents-ci.yml
.github/workflows/hyper-agents-gate2-e2e.yml
.github/workflows/iac-scan.yml
.github/workflows/lean-review.yml
.github/workflows/no-legacy-paths.yml
.github/workflows/playwright-dashboard.yml
.github/workflows/promote-dashboards.yml
.github/workflows/prune_audit.yml
)
for file in "${files[@]}"; do
test "$(grep -cE '^on:$' "$file")" -eq 1
! grep -qE '^ read$' "$file"
doneRepository: welshDog/HyperCode-V2.4 Length of output: 161 🏁 Script executed: #!/bin/bash
set -euo pipefail
files=(
.github/workflows/hyper-agents-ci.yml
.github/workflows/hyper-agents-gate2-e2e.yml
.github/workflows/iac-scan.yml
.github/workflows/lean-review.yml
.github/workflows/no-legacy-paths.yml
.github/workflows/playwright-dashboard.yml
.github/workflows/promote-dashboards.yml
.github/workflows/prune_audit.yml
)
for file in "${files[@]}"; do
echo "===== $file ====="
sed -n '1,30p' "$file" | cat -n
echo
doneRepository: welshDog/HyperCode-V2.4 Length of output: 7017 Remove the stray 📍 Affects 8 files
🤖 Prompt for AI Agents |
||
| on: | ||
| push: | ||
| branches: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Hyper Agents Gate 2 — E2E & Full Stack | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| pull_request: | ||
| branches: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: IaC & Dockerfile Scan | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| branches: [main, master] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| name: Lean Duplicate Review | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| paths: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,9 @@ | ||
| name: No Legacy Paths Guard | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| branches: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
|
|
||
| name: Performance Testing | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
|
Comment on lines
+6
to
+7
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 | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
files=(
.github/workflows/performance.yml
.github/workflows/sse-tests.yml
.github/workflows/ci-security.yml
.github/workflows/docker-build.yml
.github/workflows/docker-push.yml
.github/workflows/swarm-pipeline.yml
.github/workflows/tests.yml
.github/workflows/trivy-scan.yml
)
for f in "${files[@]}"; do
echo "===== $f ====="
nl -ba "$f" | sed -n '1,40p'
echo
doneRepository: welshDog/HyperCode-V2.4 Length of output: 248 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n '^\s*on:\s*$|^\s*read\s*$' .github/workflows/*.ymlRepository: welshDog/HyperCode-V2.4 Length of output: 3878 Remove the stray
📍 Affects 8 files
🤖 Prompt for AI Agents |
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Playwright Dashboard E2E | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Promote dashboards to Grafana Cloud | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Prune Celery Task Audit | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| schedule: | ||
| - cron: '0 3 * * *' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Fast SSE Tests | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| paths: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Swarm Pipeline | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Tests & Quality | ||
|
|
||
| permissions: | ||
| contents: read | ||
| on: | ||
| read | ||
| on: | ||
| workflow_call: | ||
| schedule: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Trivy Security Scan | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
Comment on lines
+3
to
+4
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 | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: sed -n '1,220p' .github/workflows/trivy-scan.yml
printf '\n---\n'
rg -n "upload-sarif|security-events|permissions:" .github/workflows -SRepository: welshDog/HyperCode-V2.4 Length of output: 4656 🌐 Web query:
💡 Result: To use the GitHub CodeQL Citations:
Add 🤖 Prompt for AI Agents |
||
| on: | ||
| read | ||
| on: | ||
| push: | ||
| branches: [main] # ← main only | ||
|
|
||
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 | 🔴 Critical | ⚡ Quick win
Remove invalid GitHub Actions syntax from the Dependabot configuration.
GitHub Actions workflow syntax (such as
permissions,on,concurrency, andjobs) has been mistakenly added to this file. The.github/dependabot.ymlfile uses a strict schema that does not support these keys, and their presence will cause parsing to fail, breaking Dependabot updates entirely. Furthermore, there are duplicate and malformedon:keys.Please remove these lines completely, as they are only valid inside workflow files (e.g.
.github/workflows/*.yml).🐛 Proposed fix to remove the invalid configuration
📝 Committable suggestion
🤖 Prompt for AI Agents