Verified against GitHub Copilot Autofix · 2026-08-02
Treat a Copilot Autofix suggestion as a claim to verify, not a fix to accept
A verification pass for a GitHub code-scanning alert with an Autofix suggestion attached, structured to confirm the fix closes the actual exploit path rather than just the pattern the scanner matched on, before the one-click accept happens.
The prompt
Ready to copy — highlighted parts are example details you can swap.
GitHub code scanning flagged SQL injection: user-provided value flows into a database query without sanitization (rule js/sql-injection) in this code, and Copilot Autofix already proposed a fix. Do not tell me to accept it yet — verify it first, against the actual exploit, not against whether it makes the alert go away. AUTOFIX SUGGESTION Wraps the raw value in the database driver's escape() helper before interpolating it into the query string. AFFECTED CODE The searchUsers(query) function in lib/db/users.ts, pasted below, which builds a raw SQL string from the query parameter. OTHER PLACES THE SAME PATTERN MIGHT APPEAR buildOrderClause() in the same file interpolates a sort-column parameter into a query string using a similar pattern. ANSWER IN THIS ORDER 1. State the exact exploit this alert is warning about as a concrete input or request an attacker could actually send — not a restatement of the alert's category name. If you cannot construct a concrete example, say so rather than describing the risk only in the abstract. 2. Trace whether the Autofix suggestion above genuinely closes that specific exploit path, or only makes the code shape the scanner's rule matches on disappear — these are not the same thing, and a fix that does the second without the first will pass the scanner while leaving the real vulnerability open under a slightly different trigger. 3. Check buildOrderClause() in the same file interpolates a sort-column parameter into a query string using a similar pattern., plus anywhere else in this file or nearby files you can find with the same vulnerable pattern, for whether this specific alert covers all of them or only the one location it happened to flag — a vulnerable pattern copy-pasted to a second call site is common, and static analysis does not reliably catch every instance of an indirect or slightly reshaped occurrence. 4. State what a test proving this fix actually closes the exploit would need to assert — that the malicious input from step 1 is specifically rejected or safely handled, not merely that the code still compiles and the existing tests still pass, since neither of those was ever evidence about this particular vulnerability. ONLY RECOMMEND ACCEPTING AUTOFIX IF Your answer to step 2 is an unambiguous yes. If it is a partial yes — the fix closes the exploit for the input you constructed in step 1 but you can construct a second, differently-shaped input that still gets through — say that explicitly and treat it as a no, not as a fix that mostly works. IF THE SAME PATTERN APPEARS ELSEWHERE AND IS NOT COVERED BY THIS ALERT Say so as its own explicit finding, separate from the verification of this specific alert's fix — a second unflagged instance is not resolved by fixing the one the scanner happened to catch, and burying that finding inside the verification of an unrelated alert makes it easy to miss when someone is scanning for whether this specific alert is now resolved.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
Copilot Autofix generates a suggested code change directly attached to a code-scanning alert, with a one-click accept path that is deliberately fast — which is also exactly its risk, because a fast accept can silence the specific code pattern a CodeQL query matched on without closing the actual exploit, particularly for alert types where several differently-shaped pieces of code can all trigger the same finding while only some of the possible fixes address every one of those shapes. Requiring the exploit to be stated as a concrete, constructible input rather than the alert's category name forces a check against the real attack surface instead of the label GitHub attached to it — SQL injection is a category; a query parameter containing a closing quote and a boolean OR clause is a specific thing you can actually test the fix against. Asking directly whether the fix closes that path or only removes the pattern the scanner keys on targets Autofix's most consequential known failure mode, pattern-level rather than vulnerability-level remediation — an escaping call added at the exact point the scanner's rule fires can satisfy that rule completely while leaving a second, differently structured injection point in the same function untouched, because the scanner's rule was never actually checking for the vulnerability itself, only for the textual pattern it has learned to associate with it. The instruction to search nearby code for the same unflagged pattern exists because vulnerable code is rarely written exactly once — a query-building helper copied to a second call site, or reimplemented slightly differently for a related feature, carries the same risk that static analysis does not always catch consistently across every occurrence, especially once the pattern has been reshaped even slightly from the original the scanner's rule was tuned against. Gating acceptance on an unambiguous yes, and explicitly downgrading a partial yes to a no, matters because a fix that closes the exploit for one constructed input but not a second, differently shaped one is not a partially working fix in any useful sense — it is a fix an attacker who tries the second input will walk straight through, and treating that as mostly done is the exact overconfidence a verification pass exists to prevent.
What you get back
1. Exploit: a search parameter containing a closing quote followed by an OR 1=1 clause would return every user row instead of a filtered match. 2. The Autofix escape() call does close this path — confirmed by tracing that the escaped value can no longer terminate the quoted string. 3. buildOrderClause() in the same file interpolates a sort-column parameter with no escaping at all — same risk class, not flagged by this alert. 4. A test should assert that a search containing that payload returns zero rows or an error, never the full table.
Verified against
GitHub Copilot Autofix GA, 2026 (CodeQL-integrated) · 2026-08-02
Changelog
- 2026-08-02 — Initial publish, verified against GitHub Copilot Autofix GA.
Need this built into your business?
If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.
EXPLORE CUSTOM SOFTWARE
