File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
lib/codeql/swift/frameworks/StandardLibrary
test/library-tests/dataflow/taint/libraries Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -147,5 +147,20 @@ private class StringFieldsInheritTaint extends TaintInheritingContent,
147147 "decomposedStringWithCompatibilityMapping" , "precomposedStringWithCanonicalMapping" ,
148148 "precomposedStringWithCompatibilityMapping" , "removingPercentEncoding"
149149 ] )
150+ or
151+ exists ( FieldDecl fieldDecl , Decl declaringDecl , TypeDecl namedTypeDecl |
152+ (
153+ (
154+ namedTypeDecl .getFullName ( ) = "CustomStringConvertible" and
155+ fieldDecl .getName ( ) = "description"
156+ ) or (
157+ namedTypeDecl .getFullName ( ) = "CustomDebugStringConvertible" and
158+ fieldDecl .getName ( ) = "debugDescription"
159+ )
160+ ) and
161+ declaringDecl .getAMember ( ) = fieldDecl and
162+ declaringDecl .asNominalTypeDecl ( ) = namedTypeDecl .getADerivedTypeDecl * ( ) and
163+ this .getField ( ) = fieldDecl
164+ )
150165 }
151166}
Original file line number Diff line number Diff line change @@ -272,9 +272,9 @@ func taintThroughSimpleStringOperations() {
272272 sink ( arg: [ tainted, tainted] . joined ( ) ) // $ MISSING: tainted=217
273273
274274 sink ( arg: clean. description)
275- sink ( arg: tainted. description) // $ MISSING: tainted=217
275+ sink ( arg: tainted. description) // $ tainted=217
276276 sink ( arg: clean. debugDescription)
277- sink ( arg: tainted. debugDescription) // $ MISSING: tainted=217
277+ sink ( arg: tainted. debugDescription) // $ tainted=217
278278 sink ( arg: clean. utf8)
279279 sink ( arg: tainted. utf8) // $ tainted=217
280280 sink ( arg: clean. utf16)
@@ -584,7 +584,7 @@ func taintedThroughConversion() {
584584 sink ( arg: String ( 0 ) )
585585 sink ( arg: String ( source ( ) ) ) // $ tainted=585
586586 sink ( arg: Int ( 0 ) . description)
587- sink ( arg: source ( ) . description) // $ MISSING: tainted=587
587+ sink ( arg: source ( ) . description) // $ tainted=587
588588 sink ( arg: String ( describing: 0 ) )
589589 sink ( arg: String ( describing: source ( ) ) ) // $ tainted=589
590590
You can’t perform that action at this time.
0 commit comments