Skip to content

Commit d49359a

Browse files
committed
JS: Add step through spread arg to path.join()
1 parent a826c83 commit d49359a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/TaintedPathCustomizations.qll

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,22 @@ module TaintedPath {
847847
dst = call and
848848
srclabel = dstlabel
849849
)
850+
or
851+
exists(DataFlow::CallNode join |
852+
// path.join() with spread argument
853+
join = NodeJSLib::Path::moduleMember("join").getACall() and
854+
src = join.getASpreadArgument() and
855+
dst = join and
856+
(
857+
srclabel.(Label::PosixPath).canContainDotDotSlash()
858+
or
859+
srclabel instanceof Label::SplitPath
860+
) and
861+
dstlabel.(Label::PosixPath).isNormalized() and
862+
if isRelative(join.getArgument(0).getStringValue())
863+
then dstlabel.(Label::PosixPath).isRelative()
864+
else dstlabel.(Label::PosixPath).isAbsolute()
865+
)
850866
}
851867

852868
/**

0 commit comments

Comments
 (0)