mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
recognize an access to the arguments object as library-input
This commit is contained in:
committed by
erik-krogh
parent
7b1ef7473e
commit
d86b7f6c54
@@ -11,7 +11,7 @@ private import semmle.javascript.internal.CachedStages
|
||||
* Gets a parameter that is a library input to a top-level package.
|
||||
*/
|
||||
cached
|
||||
DataFlow::SourceNode getALibraryInputParameter() {
|
||||
DataFlow::Node getALibraryInputParameter() {
|
||||
Stages::Taint::ref() and
|
||||
exists(int bound, DataFlow::FunctionNode func |
|
||||
func = getAValueExportedByPackage().getABoundFunctionValue(bound)
|
||||
@@ -19,6 +19,8 @@ DataFlow::SourceNode getALibraryInputParameter() {
|
||||
result = func.getParameter(any(int arg | arg >= bound))
|
||||
or
|
||||
result = getAnArgumentsRead(func.getFunction())
|
||||
or
|
||||
result = func.getFunction().getArgumentsVariable().getAnAccess().flow()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ module PrototypePollutingAssignment {
|
||||
/**
|
||||
* A parameter of an exported function, seen as a source prototype-polluting assignment.
|
||||
*/
|
||||
class ExternalInputSource extends Source, DataFlow::SourceNode {
|
||||
class ExternalInputSource extends Source {
|
||||
ExternalInputSource() { this = Exports::getALibraryInputParameter() }
|
||||
|
||||
override string describe() { result = "library input" }
|
||||
|
||||
@@ -21,11 +21,11 @@ module UnsafeCodeConstruction {
|
||||
/**
|
||||
* A parameter of an exported function, seen as a source.
|
||||
*/
|
||||
class ExternalInputSource extends Source, DataFlow::ParameterNode {
|
||||
class ExternalInputSource extends Source {
|
||||
ExternalInputSource() {
|
||||
this = Exports::getALibraryInputParameter() and
|
||||
// permit parameters that clearly are intended to contain executable code.
|
||||
not this.getName() = "code"
|
||||
not this.(DataFlow::ParameterNode).getName() = "code"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ module UnsafeHtmlConstruction {
|
||||
/**
|
||||
* A parameter of an exported function, seen as a source for usnafe HTML constructed from input.
|
||||
*/
|
||||
class ExternalInputSource extends Source, DataFlow::ParameterNode {
|
||||
class ExternalInputSource extends Source {
|
||||
ExternalInputSource() {
|
||||
this = Exports::getALibraryInputParameter() and
|
||||
// An AMD-style module sometimes loads the jQuery library in a way which looks like library input.
|
||||
|
||||
@@ -49,7 +49,7 @@ module UnsafeShellCommandConstruction {
|
||||
/**
|
||||
* A parameter of an exported function, seen as a source for shell command constructed from library input.
|
||||
*/
|
||||
class ExternalInputSource extends Source, DataFlow::SourceNode {
|
||||
class ExternalInputSource extends Source {
|
||||
ExternalInputSource() {
|
||||
this = Exports::getALibraryInputParameter() and
|
||||
not (
|
||||
|
||||
@@ -138,7 +138,7 @@ module PolynomialReDoS {
|
||||
/**
|
||||
* A parameter of an exported function, seen as a source for polynomial-redos.
|
||||
*/
|
||||
class ExternalInputSource extends Source, DataFlow::SourceNode {
|
||||
class ExternalInputSource extends Source {
|
||||
ExternalInputSource() { this = Exports::getALibraryInputParameter() }
|
||||
|
||||
override string getKind() { result = "library" }
|
||||
|
||||
Reference in New Issue
Block a user