Download tasks/codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a/task_prompt.md from Benchanything/checkerbench: direct link, hf CLI and curl.
- Browser
- Download file 4.95 kB
-
https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a/task_prompt.md
- Command line
-
hf download hf://datasets/Benchanything/checkerbench/tasks/codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a/task_prompt.md
-
curl -L -o task_prompt.md https://huggingface.co/datasets/Benchanything/checkerbench/resolve/main/tasks/codeql_python_benchmark51_v2/pyvul-e73df8c8998a1ddc180a/task_prompt.md
Python CodeQL detector synthesis
You are cc operating in /work. Starting only from the supplied patch,
before/after Python context, CodeQL references, and validation tools, synthesize a semantic CodeQL
detector for the vulnerability fixed by the patch. This is one fresh session. You may iterate inside
this session, but no later framework repair or resume will occur.
Inputs and owned outputs
- Read
patch.diff,python_patch.diff,pre_context.md, andpost_context.md. - Read
references/codeql/convergence_protocol.mdandreferences/codeql/api_navigation.mdbefore experimenting. Read the remainingreferences/codeql/files for the selected mechanism. - Use
scripts/search_codeql_api.shto inspect the pinned official libraries when an API detail is uncertain. Do not guess predicate names or build a large family of inspection queries. - Complete the design contract in
state.jsonandscope_statement.mdbefore final validation. - Replace
query/vulnerability.ql; add only genuinely shared.qllhelpers when useful. Keep the fixed offline dependency inquery/qlpack.yml. - Preserve the exact
expected_query_idfromconfig.jsonas the query's sole@id. This task-unique metadata must never be used in a query predicate. - Use
scripts/compile_query.sh,scripts/run_before.sh, andscripts/run_after.sh. - Finish by writing
summary.jsonwithstatus,query_path,query_kind,build_passed,before_findings,after_findings,validation_completed, and a concisenotesfield.
Required reasoning contract
Before coding, record this mapping in state.json:
vulnerable operation / trigger / patch safety condition
→ CodeQL-observable evidence
→ syntax, control-flow, local value-flow, global taint/value-flow, or interprocedural mechanism
→ source, sink/report site, guard/barrier and query predicates
Choose the lowest mechanism that can actually prove the condition. Guard-sensitive patches require real path/control-flow semantics; provenance-sensitive patches require value flow. Do not replace either with source-text matching or with the mere presence of patch-added syntax.
Mandatory convergence contract
The rollout has a 30-minute hard wall-clock ceiling and must be finalized by minute 27. Minutes
27–30 are an emergency shutdown buffer, not exploration time. A sophisticated unfinished query is
a failure; an early compilable semantic candidate can be improved. Follow the checkpoints in
references/codeql/convergence_protocol.md:
- Record the mechanism contract, then replace the placeholder in
query/vulnerability.qlimmediately. Do not wait until every CodeQL API detail is known. - Use at most three distinct scratch
.qlfiles. Prefer repeatedly editing onequery/scratch.ql. After two failed variants of one API assumption, inspect the exact bundled definition withscripts/search_codeql_api.shor simplify the mechanism. - Obtain a compiling minimal main query before broadening it. Compile the main query after every meaningful mechanism change.
- Move in order from compile → relevant before finding → after elimination → final contract. Do not continue API exploration after the intended before/after differential is established.
- Run
scripts/check_progress.shat each checkpoint. It reports elapsed time, the minute-27 finalization deadline, and the minute-30 hard timeout. When it printsfinalize_now, stop all exploration, preserve the best compiling query, finish the contract files, and exit.
Semantic and generalization rules
- Report at the vulnerable call, operator, access, or sink.
- Do not use a patch-local path, line, commit hash, label, or local variable name as the primary
matching condition. Stable library/framework APIs or public project APIs are allowed only when
scope_statement.mdexplains why they define the intended vulnerability family. - The safety condition introduced by the patch must be represented by the query.
- A lower after warning count is not enough: inspect SARIF and ensure at least one intended before finding is in a patch-overlapping semantic unit and the corresponding finding disappears after.
- Avoid broad proxy queries that report an enclosing function or unrelated API merely because it changed in the patch.
Final validation protocol
- Compile the final query.
- Run it on before and inspect
raw/before.sariffor the intended report location. - Run the identical query on after and inspect
raw/after.sarif. - Recheck query metadata, query kind/select signature, report locality, design-to-code consistency, and absence of patch-local hardcoding.
- Update
state.json,scope_statement.md, and write validsummary.json.
Do not modify the runtime databases, references, patch, context, or validation scripts except for normal CodeQL-generated database caches produced by the provided run scripts.