Commit Graph

1641 Commits

Author SHA1 Message Date
Geoffrey White
6f696ccc3c Swift: Effect of merging with main to get the AnyTryExpr fix. 2022-08-09 19:02:59 +01:00
Geoffrey White
efcc696e6e Merge branch 'main' into defaulttaint 2022-08-09 18:59:36 +01:00
Geoffrey White
36f410b9f7 Swift: Move taint logic from isAdditionalTaintStep to defaultAdditionalTaintStep. 2022-08-09 17:42:28 +01:00
Geoffrey White
242dc80907 Swift: Add taint test of try. 2022-08-09 17:42:25 +01:00
Geoffrey White
3bda9af97a Swift: Add taint test of Data. 2022-08-09 17:42:24 +01:00
Geoffrey White
42c3e29a29 Swift: Add taint test of URL. 2022-08-09 17:42:23 +01:00
Geoffrey White
068ec8ea20 Swift: More tests of taint flow through Strings. 2022-08-09 16:43:07 +01:00
Geoffrey White
0141609703 Swift: Rename test. 2022-08-09 16:41:26 +01:00
Mathias Vorreiter Pedersen
5ee11c3d7b Swift: Accept test changes. 2022-08-09 15:12:42 +01:00
Mathias Vorreiter Pedersen
f2767eb03a Merge pull request #9972 from MathiasVP/swift-taint-through-interpolated-strings
Swift: Taint through interpolated strings
2022-08-05 15:55:35 +01:00
Mathias Vorreiter Pedersen
46ec7a9b82 Swift: Add the InlineExpectationsTest framework. 2022-08-05 11:49:15 +01:00
Mathias Vorreiter Pedersen
946b8c68a6 Swift: Accept test changes. 2022-08-05 11:19:00 +01:00
Mathias Vorreiter Pedersen
a302570349 Merge branch 'main' into swift-taint-through-interpolated-strings 2022-08-05 11:17:54 +01:00
Alex Denisov
5e69adb0a9 Swift: extract comments 2022-08-05 11:50:48 +02:00
Mathias Vorreiter Pedersen
1c8090fa04 Merge pull request #9964 from geoffw0/cwe95
Swift: Query for CWE-79 / CWE-95
2022-08-05 10:38:33 +01:00
Geoffrey White
1ce06accbd Swift: Fix capitalization issue? 2022-08-05 10:20:51 +01:00
Mathias Vorreiter Pedersen
ac26371de0 Merge pull request #9909 from geoffw0/stringlengthconflation6
Swift: Understand String.utf8.count etc in the string length conflation CVE query
2022-08-05 10:13:25 +01:00
Mathias Vorreiter Pedersen
05e6dd85d4 Swift: Add taint tests for flow through interpolated strings. 2022-08-04 21:57:05 +01:00
Mathias Vorreiter Pedersen
52b78b6e68 Swift: Don't assume we know the call target statically in 'TInOutUpdateNode'. 2022-08-04 21:57:04 +01:00
Mathias Vorreiter Pedersen
3028b80e46 Swift: Control-flow through interpolated strings. 2022-08-04 21:57:04 +01:00
Geoffrey White
39f1352847 Swift: Complete the rename. 2022-08-03 14:45:20 +01:00
Geoffrey White
81bd61288c Swift: I think CWE-079 is the more accurate CWE for this query. 2022-08-03 14:45:19 +01:00
Geoffrey White
c635895644 Swift: Documentation. 2022-08-03 14:45:18 +01:00
Geoffrey White
651b73e21e Swift: Check for tainted baseURL. 2022-08-03 09:42:48 +01:00
Geoffrey White
53ea65b045 Swift: Implement query. 2022-08-03 09:41:28 +01:00
Geoffrey White
2d76d6d51a Swift: Tests for CWE-95. 2022-08-03 09:36:22 +01:00
Paolo Tranquilli
45e14c96f2 Swift: extract ModuleType 2022-07-29 16:48:45 +02:00
Paolo Tranquilli
76ea63ffbe Swift: deduplicate VarDecl
Deduplication of `ConcreteVarDecl` is triggered only if its
`DeclContext` is not local. This avoids a mangled name conflict.

Also added more thourough tests for `ConcreteVarDecl` and `ParamDecl`.
2022-07-28 12:28:52 +02:00
Geoffrey White
72fd7179f6 Merge branch 'main' into stringlengthconflation6 2022-07-28 10:01:28 +01:00
Paolo Tranquilli
f81abe40c4 Swift: disambuigate Cfg test order 2022-07-28 10:26:11 +02:00
Paolo Tranquilli
18b9a2fa6e Swift: accept tests 2022-07-28 10:26:11 +02:00
Paolo Tranquilli
95df751425 Swift: new toString for ExprPattern 2022-07-28 10:26:11 +02:00
Paolo Tranquilli
954047c6ab Swift: accept test changes 2022-07-28 10:26:11 +02:00
Paolo Tranquilli
8b13adbb93 Swift: IPA layer tweaks 2022-07-28 10:26:11 +02:00
Paolo Tranquilli
6abd4a6a29 Swift: fix QL libraries 2022-07-28 10:26:11 +02:00
Paolo Tranquilli
10976bbbab Swift: use IPA layer in generated classes 2022-07-28 10:26:10 +02:00
Paolo Tranquilli
ea0725525b Swift: first IPA layer 2022-07-28 10:26:10 +02:00
Geoffrey White
fe69bbf17c Swift: It turns out NSString.length always exactly matches String.utf16.count. 2022-07-27 17:54:57 +01:00
Geoffrey White
70ca37a3d0 Swift: Model utf8, utf16 a\nd unicodeScalars sources. 2022-07-27 17:39:04 +01:00
Geoffrey White
9e773302ed Swift: Extend test cases. 2022-07-27 17:39:01 +01:00
Paolo Tranquilli
fe73601a4e Merge pull request #9805 from github/redsun82/swift-type-repr-collapse
Swift: collapse `TypeRepr` hierarchy
2022-07-25 09:31:41 +02:00
Jeroen Ketema
c2b7300709 Merge pull request #9848 from geoffw0/stringlengthconflation5
Swift: More improvements for the string length conflation query
2022-07-20 14:05:05 +02:00
Geoffrey White
39fb714ad1 Swift: Add test with substring declared differently. 2022-07-18 14:24:12 +01:00
Paolo Tranquilli
e1bd4a78ff Merge branch 'main' into redsun82/swift-type-repr-collapse 2022-07-18 14:05:43 +02:00
Paolo Tranquilli
98fc8812fc Merge 'main' into redsun82/swift-extraction 2022-07-18 11:55:21 +02:00
Paolo Tranquilli
c779936ee8 Swift: commit forgotten files 2022-07-18 11:19:40 +02:00
Paolo Tranquilli
c08c3955d6 Swift: add UnresolvedPatternExpr test 2022-07-18 10:37:54 +02:00
Paolo Tranquilli
f7dca4d70f Swift: trap output rework
Firstly, this change reworks how inter-process races are resolved.
Moreover some responsability reorganization has led to merging
`TrapArena` and `TrapOutput` again into a `TrapDomain` class.

A `TargetFile` class is introduced, that is successfully created
only for the first process that starts processing a given trap output
file. From then on `TargetFile` simply wraps around `<<` stream
operations, dumping them to a temporary file. When `TargetFile::commit`
is called, the temporary file is moved on to the actual target trap
file.

Processes that lose the race can now just ignore the unneeded
extraction and go on, while previously all processes would carry out
all extractions overwriting each other at the end.

Some of the file system logic contained in `SwiftExtractor.cpp` has been
moved to this class, and two TODOs are solved:
* introducing a better inter process file collision avoidance strategy
* better error handling for trap output operations: if unable to write
  to the trap file (or carry out other basic file operations), we just
  abort.

The changes to `ExprVisitor` and `StmtVisitor` are due to wanting to
hide the raw `TrapDomain::createLabel` from them, and bring more
funcionality under the generic caching/dispatching mechanism.
2022-07-13 11:19:57 +02:00
Paolo Tranquilli
033b239b22 Swift: collapse TypeRepr hierarchy
Now `TypeRepr` is a final class in the AST, which is more or less just
a type with a location in code.

As the frontend does not provide a direct way to get a type from a
type representation, this information must be provided when fetching
the label of a type repr.

This meant:
* removing the type repr field from `EnumIsCaseExpr`: this is a virtual
  AST node introduced in place of some kinds of `IsEpxr`. The type
  repr is still available from the `ConditionalCheckedCastExpr` wrapped
  by this virtual node, and we will rebuild the original `IsExpr` with
  the IPA layer.
* some logic to get the type of keypath roots has been added to
  `KeyPathExpr`. This was done to keep the `TypeRepr` to `Type` relation
  total in the DB, but goes against the design of a dumb extractor. The
  logic could be moved to QL in the future
* in the control flow library, `TypeRepr` children are now ignored. As
  far as I can tell, there is no runtime evaluation going on in
  `TypeRepr`s, so it does not make much sense to have control flow
  through them.
2022-07-12 10:49:14 +02:00
Paolo Tranquilli
39406436bf Swift: extract IfConfigDecl
This also adds `UnresolvedDeclRefExpr` tests, as `IfConfigDecl`
consistently introduces those.
2022-07-11 15:11:13 +02:00