Skip to content

Commit d3e1a25

Browse files
committed
autoformat
1 parent 6b507c6 commit d3e1a25

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ module TaintTracking {
636636
}
637637

638638
/**
639-
* Holds if `params` is a construction of a `URLSearchParams` that parses
639+
* Holds if `params` is a construction of a `URLSearchParams` that parses
640640
* the parameters in `input`.
641641
*/
642642
predicate isUrlSearchParams(DataFlow::SourceNode params, DataFlow::Node input) {
@@ -650,45 +650,47 @@ module TaintTracking {
650650

651651
/**
652652
* A pseudo-property a `URL` that stores a value that can be obtained
653-
* with a `get` or `getAll` call to the `searchParams` property.
653+
* with a `get` or `getAll` call to the `searchParams` property.
654654
*/
655-
private string hiddenUrlPseudoProperty() {
656-
result = "$hiddenSearchPararms"
657-
}
655+
private string hiddenUrlPseudoProperty() { result = "$hiddenSearchPararms" }
658656

659657
/**
660658
* A pseudo-property on a `URLSearchParams` that can be obtained
661-
* with a `get` or `getAll` call.
662-
*/
663-
private string getableUrlPseudoProperty() {
664-
result = "$gettableSearchPararms"
665-
}
659+
* with a `get` or `getAll` call.
660+
*/
661+
private string getableUrlPseudoProperty() { result = "$gettableSearchPararms" }
666662

667663
/**
668664
* A taint propagating data flow edge arising from URL parameter parsing.
669665
*/
670666
private class UrlSearchParamsTaintStep extends DataFlow::AdditionalFlowStep, DataFlow::ValueNode {
671667
/**
672-
* Holds if `succ` is a `URLSearchParams` providing access to the
673-
* parameters encoded in `pred`.
674-
*/
668+
* Holds if `succ` is a `URLSearchParams` providing access to the
669+
* parameters encoded in `pred`.
670+
*/
675671
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
676672
isUrlSearchParams(succ, pred) and succ = this
677673
}
678674

679675
/**
680676
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
681-
*
682-
* This step is used to model 3 facts:
677+
*
678+
* This step is used to model 3 facts:
683679
* 1) A `URL` constructed using `url = new URL(input)` transfers taint from `input` to `url.searchParams`, `url.hash`, and `url.search`.
684680
* 2) Accessing the `searchParams` on a `URL` results in a `URLSearchParams` object (See the loadStoreStep method on this class and hiddenUrlPseudoProperty())
685-
* 3) A `URLSearchParams` object (either `url.searchParams` or `new URLSearchParams(input)`) has a tainted value,
681+
* 3) A `URLSearchParams` object (either `url.searchParams` or `new URLSearchParams(input)`) has a tainted value,
686682
* which can be accessed using a `get` or `getAll` call. (See getableUrlPseudoProperty())
687683
*/
688684
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
689-
succ = this and (
690-
(prop = "searchParams" or prop = "hash" or prop = "search" or prop = hiddenUrlPseudoProperty()) and
691-
exists(DataFlow::NewNode newUrl | succ = newUrl |
685+
succ = this and
686+
(
687+
(
688+
prop = "searchParams" or
689+
prop = "hash" or
690+
prop = "search" or
691+
prop = hiddenUrlPseudoProperty()
692+
) and
693+
exists(DataFlow::NewNode newUrl | succ = newUrl |
692694
newUrl = DataFlow::globalVarRef("URL").getAnInstantiation() and
693695
pred = newUrl.getArgument(0)
694696
)
@@ -700,26 +702,28 @@ module TaintTracking {
700702

701703
/**
702704
* Holds if the property `loadStep` should be copied from the object `pred` to the property `storeStep` of object `succ`.
703-
*
704-
* This step is used to copy the value of our pseudo-property that can later be accessed using a `get` or `getAll` call.
705-
* For an expression `url.searchParams`, the property `hiddenUrlPseudoProperty()` from the `url` object is stored in the property `getableUrlPseudoProperty()` on `url.searchParams`.
705+
*
706+
* This step is used to copy the value of our pseudo-property that can later be accessed using a `get` or `getAll` call.
707+
* For an expression `url.searchParams`, the property `hiddenUrlPseudoProperty()` from the `url` object is stored in the property `getableUrlPseudoProperty()` on `url.searchParams`.
706708
*/
707-
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string loadProp, string storeProp) {
709+
override predicate loadStoreStep(
710+
DataFlow::Node pred, DataFlow::Node succ, string loadProp, string storeProp
711+
) {
708712
succ = this and
709713
loadProp = hiddenUrlPseudoProperty() and
710714
storeProp = getableUrlPseudoProperty() and
711-
exists(DataFlow::PropRead read | read = succ |
715+
exists(DataFlow::PropRead read | read = succ |
712716
read.getPropertyName() = "searchParams" and
713717
read.getBase() = pred
714718
)
715719
}
716720

717-
/**
718-
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
719-
*
720-
* This step is used to load the value stored in the pseudo-property `getableUrlPseudoProperty()`.
721-
*/
722-
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
721+
/**
722+
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
723+
*
724+
* This step is used to load the value stored in the pseudo-property `getableUrlPseudoProperty()`.
725+
*/
726+
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
723727
succ = this and
724728
prop = getableUrlPseudoProperty() and
725729
// this is a call to `get` or `getAll` on a `URLSearchParams` object
@@ -728,7 +732,7 @@ module TaintTracking {
728732
call.getReceiver() = pred and
729733
m.matches("get%")
730734
)
731-
}
735+
}
732736
}
733737

734738
/**

javascript/ql/src/semmle/javascript/security/dataflow/DomBasedXss.qll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,5 @@ module DomBasedXss {
4949
}
5050
}
5151

52-
private string urlSuffixPseudoProperty() {
53-
result = "$UrlSuffix$"
54-
}
52+
private string urlSuffixPseudoProperty() { result = "$UrlSuffix$" }
5553
}

0 commit comments

Comments
 (0)