一键导入
codeql-fix
Reads a CodeQL or static-analysis finding and produces a targeted fix.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Reads a CodeQL or static-analysis finding and produces a targeted fix.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Diagnoses openclaude provider configuration problems and proposes fixes.
Resolves merge and rebase conflicts by preserving both sides' intent.
Fixture where a curl-piped-to-bash sits inside a fenced block; scanner must still flag it.
Reviews database schema changes, migrations, and queries.
Implements frontend components following project conventions.
Diagnoses and fixes CI pipeline failures.
| name | codeql-fix |
| title | CodeQL Fix |
| description | Reads a CodeQL or static-analysis finding and produces a targeted fix. |
| category | security |
| tags | ["codeql","sast","security","static-analysis"] |
| trust | official |
| version | 0.1.0 |
| license | MIT |
| author | gnanam |
A static-analysis tool has flagged a specific data flow. Read the finding, verify the flow is real, and write the smallest change that closes it at the right layer. Generic "validate the input" advice is the wrong answer for most rule classes.
file:line.security-audit.security-audit on the result.Dependabot, npm audit,
pip-audit). That is a different workflow — upgrade, pin, or
apply the advisory's patch.Read the finding precisely. Pull out four things:
js/sql-injection, py/command-line-injection,
js/xss). The rule ID determines the right fix class.Triage: real flow or false positive? Ask in order:
req.query.id yes;
process.env.NODE_ENV no.Pick the right fix layer for the rule class. The fix depends on the kind of vulnerability, not on the input:
*/sql-injection) → parameterized
queries (placeholders + bind values). Input validation alone
is not a fix — escaping is the database driver's job, not the
application's. db.query('SELECT * FROM users WHERE id = ?', [id]),
not WHERE id = ${id} with an "is it an integer?" check
bolted on.*/command-line-injection) → call the
process with array arguments and no shell:
subprocess.run(['git', 'log', branch], shell=False). Not a
regex over the input.js/xss, js/reflected-xss) → context-aware output
encoding at the sink, or rely on the framework's auto-escape.
React/Vue/Angular auto-escape by default; innerHTML /
dangerouslySetInnerHTML is the actual sink.*/path-injection) → resolve the path and
verify it stays within the allowed base (path.resolve(base, input)
then assert startsWith(base + sep)). Stripping .. with a
regex misses encoded variants.*/open-redirect) → allowlist of valid
destinations, or strip to a path-only redirect. Scheme checks
alone miss //evil.com.*/ssrf, */request-forgery) → resolve the
hostname and reject private / link-local ranges before the
request fires; ideally use an allowlist of external hosts.*/unsafe-deserialization) → switch
to a schema-validating parser. pickle, yaml.load,
Java native serialization on untrusted input are never the
answer.Write the smallest fix that closes the data flow.
try/except
just to make the finding go away — that hides the bug
without fixing it.id even if it looks numeric").If genuinely a false positive, suppress with justification.
// lgtm[js/sql-injection] (line comment) with a
follow-up sentence in the PR explaining why the flow is not
reachable.# nosem: rule-id reason.// NOSONAR: <reason>.
The English reason matters more than the magic comment — a
suppression without a reason is just noise the next reviewer
has to re-triage.In scope: a js/sql-injection CodeQL alert flagging
src/api/users.js:42 where req.query.id is interpolated into a
template string passed to db.query().
→ Identify rule js/sql-injection. Trace source req.query.id to
the sink db.query(\SELECT … WHERE id = ${userId}`)`. Real flow.
Fix is parameterized:
const result = await db.query('SELECT * FROM users WHERE id = ?', [req.query.id]);
Do not bolt on Number.isInteger(userId) instead — type-checking
the input does not close the SQL-injection flow. Other endpoints
calling other tables would still be vulnerable in the same way.
In scope: a finding the user believes is a false positive.
→ Triage step by step. If the "untrusted" source is actually a constant or a value already validated upstream by a known schema, suppress with a line comment that names the upstream validator and the rule ID.
Out of scope: "audit my codebase for SQL injection."
→ No specific finding attached. Use security-audit.
try/except just to
silence the finding?