mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Fix minor issues
This commit is contained in:
@@ -6,6 +6,9 @@ import javascript
|
||||
|
||||
/** Provides classes modeling [cors package](https://npmjs.com/package/cors) */
|
||||
module Cors {
|
||||
/**
|
||||
* An expression that creates a new CORS configuration.
|
||||
*/
|
||||
class Cors extends DataFlow::CallNode {
|
||||
/** Get an instanceof of `cors` */
|
||||
Cors() { this = DataFlow::moduleImport("cors").getAnInvocation() }
|
||||
@@ -16,7 +19,7 @@ module Cors {
|
||||
/** Holds if cors is using default configuration */
|
||||
predicate isDefault() { this.getNumArgument() = 0 }
|
||||
|
||||
/** The value of origin */
|
||||
/** Gets the value of origin */
|
||||
DataFlow::Node getOrigin() {
|
||||
result = this.getCorsArgument().getALocalSource().getAPropertyWrite("origin").getRhs()
|
||||
}
|
||||
|
||||
@@ -1073,22 +1073,22 @@ module Express {
|
||||
override predicate definitelyResumesDispatch() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
* The CORS configuration used in Express
|
||||
*/
|
||||
class CorsConfiguration extends DataFlow::MethodCallNode {
|
||||
/** Get an `app.use` with a cors object as argument */
|
||||
CorsConfiguration() {
|
||||
this = appCreation().getAMethodCall("use") and this.getArgument(0) instanceof Cors::Cors
|
||||
}
|
||||
|
||||
/** Get Cors */
|
||||
private Cors::Cors cors() { result = this.getArgument(0).(Cors::Cors) }
|
||||
|
||||
/** Get Cors configuration */
|
||||
DataFlow::Node getCorsArgument() { result = cors().getCorsArgument() }
|
||||
DataFlow::Node getCorsArgument() { result = this.getArgument(0).(Cors::Cors).getCorsArgument() }
|
||||
|
||||
/** Holds if cors is using default configuration */
|
||||
predicate isDefault() { cors().isDefault() }
|
||||
predicate isDefault() { this.getArgument(0).(Cors::Cors).isDefault() }
|
||||
|
||||
/** Get Cors origin value */
|
||||
DataFlow::Node getOrigin() { result = cors().getOrigin() }
|
||||
DataFlow::Node getOrigin() { result = this.getArgument(0).(Cors::Cors).getOrigin() }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user