-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS: Migrate all queries to proper flow states and deprecate FlowLabel #18265
JS: Migrate all queries to proper flow states and deprecate FlowLabel #18265
Conversation
Needed for migrating the XSS query
cba929d
to
fffb15b
Compare
4d33ddb
to
60738e8
Compare
6ed08f5
to
205f486
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 55 out of 75 changed files in this pull request and generated no comments.
Files not reviewed (20)
- docs/codeql/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript.rst: Language not supported
- javascript/ql/examples/queries/dataflow/BackendIdor/BackendIdor.ql: Language not supported
- javascript/ql/examples/queries/dataflow/InformationDisclosure/InformationDisclosure.ql: Language not supported
- javascript/ql/lib/semmle/javascript/dataflow/AdditionalFlowSteps.qll: Language not supported
- javascript/ql/lib/semmle/javascript/dataflow/Configuration.qll: Language not supported
- javascript/ql/lib/semmle/javascript/dataflow/internal/BarrierGuards.qll: Language not supported
- javascript/ql/lib/semmle/javascript/dataflow/internal/FlowSteps.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/CommonFlowState.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/TaintedObject.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/TaintedObjectCustomizations.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/TaintedUrlSuffix.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/TaintedUrlSuffixCustomizations.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/BuildArtifactLeakCustomizations.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/BuildArtifactLeakQuery.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/CleartextLoggingQuery.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideRequestForgeryQuery.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideUrlRedirectCustomizations.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/ClientSideUrlRedirectQuery.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/ConditionalBypassQuery.qll: Language not supported
- javascript/ql/lib/semmle/javascript/security/dataflow/DeepObjectResourceExhaustionCustomizations.qll: Language not supported
Tip: Turn on automatic Copilot reviews for this repository to get quick feedback on every pull request. Learn more
Taking back into draft as there are a bunch of new CI failures that popped up when I took it out of draft. |
Having the same name as a standard query is just confusing
This was previously called from isBarrier(node, state) but without restricting the state. The call was therefore moved to isBarrier(node), but this caused some optimisation changes resulting in a bad join.
bc85328
to
e5ae7e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
I'm sure that I missed some place where the code still says "label" instead of "state", but I definitely agree with the general pattern.
This PR migrates all queries to newtype-based
PrototypePollutingFunction
is still string, but that's fine.
Right, I left |
Previously, our queries used flow state simply by doing
class FlowState = DataFlow::FlowLabel;
. This meant we could reuse some existing flow label-specified infrastructure, this is no longer needed.This PR migrates all queries to
newtype
-basedFlowState
classes and deprecates theFlowLabel
class.I've introduced a file
CommonFlowState
to declare all flow states that are shared between queries, or are in use by a query that depends on another common flow state. This could technically be split intoTaintedUrlSuffix
-based queries andTaintedObject
-based queries, but it seems simpler to just have one flow state for all cases where they need to be shared.Finally, also applies a mass rename to the
node1,state1,node2,state2
naming convention in our flow step predicates. We previously had an inconsistent naming convention, ranging betweenpred -> succ
,src -> dst
,src -> trg
, and likewise for labels, but with the additional variantinlbl -> outlbl
. Now it's much more consistent.Evaluation looks quiet, again with hints of a minor speedup (1% on average).