Skip to content

Java: add neutral models - #15766

Merged
owen-mc merged 7 commits into
github:mainfrom
owen-mc:java/add-neutral-models
Mar 2, 2024
Merged

Java: add neutral models#15766
owen-mc merged 7 commits into
github:mainfrom
owen-mc:java/add-neutral-models

Conversation

@owen-mc

@owen-mc owen-mc commented Feb 29, 2024

Copy link
Copy Markdown
Contributor

In java/ql/src/Metrics/Summaries/TopJdkApis.qll there is a comment listing some APIs that we don't want models for, with reasons. Some of the commits in this PR add manual neutral models for those APIs, so that we won't accidentally generate models for them. (The APIs relating to lambda flow shouldn't have models of any kind, so they will be excluded from model generation in this PR.) The final two commits add neutral models for four methods that I noticed had erroneous generated summary models in #14919.

@owen-mc
owen-mc requested a review from a team as a code owner February 29, 2024 12:32
@github-actions github-actions Bot added the Java label Feb 29, 2024
@owen-mc owen-mc added the no-change-note-required This PR does not need a change note label Feb 29, 2024
@owen-mc
owen-mc marked this pull request as draft February 29, 2024 14:10
owen-mc added 3 commits March 1, 2024 12:31
See comment in java/ql/src/Metrics/Summaries/TopJdkApis.qll

   * Note: the following top JDK APIs are not modeled with MaD:
   * `java.lang.System#getProperty(String)`: needs to be modeled by regular CodeQL matching the get and set keys to reduce FPs
   * `java.lang.System#setProperty(String,String)`: needs to be modeled by regular CodeQL matching the get and set keys to reduce FPs
…ormat

See comment in java/ql/src/Metrics/Summaries/TopJdkApis.qll

   * Note: the following top JDK APIs are not modeled with MaD:
   * `java.text.Format#format(Object)`: similar issue as `Object.toString`; depends on the object being passed as the argument
   * `java.text.MessageFormat#format(String,Object[])`: similar issue as `Object.toString`; depends on the object being passed as the argument
See comment in java/ql/src/Metrics/Summaries/TopJdkApis.qll

   * Note: the following top JDK APIs are not modeled with MaD:
   * `java.util.stream.Collectors#joining(CharSequence)`: cannot be modeled completely without a model for `java.util.stream.Stream#collect(Collector)` as well
   * `java.util.stream.Collectors#toMap(Function,Function)`: specialized collectors flow
   * `java.util.stream.Stream#collect(Collector)`: handled separately on a case-by-case basis as it is too complex for MaD
@owen-mc
owen-mc force-pushed the java/add-neutral-models branch from 106639e to de809a7 Compare March 1, 2024 13:23
@owen-mc
owen-mc marked this pull request as ready for review March 1, 2024 14:04
@owen-mc
owen-mc force-pushed the java/add-neutral-models branch from de809a7 to 0e1c45e Compare March 1, 2024 14:09
Comment thread java/ql/lib/ext/java.text.model.yml Outdated
Co-authored-by: Tony Torralba <atorralba@users.noreply.github.com>
@owen-mc
owen-mc merged commit bf22c6d into github:main Mar 2, 2024
@owen-mc
owen-mc deleted the java/add-neutral-models branch March 2, 2024 06:00
atorralba added a commit to atorralba/codeql that referenced this pull request Mar 13, 2024
This is similar to github#15766, in the sense that it adds neutral models to prevent the model generator from generating summaries for them. These models were spotted while evaluating github#14919.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants