@@ -633,18 +633,13 @@ module TaintTracking {
633633 /**
634634 * A taint propagating data flow edge arising from URL parameter parsing.
635635 */
636- private class UrlSearchParamsTaintStep extends DataFlow:: AdditionalFlowStep {
637- UrlSearchParamsTaintStep ( ) {
638- this = DataFlow:: globalVarRef ( "URL" ) or
639- this = DataFlow:: globalVarRef ( "URLSearchParams" )
640- }
641-
636+ private class UrlSearchParamsTaintStep extends DataFlow:: AdditionalFlowStep , DataFlow:: ValueNode {
642637 /**
643638 * Holds if `succ` is a `URLSearchParams` providing access to the
644639 * parameters encoded in `pred`.
645640 */
646641 override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
647- isUrlSearchParams ( succ , pred )
642+ isUrlSearchParams ( succ , pred ) and succ = this
648643 }
649644
650645 /**
@@ -657,14 +652,16 @@ module TaintTracking {
657652 * which can be accessed using a `get` or `getAll` call. (See getableUrlPseudoProperty())
658653 */
659654 override predicate storeStep ( DataFlow:: Node pred , DataFlow:: Node succ , string prop ) {
660- ( prop = "searchParams" or prop = hiddenUrlPseudoProperty ( ) ) and
661- exists ( DataFlow:: NewNode newUrl | succ = newUrl |
662- newUrl = DataFlow:: globalVarRef ( "URL" ) .getAnInstantiation ( ) and
663- pred = newUrl .getArgument ( 0 )
655+ succ = this and (
656+ ( prop = "searchParams" or prop = hiddenUrlPseudoProperty ( ) ) and
657+ exists ( DataFlow:: NewNode newUrl | succ = newUrl |
658+ newUrl = DataFlow:: globalVarRef ( "URL" ) .getAnInstantiation ( ) and
659+ pred = newUrl .getArgument ( 0 )
660+ )
661+ or
662+ prop = getableUrlPseudoProperty ( ) and
663+ isUrlSearchParams ( succ , pred )
664664 )
665- or
666- prop = getableUrlPseudoProperty ( ) and
667- isUrlSearchParams ( succ , pred )
668665 }
669666
670667 /**
@@ -674,6 +671,7 @@ module TaintTracking {
674671 * For an expression `url.searchParams`, the property `hiddenUrlPseudoProperty()` from the `url` object is stored in the property `getableUrlPseudoProperty()` on `url.searchParams`.
675672 */
676673 override predicate loadStoreStep ( DataFlow:: Node pred , DataFlow:: Node succ , string loadProp , string storeProp ) {
674+ succ = this and
677675 loadProp = hiddenUrlPseudoProperty ( ) and
678676 storeProp = getableUrlPseudoProperty ( ) and
679677 exists ( DataFlow:: PropRead read | read = succ |
@@ -688,6 +686,7 @@ module TaintTracking {
688686 * This step is used to load the value stored in the pseudo-property `getableUrlPseudoProperty()`.
689687 */
690688 override predicate loadStep ( DataFlow:: Node pred , DataFlow:: Node succ , string prop ) {
689+ succ = this and
691690 prop = getableUrlPseudoProperty ( ) and
692691 // this is a call to `get` or `getAll` on a `URLSearchParams` object
693692 exists ( string m , DataFlow:: MethodCallNode call | call = succ |
0 commit comments