docs: add guide for adding a CodeQL data extension - #205
Conversation
Add a new "Adding a data extension" section to CONTRIBUTING.md covering how to build a data-extension (MaD) pack: an explicit rule of thumb for choosing between `ext` and `ext-library-sources` (sink/summary models vs. remote-source models, and which languages have each), the MaD row shape, the `manual/` vs `generated/` convention, the `extensionTargets` version-pinning gotcha that causes silent zero-result failures on a mismatched local CLI, and how data extensions get picked up automatically by `codeql test run`. Also tightens the pack-directory bullet in "Shipping a change to a query/library pack" to correctly scope `ext-library-sources` to csharp/java only (previously bundled with `ext`'s wider csharp/go/java/ python list), and links it to the new section. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f02ef23b-e35d-4536-bd58-f2fbc2976ba9
There was a problem hiding this comment.
🟡 Not ready to approve
The new guide references a non-existent in-repo example file (java/ext/manual/org.springframework.r2dbc.model.yml), which makes the documentation incorrect as written.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
This PR updates CONTRIBUTING.md to document how to add CodeQL Model-as-Data (MaD) data extensions, with guidance on choosing the right extensions pack, structuring model rows, and validating changes via tests/CI.
Changes:
- Adds a new “Adding a data extension” section covering
extvsext-library-sources, row shape,manual/vsgenerated/, and anextensionTargetstroubleshooting note. - Clarifies the “Shipping a change to a query/library pack” checklist to reflect that
ext-library-sourcesis only forcsharp/java, and links to the new section. - Adds a new reference link for PR #204.
File summaries
| File | Description |
|---|---|
| CONTRIBUTING.md | Adds end-to-end contributor documentation for creating and testing data extensions, and tightens the publishing checklist language for extension pack types. |
Review details
Suppressed comments (1)
CONTRIBUTING.md:112
- This section references
java/ext/manual/org.springframework.r2dbc.model.ymlas a row-shape example, but that file does not exist in the repo right now. Also, the text claims the file has explanatory comments, which may not hold for the replacement; consider wording that only asserts what the referenced file actually contains.
for the full column reference (`namespace, type, subtypes, name, signature, ext, input/output,
kind, provenance`). `java/ext/manual/org.springframework.r2dbc.model.yml` shows a real
`sinkModel`/`summaryModel` pair side by side, with comments explaining *why* each row is shaped
the way it is — comment your own rows the same way whenever the mapping from source code to a
MaD row isn't obvious at a glance.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
…ts pack consumers Two follow-ups on the "Adding a data extension" section from the initial commit: - Drop the "this bit us during development of the Spring R2DBC models" framing and the "our own file shows a real pair... comment your own rows the same way" phrasing in the row-shape bullet. Both read as insider narrative rather than generic guidance. State the comment-your-rows recommendation directly instead. - Clarify that the extensionTargets version gotcha is not a local-dev-only quirk: per CodeQL's model pack docs, a model pack's extensions are only applied if the resolved codeql/<language>-all version satisfies the pinned extensionTargets range, silently and with no warning otherwise. This affects anyone consuming the published pack with a CLI outside that range, not only contributors testing locally. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f02ef23b-e35d-4536-bd58-f2fbc2976ba9
There was a problem hiding this comment.
🟡 Not ready to approve
The new testing guidance currently makes an incorrect repo-wide claim about <language>/test/qlpack.yml depending on the extensions pack (not true for Python).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
CONTRIBUTING.md:151
- The docs claim that
<language>/test/qlpack.ymlalready depends ongithubsecuritylab/codeql-<language>-extensions, but this is not true for all languages in the repo (notablypython/test/qlpack.ymldoes not listgithubsecuritylab/codeql-python-extensions). This makes the statement misleading for Python contributors.
`<language>/test/qlpack.yml` already depends on `githubsecuritylab/codeql-<language>-extensions`
(and `-library-sources` where applicable) — that dependency is what makes `codeql test run`'s
normal dependency resolution load your new data extensions automatically, unlike ad-hoc `codeql
database analyze`/`query run`, which need an explicit `--model-packs` flag. Confirm the test
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
…ontributing-guide # Conflicts: # CONTRIBUTING.md
There was a problem hiding this comment.
🟡 Not ready to approve
The new testing guidance contains an inaccurate claim about test-pack dependencies that would mislead contributors (notably for Python).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
CONTRIBUTING.md:141
- The testing guidance claims
<language>/test/qlpack.ymlalready depends ongithubsecuritylab/codeql-<language>-extensions, but that isn’t true for all languages (e.g.python/test/qlpack.ymlhas no dependency ongithubsecuritylab/codeql-python-extensions). As written, this will mislead Python contributors into thinkingcodeql test runwill auto-load new models without any additional setup.
`<language>/test/qlpack.yml` already depends on `githubsecuritylab/codeql-<language>-extensions`
(and `-library-sources` where applicable) — that dependency is what makes `codeql test run`'s
normal dependency resolution load your new data extensions automatically, unlike ad-hoc `codeql
database analyze`/`query run`, which need an explicit `--model-packs` flag. Confirm the test
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Don't assert <language>/test/qlpack.yml uniformly depends on the extensions pack - it's not true for python/test/qlpack.yml today. Reword to tell contributors to check/add the dependency instead of claiming it's already there. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f02ef23b-e35d-4536-bd58-f2fbc2976ba9
|
Also addressing the second Copilot review (python/test/qlpack.yml gap, review 4847148821): confirmed that's real - |
There was a problem hiding this comment.
🟢 Ready to approve
Changes are documentation-only and the only noted issue is a small clarity tweak to the listed MaD column names.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Review details
Suppressed comments (1)
CONTRIBUTING.md:109
- The MaD column list says
input/output, but the actual row shape uses separateinputandoutputcolumns (e.g.Argument[0].ReturnValue,ReturnValueinjava/ext/manual/org.springframework.r2dbc.model.yml). Listing them as one column is misleading for contributors writing summary models.
for the full column reference (`namespace, type, subtypes, name, signature, ext, input/output,
kind, provenance`), and any existing file under `manual/` in this repo for a real example of the
- Files reviewed: 1/1 changed files
- Comments generated: 0 new
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
Summary
Adds a new "Adding a data extension" section to
CONTRIBUTING.md, filling the gap noted while working on #204: there was no documentation on how to build a CodeQL data-extension (MaD) pack, and in particular no clear guidance on when to useextvs.ext-library-sources.What's covered
extvsext-library-sources, grounded in what's actually in the repo today:ext= sink models, summary models, and hand-curated framework source models (almost every contribution, including Java: model Spring R2DBCDatabaseClientandio.r2dbc.spias SQL injection sinks #204's Spring R2DBCDatabaseClientsink models).ext-library-sources(csharp/java only) = a narrower, more conservatively-reviewed pack for bulk-minedsourceModel/kind: "remote"rows (seejava/src/library_sources/ExternalAPIsUsedWithUntrustedData.ql), sinceRemoteFlowSourcefeeds every standard security query.java/ext/manual/org.springframework.r2dbc.model.yml) instead of re-deriving the column reference from scratch.manual/vsgenerated/convention.DatabaseClientandio.r2dbc.spias SQL injection sinks #204: if the local CodeQL CLI's bundledcodeql/<language>-alldoesn't satisfy the pack's pinnedextensionTargetsrange, new models silently attach zero results instead of failing loudly.<language>/test/qlpack.yml's dependency on the extensions pack makescodeql test runauto-load new data extensions, and how to confirm in CI that a test is actually exercising the new model (not just compiling).Also tightens one pre-existing line in "Shipping a change to a query/library pack" that bundled
ext/ext-library-sourcesunder the same "csharp/go/java/python" language list —ext-library-sourcesis actually csharp/java only — and links it forward to the new section.Why a separate PR from #204
This is general documentation, not scoped to the Spring R2DBC work, so it's branched fresh from
mainrather than added to #204's branch.