Commit Graph

3366 Commits

Author SHA1 Message Date
Tom Hvitved
f4c255cb62 C#: Fix bad magic optimization in NonAssignedFields.ql 2020-01-16 12:31:14 +01:00
Tom Hvitved
e5abaa79ae Merge pull request #2585 from calumgrant/cs/serialization-check-bypass
C#: Improvements to cs/serialization-check-bypass
2020-01-15 20:40:51 +01:00
Robert Marsh
a91f10fe40 Merge pull request #2629 from dbartol/dbartol/missing-vvars
C++/C#: Fix missing virtual variables
2020-01-15 08:32:43 -08:00
Calum Grant
6790028d4c C#: Use guards library 2020-01-15 15:46:19 +00:00
Tom Hvitved
f7278d36e1 Merge pull request #2498 from aschackmull/java/taint-getter
Java/C++/C#: Add support for taint-getter/setter summaries in data flow.
2020-01-15 09:55:19 +01:00
Dave Bartolomeo
e60f902c36 C++/C#: Fix missing virtual variables
The aliased SSA code was assuming that, for every automatic variable, there would be at least one memory access that reads or writes the entire variable. We've encountered a couple cases where that isn't true due to extractor issues. As a workaround, we now always create the `VariableMemoryLocation` for every local variable.

I've also added a sanity test to detect this condition in the future.

Along the way, I had to fix a perf issue in the PrintIR code. When determining the ID of a result based on line number, we were considering all `Instruction`s generated for a particular line, regardless of whether they were all in the same `IRFunction`. In addition, the predicate had what appeared to be a bad join order that made it take forever on large snapshots. I've scoped it down to just consider `Instruction`s in the same function, and outlined that predicate to fix the join order issue. This causes some numbering changes, but they're for the better. I don't think there was actually any nondeterminism there before, but now the numbering won't depend on the number of instantiations of a template, either.
2020-01-14 17:57:15 -07:00
Anders Schack-Mulligen
241b8a05e4 Java/C++/C#: Address review comment. 2020-01-14 11:59:55 +01:00
Tom Hvitved
5a4be67d81 Merge pull request #2597 from calumgrant/cs/multiline-alert-suppression
C#: Alert suppression through single-line /* */ style comments
2020-01-14 10:35:11 +01:00
Anders Schack-Mulligen
041bcc5812 Java/C++/C#: Small perf improvement and simplification. 2020-01-13 17:00:56 +01:00
Robert Marsh
d2b225790a C++: fix chi instr oeprands to chi instrs 2020-01-09 11:48:18 -08:00
Robert Marsh
5007fd2aa8 C++: Autoformat and sync 2020-01-08 12:49:51 -08:00
Robert Marsh
9b361f1701 Merge pull request #2601 from dbartol/dbartol/OpcodeProperties
C++: Consolidate opcode properties onto `Opcode` class
2020-01-08 11:05:41 -08:00
Dave Bartolomeo
690d23d15e C++: Fix formatting 2020-01-07 13:23:36 -07:00
Dave Bartolomeo
9df37399f8 C++: Consolidate opcode properties onto Opcode class
Previously, we had several predicates on `Instruction` and `Operand` whose values were determined solely by the opcode of the instruction. For large snapshots, this meant that we would populate large tables mapping each of the millions of `Instruction`s to the appropriate value, times three (once for each IR flavor).

This change moves all of these opcode properties onto `Opcode` itself, with inline wrapper predicates on `Instruction` and `Operand` where necessary. On smaller snapshots, like ChakraCore, performance is a wash, but this did speed up Wireshark by about 4%.

Even ignoring the modest performance benefit, having these properties defined on `Opcode` seems like a better organization than having them on `Instruction` and `Operand`.
2020-01-07 13:17:27 -07:00
Calum Grant
a1bedf2e06 C#: Use expression flow state to determine non-null guards 2020-01-07 18:39:51 +00:00
Calum Grant
ecb22f1379 C#: Fix typo in dbscheme. 2020-01-07 18:39:51 +00:00
Calum Grant
1036640e24 C#: Update db stats 2020-01-07 18:38:58 +00:00
Calum Grant
6c9ebaba0b C#: Populate expression type nullability and nullable flow state. 2020-01-07 18:38:58 +00:00
Calum Grant
d8f5450b67 C#: Alert suppression comments can be in C89-style comments 2020-01-07 11:52:52 +00:00
Anders Schack-Mulligen
9ba169b346 Java: Fix bad join-order. 2020-01-06 16:52:06 +01:00
Calum Grant
41b4d70504 C#: Refactor, improve documentation and add tests for cs/serialization-check-bypass 2020-01-03 18:46:39 +00:00
Calum Grant
3db900b183 C#: Remove false positive and update test output
C#: Mark results as GOOD
2019-12-27 12:07:19 +00:00
Dave Bartolomeo
5b5d2f2b67 Merge pull request #2154 from rdmarsh2/rdmarsh/cpp/ir-callee-side-effects
C++: add InitializeIndirection for pointer params
2019-12-20 13:13:54 -07:00
yo-h
cc7f98e0f6 Merge pull request #2555 from hvitved/csharp/xml-sync
C#: Sync `XML.qll` with other languages
2019-12-20 09:03:55 -05:00
Jonas Jensen
de55a6846f Merge pull request #2204 from alexet/cache-to-string
Cache the computation of core toString predicates for cpp c# and java.
2019-12-20 14:54:46 +01:00
Jonas Jensen
a13748f484 Merge pull request #2259 from rdmarsh2/rdmarsh/cpp/default-taint-tracking-sources
C++: move sources into DefaultTaintTracking.qll
2019-12-19 14:09:41 +01:00
Tom Hvitved
1b6bd7a0fa C#: Update XML.qll for backwards compatibility 2019-12-19 10:27:59 +01:00
Tom Hvitved
82c368e13e C#: Sync XML.qll with other languages 2019-12-19 10:26:08 +01:00
Robert Marsh
e209ed961a Merge branch 'master' into rdmarsh/cpp/ir-callee-side-effects 2019-12-17 15:11:02 -08:00
semmle-qlci
8ad11b98d0 Merge pull request #2538 from hvitved/csharp/missing-to-string
Approved by calumgrant
2019-12-17 19:23:47 +00:00
Tom Hvitved
9dde1ce76a C#: No taint-tracking steps for ternary conditionals
Ternary conditionals `b ? x : y` mistakenly had taint-tracking steps from both
`b`, `x`, and `y` to the conditional expression itself. Flow from `b` was not
intented, and flow from `x` and `y` is already part of ordinary data flow.
2019-12-17 13:53:39 +01:00
Anders Schack-Mulligen
ca08097b56 Java/C++/C#: Fix Java Content.getType and getContainerType to match C# and fix C# tests. 2019-12-17 11:51:58 +01:00
Robert Marsh
3c9d7953b6 Merge branch 'master' into rdmarsh/cpp/default-taint-tracking-sources 2019-12-16 11:49:22 -08:00
Tom Hvitved
f1193d084b C#: Add missing toString() relations 2019-12-16 19:38:46 +01:00
Anders Schack-Mulligen
a97e7bd3b2 Java/C++/C#: Some review fixes. 2019-12-16 16:17:19 +01:00
Anders Schack-Mulligen
a1a875e3e1 Java/C++/C#: Fix autoformat. 2019-12-16 16:15:48 +01:00
Anders Schack-Mulligen
02068ecdcd Java/C++/C#: Sync. 2019-12-16 16:15:48 +01:00
Calum Grant
a5b2549f6f Merge pull request #2514 from hvitved/csharp/code-contracts
C#: Recognize Code Contract assertions
2019-12-16 13:00:01 +00:00
james
f6029bd55c Merge branch 'rc/1.23' into mergeback-123-ql 2019-12-12 15:05:28 +00:00
Tom Hvitved
374b0c063e C#: Autoformat 2019-12-11 20:36:54 +01:00
Tom Hvitved
b7484e63ee C#: Recognize Code Contract assertions 2019-12-11 16:54:42 +01:00
Jonas Jensen
5a8407749f C#: autoformat fixup 2019-12-11 09:10:23 +01:00
Jonas Jensen
66876d0f63 C++: Compute isInCycle only for raw IR
On wireshark/wireshark, `isInCycle` ran into a low-memory loop on the
`aliased_ssa` stage. It shouldn't be necessary to detect cycles after
the `raw` stage, so this commit moves cycle detection into the
`Construction` modules and makes it a no-op in `SSAConstruction.qll`.
2019-12-10 16:03:39 +01:00
Tom Hvitved
abcb6b8aab C#: Type-based pruning for data flow 2019-12-10 15:48:48 +01:00
Tom Hvitved
54088248a1 C#: Use source declarations in field flow 2019-12-10 15:46:31 +01:00
Tom Hvitved
78ddb37a8c C#: Track type information in data flow
This commit adds type information to data flow paths, by mapping node types onto
the smaller set of GVN types, and implementing `ppReprType()`.

The effect is a mere change in `DataFlow::PathNode::toString()`; no type-based
pruning is done yet.
2019-12-10 15:46:28 +01:00
Calum Grant
3049bf2c85 Merge pull request #2358 from cldrn/ASPNetPagesValidateRequest
Adds CodeQL query to check for Pages with disabled built-in validation
2019-12-09 13:05:03 +00:00
Shati Patel
f40b1b570c Fix typo 2019-12-06 15:56:01 +00:00
Jonas Jensen
0012fef504 Merge pull request #2497 from hvitved/csharp/remove-cp
C#: Remove a Cartesian product
2019-12-06 13:58:33 +00:00
Tom Hvitved
3a95cd5e9c C#: Remove a Cartesian product 2019-12-06 10:42:59 +00:00