Skip to content

Commit 8a34ea8

Browse files
author
Max Schaefer
authored
Merge pull request #1284 from esben-semmle/js/fix-azure-performance
JS: fix azure performance
2 parents 5fd10b5 + e2666a9 commit 8a34ea8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

javascript/ql/src/semmle/javascript/frameworks/SocketIO.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ module SocketIOClient {
411411
exists(DataFlow::TypeTracker t2 | result = socket(invk, t2).track(t2, t))
412412
}
413413

414+
/**
415+
* Gets the NPM package that contains `nd`.
416+
*/
417+
private NPMPackage getPackage(DataFlow::SourceNode nd) { result.getAFile() = nd.getFile() }
418+
414419
/** A data flow node that may produce a socket object. */
415420
class SocketNode extends DataFlow::SourceNode {
416421
DataFlow::InvokeNode invk;
@@ -445,10 +450,8 @@ module SocketIOClient {
445450
* it can be determined.
446451
*/
447452
SocketIO::ServerObject getATargetServer() {
448-
exists(NPMPackage pkg |
449-
result.getOrigin().getFile() = pkg.getAFile() and
450-
this.getFile() = pkg.getAFile()
451-
|
453+
getPackage(result.getOrigin()) = getPackage(this) and
454+
(
452455
not exists(getNamespacePath()) or
453456
exists(result.getNamespace(getNamespacePath()))
454457
)

0 commit comments

Comments
 (0)