Skip to content

Commit dfbe08d

Browse files
authored
Merge pull request #19518 from jketema/depr
C++/Swift: delete outdated deprecations
2 parents adb7410 + 673655e commit dfbe08d

File tree

10 files changed

+19
-215
lines changed

10 files changed

+19
-215
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
category: breaking
3+
---
4+
* Deleted the deprecated `userInputArgument` predicate and its convenience accessor from the `Security.qll`.
5+
* Deleted the deprecated `userInputReturned` predicate and its convenience accessor from the `Security.qll`.
6+
* Deleted the deprecated `userInputReturn` predicate from the `Security.qll`.
7+
* Deleted the deprecated `isUserInput` predicate and its convenience accessor from the `Security.qll`.
8+
* Deleted the deprecated `userInputArgument` predicate from the `SecurityOptions.qll`.
9+
* Deleted the deprecated `userInputReturned` predicate from the `SecurityOptions.qll`.

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowUtil.qll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,6 @@ class Node extends TNode {
9898
/** Gets the location of this element. */
9999
Location getLocation() { none() } // overridden by subclasses
100100

101-
/**
102-
* Holds if this element is at the specified location.
103-
* The location spans column `startcolumn` of line `startline` to
104-
* column `endcolumn` of line `endline` in file `filepath`.
105-
* For more information, see
106-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
107-
*/
108-
deprecated predicate hasLocationInfo(
109-
string filepath, int startline, int startcolumn, int endline, int endcolumn
110-
) {
111-
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
112-
}
113-
114101
/**
115102
* Gets an upper bound on the type of this node.
116103
*/

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -538,19 +538,6 @@ class Node extends TIRDataFlowNode {
538538
none() // overridden by subclasses
539539
}
540540

541-
/**
542-
* Holds if this element is at the specified location.
543-
* The location spans column `startcolumn` of line `startline` to
544-
* column `endcolumn` of line `endline` in file `filepath`.
545-
* For more information, see
546-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
547-
*/
548-
deprecated predicate hasLocationInfo(
549-
string filepath, int startline, int startcolumn, int endline, int endcolumn
550-
) {
551-
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
552-
}
553-
554541
/** Gets a textual representation of this element. */
555542
cached
556543
final string toString() {

cpp/ql/lib/semmle/code/cpp/security/Security.qll

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -42,58 +42,6 @@ class SecurityOptions extends string {
4242
)
4343
}
4444

45-
/**
46-
* The argument of the given function is filled in from user input.
47-
*/
48-
deprecated predicate userInputArgument(FunctionCall functionCall, int arg) {
49-
exists(string fname |
50-
functionCall.getTarget().hasGlobalOrStdName(fname) and
51-
exists(functionCall.getArgument(arg)) and
52-
(
53-
fname = ["fread", "fgets", "fgetws", "gets"] and arg = 0
54-
or
55-
fname = "scanf" and arg >= 1
56-
or
57-
fname = "fscanf" and arg >= 2
58-
)
59-
or
60-
functionCall.getTarget().hasGlobalName(fname) and
61-
exists(functionCall.getArgument(arg)) and
62-
fname = "getaddrinfo" and
63-
arg = 3
64-
)
65-
or
66-
exists(RemoteFlowSourceFunction remote, FunctionOutput output |
67-
functionCall.getTarget() = remote and
68-
output.isParameterDerefOrQualifierObject(arg) and
69-
remote.hasRemoteFlowSource(output, _)
70-
)
71-
}
72-
73-
/**
74-
* The return value of the given function is filled in from user input.
75-
*/
76-
deprecated predicate userInputReturned(FunctionCall functionCall) {
77-
exists(string fname |
78-
functionCall.getTarget().getName() = fname and
79-
(
80-
fname = ["fgets", "gets"] or
81-
this.userInputReturn(fname)
82-
)
83-
)
84-
or
85-
exists(RemoteFlowSourceFunction remote, FunctionOutput output |
86-
functionCall.getTarget() = remote and
87-
(output.isReturnValue() or output.isReturnValueDeref()) and
88-
remote.hasRemoteFlowSource(output, _)
89-
)
90-
}
91-
92-
/**
93-
* DEPRECATED: Users should override `userInputReturned()` instead.
94-
*/
95-
deprecated predicate userInputReturn(string function) { none() }
96-
9745
/**
9846
* The argument of the given function is used for running a process or loading
9947
* a library.
@@ -108,29 +56,6 @@ class SecurityOptions extends string {
10856
function = ["LoadLibrary", "LoadLibraryA", "LoadLibraryW"] and arg = 0
10957
}
11058

111-
/**
112-
* This predicate should hold if the expression is directly
113-
* computed from user input. Such expressions are treated as
114-
* sources of taint.
115-
*/
116-
deprecated predicate isUserInput(Expr expr, string cause) {
117-
exists(FunctionCall fc, int i |
118-
this.userInputArgument(fc, i) and
119-
expr = fc.getArgument(i) and
120-
cause = fc.getTarget().getName()
121-
)
122-
or
123-
exists(FunctionCall fc |
124-
this.userInputReturned(fc) and
125-
expr = fc and
126-
cause = fc.getTarget().getName()
127-
)
128-
or
129-
commandLineArg(expr) and cause = "argv"
130-
or
131-
expr.(EnvironmentRead).getSourceDescription() = cause
132-
}
133-
13459
/**
13560
* This predicate should hold if the expression raises privilege for the
13661
* current session. The default definition only holds true for some
@@ -152,16 +77,6 @@ class SecurityOptions extends string {
15277
}
15378
}
15479

155-
/**
156-
* An access to the argv argument to main().
157-
*/
158-
private predicate commandLineArg(Expr e) {
159-
exists(Parameter argv |
160-
argv(argv) and
161-
argv.getAnAccess() = e
162-
)
163-
}
164-
16580
/** The argv parameter to the main function */
16681
predicate argv(Parameter argv) {
16782
exists(Function f |
@@ -173,21 +88,6 @@ predicate argv(Parameter argv) {
17388
/** Convenience accessor for SecurityOptions.isPureFunction */
17489
predicate isPureFunction(string name) { exists(SecurityOptions opts | opts.isPureFunction(name)) }
17590

176-
/** Convenience accessor for SecurityOptions.userInputArgument */
177-
deprecated predicate userInputArgument(FunctionCall functionCall, int arg) {
178-
exists(SecurityOptions opts | opts.userInputArgument(functionCall, arg))
179-
}
180-
181-
/** Convenience accessor for SecurityOptions.userInputReturn */
182-
deprecated predicate userInputReturned(FunctionCall functionCall) {
183-
exists(SecurityOptions opts | opts.userInputReturned(functionCall))
184-
}
185-
186-
/** Convenience accessor for SecurityOptions.isUserInput */
187-
deprecated predicate isUserInput(Expr expr, string cause) {
188-
exists(SecurityOptions opts | opts.isUserInput(expr, cause))
189-
}
190-
19191
/** Convenience accessor for SecurityOptions.isProcessOperationArgument */
19292
predicate isProcessOperationArgument(string function, int arg) {
19393
exists(SecurityOptions opts | opts.isProcessOperationArgument(function, arg))

cpp/ql/lib/semmle/code/cpp/security/SecurityOptions.qll

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,4 @@ class CustomSecurityOptions extends SecurityOptions {
2222
// for example: (function = "MySpecialSqlFunction" and arg = 0)
2323
none() // rules to match custom functions replace this line
2424
}
25-
26-
deprecated override predicate userInputArgument(FunctionCall functionCall, int arg) {
27-
SecurityOptions.super.userInputArgument(functionCall, arg)
28-
or
29-
exists(string fname |
30-
functionCall.getTarget().hasGlobalName(fname) and
31-
exists(functionCall.getArgument(arg)) and
32-
// --- custom functions that return user input via one of their arguments:
33-
// 'arg' is the 0-based index of the argument that is used to return user input
34-
// for example: (fname = "readXmlInto" and arg = 1)
35-
none() // rules to match custom functions replace this line
36-
)
37-
}
38-
39-
deprecated override predicate userInputReturned(FunctionCall functionCall) {
40-
SecurityOptions.super.userInputReturned(functionCall)
41-
or
42-
exists(string fname |
43-
functionCall.getTarget().hasGlobalName(fname) and
44-
// --- custom functions that return user input via their return value:
45-
// for example: fname = "xmlReadAttribute"
46-
none() // rules to match custom functions replace this line
47-
)
48-
}
4925
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
category: breaking
3+
---
4+
* Deleted the deprecated `parseContent` predicate from the `ExternalFlow.qll`.
5+
* Deleted the deprecated `hasLocationInfo` predicate from the `DataFlowPublic.qll`.
6+
* Deleted the deprecated `SummaryComponent` class from the `FlowSummary.qll`.
7+
* Deleted the deprecated `SummaryComponentStack` class from the `FlowSummary.qll`.
8+
* Deleted the deprecated `SummaryComponent` module from the `FlowSummary.qll`.
9+
* Deleted the deprecated `SummaryComponentStack` module from the `FlowSummary.qll`.
10+
* Deleted the deprecated `RequiredSummaryComponentStack` class from the `FlowSummary.qll`.

swift/ql/lib/codeql/swift/dataflow/ExternalFlow.qll

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -446,44 +446,6 @@ Element interpretElement(
446446
)
447447
}
448448

449-
deprecated private predicate parseField(AccessPathToken c, Content::FieldContent f) {
450-
exists(string fieldRegex, string name |
451-
c.getName() = "Field" and
452-
fieldRegex = "^([^.]+)$" and
453-
name = c.getAnArgument().regexpCapture(fieldRegex, 1) and
454-
f.getField().getName() = name
455-
)
456-
}
457-
458-
deprecated private predicate parseTuple(AccessPathToken c, Content::TupleContent t) {
459-
c.getName() = "TupleElement" and
460-
t.getIndex() = c.getAnArgument().toInt()
461-
}
462-
463-
deprecated private predicate parseEnum(AccessPathToken c, Content::EnumContent e) {
464-
c.getName() = "EnumElement" and
465-
c.getAnArgument() = e.getSignature()
466-
or
467-
c.getName() = "OptionalSome" and
468-
e.getSignature() = "some:0"
469-
}
470-
471-
/** Holds if the specification component parses as a `Content`. */
472-
deprecated predicate parseContent(AccessPathToken component, Content content) {
473-
parseField(component, content)
474-
or
475-
parseTuple(component, content)
476-
or
477-
parseEnum(component, content)
478-
or
479-
// map legacy "ArrayElement" specification components to `CollectionContent`
480-
component.getName() = "ArrayElement" and
481-
content instanceof Content::CollectionContent
482-
or
483-
component.getName() = "CollectionElement" and
484-
content instanceof Content::CollectionContent
485-
}
486-
487449
cached
488450
private module Cached {
489451
/**

swift/ql/lib/codeql/swift/dataflow/FlowSummary.qll

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,4 @@ private module Summaries {
1313
private import codeql.swift.frameworks.Frameworks
1414
}
1515

16-
deprecated class SummaryComponent = Impl::Private::SummaryComponent;
17-
18-
deprecated module SummaryComponent = Impl::Private::SummaryComponent;
19-
20-
deprecated class SummaryComponentStack = Impl::Private::SummaryComponentStack;
21-
22-
deprecated module SummaryComponentStack = Impl::Private::SummaryComponentStack;
23-
2416
class SummarizedCallable = Impl::Public::SummarizedCallable;
25-
26-
deprecated class RequiredSummaryComponentStack = Impl::Private::RequiredSummaryComponentStack;

swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPublic.qll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ class Node extends TNode {
1919
cached
2020
final Location getLocation() { result = this.(NodeImpl).getLocationImpl() }
2121

22-
/**
23-
* Holds if this element is at the specified location.
24-
* The location spans column `startcolumn` of line `startline` to
25-
* column `endcolumn` of line `endline` in file `filepath`.
26-
* For more information, see
27-
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
28-
*/
29-
deprecated predicate hasLocationInfo(
30-
string filepath, int startline, int startcolumn, int endline, int endcolumn
31-
) {
32-
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
33-
}
34-
3522
/**
3623
* Gets the expression that corresponds to this node, if any.
3724
*/

swift/ql/lib/codeql/swift/security/WeakSensitiveDataHashingQuery.qll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,4 @@ module WeakSensitiveDataHashingConfig implements DataFlow::ConfigSig {
4040
}
4141
}
4242

43-
deprecated module WeakHashingConfig = WeakSensitiveDataHashingConfig;
44-
4543
module WeakSensitiveDataHashingFlow = TaintTracking::Global<WeakSensitiveDataHashingConfig>;
46-
47-
deprecated module WeakHashingFlow = WeakSensitiveDataHashingFlow;

0 commit comments

Comments
 (0)