Skip to content

Commit f3ea75d

Browse files
committed
Swift: Further modelling updates / gap filling that doesn't seem to affect tests.
1 parent 954fbc4 commit f3ea75d

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,35 @@ private class CollectionSummaries extends SummaryModelCsv {
1515
row =
1616
[
1717
";Collection;true;prefix(_:);;;Argument[-1];ReturnValue;taint",
18+
";Collection;true;prefix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
1819
";Collection;true;prefix(through:);;;Argument[-1];ReturnValue;taint",
20+
";Collection;true;prefix(through:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
1921
";Collection;true;prefix(upTo:);;;Argument[-1];ReturnValue;taint",
22+
";Collection;true;prefix(upTo:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
2023
";Collection;true;prefix(while:);;;Argument[-1];ReturnValue;taint",
24+
";Collection;true;prefix(while:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
2125
";Collection;true;suffix(_:);;;Argument[-1];ReturnValue;taint",
26+
";Collection;true;suffix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
2227
";Collection;true;suffix(from:);;;Argument[-1];ReturnValue;taint",
28+
";Collection;true;suffix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
2329
";Collection;true;dropFirst(_:);;;Argument[-1];ReturnValue;taint",
2430
";Collection;true;dropFirst(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
2531
";Collection;true;dropLast(_:);;;Argument[-1];ReturnValue;taint",
2632
";Collection;true;dropLast(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
33+
";Collection;true;flatMap(_:);;;Argument[-1];ReturnValue;taint",
34+
";Collection;true;flatMap(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
35+
";Collection;true;map(_:);;;Argument[-1];ReturnValue;taint",
36+
";Collection;true;map(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
2737
";Collection;true;split(maxSplits:omittingEmptySubsequences:whereSeparator:);;;Argument[-1];ReturnValue;taint",
2838
";Collection;true;split(separator:maxSplits:omittingEmptySubsequences:);;;Argument[-1];ReturnValue;taint",
2939
";Collection;true;removeFirst();;;Argument[-1];ReturnValue;taint",
3040
";Collection;true;popFirst();;;Argument[-1];ReturnValue;taint",
3141
";Collection;true;randomElement();;;Argument[-1].CollectionElement;ReturnValue.OptionalSome;value",
42+
";Collection;true;randomElement(using:);;;Argument[-1].CollectionElement;ReturnValue.OptionalSome;value",
43+
";Collection;true;trimmingPrefix(_:);;;Argument[-1];ReturnValue;taint",
44+
";Collection;true;trimmingPrefix(_:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
45+
";Collection;true;trimmingPrefix(while:);;;Argument[-1];ReturnValue;taint",
46+
";Collection;true;trimmingPrefix(while:);;;Argument[-1].CollectionElement;ReturnValue.CollectionElement;value",
3247
";RangeReplaceableCollection;true;init(_:);;;Argument[0];ReturnValue.CollectionElement;taint",
3348
";RangeReplaceableCollection;true;init(_:);;;Argument[0].CollectionElement;ReturnValue.CollectionElement;value",
3449
";RangeReplaceableCollection;true;init(repeating:count:);;;Argument[0];ReturnValue.CollectionElement;value",

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,18 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
167167
"precomposedStringWithCompatibilityMapping", "removingPercentEncoding"
168168
]
169169
or
170-
namedTypeDecl.getFullName() = "CustomStringConvertible" and
170+
namedTypeDecl.getFullName() = ["CustomStringConvertible"] and
171171
fieldDecl.getName() = "description"
172172
or
173173
namedTypeDecl.getFullName() = "CustomDebugStringConvertible" and
174174
fieldDecl.getName() = "debugDescription"
175175
or
176+
namedTypeDecl.getFullName() = "CustomTestStringConvertible" and
177+
fieldDecl.getName() = "testDescription"
178+
or
179+
namedTypeDecl.getFullName() = "CustomURLRepresentationParameterConvertible" and
180+
fieldDecl.getName() = "urlRepresentationParameter"
181+
or
176182
namedTypeDecl.getFullName() = "Substring" and
177183
fieldDecl.getName() = "base"
178184
) and

0 commit comments

Comments
 (0)