| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| private import semmle.code.java.controlflow.Guards | ||
| private import semmle.code.java.dataflow.internal.BaseSSA | ||
| private import semmle.code.java.dataflow.TaintTracking | ||
| private import semmle.code.java.dataflow.TypeFlow |
Code scanning / CodeQL
Redundant import
| * Provides an implementation of universal flow using input `I`. | ||
| */ | ||
| module Make<LocationSig Location, UniversalFlowInput<Location> I> { | ||
| private import I |
Code scanning / CodeQL
Redundant import
There was a problem hiding this comment.
Curious, should this also handle kotlin? Or is this java only right now?
Sorry, something went wrong.
To the extent that Kotlin calls the same methods, i.e. java.util.Collection::contains etc., then this should work just fine for Kotlin as well. Of course, if there are some similar methods in Kotlin with different qualified names, then they would need to be added alongside their Java equivalents in this QL code. I'm not fluent enough in canonical Kotlin to tell whether that's the case or not. |
Sorry, something went wrong.
I was mostly thinking of https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/list-of.html and friends for unmodifiableCollectionStep which I believe aren't covered right now. I haven't used Kotlin since almost a decade, so there might be more methods. |
Sorry, something went wrong.
| m.hasQualifiedName("java.util", "Collection", ["add", "addAll"]) and | ||
| m.getNumberOfParameters() = 1 and | ||
| arg = 0 | ||
| or | ||
| m.hasQualifiedName("java.util", "List", ["add", "addAll"]) and | ||
| m.getNumberOfParameters() = 2 and | ||
| arg = 1 |
Sorry, something went wrong.
There was a problem hiding this comment.
I don't expect allowlists constructions to use those, but I've added them now - it can't hurt.
Sorry, something went wrong.
There was a problem hiding this comment.
I think it would be good to include the tests from #17051, modified so they pass where you have made different decisions (e.g. allowing reads from fields that aren't static and final).
Sorry, something went wrong.
Done. I did the modification in a separate commit, so it's easy for you to see the diff. |
Sorry, something went wrong.
There was a problem hiding this comment.
The code all looks good. Test expectations need to be updated for one test. And you've added a module and a bunch of predicates without QLDocs in TypeFlow::FlowStepsInput. (It also seems to be complaining about some that you didn't add in BaseSSA::BaseSsaSourceVariable and BaseSSA::BaseSsaVariable, that may be worth just fixing in this PR so the alert stops going off.)
Sorry, something went wrong.
Yes, there was a semantic merge conflict. Fixed now.
All fixed. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Builds on top of #17863
This is a reimplementation of #17051 expressed in terms of a universal flow library.