File tree Expand file tree Collapse file tree 4 files changed +55
-1
lines changed
lib/codeql/swift/frameworks
test/library-tests/dataflow/flowsources Expand file tree Collapse file tree 4 files changed +55
-1
lines changed Original file line number Diff line number Diff line change 22 * This file imports all models of frameworks and libraries.
33 */
44
5+ private import Alamofire.Alamofire
56private import StandardLibrary.StandardLibrary
7+ private import UIKit.UIKit
68private import Xml.Xml
7- private import Alamofire.Alamofire
Original file line number Diff line number Diff line change 1+ /**
2+ * This file imports all models of UIKit-related frameworks and libraries.
3+ */
4+
5+ import UITextField
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides models for the `UITextField` Swift class.
3+ */
4+
5+ import swift
6+ private import codeql.swift.dataflow.ExternalFlow
7+
8+ /**
9+ * A model for `UITextField` members that are flow sources.
10+ */
11+ private class UITextFieldSource extends SourceModelCsv {
12+ override predicate row ( string row ) {
13+ row = [ ";UITextField;true;text;;;;local" , ";UITextField;true;attributedText;;;;local" ]
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ // --- stubs ---
2+
3+ class NSObject { }
4+ class NSAttributedString : NSObject { }
5+ class UIResponder : NSObject { }
6+ class UIView : UIResponder { }
7+ class UIControl : UIView { }
8+ class UITextField : UIControl {
9+ var text : String ? {
10+ get { nil }
11+ set { }
12+ }
13+ var attributedText : NSAttributedString ? {
14+ get { nil }
15+ set { }
16+ }
17+ var placeholder : String ? {
18+ get { nil }
19+ set { }
20+ }
21+ }
22+ class UISearchTextField : UITextField {
23+ }
24+
25+ // --- tests ---
26+
27+ func testUITextField( textField: UITextField , searchTextField: UISearchTextField ) {
28+ _ = textField. text // $ source=local
29+ _ = textField. attributedText // $ source=local
30+ _ = textField. placeholder // GOOD (not input)
31+ _ = textField. text? . uppercased ( ) // $ source=local
32+ _ = searchTextField. text // $ source=local
33+ }
You can’t perform that action at this time.
0 commit comments