Skip to content

Commit da28d3b

Browse files
committed
add "hash" and "search" to URL taint step
1 parent 88bb1dc commit da28d3b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,14 +646,14 @@ module TaintTracking {
646646
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
647647
*
648648
* This step is used to model 3 facts:
649-
* 1) A `URL` constructed using `url = new URL(input)` transfers taint from `input` to `url.searchParams`. (See prop = "searchParams")
649+
* 1) A `URL` constructed using `url = new URL(input)` transfers taint from `input` to `url.searchParams`, `url.hash`, and `url.search`.
650650
* 2) Accessing the `searchParams` on a `URL` results in a `URLSearchParams` object (See the loadStoreStep method on this class and hiddenUrlPseudoProperty())
651651
* 3) A `URLSearchParams` object (either `url.searchParams` or `new URLSearchParams(input)`) has a tainted value,
652652
* which can be accessed using a `get` or `getAll` call. (See getableUrlPseudoProperty())
653653
*/
654654
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
655655
succ = this and (
656-
(prop = "searchParams" or prop = hiddenUrlPseudoProperty()) and
656+
(prop = "searchParams" or prop = "hash" or prop = "search" or prop = hiddenUrlPseudoProperty()) and
657657
exists(DataFlow::NewNode newUrl | succ = newUrl |
658658
newUrl = DataFlow::globalVarRef("URL").getAnInstantiation() and
659659
pred = newUrl.getArgument(0)

0 commit comments

Comments
 (0)