Repository navigation
[code-scanning-fix] Fix js/http-to-file-access: use correct CodeQL suppression syntax - #56500
Conversation
The lgtm[rule-id] suppression comment syntax is from the deprecated LGTM.com service and is not recognized by GitHub's native CodeQL alert-suppression mechanism, which uses codeql[rule-id]. This left the js/http-to-file-access alert open despite the file already performing full validation (content-type, size limit, PDF signature check) of the downloaded bytes before writing them to disk. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories.
|
|
Lean already. Ship. Warning Firewall blocked 4 domainsThe following domains were blocked by the firewall during workflow execution:
[!TIP] tools:
github:
mode: gh-proxySee GitHub Tools for more information on To allow these domains, add them to the network:
allowed:
- defaults
- "ab.chatgpt.com"
- "api.github.com"
- "chatgpt.com"
- "github.com"See Network Configuration for more information.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. Test Quality Sentinel skipped.
|
Comment MemoryNote This comment is managed by comment memory.It stores persistent context for this thread in the code block at the top of this comment.
|
There was a problem hiding this comment.
Verdict
No actionable issues in the changed lines. This PR only swaps the suppression marker from lgtm[...] to codeql[...] and preserves the existing safety rationale around the write.
Review notes
- The diff is comment-only; runtime behavior and validation logic are unchanged.
- I did not find any changed-line correctness, performance, or maintainability regressions worth blocking.
- The background sub-agent did not produce usable findings, so this review is based on direct analysis of the diff.
🔎 Code quality review by PR Code Quality Reviewer · pi · gpt54 · 3.18 AIC · ⌖ 8.58 AIC · ⊞ 7K
Comment /review to run again
There was a problem hiding this comment.
Correct fix — replaces the deprecated lgtm[...] suppression syntax with the current codeql[...] form. The rationale is thorough and the change is minimal/surgical.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet46 · 13.7 AIC · ⌖ 10.5 AIC · ⊞ 6.2K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /diagnosing-bugs — one blocking issue found.
📋 Key Themes & Highlights
Key Themes
- Suppression placement risk: The
// codeql[js/http-to-file-access]token was moved to its own line block several lines abovewriteFileSync. CodeQL requires the annotation on the same line as the flagged statement (inline trailing comment). As written, the alert may not be suppressed, defeating the PR's stated purpose.
Positive Highlights
- ✅ Correct migration from deprecated
// lgtm[...]to// codeql[...]syntax - ✅ Thorough justification comment explaining why the write is safe
- ✅ No functional/runtime changes — comment-only, low risk
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet46 · 21.7 AIC · ⌖ 10.5 AIC · ⊞ 7.7K
Comment /matt to run again
| // after checking the response content-type, enforcing a size limit, and | ||
| // verifying the PDF file signature — or a locally generated placeholder PDF. | ||
| // Neither path writes arbitrary/unvalidated network data to disk. | ||
| fs.writeFileSync(OUTPUT_PATH, pdfBytes); |
There was a problem hiding this comment.
[/diagnosing-bugs] The // codeql[js/http-to-file-access] annotation is now placed 5 lines above the flagged writeFileSync statement. GitHub CodeQL suppression requires the annotation to appear on the same line as the flagged statement (or, for some configurations, the immediately preceding line). With several intervening comment lines, the scanner may not associate the token with the write call, leaving alert #654 still open — the exact problem this PR aims to fix.
💡 Suggested fix — annotation inline with the statement
// readPdfBytes() only ever returns bytes from a fixed, hardcoded GitHub media
// URL (constructed from validated repo/ref values) after checking the response
// content-type, enforcing a size limit, and verifying the PDF file signature —
// or a locally generated placeholder PDF. Neither path writes arbitrary/unvalidated
// network data to disk.
fs.writeFileSync(OUTPUT_PATH, pdfBytes); // codeql[js/http-to-file-access]This keeps the full justification comment while placing the suppression token exactly where CodeQL expects it — on the same line as the flagged statement, matching the GitHub CodeQL suppression docs.
@copilot please address this.
There was a problem hiding this comment.
Pull request overview
Updates a JavaScript CodeQL suppression annotation for the validated PDF write path.
Changes:
- Replaces the legacy
lgtmannotation withcodeql. - Consolidates the safety justification.
Show a summary per file
| File | Description |
|---|---|
scripts/ensure-docs-slide-pdf.js |
Updates the suppression annotation and justification. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
| // codeql[js/http-to-file-access]: readPdfBytes() only ever returns bytes from a | ||
| // fixed, hardcoded GitHub media URL (constructed from validated repo/ref values) | ||
| // after checking the response content-type, enforcing a size limit, and | ||
| // verifying the PDF file signature — or a locally generated placeholder PDF. | ||
| // Neither path writes arbitrary/unvalidated network data to disk. | ||
| fs.writeFileSync(OUTPUT_PATH, pdfBytes); |
|
🎉 This pull request is included in a new release. Release: |
test