Skip to content

Commit 1f3d3c7

Browse files
committed
JS: Resolve script 'src' attributes using Folder::Resolve
1 parent 146be6b commit 1f3d3c7

File tree

1 file changed

+8
-2
lines changed
  • javascript/ql/lib/semmle/javascript

1 file changed

+8
-2
lines changed

javascript/ql/lib/semmle/javascript/HTML.qll

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ module HTML {
214214
result = path.regexpCapture("file://(/.*)", 1)
215215
or
216216
not path.regexpMatch("(\\w+:)?//.*") and
217-
result = this.getSourcePath().(ScriptSrcPath).resolve(this.getSearchRoot()).toString()
217+
result = ResolveScriptSrc::resolve(this.getSearchRoot(), this.getSourcePath()).toString()
218218
)
219219
}
220220

@@ -274,10 +274,16 @@ module HTML {
274274
)
275275
}
276276

277+
private module ResolverConfig implements Folder::ResolveSig {
278+
predicate shouldResolve(Container base, string path) { scriptSrc(path, base) }
279+
}
280+
281+
private module ResolveScriptSrc = Folder::Resolve<ResolverConfig>;
282+
277283
/**
278284
* A path string arising from the `src` attribute of a `script` tag.
279285
*/
280-
private class ScriptSrcPath extends PathString {
286+
deprecated private class ScriptSrcPath extends PathString {
281287
ScriptSrcPath() { scriptSrc(this, _) }
282288

283289
override Folder getARootFolder() { scriptSrc(this, result) }

0 commit comments

Comments
 (0)