mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Make NumericOrBooleanSanitizer easier to access and rename it
This commit is contained in:
16
go/ql/lib/semmle/go/security/Sanitizers.qll
Normal file
16
go/ql/lib/semmle/go/security/Sanitizers.qll
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Classes to represent sanitizers commonly used in dataflow and taint tracking
|
||||||
|
* configurations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import go
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A node whose type is a simple type unlikely to carry taint, such as a
|
||||||
|
* numeric or boolean type.
|
||||||
|
*/
|
||||||
|
class SimpleTypeSanitizer extends DataFlow::Node {
|
||||||
|
SimpleTypeSanitizer() {
|
||||||
|
this.getType() instanceof NumericType or this.getType() instanceof BoolType
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import go
|
import go
|
||||||
|
private import semmle.go.security.Sanitizers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides extension points for customizing the taint tracking configuration for reasoning about
|
* Provides extension points for customizing the taint tracking configuration for reasoning about
|
||||||
@@ -39,12 +40,11 @@ module SqlInjection {
|
|||||||
/** A NoSql query, considered as a taint sink for SQL injection. */
|
/** A NoSql query, considered as a taint sink for SQL injection. */
|
||||||
class NoSqlQueryAsSink extends Sink instanceof NoSql::Query { }
|
class NoSqlQueryAsSink extends Sink instanceof NoSql::Query { }
|
||||||
|
|
||||||
|
/** DEPRECATED: Use `SimpleTypeSanitizer` from semmle.go.security.Sanitizers instead. */
|
||||||
|
deprecated class NumericOrBooleanSanitizer = SimpleTypeSanitizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A numeric- or boolean-typed node, considered a sanitizer for sql injection.
|
* A numeric- or boolean-typed node, considered a sanitizer for sql injection.
|
||||||
*/
|
*/
|
||||||
class NumericOrBooleanSanitizer extends Sanitizer {
|
private class DefaultSanitizer extends Sanitizer instanceof SimpleTypeSanitizer { }
|
||||||
NumericOrBooleanSanitizer() {
|
|
||||||
this.getType() instanceof NumericType or this.getType() instanceof BoolType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user