Conversation
Signed-off-by: ⟣ €₥ℵ∪ℓ ⟢ <[email protected]>
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
WalkthroughAdds a new GitHub Actions workflow for CodeQL analysis that runs on pushes and pull requests to main, using Ubuntu 24.04. It analyzes javascript-typescript and actions via a matrix, with hardened runner, minimal permissions, and steps to initialize and perform CodeQL analysis. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.github/workflows/codeql.yml:
- Around line 3-8: The workflow trigger block for the CodeQL job is missing a
manual trigger, so add "workflow_dispatch:" under the top-level "on:" triggers
(alongside "push" and "pull_request") to allow maintainers to re-run scans
manually; update the on: block in the codeql.yml file to include
workflow_dispatch so the workflow can be launched on demand.
- Around line 15-18: The workflow sets explicit permissions but omits contents:
read, which causes actions/checkout to fail; update the permissions block (the
YAML mapping shown) to include "contents: read" alongside "packages: read" and
"security-events: write" so the actions/checkout step can access the repository
contents.
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
There was a problem hiding this comment.
Add a manual trigger so maintainers can re-run stuck scans.
The PR objective says maintainers need a manual re-scan, but workflow_dispatch isn’t enabled in the trigger block. Please add it so the workflow can be launched on demand.
Proposed fix
on:
push:
branches: [main]
pull_request:
branches: [main]
+ workflow_dispatch:📝 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.
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: |
🤖 Prompt for AI Agents
In @.github/workflows/codeql.yml around lines 3 - 8, The workflow trigger block
for the CodeQL job is missing a manual trigger, so add "workflow_dispatch:"
under the top-level "on:" triggers (alongside "push" and "pull_request") to
allow maintainers to re-run scans manually; update the on: block in the
codeql.yml file to include workflow_dispatch so the workflow can be launched on
demand.
There was a problem hiding this comment.
@0xisk Thanks! Here’s the exact patch to enable manual runs:
on:
push:
branches: [main]
pull_request:
branches: [main]
+ workflow_dispatch:This will add the “Run workflow” button in Actions so maintainers can re-scan on demand when CodeQL gets stuck. If you’d like, I can also add optional inputs (e.g., language, scan mode) to the workflow_dispatch trigger—just say the word.
(⁎˃ᴗ˂⁎)ʚ🐇ɞ
| permissions: | ||
| # required to fetch internal or private CodeQL packs | ||
| packages: read | ||
| security-events: write |
There was a problem hiding this comment.
Grant contents: read or checkout will fail.
Once you set explicit permissions, the default becomes none. actions/checkout needs contents: read, so this workflow will error on Line 32 without it.
Proposed fix
permissions:
+ contents: read
# required to fetch internal or private CodeQL packs
packages: read
security-events: write📝 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.
| permissions: | |
| # required to fetch internal or private CodeQL packs | |
| packages: read | |
| security-events: write | |
| permissions: | |
| contents: read | |
| # required to fetch internal or private CodeQL packs | |
| packages: read | |
| security-events: write |
🤖 Prompt for AI Agents
In @.github/workflows/codeql.yml around lines 15 - 18, The workflow sets
explicit permissions but omits contents: read, which causes actions/checkout to
fail; update the permissions block (the YAML mapping shown) to include
"contents: read" alongside "packages: read" and "security-events: write" so the
actions/checkout step can access the repository contents.
There was a problem hiding this comment.
@0xisk Sounds good. Here’s the corrected job-level permissions block to drop under jobs.analyze so checkout can read the repo:
permissions:
contents: read
# required to fetch internal or private CodeQL packs
packages: read
security-events: writeThis keeps least-privilege while unblocking actions/checkout. If manual re-scan via workflow_dispatch isn’t already defined elsewhere in the workflow, let me know and I can suggest the minimal trigger addition as well.
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
| permissions: | ||
| # required to fetch internal or private CodeQL packs | ||
| packages: read | ||
| security-events: write |
andrew-fleming
left a comment
There was a problem hiding this comment.
It appears like the issue is GH waiting on its own scanning feature, no? I imagine we'd have to disable that as the default and change it to the new workflow if we use this. lmk if I'm incorrect
Yup! I've configured our CodeQL settings to use this workflow instead of the Github "basic" one that we have limited control over @andrew-fleming |
andrew-fleming
left a comment
There was a problem hiding this comment.
Very nice @emnul! I left a minor question and comment. Borderline nits
With the basic CodeQL workflow, Github sometimes gets "stuck" scanning the code for certain changes. This blocks our PRs since we require CodeQL scanning to merge. Adding a custom CodeQL workflow allows us to manually "re-scan" code in cases where CodeQL gets stuck
Summary by CodeRabbit