Commit Graph

78658 Commits

Author SHA1 Message Date
Max Schaefer
57133f91ff JavaScript: Prevent interleaved progress messages on stdout. 2019-01-17 09:29:49 +00:00
Max Schaefer
1c84dc011a JavaScript: Parallelise extraction of JavaScript (but not TypeScript) files. 2019-01-17 09:29:49 +00:00
Max Schaefer
8014ded973 JavaScript: Remove static state in JSDocParser. 2019-01-17 09:29:49 +00:00
Max Schaefer
5832f7c3ad JavaScript: Pull ExtractorState out of FileExtractor. 2019-01-17 09:29:49 +00:00
Max Schaefer
335d43b122 JavaScript: Make AutoBuild less stateful. 2019-01-17 09:29:49 +00:00
Jonas Jensen
9c42b5fab7 C++: Relax commented-out code heuristic for }
I looked through a few hundred results from this query on lgtm.com and
found that most of the FPs had to do with comment lines ending in `}`.
This change should fix most of them, at the cost of very few false
negatives.

On Wireshark, this query goes from 7,425 results to 6,686 results before
filtering for generated code. Almost all the lost results were FP,
except a handful of results involving initializer lists.
2019-01-17 10:20:48 +01:00
Max Schaefer
a058d7a502 JavaScript: Fix examples in flow-summaries.rst
The S-expression examples still used the old order of parameters for `parameter` and `member`.
2019-01-17 09:12:40 +00:00
Jonas Jensen
92b48bf6af C++: Add another test for CommentedOutCode.ql 2019-01-17 09:15:25 +01:00
Geoffrey White
c62cfb338a CPP: Clean up comment. 2019-01-16 19:10:35 +00:00
Geoffrey White
fb669e02ca CPP: Change note. 2019-01-16 19:05:51 +00:00
Geoffrey White
49cfa43fd8 CPP: Improve accuracy further. 2019-01-16 19:05:51 +00:00
Geoffrey White
105f8dddd0 CPP: Better fileHeaderLimit. 2019-01-16 19:05:50 +00:00
Geoffrey White
91c736229c CPP: Performance is better as a single regexp. 2019-01-16 19:05:50 +00:00
Geoffrey White
e3056ca96c CPP: Improve accuracy of AutogeneratedFile.qll. 2019-01-16 19:05:50 +00:00
Tom Hvitved
9031e19c88 C#: Recognize ref assignments through delegate calls 2019-01-16 15:53:31 +01:00
Max Schaefer
bca941ddf6 Merge pull request #765 from asger-semmle/class-receiver-propagation
JS: support flow out of "this" in constructor call
2019-01-16 14:40:19 +00:00
Tom Hvitved
fc5076b466 C#: Add test for assignment through delegate ref argument 2019-01-16 15:22:45 +01:00
Taus Brock-Nannestad
a422215272 Add change note for 1.20 2019-01-16 14:55:12 +01:00
Taus Brock-Nannestad
e8c092ad72 Python: Support the dill pickling library. 2019-01-16 14:53:42 +01:00
Jonas Jensen
22b15037fc C++: Split DataFlow::Node.asExpr into two
The existing `Node.asExpr` predicate changes semantics so it becomes the
one that most users should use when they don't want to think about
`Conversion`s. A new `Node.asConvertedExpr` predicate is added and has
the same semantics as the old `Node.asExpr` predicate. It's for advanced
users that know about `Conversion`s and want to account for them.
2019-01-16 14:17:57 +01:00
Jonas Jensen
dcb24e07c3 C++: Remove getFullyConverted call in sink def
With this change, the `IRDataflowTestCommon.qll` and
`DataflowTestCommon.qll` files use the same definitions of sources and
sinks. Since the IR data flow library is meant to be compatible with the
AST data flow library, this is what we ought to be testing.

Two alerts change but not necessarily for the right reasons.
2019-01-16 13:56:52 +01:00
Mark Shannon
65337ef835 Merge pull request #564 from taus-semmle/python-insecure-ssl-version
Python: Check for insecure versions of SSL and TLS.
2019-01-16 12:32:30 +00:00
Mark Shannon
7b8468d81b Python: Add bulk regression test for CFG successors. 2019-01-16 11:48:58 +00:00
Mark Shannon
e506bf85e8 Python: Add some regression tests for CFG of comparisons. 2019-01-16 11:45:20 +00:00
Mark Shannon
d1d898efac Python: Add regression test for code that proved problematic with the new parser. 2019-01-16 11:44:11 +00:00
Mark Shannon
bc4301f7b1 Python: Add an extra test for import parsing. 2019-01-16 11:32:59 +00:00
Mark Shannon
b8a91d4b1e Python tests: Add a few tests to check parsing and location of comparisons. 2019-01-16 11:27:57 +00:00
Asger F
a1c7f32fb6 JS: change note 2019-01-16 11:14:00 +00:00
Asger F
9aaea40719 JS: address comments and support TrackedNode 2019-01-16 11:12:38 +00:00
Asger F
6d1eab8a4b JS: support flow out of "this" in constructor call 2019-01-16 11:09:38 +00:00
Taus
370a9e491c Merge pull request #761 from markshannon/python-fix-regex-test-depth
Python tests: Increase import depth to ensure sre_constants module is imported
2019-01-16 11:38:02 +01:00
Mark Shannon
b4e8808582 Python, Exec used query: Remove restriction that call to exec function must be Python 3. For upcoming unified parser. 2019-01-16 10:19:35 +00:00
Tom Hvitved
b2f99dbbc7 C#: Teach data flow library about CFG splitting
Data flow nodes for expressions do not take CFG splitting into account. Example:

```
if (b)
    x = tainted;
x = x.ToLower();
if (!b)
    Use(x);
```

Flow is incorrectly reported from `tainted` to `x` in `Use(x)`, because the step
from `tainted` to `x.ToLower()` throws away the information that `b = true`.

The solution is to remember the splitting in data flow expression nodes, that is,
to represent the exact control flow node instead of just the expression. With that
we get flow from `tainted` to `[b = true] x.ToLower()`, but not from `tainted` to
`[b = false] x.ToLower()`.

The data flow API remains unchanged, but in order for analyses to fully benefit from
CFG splitting, sanitizers in particular should be CFG-based instead of expression-based:

```
if (b)
   x = tainted;
   if (IsInvalid(x))
       return;
Use(x);
```

If the call to `IsInvalid()` is a sanitizer, then defining an expression node to be
a sanitizer using `GuardedExpr` will be too conservative (`x` in `Use(x)` is in fact
not guarded). However, `[b = true] x` in `[b = true] Use(x)` is guarded, and to help
defining guard-based sanitizers, the class `GuardedDataFlowNode` has been introduced.
2019-01-16 10:39:27 +01:00
Tom Hvitved
f768abb0e6 C#: Add data flow test with CFG splitting 2019-01-16 10:29:26 +01:00
Tom Hvitved
abb3f71ec8 C#: Add GuardedControlFlowNode 2019-01-16 10:29:26 +01:00
Tom Hvitved
f323049b9d C#: CFG for expressions without enclosing callables, e.g. field initializers 2019-01-16 10:29:26 +01:00
Tom Hvitved
901f389a7d C#: Add CFG tests for field/property initializers 2019-01-16 10:29:26 +01:00
Max Schaefer
4a7e0fe104 Merge pull request #766 from asger-semmle/ts-compiler-3.2
TS: Support TypeScript 3.2
2019-01-16 08:49:45 +00:00
Jonas Jensen
502b7cfe33 C++: Don't use C-style varargs in test.cpp sink
As we prepare to clarify how conversions are treated, we don't want a
`sink(...)` declaration where it's non-obvious which conversions are
applied to arguments.
2019-01-16 09:47:58 +01:00
semmle-qlci
5bc17923b1 Merge pull request #665 from asger-semmle/js-property-concat-sanitizer
Approved by esben-semmle, xiemaisi
2019-01-16 08:44:55 +00:00
semmle-qlci
cf3a4ac956 Merge pull request #767 from esben-semmle/js/unknown-bound-event-handler-receiver
Approved by xiemaisi
2019-01-16 08:36:11 +00:00
semmle-qlci
8655e5ae17 Merge pull request #768 from xiemaisi/js/call-summaries
Approved by asger-semmle
2019-01-16 08:35:31 +00:00
Jonas Jensen
7c44764aff C++: Change note for isConstant changes 2019-01-16 09:26:06 +01:00
semmle-qlci
06d7953167 Merge pull request #771 from jbj/sync-files-after-range-analysis
Approved by rdmarsh2
2019-01-15 19:14:50 +00:00
Jonas Jensen
b3f46d757a C++: isConstant() -> exists(getValue())
This code was clearly using `isConstant` as an indirect way of checking
whether `getValue` would have a result. That's no longer valid, so I
changed it to check `getValue` directly.
2019-01-15 19:03:49 +01:00
Jonas Jensen
d81e6e9bb8 C++: Add TranslatedElement::isIRConstant
Now that there exist constants with no QL-representable value, we need
to make sure they're not treated as constants in the IR.
2019-01-15 17:35:14 +01:00
Jonas Jensen
0f2c7005fc C++: Sync files that should be identical
These files had come out of sync due to 89148a9ec7 and 8c9c316e1b. I
synced the files by replaying the changes that those commits made in
`aliased_ssa/` to the two other copies.
2019-01-15 16:01:54 +01:00
Calum Grant
6cc4c2d31f Merge pull request #762 from hvitved/csharp/autoformat/libraries
C#: Autoformat QLL files
2019-01-15 12:19:50 +00:00
Jonas Jensen
3edadc311f C++: Simplify skipInitializer in CFG.qll
The CFG construction code previously contained half of an approximation
of which address expressions are constant. Now this this property is
properly modelled by `Expr.isConstant`, we can remove this code.

This fixes most discrepancies between the QL-based CFG and the
extractor-based CFG on Wireshark.
2019-01-15 13:03:26 +01:00
Jonas Jensen
aaae5becf1 C++: Add addresses to Expr.isConstant
Before this change, `Expr.isConstant` only was only true for those
constant expressions that could be represented as QL values: numbers,
Booleans, and string literals. It was not true for string literals
converted from arrays to pointers, and it was not true for addresses of
variables with static lifetime.

The concept of a "constant expression" varies between C and C++ and
between versions of the standard, but they all include addresses of data
with static lifetime. These are modelled by the new library
`AddressConstantExpression.qll`, which is based on the code in
`EscapesTree.qll` and modified for its new purpose.

I've tested the change for performance on Wireshark and for correctness
with the included tests. I've also checked on Wireshark that all static
initializers in C files are considered constant, which was not the case
before.
2019-01-15 12:31:04 +01:00