Skip to content

Commit 0c9cd09

Browse files
committed
Make NumericOrBooleanSanitizer easier to access and rename it
1 parent 2918d30 commit 0c9cd09

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Classes to represent sanitizers commonly used in dataflow and taint tracking
3+
* configurations.
4+
*/
5+
6+
import go
7+
8+
/**
9+
* A node whose type is a simple type unlikely to carry taint, such as a
10+
* numeric or boolean type.
11+
*/
12+
class SimpleTypeSanitizer extends DataFlow::Node {
13+
SimpleTypeSanitizer() {
14+
this.getType() instanceof NumericType or this.getType() instanceof BoolType
15+
}
16+
}

go/ql/lib/semmle/go/security/SqlInjectionCustomizations.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import go
7+
private import semmle.go.security.Sanitizers
78

89
/**
910
* Provides extension points for customizing the taint tracking configuration for reasoning about
@@ -39,12 +40,11 @@ module SqlInjection {
3940
/** A NoSql query, considered as a taint sink for SQL injection. */
4041
class NoSqlQueryAsSink extends Sink instanceof NoSql::Query { }
4142

43+
/** DEPRECATED: Use `SimpleTypeSanitizer` from semmle.go.security.Sanitizers instead. */
44+
deprecated class NumericOrBooleanSanitizer = SimpleTypeSanitizer;
45+
4246
/**
4347
* A numeric- or boolean-typed node, considered a sanitizer for sql injection.
4448
*/
45-
class NumericOrBooleanSanitizer extends Sanitizer {
46-
NumericOrBooleanSanitizer() {
47-
this.getType() instanceof NumericType or this.getType() instanceof BoolType
48-
}
49-
}
49+
private class DefaultSanitizer extends Sanitizer instanceof SimpleTypeSanitizer { }
5050
}

0 commit comments

Comments
 (0)