Skip to content

Commit df29f39

Browse files
committed
Swift: Update uses of getABaseType() and similar to do things correctly now.
1 parent 37edcad commit df29f39

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ predicate defaultImplicitTaintRead(DataFlow::Node node, DataFlow::ContentSet cs)
3131
// So when the node is a `PostUpdateNode` we allow any sequence of implicit read steps of an appropriate
3232
// type to make sure we arrive at the sink with an empty access path.
3333
exists(NominalTypeDecl d, Decl cx |
34-
node.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr().getType() =
34+
node.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr().getType().getUnderlyingType() =
3535
d.getType().getABaseType*() and
3636
cx.asNominalTypeDecl() = d and
3737
cs.getAReadContent().(DataFlow::Content::FieldContent).getField() = cx.getAMember()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private class CoreDataStore extends CleartextStorageDatabaseSink {
4949
// with `coreDataObj.data` is a sink.
5050
// (ideally this would be only members with the `@NSManaged` attribute)
5151
exists(NominalType t, Expr e |
52-
t.getABaseType*().getUnderlyingType().getName() = "NSManagedObject" and
52+
t.getUnderlyingType().getABaseType*().getName() = "NSManagedObject" and
5353
this.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr() = e and
5454
e.getFullyConverted().getType() = t and
5555
not e.(DeclRefExpr).getDecl() instanceof SelfParamDecl
@@ -67,7 +67,7 @@ private class RealmStore extends CleartextStorageDatabaseSink instanceof DataFlo
6767
// example in `realmObj.data = sensitive` the post-update node corresponding
6868
// with `realmObj.data` is a sink.
6969
exists(NominalType t, Expr e |
70-
t.getABaseType*().getUnderlyingType().getName() = "RealmSwiftObject" and
70+
t.getUnderlyingType().getABaseType*().getName() = "RealmSwiftObject" and
7171
this.getPreUpdateNode().asExpr() = e and
7272
e.getFullyConverted().getType() = t and
7373
not e.(DeclRefExpr).getDecl() instanceof SelfParamDecl

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module CleartextStorageDatabaseConfig implements DataFlow::ConfigSig {
3434
// for example in `realmObj.data = sensitive`.
3535
isSink(node) and
3636
exists(NominalTypeDecl d, Decl cx |
37-
d.getType().getABaseType*().getUnderlyingType().getName() =
37+
d.getType().getUnderlyingType().getABaseType*().getName() =
3838
["NSManagedObject", "RealmSwiftObject"] and
3939
cx.asNominalTypeDecl() = d and
4040
c.getAReadContent().(DataFlow::Content::FieldContent).getField() = cx.getAMember()

0 commit comments

Comments
 (0)