Skip to content

Commit e846855

Browse files
committed
Go: Remove deprecated configuration classes referencing deleted api.
1 parent dbb260d commit e846855

23 files changed

+0
-795
lines changed

go/ql/lib/go.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ import semmle.go.controlflow.BasicBlocks
2525
import semmle.go.controlflow.ControlFlowGraph
2626
import semmle.go.controlflow.IR
2727
import semmle.go.dataflow.DataFlow
28-
import semmle.go.dataflow.DataFlow2
2928
import semmle.go.dataflow.GlobalValueNumbering
3029
import semmle.go.dataflow.SSA
3130
import semmle.go.dataflow.TaintTracking
32-
import semmle.go.dataflow.TaintTracking2
3331
import semmle.go.frameworks.Afero
3432
import semmle.go.frameworks.AwsLambda
3533
import semmle.go.frameworks.Beego

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

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,6 @@ import go
1616
module CleartextLogging {
1717
import CleartextLoggingCustomizations::CleartextLogging
1818

19-
/**
20-
* DEPRECATED: Use `Flow` instead.
21-
*
22-
* A data-flow tracking configuration for clear-text logging of sensitive information.
23-
*
24-
* This configuration identifies flows from `Source`s, which are sources of
25-
* sensitive data, to `Sink`s, which is an abstract class representing all
26-
* the places sensitive data may be stored in cleartext. Additional sources or sinks can be
27-
* added either by extending the relevant class, or by subclassing this configuration itself,
28-
* and amending the sources and sinks.
29-
*/
30-
deprecated class Configuration extends DataFlow::Configuration {
31-
Configuration() { this = "CleartextLogging" }
32-
33-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
34-
35-
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
36-
37-
override predicate isBarrier(DataFlow::Node node) {
38-
node instanceof Barrier
39-
or
40-
exists(DataFlow::CallNode call | node = call.getResult() |
41-
call.getTarget() = Builtin::error().getType().getMethod("Error")
42-
or
43-
call.getTarget().(Method).hasQualifiedName("fmt", "Stringer", "String")
44-
)
45-
}
46-
47-
override predicate isAdditionalFlowStep(DataFlow::Node src, DataFlow::Node trg) {
48-
// A taint propagating data-flow edge through structs: a tainted write taints the entire struct.
49-
exists(Write write |
50-
write.writesField(trg.(DataFlow::PostUpdateNode).getPreUpdateNode(), _, src)
51-
)
52-
or
53-
// taint steps that do not include flow through fields. Field reads would produce FPs due to
54-
// the additional taint step above that taints whole structs from individual field writes.
55-
TaintTracking::localTaintStep(src, trg) and
56-
not TaintTracking::fieldReadStep(src, trg) and
57-
// Also exclude protobuf field fetches, since they amount to single field reads.
58-
not any(Protobuf::GetMethod gm).taintStep(src, trg)
59-
}
60-
}
61-
6219
private module Config implements DataFlow::ConfigSig {
6320
predicate isSource(DataFlow::Node source) { source instanceof Source }
6421

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

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -53,132 +53,6 @@ int getIntTypeBitSize(File file, int architectureSpecificBitSize) {
5353
result = architectureSpecificBitSize
5454
}
5555

56-
/**
57-
* Holds if converting from an integer types with size `sourceBitSize` to
58-
* one with size `sinkBitSize` can produce unexpected values, where 0 means
59-
* architecture-dependent.
60-
*
61-
* Architecture-dependent bit sizes can be 32 or 64. To catch flows that
62-
* only manifest on 64-bit architectures we consider an
63-
* architecture-dependent source bit size to be 64. To catch flows that
64-
* only happen on 32-bit architectures we consider an
65-
* architecture-dependent sink bit size to be 32. We exclude the case where
66-
* both source and sink have architecture-dependent bit sizes.
67-
*/
68-
private predicate isIncorrectIntegerConversion(int sourceBitSize, int sinkBitSize) {
69-
sourceBitSize in [16, 32, 64] and
70-
sinkBitSize in [8, 16, 32] and
71-
sourceBitSize > sinkBitSize
72-
or
73-
// Treat `sourceBitSize = 0` like `sourceBitSize = 64`, and exclude `sinkBitSize = 0`
74-
sourceBitSize = 0 and
75-
sinkBitSize in [8, 16, 32]
76-
or
77-
// Treat `sinkBitSize = 0` like `sinkBitSize = 32`, and exclude `sourceBitSize = 0`
78-
sourceBitSize = 64 and
79-
sinkBitSize = 0
80-
}
81-
82-
/**
83-
* DEPRECATED: use `Flow` instead.
84-
*
85-
* A taint-tracking configuration for reasoning about when an integer
86-
* obtained from parsing a string flows to a type conversion to a smaller
87-
* integer types, which could cause unexpected values.
88-
*/
89-
deprecated class ConversionWithoutBoundsCheckConfig extends TaintTracking::Configuration {
90-
boolean sinkIsSigned;
91-
int sourceBitSize;
92-
int sinkBitSize;
93-
94-
ConversionWithoutBoundsCheckConfig() {
95-
sinkIsSigned in [true, false] and
96-
isIncorrectIntegerConversion(sourceBitSize, sinkBitSize) and
97-
this = "ConversionWithoutBoundsCheckConfig" + sourceBitSize + sinkIsSigned + sinkBitSize
98-
}
99-
100-
/** Gets the bit size of the source. */
101-
int getSourceBitSize() { result = sourceBitSize }
102-
103-
override predicate isSource(DataFlow::Node source) {
104-
exists(
105-
DataFlow::CallNode c, IntegerParser::Range ip, int apparentBitSize, int effectiveBitSize
106-
|
107-
c.getTarget() = ip and source = c.getResult(0)
108-
|
109-
(
110-
apparentBitSize = ip.getTargetBitSize()
111-
or
112-
// If we are reading a variable, check if it is
113-
// `strconv.IntSize`, and use 0 if it is.
114-
exists(DataFlow::Node rawBitSize | rawBitSize = ip.getTargetBitSizeInput().getNode(c) |
115-
if rawBitSize = any(Strconv::IntSize intSize).getARead()
116-
then apparentBitSize = 0
117-
else apparentBitSize = rawBitSize.getIntValue()
118-
)
119-
) and
120-
(
121-
if apparentBitSize = 0
122-
then effectiveBitSize = getIntTypeBitSize(source.getFile(), 0)
123-
else effectiveBitSize = apparentBitSize
124-
) and
125-
// `effectiveBitSize` could be any value between 0 and 64, but we
126-
// can round it up to the nearest size of an integer type without
127-
// changing behavior.
128-
sourceBitSize = min(int b | b in [0, 8, 16, 32, 64] and b >= effectiveBitSize)
129-
)
130-
}
131-
132-
/**
133-
* Holds if `sink` is a typecast to an integer type with size `bitSize` (where
134-
* 0 represents architecture-dependent) and the expression being typecast is
135-
* not also in a right-shift expression. We allow this case because it is
136-
* a common pattern to serialise `byte(v)`, `byte(v >> 8)`, and so on.
137-
*/
138-
predicate isSinkWithBitSize(DataFlow::TypeCastNode sink, int bitSize) {
139-
sink.asExpr() instanceof ConversionExpr and
140-
exists(IntegerType integerType | sink.getResultType().getUnderlyingType() = integerType |
141-
(
142-
bitSize = integerType.getSize()
143-
or
144-
not exists(integerType.getSize()) and
145-
bitSize = getIntTypeBitSize(sink.getFile(), 0)
146-
) and
147-
if integerType instanceof SignedIntegerType then sinkIsSigned = true else sinkIsSigned = false
148-
) and
149-
not exists(ShrExpr shrExpr |
150-
shrExpr.getLeftOperand().getGlobalValueNumber() =
151-
sink.getOperand().asExpr().getGlobalValueNumber() or
152-
shrExpr.getLeftOperand().(AndExpr).getAnOperand().getGlobalValueNumber() =
153-
sink.getOperand().asExpr().getGlobalValueNumber()
154-
)
155-
}
156-
157-
override predicate isSink(DataFlow::Node sink) {
158-
// We use the argument of the type conversion as the configuration sink so that we
159-
// can sanitize the result of the conversion to prevent flow on to further sinks
160-
// without needing to use `isSanitizerOut`, which doesn't work with flow states
161-
// (and therefore the legacy `TaintTracking::Configuration` class).
162-
this.isSinkWithBitSize(sink.getASuccessor(), sinkBitSize)
163-
}
164-
165-
override predicate isSanitizer(DataFlow::Node node) {
166-
// To catch flows that only happen on 32-bit architectures we
167-
// consider an architecture-dependent sink bit size to be 32.
168-
exists(UpperBoundCheckGuard g, int bitSize |
169-
if sinkBitSize != 0 then bitSize = sinkBitSize else bitSize = 32
170-
|
171-
node = DataFlow::BarrierGuard<upperBoundCheckGuard/3>::getABarrierNodeForGuard(g) and
172-
if sinkIsSigned = true then g.isBoundFor(bitSize, 32) else g.isBoundFor(bitSize - 1, 32)
173-
)
174-
or
175-
exists(int bitSize |
176-
isIncorrectIntegerConversion(sourceBitSize, bitSize) and
177-
this.isSinkWithBitSize(node, bitSize)
178-
)
179-
}
180-
}
181-
18256
private int validBitSize() { result = [7, 8, 15, 16, 31, 32, 63, 64] }
18357

18458
private newtype TArchitectureBitSize =

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

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,6 @@ import go
1616
module InsecureRandomness {
1717
import InsecureRandomnessCustomizations::InsecureRandomness
1818

19-
/**
20-
* DEPRECATED: Use `Flow` instead.
21-
*
22-
* A taint-tracking configuration for reasoning about random values that are
23-
* not cryptographically secure.
24-
*/
25-
deprecated class Configuration extends TaintTracking::Configuration {
26-
Configuration() { this = "InsecureRandomness" }
27-
28-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
29-
30-
override predicate isSink(DataFlow::Node sink) { this.isSinkWithKind(sink, _) }
31-
32-
/** Holds if `sink` is a sink for this configuration with kind `kind`. */
33-
predicate isSinkWithKind(Sink sink, string kind) { kind = sink.getKind() }
34-
35-
override predicate isSanitizer(DataFlow::Node node) { node instanceof Sanitizer }
36-
}
37-
3819
/** Holds if `sink` is a sink for this configuration with kind `kind`. */
3920
predicate isSinkWithKind(Sink sink, string kind) { kind = sink.getKind() }
4021

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

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,6 @@ import UrlConcatenation
1717
module OpenUrlRedirect {
1818
import OpenUrlRedirectCustomizations::OpenUrlRedirect
1919

20-
/**
21-
* DEPRECATED: Use `Flow` instead.
22-
*
23-
* A data-flow configuration for reasoning about unvalidated URL redirections.
24-
*/
25-
deprecated class Configuration extends DataFlow::Configuration {
26-
Configuration() { this = "OpenUrlRedirect" }
27-
28-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
29-
30-
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
31-
32-
override predicate isBarrier(DataFlow::Node node) { node instanceof Barrier }
33-
34-
override predicate isAdditionalFlowStep(DataFlow::Node pred, DataFlow::Node succ) {
35-
// taint steps that do not include flow through fields
36-
TaintTracking::localTaintStep(pred, succ) and not TaintTracking::fieldReadStep(pred, succ)
37-
or
38-
// explicit extra taint steps for this query
39-
any(AdditionalStep s).hasTaintStep(pred, succ)
40-
or
41-
// propagate to a URL when its host is assigned to
42-
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
43-
w.writesField(v.getAUse(), f, pred) and succ = v.getAUse()
44-
)
45-
or
46-
// propagate out of most URL fields, but not `ForceQuery` and `Scheme`
47-
exists(Field f, string fn |
48-
f.hasQualifiedName("net/url", "URL", fn) and
49-
not fn in ["ForceQuery", "Scheme"]
50-
|
51-
succ.(Read).readsField(pred, f)
52-
)
53-
}
54-
55-
override predicate isBarrierOut(DataFlow::Node node) {
56-
// block propagation of this unsafe value when its host is overwritten
57-
exists(Write w, Field f | f.hasQualifiedName("net/url", "URL", "Host") |
58-
w.writesField(node.getASuccessor(), f, _)
59-
)
60-
or
61-
hostnameSanitizingPrefixEdge(node, _)
62-
}
63-
}
64-
6520
private module Config implements DataFlow::ConfigSig {
6621
predicate isSource(DataFlow::Node source) { source instanceof Source }
6722

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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,6 @@ import go
1616
module ReflectedXss {
1717
import ReflectedXssCustomizations::ReflectedXss
1818

19-
/**
20-
* DEPRECATED: Use `Flow` instead.
21-
*
22-
* A taint-tracking configuration for reasoning about XSS.
23-
*/
24-
deprecated class Configuration extends TaintTracking::Configuration {
25-
Configuration() { this = "ReflectedXss" }
26-
27-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
28-
29-
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
30-
31-
override predicate isSanitizer(DataFlow::Node node) {
32-
super.isSanitizer(node) or
33-
node instanceof Sanitizer
34-
}
35-
}
36-
3719
private module Config implements DataFlow::ConfigSig {
3820
predicate isSource(DataFlow::Node source) { source instanceof Source }
3921

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

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,6 @@ import go
1616
module RequestForgery {
1717
import RequestForgeryCustomizations::RequestForgery
1818

19-
/**
20-
* DEPRECATED: Use `Flow` instead.
21-
*
22-
* A taint-tracking configuration for reasoning about request forgery.
23-
*/
24-
deprecated class Configuration extends TaintTracking::Configuration {
25-
Configuration() { this = "RequestForgery" }
26-
27-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
28-
29-
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
30-
31-
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
32-
// propagate to a URL when its host is assigned to
33-
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
34-
w.writesField(v.getAUse(), f, pred) and succ = v.getAUse()
35-
)
36-
}
37-
38-
override predicate isSanitizer(DataFlow::Node node) {
39-
super.isSanitizer(node) or
40-
node instanceof Sanitizer
41-
}
42-
43-
override predicate isSanitizerOut(DataFlow::Node node) {
44-
super.isSanitizerOut(node) or
45-
node instanceof SanitizerEdge
46-
}
47-
}
48-
4919
private module Config implements DataFlow::ConfigSig {
5020
predicate isSource(DataFlow::Node source) { source instanceof Source }
5121

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,6 @@ import go
1616
module SafeUrlFlow {
1717
import SafeUrlFlowCustomizations::SafeUrlFlow
1818

19-
/**
20-
* DEPRECATED: Use `Flow` instead.
21-
*
22-
* A taint-tracking configuration for reasoning about safe URLs.
23-
*/
24-
deprecated class Configuration extends TaintTracking::Configuration {
25-
Configuration() { this = "SafeUrlFlow" }
26-
27-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
28-
29-
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
30-
31-
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
32-
// propagate to a URL when its host is assigned to
33-
exists(Write w, Field f, SsaWithFields v | f.hasQualifiedName("net/url", "URL", "Host") |
34-
w.writesField(v.getAUse(), f, pred) and succ = v.getAUse()
35-
)
36-
}
37-
38-
override predicate isSanitizerOut(DataFlow::Node node) {
39-
// block propagation of this safe value when its host is overwritten
40-
exists(Write w, Field f | f.hasQualifiedName("net/url", "URL", "Host") |
41-
w.writesField(node.getASuccessor(), f, _)
42-
)
43-
or
44-
node instanceof SanitizerEdge
45-
}
46-
}
47-
4819
private module Config implements DataFlow::ConfigSig {
4920
predicate isSource(DataFlow::Node source) { source instanceof Source }
5021

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

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,6 @@ import go
1313
module SqlInjection {
1414
import SqlInjectionCustomizations::SqlInjection
1515

16-
/**
17-
* DEPRECATED: Use `Flow` instead.
18-
*
19-
* A taint-tracking configuration for reasoning about SQL-injection vulnerabilities.
20-
*/
21-
deprecated class Configuration extends TaintTracking::Configuration {
22-
Configuration() { this = "SqlInjection" }
23-
24-
override predicate isSource(DataFlow::Node source) { source instanceof Source }
25-
26-
override predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
27-
28-
override predicate isAdditionalTaintStep(DataFlow::Node pred, DataFlow::Node succ) {
29-
NoSql::isAdditionalMongoTaintStep(pred, succ)
30-
}
31-
32-
override predicate isSanitizer(DataFlow::Node node) {
33-
super.isSanitizer(node) or
34-
node instanceof Sanitizer
35-
}
36-
}
37-
3816
private module Config implements DataFlow::ConfigSig {
3917
predicate isSource(DataFlow::Node source) { source instanceof Source }
4018

0 commit comments

Comments
 (0)