Shared: update code comments explaining models-as-data format to include barriers and barrier guards#21584
Shared: update code comments explaining models-as-data format to include barriers and barrier guards#21584owen-mc wants to merge 8 commits intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Models-as-Data / API-graph model documentation comments across several languages to describe barrier and barrier-guard model formats, and to refine the description of neutral models.
Changes:
- Document Barriers and BarrierGuards row formats in multiple MaD / ApiGraph model comment blocks.
- Add/expand documentation for barrier-guard condition columns (
branch/acceptingvalue). - Adjust neutral-model description text in ExternalFlow docs.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll | Updates MaD format comment to include barriers/guards and neutrals. |
| ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll | Documents Barriers/BarrierGuards rows and branch meaning for API-graph models. |
| python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll | Documents Barriers/BarrierGuards rows and branch meaning for API-graph models. |
| javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll | Documents Barriers/BarrierGuards rows and branch meaning for API-graph models. |
| java/ql/lib/semmle/code/java/dataflow/ExternalFlow.qll | Documents Barriers/BarrierGuards and adjusts neutral-model description. |
| go/ql/lib/semmle/go/dataflow/ExternalFlow.qll | Documents Barriers/BarrierGuards and provenance; adjusts neutral-model description. |
| csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll | Documents Barriers/BarrierGuards and adjusts neutral-model description. |
| cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll | Documents Barriers/BarrierGuards, acceptingvalue, and provenance. |
Comments suppressed due to low confidence (3)
cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll:96
- Minor grammar: "In future" should be "In the future," (or similar) in this sentence.
* "false". In future "no-exception", "not-zero", "null", "not-null" may be
* supported.
rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll:18
- The Neutrals row/description here doesn't match the rest of this module: the file defines
neutralModel(string path, string kind, string provenance, ...)and later stateskindcan besource,sink, orsummary. Please align the Neutrals row columns and the neutral explanation with theneutralModelpredicate and its documented effect below.
* - Neutrals:
* `package; type; name; signature; kind; provenance`
* A neutral is used to indicate that a callable is neutral with respect to flow (no summary).
rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll:46
- This description says the barrier-guard
branchcolumn may support values like "no-exception"/"not-zero" in the future, but thebarrierGuardModeldocumentation below statesbranchis eithertrueorfalse(a branch selector). To avoid conflicting documentation, either keepbranchrestricted to true/false here or update the laterbarrierGuardModeldocs to match the intended semantics.
* 3. The `branch` column of barrier guard models specifies which branch of the
* guard is blocking flow. It can be "true" or "false". In future
* "no-exception", "not-zero", "null", "not-null" may be supported.
csharp/ql/lib/semmle/code/csharp/dataflow/internal/ExternalFlow.qll
Outdated
Show resolved
Hide resolved
a782c0f to
1d0e402
Compare
| * - BarrierGuards: | ||
| * `path; input; branch; kind; provenance` | ||
| * - Neutrals: | ||
| * `package; type; name; signature; kind; provenance` |
There was a problem hiding this comment.
Oops. Fixed in Rust: Fix columns for neutrals.
| * - "Property[p]": Selects the contents of property `p`. | ||
| * | ||
| * 8. The `kind` column is a tag that can be referenced from QL to determine to | ||
| * 8. The `acceptingvalue` column of barrier guard models specifies the condition |
There was a problem hiding this comment.
In Rust it is called branch; we should probably align on this.
There was a problem hiding this comment.
Let me know if you want me to do it in this PR. I think it's equally good as a follow-up or in the future when rust adopts the shared guards library.
There was a problem hiding this comment.
Perhaps simply rename it to acceptingvalue (I would actually prefer acceptingValue) so that all languages are aligned.
There was a problem hiding this comment.
Hmm, now I look I see that all the dynamic languages call it branch. Shall I change it for all of them?
michaelnebel
left a comment
There was a problem hiding this comment.
Thank you for doing this!
1d0e402 to
5451424
Compare
I have also copied some sections that were missing for some languages and corrected the explanation of neutral models. These changes have been done in separate commits.