JS: Add store step into namespace re-export specifier

This commit is contained in:
Asger F
2024-04-17 14:13:39 +02:00
parent 0a7af90454
commit 55b9724f59
4 changed files with 24 additions and 1 deletions

View File

@@ -510,6 +510,9 @@ class ExportNamedDeclaration extends ExportDeclaration, @export_named_declaratio
or
exists(ReExportDeclaration red | red = this |
result = red.getReExportedES2015Module().getAnExport().getSourceNode(spec.getLocalName())
or
spec instanceof ExportNamespaceSpecifier and
result = DataFlow::valueNode(spec)
)
)
}
@@ -524,6 +527,19 @@ class ExportNamedDeclaration extends ExportDeclaration, @export_named_declaratio
ExportSpecifier getASpecifier() { result = this.getSpecifier(_) }
}
private import semmle.javascript.dataflow.internal.PreCallGraphStep
private class ExportNamespaceStep extends PreCallGraphStep {
override predicate storeStep(DataFlow::Node pred, DataFlow::SourceNode succ, string prop) {
exists(ExportNamedDeclaration exprt, ExportNamespaceSpecifier spec |
spec = exprt.getASpecifier() and
pred =
exprt.(ReExportDeclaration).getReExportedES2015Module().getAnExport().getSourceNode(prop) and
succ = DataFlow::valueNode(spec)
)
}
}
/**
* An export declaration with the `type` modifier.
*/