Conversation
📝 WalkthroughWalkthroughThe GitHub workflows were refactored to replace implicit change-detection with explicit boolean inputs ( Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2999 +/- ##
=======================================
Coverage 59.39% 59.39%
=======================================
Files 1031 1031
Lines 24130 24130
Branches 5988 5988
=======================================
Hits 14332 14332
+ Misses 8543 8538 -5
- Partials 1255 1260 +5
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/reusable-validate-app-unsafe.yml (1)
62-78: Consider adding explicit permissions block.The static analysis tool flagged that this workflow lacks a
permissionsblock. While the parent workflow (all-ci-unsafe.yml) has permissions defined, adding explicit minimal permissions here provides defense in depth.🔒 Proposed addition at workflow level (after line 39)
permissions: contents: read🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/reusable-validate-app-unsafe.yml around lines 62 - 78, Add an explicit minimal permissions block to this reusable workflow so the apps-deps-scan job runs with least privilege; update the workflow top-level to include "permissions: contents: read" (affecting the jobs such as apps-deps-scan that perform actions/checkout and the Snyk step) to provide defense-in-depth even though the parent workflow defines permissions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/all-ci-unsafe.yml:
- Around line 161-172: The bug is that the template string uses the loop
variable `output` which is out of scope (it was declared by destructuring inside
the for...of loop), so replace the out-of-scope reference by using a
properly-scoped name (capture the loop's output value into a variable in the
outer scope or move this github.paginate + core.setOutput block inside the same
for...of loop where `output` is defined). Specifically, ensure the code that
calls github.paginate(github.rest.pulls.listFiles, ...) and the subsequent
core.setOutput(`should_run_${output}`, ...) /
core.setOutput(`skip_reason_${output}`, ...) either runs inside the loop that
defines `output` or use a new variable (e.g., const outputName = output)
declared in the same scope before using it so `output` is defined when setting
outputs.
In @.github/workflows/reusable-validate-app-unsafe.yml:
- Around line 62-63: The conditional on the apps-deps-scan job is comparing the
boolean input run_deps_scan to the string 'true', which makes the job never run;
update the job condition to evaluate the boolean correctly (e.g., use ${{
inputs.run_deps_scan }} or ${{ inputs.run_deps_scan == true }}) so the
apps-deps-scan job triggers when run_deps_scan is true.
- Around line 42-43: The job conditional uses a string comparison so it never
runs; change the `if` expression on the `static-analyses` job from `if: ${{
inputs.run_static_analyses == 'true' }}` to a boolean check such as `if: ${{
inputs.run_static_analyses }}` (or `== true`) so the boolean
`run_static_analyses` input correctly controls execution.
---
Nitpick comments:
In @.github/workflows/reusable-validate-app-unsafe.yml:
- Around line 62-78: Add an explicit minimal permissions block to this reusable
workflow so the apps-deps-scan job runs with least privilege; update the
workflow top-level to include "permissions: contents: read" (affecting the jobs
such as apps-deps-scan that perform actions/checkout and the Snyk step) to
provide defense-in-depth even though the parent workflow defines permissions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4f85a967-2b0b-48fd-8f44-84bc9bc8cd13
📒 Files selected for processing (2)
.github/workflows/all-ci-unsafe.yml.github/workflows/reusable-validate-app-unsafe.yml
| if (core.getOutput('should_run_deps_scan') === 'true') { | ||
| const files = await github.paginate(github.rest.pulls.listFiles, { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: Number(prNumber), | ||
| }); | ||
| const hasLockfileChange = files.some(f => f.filename === 'package-lock.json'); | ||
| if (!hasLockfileChange) { | ||
| core.setOutput(`should_run_${output}`, 'false'); | ||
| core.setOutput(`skip_reason_${output}`, 'package-lock.json not changed'); | ||
| } | ||
| } |
There was a problem hiding this comment.
Bug: output variable is out of scope.
The variable output was declared inside the for...of loop (via destructuring in line 148), but this code block is outside the loop. After the loop ends at line 159, output is no longer in scope, causing this to use undefined in the template string.
🐛 Proposed fix
if (core.getOutput('should_run_deps_scan') === 'true') {
const files = await github.paginate(github.rest.pulls.listFiles, {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: Number(prNumber),
});
const hasLockfileChange = files.some(f => f.filename === 'package-lock.json');
if (!hasLockfileChange) {
- core.setOutput(`should_run_${output}`, 'false');
- core.setOutput(`skip_reason_${output}`, 'package-lock.json not changed');
+ core.setOutput('should_run_deps_scan', 'false');
+ core.setOutput('skip_reason_deps_scan', 'package-lock.json not changed');
}
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (core.getOutput('should_run_deps_scan') === 'true') { | |
| const files = await github.paginate(github.rest.pulls.listFiles, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: Number(prNumber), | |
| }); | |
| const hasLockfileChange = files.some(f => f.filename === 'package-lock.json'); | |
| if (!hasLockfileChange) { | |
| core.setOutput(`should_run_${output}`, 'false'); | |
| core.setOutput(`skip_reason_${output}`, 'package-lock.json not changed'); | |
| } | |
| } | |
| if (core.getOutput('should_run_deps_scan') === 'true') { | |
| const files = await github.paginate(github.rest.pulls.listFiles, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: Number(prNumber), | |
| }); | |
| const hasLockfileChange = files.some(f => f.filename === 'package-lock.json'); | |
| if (!hasLockfileChange) { | |
| core.setOutput('should_run_deps_scan', 'false'); | |
| core.setOutput('skip_reason_deps_scan', 'package-lock.json not changed'); | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/all-ci-unsafe.yml around lines 161 - 172, The bug is that
the template string uses the loop variable `output` which is out of scope (it
was declared by destructuring inside the for...of loop), so replace the
out-of-scope reference by using a properly-scoped name (capture the loop's
output value into a variable in the outer scope or move this github.paginate +
core.setOutput block inside the same for...of loop where `output` is defined).
Specifically, ensure the code that calls
github.paginate(github.rest.pulls.listFiles, ...) and the subsequent
core.setOutput(`should_run_${output}`, ...) /
core.setOutput(`skip_reason_${output}`, ...) either runs inside the loop that
defines `output` or use a new variable (e.g., const outputName = output)
declared in the same scope before using it so `output` is defined when setting
outputs.
e5fac57 to
5fe3edf
Compare
| @@ -63,3 +59,20 @@ jobs: | |||
| with: | |||
| command: code | |||
| args: test ./untrusted-user-fork/${{ inputs.path }} --severity-threshold=medium | |||
| apps-deps-scan: | |||
| if: ${{ inputs.run_deps_scan }} | |||
| runs-on: ubuntu-latest | |||
| steps: | |||
| - name: Checkout UNTRUSTED user's fork | |||
| uses: actions/checkout@v6 | |||
| with: | |||
| ref: ${{ inputs.pr_head_ref || github.event.pull_request.head.ref }} | |||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
There was a problem hiding this comment.
♻️ Duplicate comments (1)
.github/workflows/all-ci-unsafe.yml (1)
161-172:⚠️ Potential issue | 🔴 CriticalBug:
outputvariable is out of scope - deps scan will never be disabled.The
outputvariable is declared via destructuring inside thefor...ofloop (line 148) and is block-scoped to that loop. On lines 169-170,outputis referenced outside the loop where it'sundefined, resulting in outputs likeshould_run_undefinedbeing set instead ofshould_run_deps_scan.🐛 Proposed fix
if (core.getOutput('should_run_deps_scan') === 'true') { const files = await github.paginate(github.rest.pulls.listFiles, { owner: context.repo.owner, repo: context.repo.repo, pull_number: Number(prNumber), }); const hasLockfileChange = files.some(f => f.filename === 'package-lock.json'); if (!hasLockfileChange) { - core.setOutput(`should_run_${output}`, 'false'); - core.setOutput(`skip_reason_${output}`, 'package-lock.json not changed'); + core.setOutput('should_run_deps_scan', 'false'); + core.setOutput('skip_reason_deps_scan', 'package-lock.json not changed'); } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/all-ci-unsafe.yml around lines 161 - 172, The code references the block-scoped variable `output` outside its `for...of` loop when calling core.setOutput(`should_run_${output}`, ...) which makes `output` undefined; fix by using the actual output name for the deps scan instead of the out-of-scope variable (e.g. replace core.setOutput(`should_run_${output}`, 'false') and core.setOutput(`skip_reason_${output}`, 'package-lock.json not changed') with core.setOutput('should_run_deps_scan', 'false') and core.setOutput('skip_reason_deps_scan', 'package-lock.json not changed') respectively, or alternatively declare `let output` in an outer scope so the same `output` variable is valid here; update the calls that use `should_run_${output}`/`skip_reason_${output}` accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In @.github/workflows/all-ci-unsafe.yml:
- Around line 161-172: The code references the block-scoped variable `output`
outside its `for...of` loop when calling core.setOutput(`should_run_${output}`,
...) which makes `output` undefined; fix by using the actual output name for the
deps scan instead of the out-of-scope variable (e.g. replace
core.setOutput(`should_run_${output}`, 'false') and
core.setOutput(`skip_reason_${output}`, 'package-lock.json not changed') with
core.setOutput('should_run_deps_scan', 'false') and
core.setOutput('skip_reason_deps_scan', 'package-lock.json not changed')
respectively, or alternatively declare `let output` in an outer scope so the
same `output` variable is valid here; update the calls that use
`should_run_${output}`/`skip_reason_${output}` accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e96d8a77-ce03-46a5-8ce9-0f736284473c
📒 Files selected for processing (2)
.github/workflows/all-ci-unsafe.yml.github/workflows/reusable-validate-app-unsafe.yml
Why
To decrease snyk limits usage
What
Summary by CodeRabbit
Note: Internal infrastructure updates with no direct impact on end-user functionality.