Skip to content

Commit 3d67970

Browse files
committed
Swift: query library renamings
1 parent 4c0384b commit 3d67970

21 files changed

+54
-54
lines changed

swift/ql/lib/codeql/swift/StringFormat.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import swift
77
/**
88
* A function that takes a `printf` style format argument.
99
*/
10-
abstract class FormattingFunction extends AbstractFunctionDecl {
10+
abstract class FormattingFunction extends Function {
1111
/**
1212
* Gets the position of the format argument.
1313
*/
@@ -32,7 +32,7 @@ class FormattingFunctionCall extends CallExpr {
3232
* An initializer for `String`, `NSString` or `NSMutableString` that takes a
3333
* `printf` style format argument.
3434
*/
35-
class StringInitWithFormat extends FormattingFunction, MethodDecl {
35+
class StringInitWithFormat extends FormattingFunction, Method {
3636
StringInitWithFormat() {
3737
exists(string fName |
3838
this.hasQualifiedName(["String", "NSString", "NSMutableString"], fName) and
@@ -46,7 +46,7 @@ class StringInitWithFormat extends FormattingFunction, MethodDecl {
4646
/**
4747
* The `localizedStringWithFormat` method of `String`, `NSString` and `NSMutableString`.
4848
*/
49-
class LocalizedStringWithFormat extends FormattingFunction, MethodDecl {
49+
class LocalizedStringWithFormat extends FormattingFunction, Method {
5050
LocalizedStringWithFormat() {
5151
this.hasQualifiedName(["String", "NSString", "NSMutableString"],
5252
"localizedStringWithFormat(_:_:)")
@@ -58,7 +58,7 @@ class LocalizedStringWithFormat extends FormattingFunction, MethodDecl {
5858
/**
5959
* The functions `NSLog` and `NSLogv`.
6060
*/
61-
class NsLog extends FormattingFunction, FreeFunctionDecl {
61+
class NsLog extends FormattingFunction, FreeFunction {
6262
NsLog() { this.getName() = ["NSLog(_:_:)", "NSLogv(_:_:)"] }
6363

6464
override int getFormatParameterIndex() { result = 0 }
@@ -67,7 +67,7 @@ class NsLog extends FormattingFunction, FreeFunctionDecl {
6767
/**
6868
* The `NSException.raise` method.
6969
*/
70-
class NsExceptionRaise extends FormattingFunction, MethodDecl {
70+
class NsExceptionRaise extends FormattingFunction, Method {
7171
NsExceptionRaise() { this.hasQualifiedName("NSException", "raise(_:format:arguments:)") }
7272

7373
override int getFormatParameterIndex() { result = 1 }

swift/ql/lib/codeql/swift/frameworks/AEXML.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ import swift
77
/** The creation of an `AEXMLParser`. */
88
class AexmlParser extends ApplyExpr {
99
AexmlParser() {
10-
this.getStaticTarget().(ConstructorDecl).getEnclosingDecl() instanceof AexmlParserDecl
10+
this.getStaticTarget().(Initializer).getEnclosingDecl() instanceof AexmlParserDecl
1111
}
1212
}
1313

1414
/** The creation of an `AEXMLDocument`. */
1515
class AexmlDocument extends ApplyExpr {
1616
AexmlDocument() {
17-
this.getStaticTarget().(ConstructorDecl).getEnclosingDecl() instanceof AexmlDocumentDecl
17+
this.getStaticTarget().(Initializer).getEnclosingDecl() instanceof AexmlDocumentDecl
1818
}
1919
}
2020

2121
/** A call to `AEXMLDocument.loadXML(_:)`. */
2222
class AexmlDocumentLoadXml extends MethodApplyExpr {
2323
AexmlDocumentLoadXml() {
24-
exists(MethodDecl f |
24+
exists(Method f |
2525
this.getStaticTarget() = f and
2626
f.hasName("loadXML(_:)") and
2727
f.getEnclosingDecl() instanceof AexmlDocumentDecl

swift/ql/lib/codeql/swift/frameworks/StandardLibrary/CustomUrlSchemes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private class UrlLaunchOptionsRemoteFlowSource extends RemoteFlowSource {
5151
}
5252
}
5353

54-
private class ApplicationWithLaunchOptionsFunc extends FuncDecl {
54+
private class ApplicationWithLaunchOptionsFunc extends Function {
5555
ApplicationWithLaunchOptionsFunc() {
5656
this.getName() = "application(_:" + ["did", "will"] + "FinishLaunchingWithOptions:)" and
5757
this.getEnclosingDecl().(ClassOrStructDecl).getABaseTypeDecl*().(ProtocolDecl).getName() =

swift/ql/lib/codeql/swift/frameworks/StandardLibrary/WebView.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private class AdoptsWkNavigationDelegate extends Decl {
5757
*/
5858
private class WKNavigationDelegateSource extends RemoteFlowSource {
5959
WKNavigationDelegateSource() {
60-
exists(ParamDecl p, FuncDecl f, AdoptsWkNavigationDelegate t |
60+
exists(ParamDecl p, Function f, AdoptsWkNavigationDelegate t |
6161
t.getAMember() = f and
6262
f.getName() =
6363
[
@@ -170,7 +170,7 @@ private class JsExportedType extends ClassOrStructDecl {
170170
*/
171171
private class JsExportedSource extends RemoteFlowSource {
172172
JsExportedSource() {
173-
exists(MethodDecl adopter, MethodDecl base |
173+
exists(Method adopter, Method base |
174174
base.getEnclosingDecl() instanceof JsExportedProto and
175175
adopter.getEnclosingDecl() instanceof JsExportedType
176176
|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private class CoreDataStore extends CleartextStorageDatabaseSink {
3838
// values written into Core Data objects through `set*Value` methods are a sink.
3939
exists(CallExpr call |
4040
call.getStaticTarget()
41-
.(MethodDecl)
41+
.(Method)
4242
.hasQualifiedName("NSManagedObject",
4343
["setValue(_:forKey:)", "setPrimitiveValue(_:forKey:)"]) and
4444
call.getArgument(0).getExpr() = this.asExpr()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CleartextStoragePreferencesAdditionalTaintStep extends Unit {
3737
private class UserDefaultsStore extends CleartextStoragePreferencesSink {
3838
UserDefaultsStore() {
3939
exists(CallExpr call |
40-
call.getStaticTarget().(MethodDecl).hasQualifiedName("UserDefaults", "set(_:forKey:)") and
40+
call.getStaticTarget().(Method).hasQualifiedName("UserDefaults", "set(_:forKey:)") and
4141
call.getArgument(0).getExpr() = this.asExpr()
4242
)
4343
}
@@ -50,7 +50,7 @@ private class NSUbiquitousKeyValueStore extends CleartextStoragePreferencesSink
5050
NSUbiquitousKeyValueStore() {
5151
exists(CallExpr call |
5252
call.getStaticTarget()
53-
.(MethodDecl)
53+
.(Method)
5454
.hasQualifiedName("NSUbiquitousKeyValueStore", "set(_:forKey:)") and
5555
call.getArgument(0).getExpr() = this.asExpr()
5656
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private class NWConnectionSendSink extends CleartextTransmissionSink {
3838
// `content` arg to `NWConnection.send` is a sink
3939
exists(CallExpr call |
4040
call.getStaticTarget()
41-
.(MethodDecl)
41+
.(Method)
4242
.hasQualifiedName("NWConnection", "send(content:contentContext:isComplete:completion:)") and
4343
call.getArgument(0).getExpr() = this.asExpr()
4444
)
@@ -55,7 +55,7 @@ private class UrlSink extends CleartextTransmissionSink {
5555
// (we assume here that the URL goes on to be used in a network operation)
5656
exists(CallExpr call |
5757
call.getStaticTarget()
58-
.(MethodDecl)
58+
.(Method)
5959
.hasQualifiedName("URL", ["init(string:)", "init(string:relativeTo:)"]) and
6060
call.getArgument(0).getExpr() = this.asExpr()
6161
)
@@ -70,7 +70,7 @@ private class AlamofireTransmittedSink extends CleartextTransmissionSink {
7070
// sinks are the first argument containing the URL, and the `parameters`
7171
// and `headers` arguments to appropriate methods of `Session`.
7272
exists(CallExpr call, string fName |
73-
call.getStaticTarget().(MethodDecl).hasQualifiedName("Session", fName) and
73+
call.getStaticTarget().(Method).hasQualifiedName("Session", fName) and
7474
fName.regexpMatch("(request|streamRequest|download)\\(.*") and
7575
(
7676
call.getArgument(0).getExpr() = this.asExpr() or

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ConstantPasswordAdditionalTaintStep extends Unit {
3535
private class CryptoSwiftPasswordSink extends ConstantPasswordSink {
3636
CryptoSwiftPasswordSink() {
3737
// `password` arg in `init` is a sink
38-
exists(NominalTypeDecl c, ConstructorDecl f, CallExpr call |
38+
exists(NominalTypeDecl c, Initializer f, CallExpr call |
3939
c.getName() = ["HKDF", "PBKDF1", "PBKDF2", "Scrypt"] and
4040
c.getAMember() = f and
4141
call.getStaticTarget() = f and
@@ -50,7 +50,7 @@ private class CryptoSwiftPasswordSink extends ConstantPasswordSink {
5050
private class RnCryptorPasswordSink extends ConstantPasswordSink {
5151
RnCryptorPasswordSink() {
5252
// RNCryptor (labelled arguments)
53-
exists(NominalTypeDecl c, MethodDecl f, CallExpr call |
53+
exists(NominalTypeDecl c, Method f, CallExpr call |
5454
c.getFullName() =
5555
[
5656
"RNCryptor", "RNEncryptor", "RNDecryptor", "RNCryptor.EncryptorV3",
@@ -63,7 +63,7 @@ private class RnCryptorPasswordSink extends ConstantPasswordSink {
6363
)
6464
or
6565
// RNCryptor (unlabelled arguments)
66-
exists(MethodDecl f, CallExpr call |
66+
exists(Method f, CallExpr call |
6767
f.hasQualifiedName("RNCryptor", "keyForPassword(_:salt:settings:)") and
6868
call.getStaticTarget() = f and
6969
call.getArgument(0).getExpr() = this.asExpr()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ConstantSaltAdditionalTaintStep extends Unit {
3535
private class CryptoSwiftSaltSink extends ConstantSaltSink {
3636
CryptoSwiftSaltSink() {
3737
// `salt` arg in `init` is a sink
38-
exists(NominalTypeDecl c, ConstructorDecl f, CallExpr call |
38+
exists(NominalTypeDecl c, Initializer f, CallExpr call |
3939
c.getName() = ["HKDF", "PBKDF1", "PBKDF2", "Scrypt"] and
4040
c.getAMember() = f and
4141
call.getStaticTarget() = f and
@@ -49,7 +49,7 @@ private class CryptoSwiftSaltSink extends ConstantSaltSink {
4949
*/
5050
private class RnCryptorSaltSink extends ConstantSaltSink {
5151
RnCryptorSaltSink() {
52-
exists(NominalTypeDecl c, MethodDecl f, CallExpr call |
52+
exists(NominalTypeDecl c, Method f, CallExpr call |
5353
c.getFullName() =
5454
[
5555
"RNCryptor", "RNEncryptor", "RNDecryptor", "RNCryptor.EncryptorV3",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class EcbEncryptionAdditionalTaintStep extends Unit {
4343
private class CryptoSwiftEcb extends EcbEncryptionSource {
4444
CryptoSwiftEcb() {
4545
exists(CallExpr call |
46-
call.getStaticTarget().(MethodDecl).hasQualifiedName("ECB", "init()") and
46+
call.getStaticTarget().(Method).hasQualifiedName("ECB", "init()") and
4747
this.asExpr() = call
4848
)
4949
}

0 commit comments

Comments
 (0)