Commit Graph

17948 Commits

Author SHA1 Message Date
Anders Schack-Mulligen
2a2484ee0f Merge pull request #2800 from SpaceWhite/CWE-643
CWE-643 XPathInjection on java
2020-03-13 13:40:17 +01:00
Dave Bartolomeo
11ab2d6848 C++: Fix formatting 2020-03-13 08:21:25 -04:00
semmle-qlci
25b9fcfafd Merge pull request #3058 from asger-semmle/js/may-receive-argument-fix
Approved by max-schaefer
2020-03-13 11:49:49 +00:00
Felicity Chapman
d7f37056a6 Merge pull request #3042 from felicitymay/merge-123-master-2
Merge rc/1.23 into master
2020-03-13 11:18:43 +00:00
Dave Bartolomeo
9922958bf1 C++: Fix failed tests
Added a new `StaticLocalVariable` class, which made several other pieces of the original change a bit cleaner.

Fixed test failures due to a mistake in the original `CFG.qll` change.

Added a test case for static local variables with constructors.

Removed the `Uninitialized` instruction from the initialization of a static local, because all objects with static storage duration are zero-initialized at startup.

Fixed expectations for `SignAnalysis.ql` to reflect that a bad result is now fixed.
2020-03-13 06:46:07 -04:00
Rasmus Wriedt Larsen
b45f8ff41d Merge pull request #3053 from tausbn/python-make-test-not-depend-on-minor-version
Python: Make two tests not depend on minor Python version.
2020-03-13 10:56:40 +01:00
Dave Bartolomeo
4c0d5c9d78 C++: Fix formatting 2020-03-13 04:50:35 -04:00
Felicity Chapman
7779862671 Merge pull request #3052 from felicitymay/2176-cobol
Remove information about COBOL analysis
2020-03-13 08:50:35 +00:00
yo-h
5104fd8692 Merge pull request #3051 from aschackmull/java/queue-taint-steps
Java: Add taint steps for java.util.Queue methods.
2020-03-12 20:54:11 -04:00
Dave Bartolomeo
1526400a81 C++: Model dynamic initialization of static local variables in IR
Previously, the IR for the initialization of a static local variable ran the initialization unconditionally, every time the declaration was reached during execution. This means that we don't model the possibility that an access to the static variable fetches a value that was set on a previous execution of the function.

I've added some simple modelling of the correct behavior to the IR. For each static local variable that has a dynamic initializer, we synthesize a (static) `bool` variable to hold whether the initializer for the original variable has executed. When executing a declaration, we check the value of the synthesized variable, and skip the initialization code if it is `true`. If it is `false`, we execute the initialization code as before, and then set the flag to `true`. This doesn't capture the thread-safe nature of static initialization, but I think it's more than enough to handle anything we're likely to care about for the foreseeable future.

In `TranslatedDeclarationEntry.qll`, I split the translation of a static local variable declaration into two `TranslatedElement`s: one for the declaration itself, and one for the initialization. The declaration part handles the checking and setting of the flag; the initialization just does the initialization as before.

I've added an IR test case that has static variables with constant, zero, and dynamic initialization. I've also verified the new IR generated for @jbj's previous test cases for constant initialization.

I inverted the sense of the `hasConstantInitialization()` predicate to be `hasDynamicInitialization()`. Mostly this just made more sense to me, but I think it also fixed a potential bug where `hasConstantInitialization()` would not hold for a zero-initialized variable. Technically, constant initialization isn't the same as zero initialization, but I believe that most code really cares about the distinction between dynamic initialization and static initialization, where static initialization includes both constant and zero initialization.

I've fixed up the C# side of IR generation to continue working, but it doesn't use any of the dynamic initialization stuff. In theory, it could use something similar to model the initialization of static fields.
2020-03-12 18:29:16 -04:00
Robert Marsh
9f1833af76 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-03-12 15:09:58 -07:00
Robert Marsh
a0823a2582 C++: add argv chi chain example to ssa test 2020-03-12 15:06:17 -07:00
Felicity Chapman
9d32ae7fc1 Apply suggestions from code review
Replace COBOL with Go

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2020-03-12 19:32:30 +00:00
Taus Brock-Nannestad
5c90becc1c Python: Use TUnknown instead of TUnknownInstance. 2020-03-12 19:21:11 +01:00
Taus Brock-Nannestad
115bbf619d Merge branch 'master' into python-fix-multi-assign-points-to 2020-03-12 18:50:10 +01:00
Taus Brock-Nannestad
3d0ee90880 Python: Make two tests not depend on minor Python version.
For syntax errors, we simply report the major version.

For unused imports, we were getting a result for `typing.py` when run under
Python 3.7.3. To prevent this import from being considered, I've set the maximum
import depth to `0`.
2020-03-12 18:19:53 +01:00
Felicity Chapman
8c931bfc66 Remove information about COBOL analysis 2020-03-12 16:37:29 +00:00
Asger Feldthaus
2bdf26a8f1 JS: Remove unneeded forwarding method 2020-03-12 15:48:47 +00:00
Asger Feldthaus
788c0f9037 JS: Refactor metadata class a bit 2020-03-12 15:45:22 +00:00
Geoffrey White
f4a1b41094 C++: Correct hasUpperBoundsCheck. 2020-03-12 15:45:01 +00:00
Geoffrey White
26ed560bd7 C++: Add new test cases. 2020-03-12 15:45:01 +00:00
Geoffrey White
263e51f72e C++: Clean up the test. 2020-03-12 15:45:00 +00:00
Erik Krogh Kristensen
799c3eb06c remove model of Deferred 2020-03-12 16:38:20 +01:00
Asger Feldthaus
ddab13ab44 JS: Add a comment 2020-03-12 15:29:51 +00:00
Anders Schack-Mulligen
99c55b6edb Java: Add taint steps for java.util.Queue methods. 2020-03-12 15:02:06 +01:00
Taus
099997088a Merge pull request #3005 from RasmusWL/python-modernise-string-taint
Python: Modernise StringKind files
2020-03-12 15:01:18 +01:00
Erik Krogh Kristensen
59d2d6d4fd autoformat 2020-03-12 14:48:16 +01:00
Asger Feldthaus
4391b70b5f JS: Fix perf issue in mayReceiveArgument 2020-03-12 13:45:34 +00:00
Jonas Jensen
917b984909 Merge pull request #3050 from geoffw0/mismatching_placement_new
C++: Fix mismatching new/free FP in template code.
2020-03-12 12:42:29 +01:00
SpaceWhite
300aee39be nit: add dot to qhelp 2020-03-12 20:38:03 +09:00
SpaceWhite
bb1ea94c54 Nit: Fix qhelp and ql autoformat 2020-03-12 20:35:01 +09:00
SpaceWhite
822bfcd36c Nit: fix qhelp 2020-03-12 20:25:23 +09:00
Taus Brock-Nannestad
4b5a20d21b Merge branch 'master' into python-add-points-to-for-missing-builtin-return-types 2020-03-12 11:31:29 +01:00
Erik Krogh Kristensen
172c5ccaca changes based on review 2020-03-12 11:04:33 +01:00
Erik Krogh Kristensen
91bc124f78 autoformat 2020-03-12 10:45:25 +01:00
semmle-qlci
4355f8d2b4 Merge pull request #3023 from erik-krogh/RedundantUpdate
Approved by esbena
2020-03-12 09:34:53 +00:00
Pavel Avgustinov
ecded4c11c Merge pull request #3048 from jbj/desemmlify
Docs: Remove some Semmle references
2020-03-12 09:27:36 +00:00
Robert Marsh
cc99ddfd2c C++/C#: resync 2020-03-11 12:41:26 -07:00
Ted Reed
07605f5161 Formatting and use lower case string matching 2020-03-11 15:00:58 -04:00
Robert Marsh
1878d04852 C++/C#: sync files and update imports 2020-03-11 11:49:11 -07:00
Robert Marsh
0c43a16ac8 C++: restrict dump str generation in aliased_ssa 2020-03-11 11:45:32 -07:00
Geoffrey White
f84c94b5fb C++: Change note. 2020-03-11 18:11:51 +00:00
Geoffrey White
b2c5ce8dbd C++: Exclude code in templates. 2020-03-11 18:11:45 +00:00
Geoffrey White
d454c8457d C++: Test case. 2020-03-11 18:09:09 +00:00
Rasmus Wriedt Larsen
e52fec03f8 Python: Fix code formatting 2020-03-11 18:16:55 +01:00
Shati Patel
80de75515e Merge pull request #3043 from shati-patel/2173-tutorials
CodeQL docs migration prep: Update QL tutorials
2020-03-11 17:07:35 +00:00
Felicity Chapman
02bec9f1e8 Update link text for remaining links to Python topics 2020-03-11 16:13:47 +00:00
Asger Feldthaus
1a1b7d4ee0 JS: Switch to whitelisting allowed properties 2020-03-11 16:09:14 +00:00
Erik Krogh Kristensen
2c18144560 change note 2020-03-11 17:01:41 +01:00
Erik Krogh Kristensen
d32d14f572 model responseText and responseXml on jqXHR objects 2020-03-11 17:00:44 +01:00