File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
lib/codeql/swift/frameworks/StandardLibrary
test/library-tests/dataflow/taint/libraries Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,9 @@ private class StringSummaries extends SummaryModelCsv {
125125 ";String;true;enumerated();;;Argument[-1];ReturnValue;taint" ,
126126 ";String;true;encode(to:);;;Argument[-1];Argument[0];taint" ,
127127 ";LosslessStringConvertible;true;init(_:);;;Argument[0];ReturnValue;taint" ,
128+ ";Substring;true;withUTF8(_:);;;Argument[-1];Argument[0].Parameter[0].CollectionElement;taint" ,
129+ ";Substring;true;withUTF8(_:);;;Argument[0].Parameter[0].CollectionElement;Argument[-1];taint" ,
130+ ";Substring;true;withUTF8(_:);;;Argument[0].ReturnValue;ReturnValue;value" ,
128131 ]
129132 }
130133}
@@ -154,6 +157,9 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
154157 or
155158 namedTypeDecl .getFullName ( ) = "CustomDebugStringConvertible" and
156159 fieldDecl .getName ( ) = "debugDescription"
160+ or
161+ namedTypeDecl .getFullName ( ) = "Substring" and
162+ fieldDecl .getName ( ) = "base"
157163 ) and
158164 declaringDecl .getAMember ( ) = fieldDecl and
159165 declaringDecl .asNominalTypeDecl ( ) = namedTypeDecl .getADerivedTypeDecl * ( ) and
Original file line number Diff line number Diff line change @@ -655,7 +655,7 @@ func testSubstringMembers() {
655655
656656 let sub1 = tainted [ ..< tainted. index ( tainted. endIndex, offsetBy: - 5 ) ]
657657 sink ( arg: sub1) // $ tainted=654
658- sink ( arg: sub1. base) // $ MISSING: tainted=
658+ sink ( arg: sub1. base) // $ tainted=654
659659 sink ( arg: sub1. utf8) // $ tainted=654
660660 sink ( arg: sub1. capitalized) // $ tainted=654
661661 sink ( arg: sub1. description) // $ tainted=654
@@ -664,10 +664,10 @@ func testSubstringMembers() {
664664 sink ( arg: sub2) // $ tainted=654
665665 let result1 = sub2. withUTF8 ( {
666666 buffer in
667- sink ( arg: buffer [ 0 ] ) // $ MISSING: tainted=
667+ sink ( arg: buffer [ 0 ] ) // $ tainted=654
668668 return source ( )
669669 } )
670- sink ( arg: result1) // $ MISSING: tainted=
670+ sink ( arg: result1) // $ tainted=668
671671
672672 let sub3 = Substring ( sub2. utf8)
673673 sink ( arg: sub3) // $ tainted=654
You can’t perform that action at this time.
0 commit comments