Compare commits

..

5394 Commits

Author SHA1 Message Date
Dave Bartolomeo
33092c9255 C++: Insecure memset 2019-10-25 15:03:56 -07:00
Dave Bartolomeo
cc5a689293 C++/C#: Fix up after merge from master 2019-10-25 14:11:34 -07:00
Dave Bartolomeo
f5e320e988 Merge from master 2019-10-25 13:24:19 -07:00
Dave Bartolomeo
56cbd0c152 C++/C#: Make AliasedUse access only non-local memory
The `AliasedUse` instruction is supposed to represent future uses of aliased memory after the function returns. Since local variables from that function are no longer allocated after the function returns, the `AliasedUse` instruction should access only the set of aliased locations that does not include locals from the current stack frame.
2019-10-25 13:10:39 -07:00
semmle-qlci
d2f3574427 Merge pull request #2165 from erik-krogh/dosHigh
Approved by asger-semmle
2019-10-25 16:28:07 +01:00
Rasmus Wriedt Larsen
f1004b10ba Merge pull request #2147 from tausbn/python-cyclic-import-package-fp
Python: Fix cyclic import FP relating to packages.
2019-10-25 11:57:55 +02:00
semmle-qlci
89896c02c4 Merge pull request #2176 from Semmle/esbena-patch-1
Approved by erik-krogh
2019-10-25 09:26:12 +01:00
Jonas Jensen
22de0efc58 Merge pull request #2008 from dave-bartolomeo/dave/IRType2
C++: Implement language-neutral IR type system
2019-10-25 09:42:23 +02:00
yh-semmle
80fd5b2ada Merge pull request #2175 from aschackmull/java/continue-in-false-loop
Java: Port C++ query cpp/continue-in-false-loop to Java.
2019-10-24 20:47:59 -04:00
Dave Bartolomeo
80e29dce8b C++: Fix comment and remove unnecessary max() 2019-10-24 14:15:59 -07:00
Dave Bartolomeo
1223388ab6 C++: Fix test expectations 2019-10-24 13:54:21 -07:00
Dave Bartolomeo
956c18f976 C++/C#: Fix formatting 2019-10-24 13:54:09 -07:00
Ziemowit Łąski
01035f15cf Merge pull request #2123 from geoffw0/comparison2
CPP: Reword ComparisonPrecedence.ql query message.
2019-10-24 12:05:59 -07:00
Tom Hvitved
6d22e351f1 Merge pull request #2151 from raulgarciamsft/users/raul/oss
Users/raul/oss
2019-10-24 19:35:40 +02:00
Geoffrey White
f2656d8556 CPP: Autoformat. 2019-10-24 17:29:05 +01:00
Geoffrey White
73c677d417 Merge pull request #2189 from jbj/eivc-2019
C++: Minor tweaks to ExprInVoidContext
2019-10-24 16:50:35 +01:00
Geoffrey White
e48936244d CPP: Reword the query message. 2019-10-24 16:22:51 +01:00
Jonas Jensen
73e217a51e C++: Un-deprecate class Qualifier
It turns out this was used in the internal repo.
2019-10-24 16:47:29 +02:00
Hening Makholm
c927a4c354 Merge pull request #2191 from lcartey/lgtm-selectors
Update new-style suite definitions
2019-10-24 16:15:56 +02:00
Calum Grant
ad867bb855 Merge pull request #2186 from hvitved/csharp/new-env-variables
C#: Teach extractor and autobuilder about new environment variables
2019-10-24 15:12:13 +01:00
Luke Cartey
6bcfb4e5cc Update new-style suite definitions
Capture path-problem as well as problem queries.
2019-10-24 14:54:13 +01:00
Jonas Jensen
6c069ff444 C++: The update of a for-loop is ExprInVoidContext 2019-10-24 15:27:54 +02:00
Jonas Jensen
edc9e23a9d C++: Deprecate class Qualifier
It's not used anywhere outside `VoidContext.qll`, where it was defined.
The use in `VoidContext.qll` is 10 years old and was a workaround for an
extractor bug that no longer exists.
2019-10-24 15:22:44 +02:00
Anders Schack-Mulligen
fe2988ab39 Merge pull request #2152 from yh-semmle/java-alert-suppression-annotations
Java: support LGTM alert suppression using `@SuppressWarnings` annotations
2019-10-24 15:04:29 +02:00
Tom Hvitved
4ac32c4b12 C#: Fix more tests 2019-10-24 13:00:14 +02:00
Asger F
7dd7463288 Merge pull request #2169 from erik-krogh/importMeta
JS: add initial support for import.meta expressions in TypeScript
2019-10-24 11:20:04 +01:00
Tom Hvitved
83ec2d6162 C#: Teach extractor and autobuilder about new environment variables 2019-10-24 11:15:33 +02:00
Erik Krogh Kristensen
ab42b5de80 fix line end at end of dbscheme 2019-10-24 10:17:06 +02:00
Erik Krogh Kristensen
a584d7c850 change update script description
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-10-24 10:17:06 +02:00
Erik Krogh Kristensen
834b572f45 add initial support for expressions in TypeScript 2019-10-24 10:17:00 +02:00
Jonas Jensen
4b27b2ac05 Merge pull request #2173 from zlaski-semmle/zlaski/bad-addition-qhelp-reword
Reword and reformat Qhelp for BadAdditionOverflowCheck query
2019-10-24 09:26:41 +02:00
Dave Bartolomeo
d03a4f86e5 C++/C#: Add AliasedUse instruction to all functions
This new instruction is the dual of the existing `AliasedDefinition` instruction. Whereas that instruction defines the contents of aliased memory before the function was called, `AliasedUse` represents the potential use of all aliased memory after the function returns. This ensures that writes to aliased memory do not appear "dead", even if there are no further reads from aliased memory within the function itself.
2019-10-23 11:59:05 -07:00
Geoffrey White
0427b1eb3f C#: Fix more tests. 2019-10-23 18:20:44 +01:00
Anders Schack-Mulligen
3462624995 Java: Add test. 2019-10-23 16:24:26 +02:00
semmle-qlci
fc8c1e195a Merge pull request #2177 from asger-semmle/nodejs-detector-class-expression
Approved by max-schaefer
2019-10-23 14:33:07 +01:00
Asger F
45667cc127 TS: Tolerate syntax errors in class declaration 2019-10-23 11:40:34 +01:00
Taus
30483db621 Merge pull request #2146 from RasmusWL/python-improve-iter-returns-non-iterator
Python: improve py/iter-returns-non-iterator
2019-10-23 11:53:00 +02:00
Esben Sparre Andreasen
207692a7a1 add missing .ql extension to suite file name 2019-10-23 11:18:48 +02:00
Rasmus Wriedt Larsen
5c5eaacc09 Python: Remove cached annotation in py/iter-returns-non-iterator 2019-10-23 10:46:07 +02:00
Rasmus Wriedt Larsen
a98466392d Python: Improve tests and docs for py/iter-returns-non-iterator 2019-10-23 10:46:07 +02:00
shati-patel
41969a3d92 Merge pull request #2174 from jf205/go-docs/sd-3871
docs: add ql for go topic
2019-10-23 09:25:30 +01:00
james
efe84a6d93 docs: ql-for-go.rst 2019-10-23 09:16:38 +01:00
Geoffrey White
e331a24dbb C#: Fix autoformat. 2019-10-23 08:48:07 +01:00
Ziemowit Laski
ac7a1230e6 [zlaski/bad-addition-qhelp-reword] Left-justify help text so that it renders proerly in MD. 2019-10-22 14:00:02 -07:00
Ziemowit Laski
ad4cd6f2bb [zlaski/bad-addition-qhelp-reword] Initial change. 2019-10-22 13:43:35 -07:00
Dave Bartolomeo
0219dbeeed C++: Fix override warning 2019-10-22 11:50:48 -07:00
Robert Marsh
219fcb7889 Merge pull request #2160 from jf205/review-cpp-docs
docs: editorial suggestions to new C/C++ topics
2019-10-22 10:59:59 -07:00
Robert Marsh
9f0499cce9 Merge pull request #2063 from jbj/dataflow-ref-parameter
C++: Data flow through reference parameters
2019-10-22 09:40:15 -07:00
Pavel Avgustinov
325dbfe9c0 Merge pull request #2172 from hmakholm/qlpack.yml
qlpack files are now YAML rather than JSON
2019-10-22 17:19:52 +01:00
Geoffrey White
9949d8a000 C#: Fix warnings. 2019-10-22 17:10:11 +01:00
semmle-qlci
cbfa1cd058 Merge pull request #2168 from xiemaisi/js/remove-duplicate-configuration
Approved by erik-krogh
2019-10-22 17:02:26 +01:00
Geoffrey White
b218a87ecc C#: Override tags. 2019-10-22 16:57:12 +01:00
Henning Makholm
f4a6261f7c add a codeql manifest too 2019-10-22 17:36:35 +02:00
Henning Makholm
347d97c14c qlpack.json is now qlpack.yml 2019-10-22 17:36:35 +02:00
Pavel Avgustinov
72de1b25ab Merge pull request #2164 from hmakholm/suites
Add some new-style suite definitions
2019-10-22 16:35:19 +01:00
Geoffrey White
ae20e9ace1 CPP: Fix autoformat. 2019-10-22 16:28:53 +01:00
Anders Schack-Mulligen
da57dbc528 Java: Port C++ query cpp/continue-in-false-loop. 2019-10-22 17:07:57 +02:00
Taus
a19569ce3e Merge pull request #2161 from RasmusWL/python-fix-cookieset-tostring
Python: Fix toString for CookieSet classes
2019-10-22 16:48:31 +02:00
James Fletcher
25e3258b10 Merge pull request #2170 from shati-patel/link
Docs: Fix broken link
2019-10-22 15:43:03 +01:00
Geoffrey White
41984a8731 CPP: Fix more qhelp. 2019-10-22 15:38:44 +01:00
Geoffrey White
78e56d9f7f C#: Sync identical files. 2019-10-22 15:24:50 +01:00
Geoffrey White
2fa80c7da5 CPP: Fix qhelp. 2019-10-22 15:21:27 +01:00
Shati Patel
50c7816a66 Fix broken link 2019-10-22 15:12:06 +01:00
Geoffrey White
33867dd859 C#: Fixes. 2019-10-22 15:05:32 +01:00
Geoffrey White
63003894c3 CPP: Fixes. 2019-10-22 14:51:17 +01:00
Henning Makholm
fd768a1af6 Add some new-style suite definitions 2019-10-22 15:51:00 +02:00
Taus Brock-Nannestad
32de65c0c6 Python: Add discussed test case (a false negative). 2019-10-22 15:10:40 +02:00
Taus Brock-Nannestad
83bf54c524 Python: Move false positive (now a true negative) into subfolder. 2019-10-22 15:08:29 +02:00
semmle-qlci
cb3a05c6de Merge pull request #2166 from xiemaisi/js/fix-typo
Approved by esben-semmle
2019-10-22 12:38:10 +01:00
Max Schaefer
1c23615742 JavaScript: Fix typo in doc comment. 2019-10-22 10:44:25 +01:00
Geoffrey White
faf1a2acbe CPP: Fix typos. 2019-10-22 09:56:50 +01:00
Geoffrey White
47169e2ece C#: Fix autoformat. 2019-10-22 09:56:49 +01:00
Geoffrey White
3b674de12c C#: Disable precision tags for now. 2019-10-22 09:56:49 +01:00
Geoffrey White
49e7addaa4 C#: Autoformat. 2019-10-22 09:56:42 +01:00
Geoffrey White
31dd3cae84 CPP: Autoformat. 2019-10-22 09:55:48 +01:00
Raul Garcia (MSFT)
cb8dcf7db2 Publishing queries to the OSS Semmle repository 2019-10-22 09:55:39 +01:00
Rasmus Wriedt Larsen
e487fd3648 Python: Improve alert message for py/iter-returns-non-iterator
Fixes https://github.com/Semmle/ql/issues/1427
2019-10-22 10:27:55 +02:00
Rasmus Wriedt Larsen
6056b457e9 Python: Autoformat py/iter-returns-non-iterator 2019-10-22 10:25:01 +02:00
semmle-qlci
1c79ec550e Merge pull request #2092 from esben-semmle/js/brittle-system-reflection-command
Approved by mchammer01, xiemaisi
2019-10-22 08:36:44 +01:00
Erik Krogh Kristensen
1ae8e25603 change precision of js/loop-bound-injection and fix a false positive 2019-10-22 09:21:19 +02:00
semmle-qlci
eb9d90dff6 Merge pull request #2143 from esben-semmle/js/fix-all-sanitisers
Approved by xiemaisi
2019-10-22 07:16:27 +01:00
semmle-qlci
0dcb189e67 Merge pull request #2162 from xiemaisi/js/remove-deprecated-queries
Approved by esben-semmle
2019-10-22 07:15:58 +01:00
Dave Bartolomeo
63038896f4 C++: Accept test output after changes 2019-10-21 17:06:32 -07:00
Dave Bartolomeo
2cd694756b C++: Remove mistakenly-added file 2019-10-21 15:58:38 -07:00
Dave Bartolomeo
1c8e275b40 C++/C#: Autoformat all the things 2019-10-21 15:00:05 -07:00
Esben Sparre Andreasen
5a983cb535 JS: add query js/shell-command-injection-from-environment 2019-10-21 23:31:55 +02:00
Dave Bartolomeo
7241c1aae6 C++/C#: More sanity checks for IRType 2019-10-21 14:22:46 -07:00
Dave Bartolomeo
958754bed8 C++: Use max to handle mixed 32/64-bit extraction 2019-10-21 11:56:12 -07:00
Dave Bartolomeo
5776077bf6 C++: Add comment about enum signedness 2019-10-21 11:37:18 -07:00
Dave Bartolomeo
debb662b8c C++: Reformat comment 2019-10-21 10:55:59 -07:00
Dave Bartolomeo
71a6b5dffe C++/C#: Fix some duplicate IRType problems, and add a sanity test 2019-10-21 10:46:30 -07:00
Max Schaefer
b9203377c7 JavaScript: Remove a duplicate Configuration class. 2019-10-21 17:32:02 +01:00
Max Schaefer
90cefead84 Merge pull request #1988 from erik-krogh/unreacableOverloads
JS: Unreachable overloads
2019-10-21 14:57:29 +01:00
Max Schaefer
55fb86d618 JavaScript: Remove deprecated queries.
These queries have all been deprecated since 1.17 (released in July 2018). I think it's time to say goodbye.
2019-10-21 14:42:02 +01:00
Rasmus Wriedt Larsen
016c95a69c Merge pull request #2078 from taus-semmle/python-unreachable-suppressed
Python: Teach `py/unreachable-statement` about `contextlib.suppress`.
2019-10-21 15:14:39 +02:00
Taus Brock-Nannestad
b2f7b0921b Python: Add false negative test case. 2019-10-21 14:31:05 +02:00
Taus Brock-Nannestad
99b99ef2b6 Python: Teach py/unreachable-statement about contextlib.suppress. 2019-10-21 14:31:05 +02:00
Erik Krogh Kristensen
9eda120de4 implement a new query to detect unreachable overloaded methods in TypeScript 2019-10-21 13:34:42 +02:00
james
ec15add112 docs: fix headings 2019-10-21 12:03:59 +01:00
James Fletcher
31bd2abd87 Update docs/language/learn-ql/cpp/value-numbering-hash-cons.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-10-21 11:26:27 +01:00
james
d4e9aa53f3 docs: edits to new cpp topics 2019-10-21 10:34:28 +01:00
Rasmus Wriedt Larsen
9cf0e244b1 Python: Fix toString for CookieSet classes
The old implementation would result in empty recursion.
2019-10-21 11:26:10 +02:00
James Fletcher
82ca45f0b5 Merge pull request #2131 from shati-patel/spec-links
Docs: Update links to avoid redirects within help.semmle.com
2019-10-21 10:02:34 +01:00
Calum Grant
4ee3f2c46e Merge pull request #2139 from hvitved/csharp/dataflow/callcontext-bool-pruning
C#: Data-flow pruning based on call contexts
2019-10-21 09:49:05 +01:00
Jonas Jensen
c0fdcf3089 Merge pull request #2094 from rdmarsh2/rdmarsh/docs/cpp/advanced-library-guide
C++/Docs: Add guides to advanced AST libraries
2019-10-21 10:40:53 +02:00
Jonas Jensen
defe99503d Merge pull request #2113 from raulgarciamsft/users/raulga/boost
Users/raulga/boost
2019-10-20 13:14:44 +02:00
Robert Marsh
fc7dbeb0a9 Docs: quotes around "then" block and "else" block 2019-10-18 13:00:02 -07:00
Dave Bartolomeo
f871c72660 C++: Fix PR feedback 2019-10-18 12:54:03 -07:00
Dave Bartolomeo
8ec15933f5 C++/C#: Blob -> Opaque 2019-10-18 12:51:25 -07:00
yh-semmle
afcde14403 Merge pull request #2085 from aschackmull/java/overflow-check-fp
Java: Add another overflow check pattern to UselessComparisonTest.
2019-10-18 11:01:24 -04:00
Geoffrey White
446763d331 CPP: Fix typo. 2019-10-18 14:47:21 +01:00
yh-semmle
155d14a185 Java: simplify Extents.qll 2019-10-18 09:46:00 -04:00
yh-semmle
4348241f72 Java: simplify java/alert-suppression-annotations 2019-10-18 09:45:49 -04:00
Geoffrey White
411f74db70 CPP: Delete comment. 2019-10-18 14:44:38 +01:00
semmle-qlci
0ad802bad0 Merge pull request #2145 from xiemaisi/js/es2020
Approved by esben-semmle
2019-10-18 14:06:45 +01:00
Taus
45158a7177 Merge pull request #2053 from RasmusWL/python-modernise-falcon-library
Python modernise falcon library
2019-10-18 14:47:33 +02:00
Taus Brock-Nannestad
70d9d1bd0e Python: Add false positive test case for cyclic import. 2019-10-18 14:03:23 +02:00
Anders Schack-Mulligen
582a91f1e9 Java: Add change note. 2019-10-18 11:59:09 +02:00
Anders Schack-Mulligen
27b8a46dac Java: Exclude loop conditions from overflow check heuristic. 2019-10-18 11:58:46 +02:00
Taus
37291c5642 Merge pull request #2100 from RasmusWL/python-fix-hasFlowPath
Python: Fix hasFlowPath default implementation of isSink/2
2019-10-18 11:16:58 +02:00
Geoffrey White
5a97a16945 CPP: Autoformat. 2019-10-18 09:46:04 +01:00
Jonas Jensen
dcc446660e Merge pull request #2149 from rdmarsh2/rdmarsh/cpp/ir-side-effect-primary
C++: Add getPrimaryInstruction to specific side effects
2019-10-18 10:31:01 +02:00
yh-semmle
1d415b3680 Java: enable java/alert-suppression-annotations in LGTM suite 2019-10-17 22:09:04 -04:00
yh-semmle
ee2c97f147 Java: add extra test for java/alert-suppression-annotations 2019-10-17 22:09:04 -04:00
yh-semmle
62521dca32 Java: account for multiple strings in java/alert-suppression-annotations 2019-10-17 22:09:04 -04:00
yh-semmle
f3a980deb6 Java: clarify predicate name in java/alert-suppression-annotations 2019-10-17 22:09:03 -04:00
yh-semmle
d165ce95f2 Java: tidy QLDoc in Extents.qll 2019-10-17 22:09:03 -04:00
yh-semmle
e3f828c588 Java: refine ranges in java/alert-suppression-annotations 2019-10-17 22:09:03 -04:00
yh-semmle
b2bc8382b0 Java: add alert-suppression query for @SuppressWarnings("lgtm[...]") 2019-10-17 22:09:02 -04:00
Robert Marsh
30e501e110 C++/Docs: reword "divide" to "partition"
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-10-17 12:22:37 -07:00
Robert Marsh
5451c394a2 C++/C#: autoformat 2019-10-17 12:20:36 -07:00
Robert Marsh
b8bbce0eb6 C#: sync IR 2019-10-17 11:00:04 -07:00
Nick Rolfe
176d7672a1 Merge pull request #2148 from Semmle/cpp-454-invalid_key-diagnostic_for
Drop unique diagnostic key on diagnostic_for tuple
2019-10-17 16:51:03 +01:00
Matthew Gretton-Dann
4e345fb921 C++: Add upgrade script 2019-10-17 15:37:34 +01:00
Matthew Gretton-Dann
bc0d73b86e C++: Remove unique diagniostic key on diagnostic_for. 2019-10-17 15:34:51 +01:00
Esben Sparre Andreasen
80a32aebc1 JS: add SystemCommandExecution::isShellInterpreted 2019-10-17 13:29:24 +02:00
Max Schaefer
a4bffe35fd JavaScript: Add support for globalThis. 2019-10-17 12:04:01 +01:00
semmle-qlci
9995c12132 Merge pull request #2144 from shati-patel/monospace-links
Approved by jf205
2019-10-17 11:55:58 +01:00
Taus Brock-Nannestad
067bdf5ec4 Python: Disregard packages when looking for cyclic imports. 2019-10-17 12:47:34 +02:00
Shati Patel
54d7bba3dd Docs: Remove unused styling 2019-10-17 11:31:35 +01:00
Jonas Jensen
9bc7ce1fac Merge pull request #2141 from geoffw0/newtest
CPP: AV Rule 114 test cases
2019-10-17 09:28:10 +02:00
Esben Sparre Andreasen
93b1e59d62 JS: fix spelling: sanitisers -> sanitizers 2019-10-17 09:05:03 +02:00
Robert Marsh
30d7238921 C++: fix missing getPrimaryInstruction 2019-10-16 17:05:37 -07:00
Robert Marsh
fffe3c2432 C++: add sanity test for side effect primaries 2019-10-16 16:53:55 -07:00
Dave Bartolomeo
6e61b1dcd0 C++: Fix up after merge from master
The one interesting piece that needed to be fixed up was the type of an `Indirect[Read|Write]SideEffect` operand/result. If the parameter type is a pointer or reference to an incomplete type, we need to set the type of the side effect memory access to `Unknown`, because we don't model incomplete types in the IR type system.

I also added minimal support for `__assume` (generated as a `NoOp`), because lack of `__assume` support got in the way of debugging the other issue above.
2019-10-16 15:55:56 -07:00
Robert Marsh
3c127fb829 C++/Docs: expand on VN/HC and add wikipedia links 2019-10-16 13:09:36 -07:00
Robert Marsh
0cc0977a09 C++/Docs: more examples and rewording for guards 2019-10-16 12:45:59 -07:00
Dave Bartolomeo
167d2289c4 Merge from master 2019-10-16 10:10:10 -07:00
Max Schaefer
dfed7502b6 Merge pull request #2142 from Semmle/jf205-patch-1
docs: update path to support docs in readme.md
2019-10-16 16:58:34 +01:00
James Fletcher
d1a8152f29 update path to support docs in readme.md 2019-10-16 16:55:28 +01:00
semmle-qlci
280a62ed30 Merge pull request #2138 from Semmle/xiemaisi-patch-1
Approved by erik-krogh
2019-10-16 15:14:29 +01:00
Pavel Avgustinov
7fa6c54731 Merge pull request #2119 from hmakholm/pr/qlpacks
Add qlpack.json files
2019-10-16 14:27:10 +01:00
Geoffrey White
6f96d1759f Merge pull request #2077 from jbj/cfg-enable-pr
C++: enable the QL-based CFG code
2019-10-16 14:06:22 +01:00
Geoffrey White
5f1fdd08a7 CPP: Post-2115. 2019-10-16 13:51:06 +01:00
Geoffrey White
096af3c3f3 CPP: Add test cases involving __builtin_complex. 2019-10-16 13:46:11 +01:00
Tom Hvitved
c57015af7d C#: Data-flow pruning based on call contexts 2019-10-16 13:51:32 +02:00
Max Schaefer
f963ebcddc JavaScript: Remove stray comma from @tags. 2019-10-16 12:42:33 +01:00
Tom Hvitved
853cbd8728 C#: Add dataflow tests exhibiting missing call-context based pruning 2019-10-16 13:39:35 +02:00
Max Schaefer
712762481c Merge pull request #2001 from esben-semmle/js/identity-escape
JS: add query js/useless-regexp-character-escape
2019-10-16 10:27:50 +01:00
Geoffrey White
33ae7ee802 Merge pull request #2130 from jbj/cfg-pos-int
C++: Implement Pos and Spec as int, not newtype
2019-10-16 09:56:14 +01:00
Jonas Jensen
bca1be0601 Merge pull request #2135 from zlaski-semmle/zlaski/memset-model
[zlaski/memset-model] Add side effect modeling to Memset.
2019-10-16 08:49:24 +02:00
Esben Sparre Andreasen
e1d7434be4 JS: add query js/useless-regexp-character-escape 2019-10-16 00:15:54 +02:00
Ziemowit Laski
fcc1938143 [zlaski/memset-model] Ctrl+Shift+F. 2019-10-15 15:03:58 -07:00
Ziemowit Laski
2ca52a4124 [zlaski/memset-model] Add side effect modeling to Memset. 2019-10-15 14:43:39 -07:00
Robert Marsh
9aea2eda9b Apply suggestions from code review
Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-10-15 14:11:45 -07:00
Jonas Jensen
25130f200b Merge pull request #2132 from hmakholm/pr/gitignore-codeql
.gitignore += codeql
2019-10-15 21:57:39 +02:00
Henning Makholm
12c44b1994 .gitignore += codeql
It is useful (though not necessary) to be able to place codeql in a Semmle/ql checkout.
2019-10-15 20:59:14 +02:00
Jonas Jensen
4c15ea581a C++: Autoformat CFG.qll 2019-10-15 19:32:55 +02:00
igfoo
61d21c1ec0 Merge pull request #2127 from matt-gretton-dann/cpp-451-invalid_key-for-var_decls-fun_decls
Use correct keysets for var_decls and fun_decls
2019-10-15 17:56:04 +01:00
yh-semmle
5aced3e432 Merge pull request #2128 from AlexTereshenkov/move-qll-java
Move qll file to support import from custom QL queries
2019-10-15 11:39:10 -04:00
Sam Lanning
54af67c40f Merge pull request #2126 from AlexTereshenkov/issue-template-general
Add general question issue template
2019-10-15 08:26:24 -07:00
Shati Patel
a2162ba6f3 Docs: Update some more links 2019-10-15 16:19:18 +01:00
Shati Patel
1a319b03cd Docs: Update links to language specification 2019-10-15 16:02:45 +01:00
Anders Schack-Mulligen
309961d493 Merge pull request #2118 from yh-semmle/java-non-sync-override
Java: restrict `java/non-sync-override` to immediate overrides
2019-10-15 16:40:00 +02:00
Jonas Jensen
a9984e9d8b C++: Implement Pos and Spec as int, not newtype
This change gives a slight performance improvement and makes the QL code
shorter. It introduces some magic numbers in the code, but those are
confined to the `Pos` and `Spec` classes.

We get a speed-up because the evaluator has built-in support for integer
literals in the `OUTPUT` of `JOIN` operations, whereas `newtype`s have
to be explicitly joined on. As a result, a predicate like
`CFG::straightLineSparse#ffff` drops from 262 pipeline nodes to 242.

I measured performance on https://github.com/jluttine/suitesparse, which
is one of the projects that had the biggest slowdown when enabling the
QL CFG on lgtm.com. I took two measurements before this change and two
after. The `CFG.qll` stage took 117s and 112s before, and it took 106s
and 107s after.
2019-10-15 16:22:37 +02:00
alexey
715f1ddaca Move qll file to support import from custom QL queries 2019-10-15 14:55:09 +01:00
Matthew Gretton-Dann
692c29d095 C++: Test fun_decl for INVALID_KEYs 2019-10-15 14:47:32 +01:00
Matthew Gretton-Dann
0f6d64e27e C++: Update schema stats 2019-10-15 14:42:57 +01:00
Matthew Gretton-Dann
e4174ff610 C++: Add schema upgrade script 2019-10-15 14:42:57 +01:00
Matthew Gretton-Dann
f98d20c33a C++: Update var_decls, fun_decls keysets. 2019-10-15 14:42:57 +01:00
Tom Hvitved
b142113037 Merge pull request #2087 from calumgrant/cs/localexprflow
C#: Implement localExprFlow and localExprTaint
2019-10-15 15:33:50 +02:00
Tom Hvitved
3f170142c9 Merge pull request #2086 from calumgrant/cs/indexer-detection
C#: Fix an InvalidCastException
2019-10-15 15:33:32 +02:00
alexey
a2478296db Add general question issue template 2019-10-15 12:13:45 +01:00
Rasmus Wriedt Larsen
d3f3cefa54 Python: Autoformat (4 spaces) falcon library 2019-10-15 11:23:51 +02:00
Rasmus Wriedt Larsen
7a112f37cb Python: Modernise falcon library 2019-10-15 11:22:46 +02:00
Tom Hvitved
cae7f9d805 Merge pull request #2099 from aschackmull/java/callcontext-bool-pruning
Java: Data-flow pruning based on call contexts.
2019-10-15 09:36:36 +02:00
Robert Marsh
47668f275f C++/Docs: move controls predicate to top of file 2019-10-14 11:54:55 -07:00
Jonas Jensen
527ec4a9e4 Merge pull request #2122 from geoffw0/bitsign2
CPP: BitwiseSignCheck.ql fix
2019-10-14 15:47:36 +02:00
Matthew Gretton-Dann
53720a30e9 Merge pull request #2115 from nickrolfe/builtin_complex
C++: support `__builtin_complex`
2019-10-14 14:40:43 +01:00
Max Schaefer
dca808126f Merge pull request #2032 from erik-krogh/lessSpaces
JS: remove false positive in js/missing-space-in-concatenation
2019-10-14 14:25:40 +01:00
Anders Schack-Mulligen
2be5c38615 Java: Address comments. 2019-10-14 14:59:14 +02:00
semmle-qlci
82db8c8856 Merge pull request #2108 from asger-semmle/typescript-3.6.3
Approved by esben-semmle
2019-10-14 12:33:06 +01:00
Nick Rolfe
22fa657818 C++: update stats for @builtincomplex 2019-10-14 11:31:59 +01:00
Nick Rolfe
564e4511bc C++: add upgrade script 2019-10-14 11:31:59 +01:00
Nick Rolfe
6c83c76268 C++: add a test for __builtin_complex 2019-10-14 11:31:59 +01:00
Nick Rolfe
682832fc55 C++: add an expr kind for __builtin_complex 2019-10-14 11:31:58 +01:00
Geoffrey White
62311eb37d CPP: Change note. 2019-10-14 11:03:49 +01:00
Geoffrey White
ff8e04aa99 CPP: Fix bug. 2019-10-14 11:00:43 +01:00
Geoffrey White
62625cc454 CPP: Extend the test. 2019-10-14 10:44:04 +01:00
Henning Makholm
29167bbff8 Add qlpack.json files
Eventually these files will subsume the current `queries.xml` files
at the top of query-containing and library directories. For now they're
just here to support internal testing of the tooling support for them
we're writing on.

Format and contents is a work in progress. If you're not in Semmle,
don't depend on anything here making sense (or staying stable) until
you see the version tags increase to something nonzero.
2019-10-12 17:38:01 +02:00
yh-semmle
b37d92ac95 Java: add change note for java/non-sync-override 2019-10-11 19:36:45 -04:00
zlaski-semmle
ae0c4e449f Merge pull request #1925 from geoffw0/qldoceg10
CPP: Add syntax examples to QLDoc in Access.qll, Declaration.qll
2019-10-11 12:19:18 -07:00
Geoffrey White
0398681b84 CPP: Autoformat. 2019-10-11 17:30:29 +01:00
shati-patel
26fd0df023 Merge pull request #2117 from felicitymay/codeowners
Update CODEOWNERS file
2019-10-11 15:55:39 +01:00
Felicity Chapman
850cc53278 Update CODEOWNERS file 2019-10-11 15:37:36 +01:00
shati-patel
c8595d1da1 Merge pull request #2111 from jf205/fix-heading
docs: fix heading levels in c/c++ topic
2019-10-11 10:21:08 +01:00
Anders Schack-Mulligen
bc2d31bef2 Merge pull request #2114 from yh-semmle/java-expr-parent
Java: refine type of parent column in `exprs` relation
2019-10-11 09:58:11 +02:00
yh-semmle
64db00ae6d Java: refine type of parent column in exprs relation 2019-10-10 19:57:53 -04:00
yh-semmle
35552a8c0e Java: restrict java/non-sync-override to immediate overrides 2019-10-10 19:56:42 -04:00
Raul Garcia (MSFT)
7b0e83fead Porting Boost.org TLS queries 2019-10-10 16:05:14 -07:00
semmle-qlci
75bf339a9b Merge pull request #2112 from shati-patel/quick-fix
Approved by jf205
2019-10-10 16:04:30 +01:00
Shati Patel
b6311836a0 Docs: small fixes 2019-10-10 15:50:50 +01:00
Jonas Jensen
c99845ce5d Merge pull request #2035 from geoffw0/comparison
CPP: Unclear comparison precedence template fix
2019-10-10 16:31:54 +02:00
james
09cd86c005 docs: heading levels 2019-10-10 14:38:14 +01:00
Rasmus Wriedt Larsen
bf197b9f20 Add testcase 2019-10-10 15:34:54 +02:00
Rasmus Wriedt Larsen
36bb5f54ce Python: Fix hasFlowPath default implementation of isSink/2
If hasFlowPath was used, and isSink/2 was not overridden,
hasFlowPath(src, sink) would not use isSink/1 to restrict the allowed TaintSink.
This resulted in false-positives when we had flows with unrelated TaintSinks.

FP: 1a8e7ffc2e/files/webapp/graphite/dashboard/views.py (x2d486922081db956):1

Fixes https://github.com/Semmle/ql/issues/2081
2019-10-10 15:34:54 +02:00
semmle-qlci
7ba04768cd Merge pull request #2098 from asger-semmle/ts-computed-field-name-context
Approved by esben-semmle
2019-10-10 12:06:46 +01:00
Asger F
3e83d8486f TS: Update @types/node 2019-10-10 10:56:07 +01:00
Asger F
c10e48ddea TS: Bump to TypeScript 3.6.3 2019-10-10 10:24:48 +01:00
semmle-qlci
3726b79a23 Merge pull request #2103 from asger-semmle/remove-rollup-deps
Approved by esben-semmle
2019-10-10 10:10:45 +01:00
Geoffrey White
d8f3422375 CPP: Reword and clarify. 2019-10-10 10:04:32 +01:00
Geoffrey White
393c9e9247 CPP: QLDoc example for ImplicitThisFieldAccess. 2019-10-10 10:04:32 +01:00
Geoffrey White
1c0fdef0a8 CPP: Add a simplified test case for ImplicitThisFieldAccess. 2019-10-10 10:04:32 +01:00
Geoffrey White
e45ea90428 CPP: Backticks. 2019-10-10 10:04:31 +01:00
Geoffrey White
5fe69c7658 CPP: QLDoc fix for Stmt.qll. 2019-10-10 10:04:31 +01:00
Geoffrey White
85063760af CPP: Examples Declaration.qll. 2019-10-10 10:04:31 +01:00
Geoffrey White
3e46494c3a CPP: Clarify the Declaration / DeclarationEntry relationship around definitions, as there has been confusion over this. 2019-10-10 10:04:31 +01:00
Geoffrey White
bc4363bc22 CPP: Add a test of FunctionAccess and cases for FieldAccess. 2019-10-10 10:04:31 +01:00
Geoffrey White
4543aaf5dd CPP: Examples Access.qll. 2019-10-10 10:04:31 +01:00
Geoffrey White
cdf48cf0d4 CPP: Change note. 2019-10-10 09:23:03 +01:00
Geoffrey White
b10988faec CPP: Fix the query. 2019-10-10 09:15:19 +01:00
Geoffrey White
3f167a6f15 CPP: Add a test involving templates. 2019-10-10 09:15:19 +01:00
Geoffrey White
4fc73cab63 CPP: Add a test of ComparisonPrecedence.ql. 2019-10-10 09:15:19 +01:00
Robert Marsh
62c73a5f70 C++/Docs: more work on guards.rst
Added some examples and reworded portions of guards.rst. There's still
more to do - examples for ensures and compares predicates, and possibly
rewording the description of the compares predicates
2019-10-09 16:13:53 -07:00
zlaski-semmle
8896fa5bc9 Merge pull request #1924 from geoffw0/quickfix
CPP: Tiny qldoc fixes.
2019-10-09 14:52:54 -07:00
Robert Marsh
500a81ad1e C++/Docs: remove reference to IR GVN 2019-10-09 10:45:39 -07:00
Alexander Eyers-Taylor
70caa9b82c Merge pull request #2105 from shati-patel/qldoc-spec
Terminology update
2019-10-09 17:02:35 +01:00
semmle-qlci
6e8764d592 Merge pull request #2104 from Semmle/training-typo
Approved by jf205
2019-10-09 16:03:25 +01:00
Nick Rolfe
91d3389e58 QL training: fix typos 2019-10-09 15:55:41 +01:00
shati-patel
9bb1b4f68a Terminology update
Method -> member predicate
2019-10-09 15:08:18 +01:00
Esben Sparre Andreasen
0e79d3db46 Merge pull request #2065 from erik-krogh/noReturn
JS: use of returnless function
2019-10-09 13:44:39 +02:00
Asger F
7355fdf900 JS: Update trap output 2019-10-09 11:59:42 +01:00
Asger F
1f2c331ad9 TS: Remove dependency on rollup 2019-10-09 11:42:13 +01:00
Esben Sparre Andreasen
ea63414e97 Merge pull request #2016 from asger-semmle/jquery
Add type tracking and type info to jQuery model
2019-10-09 10:55:57 +02:00
Anders Schack-Mulligen
312c573eb6 Java: Remove unneeded import. 2019-10-09 10:10:36 +02:00
Anders Schack-Mulligen
e123f97303 Java: Remove useless pruning. 2019-10-09 09:35:30 +02:00
Jonas Jensen
daabb2c5d0 Merge pull request #2082 from rdmarsh2/rdmarsh/cpp/ir-getASTVariable
IR: add getASTVariable to VariableInstruction
2019-10-09 08:56:01 +02:00
Robert Marsh
07e7d061cd C++/Docs: expand on gvn and hashcons design 2019-10-08 13:41:26 -07:00
Robert Marsh
aee87ebaaa C++/Docs: respond to simple PR comments 2019-10-08 10:53:54 -07:00
Robert Marsh
a90e8684e4 C++: Apply suggestions from code review
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-10-08 10:40:08 -07:00
Anders Schack-Mulligen
5e0ce81030 Java: Refactor to improve join-pipeline. 2019-10-08 17:15:06 +02:00
Asger F
c09e748bca JS: Migrate JQueryMethodCall to new API 2019-10-08 14:05:10 +01:00
semmle-qlci
c8e5be74d5 Merge pull request #2093 from asger-semmle/ts-unused-var-fix
Approved by erik-krogh
2019-10-08 13:51:46 +01:00
Asger F
e4e10a3222 JS: Bump extractor version string 2019-10-08 13:51:13 +01:00
Asger F
1fc01d9b5d JS: Add change note 2019-10-08 13:51:13 +01:00
Asger F
8146619913 JS: Set context of computed field names to enclosing ctor 2019-10-08 13:51:12 +01:00
Asger F
2235072841 JS: Add tests 2019-10-08 13:51:12 +01:00
Jonas Jensen
5d7a0b8dd5 Merge remote-tracking branch 'upstream/master' into dataflow-ref-parameter
I've accepted the new test output, which shows that this branch fixes
two false negatives in the test cases from #2088.
2019-10-08 13:09:20 +02:00
Asger F
ea35b8418a JS: Add change note 2019-10-08 12:05:31 +01:00
Jonas Jensen
19f642fc8d Merge commit '7434702' into dataflow-ref-parameter
This merges #1735 into this branch to resolve the semantic merge
conflicts between them.
2019-10-08 12:55:47 +02:00
Asger F
90ad55e8ce JS: Update DOM test 2019-10-08 11:50:18 +01:00
Erik Krogh Kristensen
0933235132 whitelist calls to functions that always throw an exception 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
a2993f1849 massively improve performance for detecting one-shot closures 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
0b8ea3c504 remove redundant check in returnsVoid 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
5ce356f509 two small doc fixes from docteam
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
c6918ef38e changes to documentation and small change in returnsVoid based on code-review 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
8c7f316a57 add qldoc to benignContext predicate
Co-Authored-By: Esben Sparre Andreasen <42067045+esben-semmle@users.noreply.github.com>
2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
63b3005217 remove punctuation in query name 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
b0b2d02855 small doc update
Co-Authored-By: mc <42146119+mchammer01@users.noreply.github.com>
2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
55f2f62c7a changes based on code review 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
49bd553916 change query severity to warning 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
ea3c2fb2fa add fix suggestion to qhelp of js/use-of-returnless-function 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
64bcc10af3 remove redundancy in qhelp 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
666e11a506 apply suggestions from code review
Co-Authored-By: Esben Sparre Andreasen <42067045+esben-semmle@users.noreply.github.com>
2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
1c424310ae revert the last small change to ExprHasNoEffect.qll 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
34d0f72706 small refactor and added docstring based on code review 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
92623a3e32 cleanup and refactor of promise case based on code-review 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
0b48999718 refactored the attribute checks based on code-review 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
1bbe1ecdba the js/use-of-returnless-function query now support multiple callees 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
7025ba36c0 refactor of js/use-of-returnless-function 2019-10-08 11:54:57 +02:00
Erik Krogh Kristensen
00bf82d3c7 small changes to benignContext predicate based on code review 2019-10-08 11:54:56 +02:00
Erik Krogh Kristensen
dedae5ba1d refactor isExplicitConditional into a library file, and use it from js/use-of-returnless-function 2019-10-08 11:54:56 +02:00
Erik Krogh Kristensen
bda37b6d6f refactor of benignContext predicate based on code review 2019-10-08 11:54:56 +02:00
Erik Krogh Kristensen
cdde8aea58 revert changes to js/useless-expression 2019-10-08 11:54:56 +02:00
Erik Krogh Kristensen
be18adca3c update description in change-notes 2019-10-08 11:54:56 +02:00
Erik Krogh Kristensen
9788b16dee add change note for js/use-of-returnless-function 2019-10-08 11:54:08 +02:00
Erik Krogh Kristensen
bed14244ae add query for detecting uses return-values from functions that does not return a value 2019-10-08 11:53:14 +02:00
Anders Schack-Mulligen
20084fb3c0 Java: Fix pruning in partialPathStep. 2019-10-08 11:28:53 +02:00
Anders Schack-Mulligen
bf14889077 Java: Refactor to improve performance. 2019-10-08 11:28:35 +02:00
Esben Sparre Andreasen
24a5301d87 Merge pull request #2056 from erik-krogh/suspiciousMethodName
JS: add query for detecting suspicious method names in TypeScript
2019-10-08 10:49:57 +02:00
Robert Marsh
d8f539d78b C++/Docs: Add guides to advanced AST libraries 2019-10-07 16:14:10 -07:00
Asger F
d0cce12db9 JS: Bump extractor version 2019-10-07 16:51:57 +01:00
Asger F
52bd19b951 JS: Run Java formatter 2019-10-07 16:51:57 +01:00
Asger F
316580334a TS: Fix extraction of default-exported class 2019-10-07 16:46:59 +01:00
Calum Grant
d6bbc51996 C#: Autoformat QL. 2019-10-07 16:10:46 +01:00
Calum Grant
d5a48a34e6 C#: Remove redundant test for indexers. Tested in library-tests\overrides. 2019-10-07 15:56:36 +01:00
semmle-qlci
ff5a98b260 Merge pull request #2074 from taus-semmle/python-unreachable-nonlocal
Approved by RasmusWL
2019-10-07 15:45:24 +01:00
semmle-qlci
e36e16af48 Merge pull request #2079 from taus-semmle/python-unused-local-nonlocal
Approved by RasmusWL
2019-10-07 15:38:21 +01:00
Anders Schack-Mulligen
3c4e877913 Java: Minor refactor. 2019-10-07 16:18:48 +02:00
Anders Schack-Mulligen
f8123679a1 Java: Qldoc updates. 2019-10-07 16:12:31 +02:00
Anders Schack-Mulligen
38aba7bfc1 Java: Fix qltest. 2019-10-07 15:51:42 +02:00
Anders Schack-Mulligen
75ebc098bb Java: Fix semantic merge conflict. 2019-10-07 15:42:26 +02:00
Asger F
8fcf0ed30c JS: Update Angular/JQLiteObject test 2019-10-07 14:31:09 +01:00
Anders Schack-Mulligen
b581e38782 Java: Autoformat and sync post rebase. 2019-10-07 15:26:39 +02:00
Cornelius Riemenschneider
9ef61bd43c Address more parts of Anders review. 2019-10-07 15:19:20 +02:00
Erik Krogh Kristensen
3a55880d51 update expected output for js/suspicious-method-name-declaration 2019-10-07 15:18:37 +02:00
Cornelius Riemenschneider
812a0bcb16 Address some parts of Anders' review. 2019-10-07 15:17:17 +02:00
Cornelius Riemenschneider
0f5dd5d7c7 Add one more test with a more complicated guard. 2019-10-07 15:14:42 +02:00
Cornelius Riemenschneider
393fb02dfa Fix undesirable join order. 2019-10-07 15:14:41 +02:00
Tom Hvitved
ee5503146e Add stub implementations for isUnreachableInCall() 2019-10-07 15:13:49 +02:00
Tom Hvitved
eabfa31767 Synchronize data flow files 2019-10-07 15:13:48 +02:00
Tom Hvitved
46933ef65e Java: Autoformat 2019-10-07 15:12:13 +02:00
Cornelius Riemenschneider
d79eaffd3a Prune unreachable paths in the Java dataflow library based on call context.
We now detect patterns like
f(bool cond){
       if(cond)
        then A
        else B
and prune branches for calls like f(true) or f(false).
This pruning is done both in the local (bigstep) flow graph
as well as in the inter-procedural dataflow graph.
2019-10-07 15:10:54 +02:00
Cornelius Riemenschneider
dba93b30e7 Add tests exhibiting false positives in the dataflow library, where call context is not used to prune branches. 2019-10-07 14:59:55 +02:00
Rasmus Wriedt Larsen
3f45d8614b Merge pull request #2047 from taus-semmle/python-modernise-and-fix-cyclic-import-fp
Python: modernise and fix cyclic import false positive.
2019-10-07 14:28:36 +02:00
semmle-qlci
fbb7747bd1 Merge pull request #2073 from hvitved/csharp/splitting-joins
Approved by calumgrant
2019-10-07 12:22:57 +01:00
Asger F
755f76a308 JS: Mention the ::Range classes 2019-10-07 08:29:42 +01:00
Asger F
34b4eb69db JS: Cache JSDocTypeExpr.resolvedName() 2019-10-07 08:29:42 +01:00
Asger F
c1e9eec267 JS: Modernize jQuery attribute defs 2019-10-07 08:29:42 +01:00
Asger F
a224186fab JS: Migrate AngularJS.JQLiteObject 2019-10-07 08:29:42 +01:00
Asger F
afdcb1e075 JS: Handle jQuery objects from Parameter.getAnInitialUse() 2019-10-07 08:29:42 +01:00
Asger F
284a24c18e JS: Update tests with deprecation warning 2019-10-07 08:29:42 +01:00
Asger F
fb181c2d14 JS: Use type info and type tracking in jQuery 2019-10-07 08:29:42 +01:00
Calum Grant
369c456353 Merge pull request #2090 from hvitved/csharp/local-function-trap
C#: Use containing type instead of containing method in local function TRAP label
2019-10-07 08:29:13 +01:00
Tom Hvitved
8ba94140b1 C#: Use containing type instead of containing method in local function TRAP label
This is in order to handle the case where the enclosing callable of a local
function is a lambda expression.
2019-10-06 21:05:34 +02:00
Tom Hvitved
28021d6715 C#: Add test for local function in lambda 2019-10-06 20:50:24 +02:00
Jonas Jensen
6c87d75190 Merge pull request #2088 from geoffw0/swap3
CPP: Add taint tests.
2019-10-04 20:44:18 +02:00
Robert Marsh
7fefe4385a Merge pull request #1963 from jbj/predictableInstruction
C++: Implement predictableInstruction without Expr
2019-10-04 10:04:52 -07:00
Geoffrey White
050d99fa87 CPP: Add test cases. 2019-10-04 17:44:27 +01:00
Calum Grant
2706238413 C#: Update queries to use localExprFlow. 2019-10-04 16:53:02 +01:00
Calum Grant
af25536648 C#: Add localExprFlow and localExprTaint, and change notes. 2019-10-04 16:46:02 +01:00
ian-semmle
ebc10cf5db Merge pull request #2084 from matt-gretton-dann/cpp-445-synthetic_destructor_call-INVALID_KEY-warnings
Update keysets for synthetic_destructor_call and *variables tuple
2019-10-04 16:38:35 +01:00
Calum Grant
ba6eb22cc9 C#: Roslyn workaround for when IPropertySymbol.IsIndexer seems to be working incorrectly. 2019-10-04 16:28:28 +01:00
Tom Hvitved
b55e2948be Merge pull request #1986 from calumgrant/cs/switch-cfg
C#: Fix CFG for switch statements where the default case is not the last
2019-10-04 16:54:04 +02:00
Erik Krogh Kristensen
14cc352bd9 small documentation change based on review 2019-10-04 15:26:32 +02:00
Geoffrey White
0e478d1c0e Merge pull request #2066 from jbj/dataflow-conditionAlwaysTrue-perf
C++: Improve join orders for QL CFG
2019-10-04 14:16:41 +01:00
Geoffrey White
e465f4cc81 Merge pull request #2064 from jbj/leapyear-extends-abstract
C++: Avoid `extends Operation` in LeapYear.qll
2019-10-04 14:15:21 +01:00
Erik Krogh Kristensen
144e831515 mention that "function" should not be used when declaring a call signature in an interface 2019-10-04 15:05:11 +02:00
Anders Schack-Mulligen
066a2f0d12 Java: Add another overflow check pattern to UselessComparisonTest. 2019-10-04 15:04:40 +02:00
Erik Krogh Kristensen
bf1fd83851 fix typo in predicate name 2019-10-04 15:04:39 +02:00
Erik Krogh Kristensen
b741a65e9b documentation changes based on review
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-10-04 14:42:16 +02:00
Jonas Jensen
a7641a8765 C++: Clarify OutNode and ReturnNode QLDoc 2019-10-04 14:33:04 +02:00
Anders Schack-Mulligen
273ef46c22 Merge pull request #2080 from hvitved/dataflow/ap-tostring
Java/C++/C#: Tweak `AccessPathNil::toString()`
2019-10-04 14:02:10 +02:00
Erik Krogh Kristensen
c8d60c9e2a update @description of js/suspicious-method-name-declaration 2019-10-04 11:40:33 +02:00
Tom Hvitved
7f6e253425 Java: Update expected test output 2019-10-04 11:09:44 +02:00
Tom Hvitved
9b58d799cb Java/C++/C#: Tweak AccessPathNil::toString()
Move the type annotation outside the brackets, to avoid prefixes such as
`[ : T]`.
2019-10-04 11:09:44 +02:00
Erik Krogh Kristensen
712a337bdd qhelp adjustments based on code-review 2019-10-04 11:06:11 +02:00
Erik Krogh Kristensen
ced5e3ea29 qhelp adjustment from code-review
Co-Authored-By: Esben Sparre Andreasen <42067045+esben-semmle@users.noreply.github.com>
2019-10-04 11:02:15 +02:00
Robert Marsh
6e587f3f2a IR: Add VariableInstruction.getASTVariable 2019-10-03 13:12:06 -07:00
Robert Marsh
c1e3821ab0 IR: rename getVariable to getIRVariable 2019-10-03 13:10:49 -07:00
Taus Brock-Nannestad
26da6a1178 Python: Apply autoformat. 2019-10-03 17:58:52 +02:00
Taus Brock-Nannestad
5946a4a066 Python: Teach py/unused-local-variable about nonlocal. 2019-10-03 17:56:29 +02:00
Calum Grant
48dee29620 Merge pull request #2021 from hvitved/csharp/local-not-disposed
C#: Refactor `cs/local-not-disposed` using data flow library
2019-10-03 15:21:06 +01:00
Matthew Gretton-Dann
d06e3d79c6 C++: Add DB Upgrade script 2019-10-03 15:16:50 +01:00
Matthew Gretton-Dann
618d0a9603 C++: Update DB Stats 2019-10-03 15:16:50 +01:00
Matthew Gretton-Dann
a7f682a9be C++: Update *variables keysets. 2019-10-03 15:16:50 +01:00
Matthew Gretton-Dann
d62730a9f3 C++: Update synthetic_destructor_call keysets.
Reorder the [ destructor_call, expr ] tuple.
Add a [ expr, i ] tuple.
2019-10-03 15:16:50 +01:00
Matthew Gretton-Dann
06d1d6ed5d C++: Fix synthetic_destructor_call key uniqueness. 2019-10-03 15:16:50 +01:00
Jonas Jensen
dca39f0fad Merge pull request #2027 from zlaski-semmle/zlaski/memset-model
[zlaski/memset-model] QL model for `memset` and friends
2019-10-03 14:31:23 +02:00
Jonas Jensen
01a3a037bc C++: Make complex_numbers/expr.ql less brittle
This test used `getAQlClass`, which caused it to break when new classes
were added anywhere in the libraries. That's now avoided by switching to
`getCanonicalQLClass`. It turns out that `getCanonicalQLClass` didn't
support arithmetic expressions on complex numbers, so that support had
to be added.
2019-10-03 13:19:16 +02:00
AlexTereshenkov
3e6f8fb6be Add bind-socket-all-network-interfaces Python query (#2048)
Add bind-socket-all-network-interfaces Python query
2019-10-03 11:23:11 +01:00
Jonas Jensen
41d344a8b7 C++: Support if constexpr in QL CFG
This fixes the test `cpp/ql/test/library-tests/constexpr_if/cfg.ql`,
which broke when the QL CFG was enabled.

The new cases are just copy-pastes of the `IfStmt` cases (they don't
share a useful common superclass) with added checks for whether their
constant value equals 0.
2019-10-03 12:21:41 +02:00
Jonas Jensen
2eed38e2d4 C++: Accept slight CFG regression in static init
Hopefully it does not make a difference in practice whether
uninstantiated template functions are considered to have control flow
through initializers of their static variables.
2019-10-03 11:48:03 +02:00
semmle-qlci
a019c456e9 Merge pull request #1985 from shati-patel/ql-etudes
Approved by jf205
2019-10-03 09:16:22 +01:00
semmle-qlci
a8a7de963c Merge pull request #2070 from shati-patel/hb/updates
Approved by jf205
2019-10-03 09:14:58 +01:00
Jonas Jensen
8bed418022 C++: enable the QL-based CFG code 2019-10-03 10:04:24 +02:00
yh-semmle
3313af5189 Merge pull request #2036 from aschackmull/java/eq-ssa-guard
Java: Improve guards for equal ssa variables.
2019-10-02 12:00:59 -04:00
Taus Brock-Nannestad
384013e0dc Python: Add tests for reachability when using nonlocal. 2019-10-02 17:13:00 +02:00
Tom Hvitved
e5380aa6a7 Merge pull request #2038 from aschackmull/java/dataflow-fixes
Java/C++/C#: Misc. dataflow fixes.
2019-10-02 16:39:01 +02:00
Calum Grant
eb893fbc5d Merge pull request #2024 from hvitved/csharp/conversion-unbound
C#: Handle unbound types in conversion library
2019-10-02 15:36:38 +01:00
Tom Hvitved
b66479c028 C#: Add change note 2019-10-02 16:31:26 +02:00
Tom Hvitved
17085dc05c C#: Fix typo 2019-10-02 16:26:38 +02:00
Tom Hvitved
6ebefbb67d C#: Improve a few join-orders in Splitting.qll 2019-10-02 16:23:08 +02:00
Erik Krogh Kristensen
2b5e3aebb7 change tabs to spaces 2019-10-02 15:03:38 +02:00
Erik Krogh Kristensen
0c46e5c1a8 update description of js/suspicious-method-name-declaration 2019-10-02 15:01:25 +02:00
Erik Krogh Kristensen
c0b7538cf0 made the blacklist for methods named "function" work again 2019-10-02 14:56:41 +02:00
Erik Krogh Kristensen
e5290f3bb0 remove some parentheses 2019-10-02 14:51:47 +02:00
Erik Krogh Kristensen
22aac8e723 ensure that the existence of non-synthetic constructor is checked correctly 2019-10-02 14:49:33 +02:00
Anders Schack-Mulligen
f87cb4d6ac Java/C++/C#: Address review comments and fix test. 2019-10-02 14:32:17 +02:00
Shati Patel
9c54eef45a QL HB: Update aggregation section 2019-10-02 12:48:16 +01:00
Shati Patel
3dd2a6c325 QL etudes: Add further explanation + link 2019-10-02 12:21:23 +01:00
Anders Schack-Mulligen
0154e31e64 Java: Add change note. 2019-10-02 11:47:53 +02:00
Calum Grant
28c34ad41e C#: Address review comments. 2019-10-02 10:42:06 +01:00
Calum Grant
39f550b6d2 Merge pull request #2054 from hvitved/csharp/autobuilder/log-cleanup
C#: Cleanup more files after failed autobuilder attempt
2019-10-01 15:55:58 +01:00
Calum Grant
b4da63b3f2 Merge pull request #2061 from hvitved/csharp/local-function-label
C#: Prepend enclosing method in local function TRAP labels
2019-10-01 15:19:04 +01:00
Erik Krogh Kristensen
a66e33ea5e add references to TypeScript spec for "new" and "constructor" keywords 2019-10-01 15:56:45 +02:00
Jonas Jensen
3c7d79481f C++: Autoformat FlowVar.qll 2019-10-01 15:54:41 +02:00
Erik Krogh Kristensen
584b9d4e30 update expected test output 2019-10-01 15:53:37 +02:00
Erik Krogh Kristensen
2ad85d16bd refactor a list of negated conjunctions to a disjunction 2019-10-01 15:53:22 +02:00
Erik Krogh Kristensen
6c176fc967 introduce name as a variable, and adjust alert messages 2019-10-01 15:28:57 +02:00
Erik Krogh Kristensen
26a0bfac39 refactor js/suspicious-method-name-declaration to use isSynthetic predicate 2019-10-01 15:06:45 +02:00
Erik Krogh Kristensen
1e2aad5a29 fix pointer in .qlref, and update expected test results 2019-10-01 14:56:00 +02:00
Erik Krogh Kristensen
aa1368741b rename suspicious-method-name to suspicious-method-name-declaration 2019-10-01 14:37:07 +02:00
Jonas Jensen
0990ceb09a C++: Remove bbNotInLoop and its caller in FlowVar
This change is needed when enabling the QL CFG on certain snapshots such
as notaz/picodrive. It removes the `bbNotInLoop` predicate, which was
always a liability because it's inherently quadratic. The real slowdown
came in `skipLoop`, where all true-upon-entry loops were crossed with
all definitions of variables that should take their definition from the
loop body.
2019-10-01 14:33:28 +02:00
Jonas Jensen
eed24f1933 C++: Improve join orders with QL CFG
Size estimates are slightly different when we enable the QL CFG, and
this caused bad join orders in these predicates.
2019-10-01 14:33:28 +02:00
ian-semmle
e048207e2f Merge pull request #2055 from matt-gretton-dann/cpp-439-test-cases
C++: Add test cases for constant initializers
2019-10-01 12:43:46 +01:00
Shati Patel
427325b04a QL etudes: Update with Robert's suggestions 2019-10-01 11:23:41 +01:00
Jonas Jensen
34b625900a C++: Avoid extends Operation in LeapYear.qll
The `Operation` class is abstract, and extending it caused cached stages
to be recomputed all the way down to the AST. This meant that the leap
year queries evaluated their own copy of SSA and data flow.
2019-10-01 11:50:33 +02:00
Jonas Jensen
7434702958 Merge pull request #1735 from rdmarsh2/rdmarsh/cpp/ir-dataflow-def-by-ref-2
C++: side effect IR instructions for pointer arguments
2019-10-01 11:35:19 +02:00
Calum Grant
fdc29aa81d Merge pull request #2062 from hvitved/csharp/suppress-similar-file
C#: Suppress `cs/similar-file` alerts
2019-10-01 10:21:55 +01:00
Jonas Jensen
7c319efb8b C++: Data flow through reference parameters 2019-10-01 10:43:49 +02:00
Tom Hvitved
413926f675 C#: Prepend enclosing method in local function TRAP labels 2019-10-01 10:25:18 +02:00
Robert Marsh
d1e2ddcf99 C#: sync unalised_ssa IR stage and add to check 2019-09-30 12:53:00 -07:00
Robert Marsh
ee3b40bd89 C#: sync changes and accept test output 2019-09-30 12:00:55 -07:00
Robert Marsh
a45a6e48f8 C++: remove side effect operands from non-reads 2019-09-30 12:00:55 -07:00
Robert Marsh
9f20cb83c3 C++/C#: Autoformat 2019-09-30 12:00:55 -07:00
Robert Marsh
fcfc11052a C++: add QLDoc to side effect functions 2019-09-30 12:00:54 -07:00
Robert Marsh
8649978a43 C++: add indexes for specific side effects 2019-09-30 12:00:53 -07:00
Robert Marsh
24574be007 C++: add SizedBuffer side effect instructions 2019-09-30 12:00:53 -07:00
Robert Marsh
554d6390f7 C++: clean up after rebase 2019-09-30 12:00:53 -07:00
Robert Marsh
49088e7f09 C++: Fix formatting and dropped line 2019-09-30 12:00:53 -07:00
Robert Marsh
3d562243e4 C++: add side effects for outparams 2019-09-30 12:00:52 -07:00
Ziemowit Laski
a0cbd87d1f [zlaski/memset-model] Rename predicate usage as per PR/1938. 2019-09-30 10:47:59 -07:00
Ziemowit Laski
ae169e9c33 [zlaski/memset-model] Add AliasFunction as base class of MemsetFunction; override predicates parameterNeverEscapes, parameterEscapesOnlyViaReturn and parameterIsAlwaysReturned. 2019-09-30 10:44:12 -07:00
Ziemowit Laski
aaa2a60b93 [zlaski/memset-model] Remove taint tracking from Memset.qll. Add Memset.qll to Models.qll. 2019-09-30 10:44:12 -07:00
Ziemowit Laski
144aacb09d [zlaski/memset-model] New Memset.qll file. 2019-09-30 10:44:12 -07:00
Tom Hvitved
4f2ca11d2c C#: Suppress cs/similar-file alerts 2019-09-30 19:26:02 +02:00
Calum Grant
ad8ae35c82 Merge pull request #1956 from hvitved/csharp/get-an-out-node
C#: Refactor `getAnOutNode()` predicate
2019-09-30 16:58:21 +01:00
Matthew Gretton-Dann
b76f66e83b C++: Add test cases for constant initializers
Adds test cases for initialisation of constants which aren't simple
zeros.  Example: int x = int();
2019-09-30 14:57:26 +01:00
Taus
fb20cab4c8 Merge pull request #2012 from RasmusWL/python-modernise-cls-self-checks
Python: modernise cls self argument name checks
2019-09-30 15:50:32 +02:00
Jonas Jensen
f417640da4 Merge pull request #1938 from dave-bartolomeo/dave/InNOut
C++: Rename predicates in `FunctionInputsAndOutputs.qll` and add QLDoc
2019-09-30 13:30:19 +02:00
Erik Krogh Kristensen
0320f0f26b add query for detecting suspisous method names in TypeScript 2019-09-30 13:05:50 +02:00
Tom Hvitved
c18d0430de C#: Cleanup more files after failed autobuilder attempt 2019-09-30 12:08:25 +02:00
Taus
9a8b62250f Merge pull request #2043 from RasmusWL/python-modernise-django
Python: modernise django library
2019-09-30 11:57:09 +02:00
Taus
04f14f1fe7 Merge pull request #2040 from RasmusWL/python-modernise-cherrypy
Python: Modernise cherrypy library
2019-09-30 11:53:59 +02:00
Taus
fc4a583cd9 Merge pull request #2034 from RasmusWL/python-modernise-bottle
Python: modernise bottle
2019-09-30 11:52:16 +02:00
ian-semmle
610188984d Merge pull request #2031 from matt-gretton-dann/cpp-444-fix-vector_size-INVALID_KEY
Update tests for changes to reporting of vector_size attribute
2019-09-30 10:45:37 +01:00
Tom Hvitved
b7595ed60e C#: Remove duplicated class 2019-09-30 09:11:47 +02:00
Dave Bartolomeo
420713204a C++, C#: Fix typo 2019-09-29 22:44:17 -07:00
Dave Bartolomeo
043e5f716b C++, C#: Autoformat 2019-09-29 22:39:09 -07:00
Dave Bartolomeo
c1e5db0b96 C++ More PR feedback 2019-09-27 17:54:18 -07:00
Dave Bartolomeo
bcd987cdf1 Merge from master and share value numbering 2019-09-27 17:40:43 -07:00
Dave Bartolomeo
f76334c24a C++, C#: Share unaliased SSA files between languages
Most of the C# diffs are from bringing those files in sync with the latest C++ files.
2019-09-27 13:46:42 -07:00
Dave Bartolomeo
5585ccd509 C#: Fix up after merge 2019-09-27 12:33:33 -07:00
Taus
387e21e12c Merge pull request #2044 from AlexTereshenkov/add-py-query-tag
Add tags tag to a Python query
2019-09-27 17:54:54 +02:00
Calum Grant
abdf7ce223 Merge pull request #2045 from AndreiDiaconu1/ircsharp-various-fixes
C# IR: Minor sanity fixes
2019-09-27 15:51:07 +01:00
Calum Grant
09f441a27e Merge pull request #2009 from AndreiDiaconu1/ircsharp-rangeanalysis
C# IR: Add range analysis library
2019-09-27 14:27:41 +01:00
Taus Brock-Nannestad
c5c84a11d8 Python: Autoformat. 2019-09-27 15:22:12 +02:00
Taus Brock-Nannestad
aa16d20d5a Python: Fix false positive for cyclic imports guarded by if False:. 2019-09-27 15:22:12 +02:00
AndreiDiaconu1
c5cd5f489f Autoformat 2019-09-27 13:07:20 +01:00
Taus Brock-Nannestad
921371d544 Python: Modernise the cyclic import queries. 2019-09-27 13:51:56 +02:00
alexey
70eca91d28 Add tags tag to a Python query 2019-09-27 12:36:38 +01:00
AndreiDiaconu1
f5b31ae9f5 Static fields
The translation of static fields now uses `VariableAddress` instead of `FieldAddress`. This fixes the logic as well as the "field address without qualifier address" sanity check.
2019-09-27 12:21:47 +01:00
AndreiDiaconu1
21513102f7 Compiler generated constructor
Fixed a problem when the translating the compiler generated constructors that caused some sanity errors (since they have no body, when translating the constructor block fragmentation happened). Fixed this by skipping the translation of the body, if it does not exist (when translating a function).
2019-09-27 12:20:39 +01:00
Rasmus Wriedt Larsen
fc59b10ba4 Python: Autoformat (4 spaces) django library 2019-09-27 13:15:28 +02:00
Rasmus Wriedt Larsen
f4e0abd4c4 Python: Modernise django library 2019-09-27 13:14:52 +02:00
Rasmus Wriedt Larsen
bc8e4d2005 Python: Autoformat (4 spaces) cherrypy library 2019-09-27 13:06:09 +02:00
Matthew Gretton-Dann
cc016d583d C++: Add further vector_size attribute tests 2019-09-27 11:28:31 +01:00
Matthew Gretton-Dann
c10ed5e114 C++: Update results for vector_size atrr changes 2019-09-27 11:28:31 +01:00
Rasmus Wriedt Larsen
ff28b3f1b4 Python: Modernise cherrypy library 2019-09-27 11:23:33 +02:00
Dave Bartolomeo
9b8b364c8f Merge from master 2019-09-26 22:15:02 -07:00
Dave Bartolomeo
c389432922 C++, C#: Sync IRType.qll between languages 2019-09-26 22:11:24 -07:00
Dave Bartolomeo
c8d154e9cc C#: Fix dump of IR types 2019-09-26 15:54:09 -07:00
Dave Bartolomeo
e30e163081 C#: Implement IRType
This commit implements the language-neutral IR type system for C#. It mostly follows the same pattern as C++, modified to fit the C# type system. All object references, pointers, and lvalues are represented as `IRAddress` types. All structs and generic parameters are implemented as `IRBlobType`. Function addresses get a single `IRFunctionAddressType`.

I had to fix a couple places in the original IR type system where I didn't realize I was still depending on language-specific types. As part of this, `CSharpType` and `CppType` now have a `hasUnspecifiedType()` predicate, which is equivalent to `hasType()`, except that it holds only for the unspecified version of the type. This predicate can go away once we remove the IR's references to the underlying `Type` objects.

All C# IR tests pass without modification, but only because this commit continues to print the name of `IRUnknownType` as `null`, and `IRFunctionAddressType` as `glval<null>`. These will be fixed separately in a subsequent commit in this PR.
2019-09-26 15:47:52 -07:00
Dave Bartolomeo
28aa7dcae2 C++: Fix PR feedback 2019-09-26 13:56:43 -07:00
Geoffrey White
18b28b1b57 Merge pull request #1959 from jbj/const-pmf
C++: Classify more expressions as constant
2019-09-26 17:13:27 +01:00
AndreiDiaconu1
a7a5eaa23f Address PR comments 2019-09-26 16:49:18 +01:00
Anders Schack-Mulligen
f97958296d Java/C++/C#: Sync. 2019-09-26 17:12:08 +02:00
Erik Krogh Kristensen
7fb8f8453d fix for when the concatenation root is in parentheses 2019-09-26 16:35:38 +02:00
Rasmus Wriedt Larsen
4a5aae0db8 Python: autoformat (4 spaces) NonCls.ql NonSelf.ql 2019-09-26 16:31:14 +02:00
Rasmus Wriedt Larsen
457794e030 Python: Consistenly use parameter instead of argument in docs
The Python 3 FAQ states that this is the right thing [0]

It sadly doesn't align 100% with PEP8, which calls them for "arguments" [1], but
after discussion with Taus, we decided to go with "parameter" everywhere to be
consistent.

[0] https://docs.python.org/3/faq/programming.html#faq-argument-vs-parameter
[1] https://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
2019-09-26 16:31:09 +02:00
Anders Schack-Mulligen
0afea80d53 Java: Improve guards for equal ssa variables. 2019-09-26 16:29:13 +02:00
Anders Schack-Mulligen
4221639155 Java: Improve taint/value distinction for flow through with fields. 2019-09-26 16:25:15 +02:00
Calum Grant
e1594a4b0b Merge pull request #2017 from AndreiDiaconu1/ircsharp-various
C# IR: Some minor additions
2019-09-26 15:02:59 +01:00
Rasmus Wriedt Larsen
41f16aaf7a Python: Autoformat (4 spaces) bottle library 2019-09-26 15:05:51 +02:00
Rasmus Wriedt Larsen
12c49031e8 Python: Modernise bottle library 2019-09-26 15:03:47 +02:00
Max Schaefer
1e7b4c2989 Merge pull request #1953 from asger-semmle/typescript-call-signature-api
TS: Make overload index and functions signature more available
2019-09-26 12:42:04 +01:00
Rasmus Wriedt Larsen
546405a379 Python: Add more tests for cls/self argument names 2019-09-26 13:25:14 +02:00
Rasmus Wriedt Larsen
5271d6a063 Python: Add min/max #parameters to FunctionValue
So we don't loose this information on the newly migrated/modernise zope
interface
2019-09-26 13:25:14 +02:00
Rasmus Wriedt Larsen
a81bf720f5 Python: Modernise the py/not-named-self query. 2019-09-26 13:25:14 +02:00
Rasmus Wriedt Larsen
c6d9eb9254 Python: Move more tests for argument names into own file
Plus fixup of expected output from unrelated tests
2019-09-26 13:25:14 +02:00
Rasmus Wriedt Larsen
3f974fbc14 Python: Modernise the py/not-named-cls query. 2019-09-26 13:25:14 +02:00
Erik Krogh Kristensen
69365ccd03 remove false positive in missingSpaceInAppend by requring the presence of a word-like fragment 2019-09-26 12:59:05 +02:00
AndreiDiaconu1
0999780d82 Address PR comments 2019-09-26 11:51:54 +01:00
AndreiDiaconu1
3a5140c0f5 Indexers and events
Added test for indexers.
Added support for event accesses and added test.
2019-09-26 11:46:16 +01:00
AndreiDiaconu1
16d8d2efa1 Remove useless translation 2019-09-26 11:46:16 +01:00
jf205
47a094239c Merge pull request #2028 from RasmusWL/learnql-fix-formatting
Learn QL: Minor formatting fix in python/statements-expressions
2019-09-26 10:34:31 +01:00
Asger F
c2f6855a7b JS: Update tests 2019-09-26 10:17:58 +01:00
Asger F
cafa9edf69 JS: upgrade script, stats, version string 2019-09-26 10:17:58 +01:00
Asger F
b4f67f20af JS: Extract types and signatures for functions 2019-09-26 10:17:58 +01:00
Asger F
999d10e1f0 JS: Use consistent indentation 2019-09-26 10:17:58 +01:00
Asger F
405d43d539 JS: Merge CallSignatureTypes test 2019-09-26 10:17:58 +01:00
Asger F
97494290de JS: Add getOverloadIndex() 2019-09-26 10:17:58 +01:00
Asger F
8ca294ae41 JS: Merge TypeScript/CallSignatures test 2019-09-26 10:17:58 +01:00
Rasmus Wriedt Larsen
c47a4e0c44 Learn QL: Minor formatting fix in python/statements-expressions 2019-09-26 11:16:24 +02:00
Taus
3f3b0e5149 Merge pull request #2013 from RasmusWL/python-random-bag
Python: small improvements
2019-09-26 11:08:36 +02:00
jf205
af1bfb2f7e Merge pull request #2025 from RasmusWL/python-fix-example-link
Learn QL: Fix query link in Python Points-to tutorial
2019-09-26 08:26:13 +01:00
Tom Hvitved
7f18f35f31 C#: Update test 2019-09-25 21:20:45 +02:00
Rasmus Wriedt Larsen
c6c565bc37 Learn QL: Fix query link in Python Points-to tutorial 2019-09-25 18:20:48 +02:00
Tom Hvitved
3da438bb84 C#: Handle unbound types in conversion library
A constructed type, `C<T>`, where `T` is the type parameter of `C`, is represented
in the database as the corresponding unbound generict type `C<>`. Consequently, the
type conversion library, which only considers `ConstructedType`s, does not handle
all implicit conversions. For example, in

```
interface I<in T1, T2> where T1 : C
```

there should be an implicit conversion from `I<C, T2>` to `I<T1, T2>` (=`I<>`).
2019-09-25 16:24:38 +02:00
Shati Patel
886b258385 QL etudes: Update linked queries 2019-09-25 14:35:25 +01:00
Tom Hvitved
c810776413 C#: Update reference conversion test 2019-09-25 15:14:21 +02:00
Shati Patel
0b0f69fe2d QL etudes: Tidy up alternative solns 2019-09-25 12:50:05 +01:00
semmle-qlci
24240177c5 Merge pull request #2023 from ian-semmle/agglit
Approved by jbj
2019-09-25 11:35:33 +01:00
Tom Hvitved
5a198a39df C#: Autoformat 2019-09-25 11:52:19 +02:00
Ian Lynagh
142e1cb9fb C++: Implement AggregateLiteral.mayBeImpure() 2019-09-25 10:34:30 +01:00
Anders Schack-Mulligen
7c1594df13 Java: Slight precision improvement for getter/setter detection. 2019-09-25 10:14:49 +02:00
Tom Hvitved
afdb788333 C#: Refactor cs/local-not-disposed using data flow library 2019-09-25 09:33:39 +02:00
Tom Hvitved
665564f809 C#: Add more tests for cs/local-not-disposed 2019-09-25 09:33:39 +02:00
Jonas Jensen
0aafa0b0e2 C++: Accept test changes in IR sanity queries
These looks harmless.
2019-09-25 08:55:55 +02:00
Jonas Jensen
67ae00f0f0 Merge pull request #2019 from zlaski-semmle/zlaski/what-buffer-function
Rename references to `BufferFunction` with `ArrayFunction`
2019-09-25 08:33:01 +02:00
Ziemowit Laski
a6d619cfe1 [zlaski/what-buffer-function] Rename CustomModels to Models 2019-09-24 18:17:34 -07:00
Ziemowit Laski
7e14e2a950 [zlaski/what-buffer-function] Rename references to BufferFunction to ArrayFunction. 2019-09-24 18:02:14 -07:00
Dave Bartolomeo
0e432c2405 Merge pull request #1937 from matt-gretton-dann/cpp-432-namespacembrs-unique-key
C++: Update test for fix to namespace members
2019-09-24 10:11:55 -07:00
Shati Patel
3441696100 Apply suggestions from code review 2019-09-24 17:28:14 +01:00
AndreiDiaconu1
d6e4a2afef Autoformat 2019-09-24 17:26:13 +01:00
Dave Bartolomeo
f5dc8ba3ce Merge pull request #2005 from AndreiDiaconu1/ircsharp-unaliased
C# IR: Unaliased SSA
2019-09-24 09:05:48 -07:00
Rasmus Wriedt Larsen
752615fb56 Python: Fix doc for Expr::isDeletion 2019-09-24 16:56:07 +02:00
Rasmus Wriedt Larsen
f870b21d2f Python: Use Builtin::special for floats ClassValue
We could find no reason for using `Builtin::builtin` instead of
`Builtin::special`. Since all the other base types use `special`, and the old
Object API is using `special`, let's also do that :)
2019-09-24 16:55:49 +02:00
semmle-qlci
0d3edae3fc Merge pull request #2004 from xiemaisi/js/fix-xss-sanitisers
Approved by asger-semmle
2019-09-24 15:44:23 +01:00
Taus
594a50e066 Merge pull request #1955 from RasmusWL/python-modernise-explicit-return-in-init
Python: Modernise the `py/explicit-return-in-init` query.
2019-09-24 16:23:37 +02:00
AndreiDiaconu1
3f4713f0f5 Add tests and query 2019-09-24 14:53:12 +01:00
AndreiDiaconu1
1b47f80a7a C# implementation 2019-09-24 14:53:12 +01:00
AndreiDiaconu1
f25602bf1c Initial, C++ implementation 2019-09-24 14:53:12 +01:00
AndreiDiaconu1
9228cf83fa Address PR comments 2019-09-24 14:49:09 +01:00
Ian Lynagh
49276e09c5 C++: Add aggregate literals to sideEffects test 2019-09-24 11:28:57 +01:00
Dave Bartolomeo
300e580874 C++: Implement language-neutral IR type system
The C++ IR currently has a very clunky way of specifying the type of an IR entity (`Instruction`, `Operand`, `IRVariable`, etc.). There are three separate predicates: `getType()`, `isGLValue()`, and `getSize()`. All three are necessary, rather than just having a `getType()` predicate, because some IR entities have types that are not represented via an existing `Type` object in the AST. Examples include the type for an lvalue returned from a `VariableAddress` instruction, the type for an array slice being zero-initialized in a variable initializer, and several others. It is very easy for QL code to just check the `getType()` predicate, while forgetting to use `isGLValue()` to determine if that type is the actual type of the entity (the prvalue case) or the type referred to by a glvalue entity. Furthermore, the C++ type system creates potentially many different `Type` objects for the same underlying type (e.g. typedefs, using declarations, `const`/`volatile` qualifiers, etc.), making it more difficult to tell when two entities have semantically equivalent types.

In addition, other languages for which we want to enable the IR have somewhat different type systems. The various language type systems differ in their structure, although they tend to share the basic building blocks necessary for the IR.

To address all of the above problems, I've introduced a new class hierarchy, rooted at the class `IRType`, that represents a bare-bones type system that is independent of source language (at least across C/C++/C#/Java). A type's identity is based on its kind (signed integer, unsigned integer, floating-point, Boolean, blob, etc.), size and in the case of blob types, a "tag" to differentiate between different classes and structs. No distinction is made between, say `signed int` and plain `int`, or between different language integer types that have the same signedness and size (e.g. `unsigned int` vs. `wchar_t` on Linux). `IRType` is intended for use by language-agnostic IR-based analyses, including range analysis, dataflow, SSA construction, and alias analysis. The set of available `IRType`s is determined by predicate provided by the language library implementation (e.g. `hasSignedIntegerType(int byteSize)`.

In addition to `IRType`, each language now defines a type alias named `LanguageType`, representing the type of an IR entity in more language-specific terms. The only predicate requried on `LanguageType` is `getIRType()`, which returns the single `IRType` object for the language-neutral representation of that `LanguageType`. All other predicates on and subclasses of `LanguageType` are language-specific. There may be many instances of `LanguageType` that map to a given `IRType`, to allow for typedefs, etc.

Most of the changes are mechanical changes in the IR construction code, to return the correct type for each IR entity. SSA construction has also been updated to avoid dependencies on language-specific types.

I have not yet removed the original `getType()` predicates that just return `Type`. These can be removed once we move the remaining existing libraries to use `IRType`.

Test results are, by design, pretty much unchanged. Once case changed for inline asm, because the previously IR generation for it played a little fast and loose with the input/output expressions. The test case now includes both input and output variables. The generated IR for `Conditional_LValue` is now more correct, because we now have a way to represent an lvalue of an lvalue. `syntax-zoo` is still a hot mess. Most of the changed outputs are due to wobble from having multiple functions with the same name, but with a slightly different order of evaluation due to the type changes. Others are wobble from already-invalid IR. A couple non-wobbly places have improved slightly, though.

The C# part of this change is waiting for #2005 to be merged, since that has some of the necessary C# implementation.
2019-09-23 16:14:00 -07:00
Calum Grant
b85896299d Merge pull request #2000 from AndreiDiaconu1/ircsharp-fixes
C# IR: Minor fixes and changes
2019-09-23 18:14:50 +01:00
AndreiDiaconu1
a86a15d280 Fix problem with IsExpr
The translation of `IsExpr` created a sanity check to fail since it generated
a Phi node that had only one source: if a variable was declared as part of the `IsExpr`, a conditional branch was generated, and the variable was defined only in the true successor; this has been changes so that the declaration happens before the conditional branch, and the variable is uninitialized (this removed the need for the `isInitializedByElement` predicate from `TranslatedDeclarationBase`, so that has been removed) and only the assignment happens in the true successor block (so now the two inputs of the Phi node are the result of the `Uninitialized` instruction and the `Store` instruction from the true successor block).
2019-09-23 17:37:50 +01:00
Shati Patel
c156d6a555 Autoformat QL 2019-09-23 17:34:08 +01:00
AndreiDiaconu1
17e6b80a34 Added C# implementation 2019-09-23 17:31:24 +01:00
AndreiDiaconu1
1dab4e0e26 Initial commit, C++ files 2019-09-23 17:31:24 +01:00
Max Schaefer
d4fca84898 JavaScript: Improve XSS sanitizer detection.
We now use local data flow to detect more regexp-based sanitizers.
2019-09-23 17:07:06 +01:00
Matthew Gretton-Dann
6b28f33713 C++: Update test for fix to namespace members
Generation of IDs for namespace members has been fixed to generate
unique IDs for variables of the same name but in different namespaces.

Update the same_name test to validate this.
2019-09-23 16:04:59 +01:00
Jonas Jensen
22e57a6559 Merge pull request #1860 from matt-gretton-dann/add-using-aliases
Add support for using aliases
2019-09-23 16:53:51 +02:00
Jonas Jensen
898976121b Merge pull request #1987 from geoffw0/toomanyformat
CPP: WrongNumberOfFormatArguments.ql Fix
2019-09-23 16:05:11 +02:00
AndreiDiaconu1
7f76947af0 Autoformat 2019-09-23 15:03:38 +01:00
AndreiDiaconu1
ae503b2982 Remove incorrect Load
Removed an incorrect `Load` op generated by propery accesses.
2019-09-23 14:43:08 +01:00
AndreiDiaconu1
3c95205f2e Minor fixes for array related translation
More accurate type sizes using language specific predicates from `IRCSharpLanguage.qll`.
Added immediate operands for some `PointerX` (add, sub) instructions.
Some other minor consistency fixes.
2019-09-23 14:37:31 +01:00
Robert Marsh
90c91a78f8 Merge pull request #1976 from pavgust/fix/hashcons-perf
C++: HashCons: Further performance improvements
2019-09-23 06:37:03 -07:00
Rasmus Wriedt Larsen
a0ecbc555d Merge pull request #1998 from taus-semmle/python-support-aiter
Python: Add `__aiter__` as a recognised iterator method.
2019-09-23 15:32:53 +02:00
Matthew Gretton-Dann
4606587fe8 C++: Apply style guide to TypedefType.qll 2019-09-23 13:57:50 +01:00
Matthew Gretton-Dann
af3b0d9e73 C++: Update stats. 2019-09-23 13:57:50 +01:00
Matthew Gretton-Dann
c8dfa46c63 C++: Add upgrade script for using aliases. 2019-09-23 13:57:50 +01:00
Matthew Gretton-Dann
fc75a6af5a C++: Add tests for using aliases 2019-09-23 13:57:50 +01:00
Matthew Gretton-Dann
9ff38ebeee C++: Update tests for new CTypedefType. 2019-09-23 13:57:50 +01:00
Matthew Gretton-Dann
5468b8def7 C++: Add support for C++ using aliases
Previously these were identified as typedefs.
2019-09-23 13:57:50 +01:00
Geoffrey White
b3df289a80 CPP: Fix test. 2019-09-23 13:56:24 +01:00
Geoffrey White
2d8e4b3176 CPP: Additional cases resembling the ticket. 2019-09-23 13:04:14 +01:00
semmle-qlci
825a3d2917 Merge pull request #1954 from asger-semmle/type-tracking-through-captured-vars
Approved by xiemaisi
2019-09-23 12:10:30 +01:00
semmle-qlci
e2c941c577 Merge pull request #1916 from erik-krogh/taintedLength
Approved by asger-semmle, xiemaisi
2019-09-23 11:47:48 +01:00
Taus Brock-Nannestad
e1012d8d5a Python: Add __aiter__ as a recognised iterator method. 2019-09-23 12:26:16 +02:00
Geoffrey White
040bd89163 CPP: Correct expected results. 2019-09-23 11:02:36 +01:00
Rasmus Wriedt Larsen
d6a7b6f7f1 Python: Fix documentation markup for IdentityEqMethod 2019-09-23 11:22:56 +02:00
Rasmus Wriedt Larsen
d273974045 Python: Don't flag return procedure_call() in __init__ as error
This commit fixes the results for
0d8a429b7e/files/mayaTools/cgm/lib/classes/AttrFactory.py (L90)

```
def __init__(...):
    if error_case:
        return guiFactory.warning(...)
```

that was wrongly reporting _Explicit return in __init__ method._ as an error.
2019-09-23 11:22:55 +02:00
Rasmus Wriedt Larsen
6e50a0ef84 Python: Modernise the py/explicit-return-in-init query.
Add explicit test case to show that we don't doulbe report this problem.
2019-09-23 11:22:55 +02:00
Rasmus Wriedt Larsen
f0479687d8 Python: Fix documentation for Function.isInitMethod 2019-09-23 11:22:55 +02:00
Shati Patel
f88f7962e7 QL etudes: Update predicate 2019-09-23 10:19:49 +01:00
Anders Schack-Mulligen
f8f3a4b25f Java: Minor additional type pruning. 2019-09-23 11:07:10 +02:00
Shati Patel
f94b01cb40 QL etudes: Address comments + fix sphinx warning 2019-09-23 09:52:43 +01:00
semmle-qlci
7a57a3c743 Merge pull request #1996 from xiemaisi/js/fix-illegal-invocation-refl
Approved by esben-semmle
2019-09-23 09:16:33 +01:00
Max Schaefer
149ae5d7ab JavaScript: Fix IllegalInvocation.
This fixes false positives that arise when a call such as `f.apply` can either be interpreted as a reflective invocation of `f`, or a normal call to method `apply` of `f`.
2019-09-23 07:44:14 +01:00
Tom Hvitved
e4d17a9b04 C#: Refactor getAnOutNode() predicate 2019-09-22 18:55:34 +02:00
Erik Krogh Kristensen
814c5537be update name of loop bound injection in change-notes 2019-09-20 22:56:08 +02:00
Asger F
69a88c4fcd JS: Fix typo and add metadata to DomValueRefs 2019-09-20 15:43:08 +01:00
Asger F
1ce0a48996 JS: Update tests 2019-09-20 15:41:36 +01:00
Geoffrey White
9100ab9360 CPP: Autoformat. 2019-09-20 15:30:59 +01:00
Anders Schack-Mulligen
42a970b905 Java: Update qldoc. 2019-09-20 16:21:03 +02:00
Geoffrey White
accb8246d4 CPP: Change note. 2019-09-20 15:15:35 +01:00
Anders Schack-Mulligen
d9aa46d3b0 Java: Add missing field pruning. 2019-09-20 16:13:48 +02:00
Anders Schack-Mulligen
648335d46d Java: Remove two unnecessary unbinds. 2019-09-20 16:12:56 +02:00
Geoffrey White
f7607313e7 CPP: Fix FPs. 2019-09-20 15:12:55 +01:00
Geoffrey White
9a407eb43c CPP: Test format args with mismatching declarations. 2019-09-20 14:54:44 +01:00
Calum Grant
b31cd8ab32 Merge pull request #1982 from hvitved/csharp/null-maybe-dynamic
C#: Remove false positives from `cs/dereferenced-value-may-be-null`
2019-09-20 14:46:01 +01:00
Calum Grant
8408e90b5f C#: Change note & docs. 2019-09-20 14:44:07 +01:00
Shati Patel
56bc8cb035 QL etudes: Add river crossing puzzle
WIP
2019-09-20 14:23:47 +01:00
Calum Grant
fdc8abce4d C#: Fix CFG by removing unnecessary edge. 2019-09-20 14:22:31 +01:00
Calum Grant
d696235668 C#: Updated CFG for switch statements - note that the last() predicate is incorrect. 2019-09-20 14:22:31 +01:00
Calum Grant
81110dca0a C#: Add new test for switch statements. 2019-09-20 14:22:31 +01:00
Calum Grant
478095223e Merge pull request #1983 from hvitved/csharp/unit-test-windows
C#: Fix broken unit test on Windows
2019-09-20 13:52:01 +01:00
Pavel Avgustinov
1c971d3f88 HashCons: Further performance improvements
The key insight here is that `HC_FieldCons` and `HC_Array` are
functionally determined by the things that arise in another
recursive call. Lifting them to their own predicate, therefore,
reduces nonlinearity and constrains the join order in a way that
cannot be asymptotically bad -- and, indeed, makes quite a big
difference in practice.
2019-09-20 12:00:33 +01:00
Tom Hvitved
cb6e1536a3 C#: Fix broken unit test on Windows 2019-09-20 11:40:18 +02:00
semmle-qlci
6d9d859119 Merge pull request #1934 from asger-semmle/node-js-classification
Approved by esben-semmle
2019-09-20 09:50:34 +01:00
Tom Hvitved
fb68d839a9 C#: Add change note 2019-09-20 10:40:20 +02:00
Max Schaefer
4fe74c0b2a Merge pull request #1960 from Semmle/rc/1.22
Merge rc/1.22 into master
2019-09-20 09:08:40 +01:00
Tom Hvitved
aa0c78cd85 C#: Teach guards library about more null guards 2019-09-20 09:58:04 +02:00
Tom Hvitved
40fafc5fda C#: Teach comparison library about dynamic comparison operations 2019-09-20 09:51:35 +02:00
Tom Hvitved
c923cc6378 C#: Add tests for dynamic comparisons 2019-09-20 09:19:03 +02:00
Tom Hvitved
cb7db8f4c0 C#: Add more nullness tests 2019-09-20 09:18:55 +02:00
Robert Marsh
d3f2d8169e Merge pull request #1967 from jbj/tainttracking-ir-2
C++: DefaultTaintTracking flow from a to a[i]
2019-09-19 15:00:29 -07:00
Robert Marsh
9c6a0ffc48 Merge pull request #1979 from nickrolfe/wrong_type_uninstantiated
C++: ignore uninstantiated templates in WrongTypeFormatArguments.ql
2019-09-19 14:51:45 -07:00
Nick Rolfe
56f4f86921 C++: ignore uninstantiated templates in WrongTypeFormatArguments.ql 2019-09-19 21:18:47 +01:00
semmle-qlci
0387177acd Merge pull request #1851 from hvitved/csharp/early-identify-duplicate-extraction
Approved by calumgrant
2019-09-19 19:45:33 +01:00
Robert Marsh
fd88f7a3ce Merge pull request #1884 from jbj/dataflow-addressof
C++: Data flow through address-of operator (&)
2019-09-19 09:15:43 -07:00
Robert Marsh
340c8026de Merge pull request #1965 from jbj/bitfield-template
C++: Ignore templates in AmbiguouslySignedBitField.ql
2019-09-19 07:46:54 -07:00
semmle-qlci
6b783141e9 Merge pull request #1962 from shati-patel/sphinx/collapse
Approved by jf205
2019-09-19 15:33:45 +01:00
Calum Grant
3a51e02f66 Merge pull request #1923 from AndreiDiaconu1/ircsharp-pointers-typespec
C# IR: Fix loads and assign ops, add pointers, ref, in, out params
2019-09-19 15:25:54 +01:00
Shati Patel
2956cb781b Sphinx: Change to pointer 2019-09-19 15:07:18 +01:00
Jonas Jensen
29c93488bc C++: DefaultTaintTracking flow from a to a[i]
Switching `security.TaintTracking` to use `DefaultTaintTracking` causes
us to lose a result from `UnboundedWrite.ql`, while this commit restores
it:

diff --git a/semmlecode-cpp-tests/DO_NOT_DISTRIBUTE/security-tests/CWE-120/CERT/STR35-C/UnboundedWrite.expected b/semmlecode-cpp-tests/DO_NOT_DISTRIBUTE/security-tests/CWE-120/CERT/STR35-C/UnboundedWrite.expected
index 1eba0e52f0e..d947b33b9d9 100644
--- a/semmlecode-cpp-tests/DO_NOT_DISTRIBUTE/security-tests/CWE-120/CERT/STR35-C/UnboundedWrite.expected
+++ b/semmlecode-cpp-tests/DO_NOT_DISTRIBUTE/security-tests/CWE-120/CERT/STR35-C/UnboundedWrite.expected
@@ -1,2 +1,3 @@
+| main.c:54:7:54:12 | call to strcat | This 'call to strcat' with input from $@ may overflow the destination. | main.c:93:15:93:18 | argv | argv |
 | main.c:99:9:99:12 | call to gets | This 'call to gets' with input from $@ may overflow the destination. | main.c:99:9:99:12 | call to gets | call to gets |
 | main.c:213:17:213:19 | buf | This 'scanf string argument' with input from $@ may overflow the destination. | main.c:213:17:213:19 | buf | buf |
2019-09-19 14:52:40 +02:00
Jonas Jensen
34a5368101 C++: Ignore templates in AmbiguouslySignedBitField
If it's possible that the type is not fully resolved, it's better to
avoid giving an alert.

This fixes a FP in https://github.com/heremaps/flatdata.
2019-09-19 14:21:53 +02:00
Jonas Jensen
0ed0951d43 C++: Demonstrate AmbiguouslySignedBitField FP 2019-09-19 14:19:34 +02:00
semmle-qlci
6f2e485ace Merge pull request #1950 from xiemaisi/js/rate-limiter-flexible
Approved by esben-semmle
2019-09-19 12:45:45 +01:00
Tom Hvitved
61bd9f2f17 C#: Address review comments 2019-09-19 13:39:16 +02:00
Jonas Jensen
30d1c327cf C++: Implement predictableInstruction without Expr
This is one step toward implementing the taint-tracking wrapper in terms
of `Instruction` rather than `Expr`.

This leads to a few duplicate results in `TaintedAllocationSize.ql`
because the library now considers `sizeof(int)` to be just as
predictable as `4`, whereas the `security.TaintTracking` library does
not consider `sizeof` to be predictable. I think it's simpler to accept
the duplicate results since they are ultimately a quirk of the query,
not the library.

The following is the diff between (a) replacing `TaintTracking.qll` with
a link to `DefaultTaintTracking.qll` and (b) additionally applying this
commit.

diff --git a b
--- a/cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/TaintedAllocationSize/TaintedAllocationSize.expected
+++ b/cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/TaintedAllocationSize/TaintedAllocationSize.expected
@@ -1,5 +1,8 @@
 | test.cpp:42:31:42:36 | call to malloc | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
+| test.cpp:43:31:43:36 | call to malloc | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
 | test.cpp:43:38:43:63 | ... * ... | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
+| test.cpp:45:31:45:36 | call to malloc | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
 | test.cpp:48:25:48:30 | call to malloc | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
 | test.cpp:49:17:49:30 | new[] | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
+| test.cpp:52:21:52:27 | call to realloc | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
 | test.cpp:52:35:52:60 | ... * ... | This allocation size is derived from $@ and might overflow | test.cpp:39:21:39:24 | argv | user input (argv) |
--- a/semmlecode-cpp-tests/DO_NOT_DISTRIBUTE/security-tests/CWE-190/CERT/INT04-C/int04.expected
+++ b/semmlecode-cpp-tests/DO_NOT_DISTRIBUTE/security-tests/CWE-190/CERT/INT04-C/int04.expected
@@ -1 +1,2 @@
 | int04c.c:21:29:21:51 | ... * ... | This allocation size is derived from $@ and might overflow | int04c.c:14:30:14:35 | call to getenv | user input (getenv) |
+| int04c.c:22:33:22:38 | call to malloc | This allocation size is derived from $@ and might overflow | int04c.c:14:30:14:35 | call to getenv | user input (getenv) |
2019-09-19 13:11:27 +02:00
Taus
dcd62e5d97 Merge pull request #1961 from RasmusWL/python-split-function-tests
Python: split tests for Functions into more files
2019-09-19 13:07:46 +02:00
Shati Patel
0a710f2770 Sphinx: Make clickable section more obvious 2019-09-19 12:00:26 +01:00
Felicity Chapman
d9df5afc44 Merge pull request #1958 from jf205/slide-buttons
docs: a few slide improvements
2019-09-19 11:39:41 +01:00
Erik Krogh Kristensen
7671b6759b import DataFlow::PathGraph from the ql file instead of the qll file 2019-09-19 11:59:45 +02:00
Rasmus Wriedt Larsen
3c33e863ad Python: split tests for Functions into more files
Makes it easier to see what the testcases are relevant for what queries.
2019-09-19 11:54:28 +02:00
Calum Grant
68a67c396d Merge pull request #1944 from lcartey/csharp/autobuild-multiple-solutions
C# autobuilder: Build all solutions at the highest depth
2019-09-19 10:49:49 +01:00
Erik Krogh Kristensen
bbf7e56e47 remove unused import in query 2019-09-19 11:49:20 +02:00
Shati Patel
7aefb839a7 Sphinx: Add support for collapsible sections 2019-09-19 10:44:34 +01:00
AndreiDiaconu1
c64db777ee More auto formatting 2019-09-19 10:31:25 +01:00
AndreiDiaconu1
e18b36bebf Make preds private, autoformat 2019-09-19 10:31:25 +01:00
AndreiDiaconu1
3a83dc54aa Update indexing logic 2019-09-19 10:31:25 +01:00
AndreiDiaconu1
47750513de Address PR comment and fix bug
Fixes a bug where loads for array indexes would be ignored, even though the only ignored load in an array access should be the qualifier's.
2019-09-19 10:31:25 +01:00
AndreiDiaconu1
fa74ed3419 Address PR comments 2019-09-19 10:31:25 +01:00
AndreiDiaconu1
515642eadc C# IR: pointers and pointer ops, unsafe, fixed
Added support for pointers and pointer operations and made sure all loads are correct.
Added support for the unsafe stmt.
Added basic support for the fixed stmt (for now we ignore the pinning).
2019-09-19 10:31:25 +01:00
AndreiDiaconu1
aef26cc534 C# IR: Fix Load inconsistencies, in, out, ref
Fixed a bug where assignments of the form `Object obj1 = obj2` would not generate a load instruction for `obj2` (see `raw_ir.expected`).
Added an extra `Load` for object creations that involve structs. This is because the variable that represents the struct should hold the actual struct, not a reference to it.
Refactored the piece of code that decided if a particular expr needs a load instruction and improved the code sharing between `TranslatedExpr.qll` and `TranslatedElement.qll` by creating 2 predicates that tell if a certain expr does or does not need a load.
Added support for `in`, `out` and `ref` parameters.
2019-09-19 10:31:23 +01:00
Erik Krogh Kristensen
3ef187f7f2 Add external/cwe/cwe-834 tag in change notes for js/loop-bound-injectoin
Co-Authored-By: Max Schaefer <max@semmle.com>
2019-09-19 11:30:15 +02:00
AndreiDiaconu1
9ac052711b C# IR: Fix problem with AssignOperations 2019-09-19 10:30:15 +01:00
Calum Grant
23087672bf Merge pull request #1920 from AndreiDiaconu1/ircsharp-usingstmt
C# IR: using, checked, unchecked stmts
2019-09-19 10:26:59 +01:00
Calum Grant
dd3fb6ca52 Merge pull request #1929 from hvitved/csharp/cfg/finally
C#: Fix CFG for nested `finally` blocks
2019-09-19 10:13:31 +01:00
Max Schaefer
fa91ecb0d3 Merge pull request #1952 from hvitved/merge-rc
Merge rc/1.22 into master
2019-09-19 09:42:19 +01:00
Max Schaefer
4e1e7bc127 JavaScript: Apply review suggestion.
Co-Authored-By: Esben Sparre Andreasen <42067045+esben-semmle@users.noreply.github.com>
2019-09-19 09:40:28 +01:00
james
4adda1056f docs: better fix for width on notes 2019-09-19 09:27:28 +01:00
Jonas Jensen
307b92feed C++: Unknown template literals are constant 2019-09-19 10:23:26 +02:00
james
8b13e32598 docs: add icons on slides with notes 2019-09-19 08:44:36 +01:00
james
1d0a96f0a1 docs: mention icons on training homepage 2019-09-19 08:44:13 +01:00
james
86069df9ee docs: mention graphviz in readme 2019-09-19 08:44:08 +01:00
james
9242507487 docs: removed unused extension from conf.py 2019-09-19 08:44:01 +01:00
james
b07e1fa08d docs: slightly adjust width of lists in notes 2019-09-19 08:43:48 +01:00
Esben Sparre Andreasen
b631bfc8eb Merge branch 'master' into node-js-classification 2019-09-19 09:42:26 +02:00
Jonas Jensen
9b805c01cc Merge pull request #1951 from pavgust/fix/hashcons-perf
C++: Fix HashCons library performance
2019-09-19 08:10:34 +02:00
Raul Garcia
c66e5dd13a Merge pull request #1 from Semmle/master
Switching Base
2019-09-18 13:39:16 -07:00
Tom Hvitved
11f9967491 C#: Address review comments 2019-09-18 17:36:31 +02:00
AndreiDiaconu1
99c6a328c4 Autoformat 2019-09-18 16:20:06 +01:00
Asger F
71763af2d5 JS: Further restrict receiver type inference 2019-09-18 16:18:10 +01:00
Asger F
e724f92ee8 JS: Also summarize loads 2019-09-18 16:18:10 +01:00
Asger F
ffc69cb61e JS: Summarize functions in type tracking 2019-09-18 16:17:59 +01:00
Asger F
3479f02082 JS: Add test showing lack of flow out of inner function 2019-09-18 16:17:22 +01:00
Asger F
76438f98ad JS: Add DomValuesRefs metric 2019-09-18 16:17:21 +01:00
Asger F
0924de4c56 JS: Simplify call graph metric 2019-09-18 16:17:21 +01:00
Tom Hvitved
cf4db48eb1 Merge branch 'rc/1.22' into master 2019-09-18 16:53:55 +02:00
Tom Hvitved
0e0f78e448 Merge pull request #1943 from lcartey/csharp/ttransitivecapture-fix
C#: Include runtime target in TTransitiveCaptureCall
2019-09-18 16:36:19 +02:00
Anders Schack-Mulligen
327ade1f34 Merge pull request #1940 from hvitved/dataflow/pathnode-successor
Java/C++/C#: Simplify `PathNode` successor logic
2019-09-18 16:13:39 +02:00
Luke Cartey
b8387bdf23 C#: Fix whitespace issues. 2019-09-18 14:43:43 +01:00
Jonas Jensen
e0d1da3b67 C++: Test for template enum constant CFG 2019-09-18 15:17:24 +02:00
semmle-qlci
cd362d82a5 Merge pull request #1948 from hvitved/csharp/autoformat
Approved by calumgrant
2019-09-18 14:17:02 +01:00
semmle-qlci
57a6c0c20d Merge pull request #1918 from esben-semmle/js/improve-getAResponseDataNode
Approved by asger-semmle
2019-09-18 14:03:45 +01:00
Jonas Jensen
7d8396fa65 C++: Constant template pointer-to-member literals 2019-09-18 14:44:25 +02:00
Jonas Jensen
d644150ead C++: Test for template pointer-to-member CFG 2019-09-18 14:30:18 +02:00
Jonas Jensen
0f2731064d C++: Annotate tellDifferent with template status
This is helpful for turning real-world cases into test cases.
2019-09-18 14:23:52 +02:00
Luke Cartey
af41a0a927 C#: Add autobuilder unit test for multiple csproj files. 2019-09-18 13:12:46 +01:00
Jonas Jensen
c90fd32a78 C++: Pointer-to-member-function is constant 2019-09-18 13:55:56 +02:00
Pavel Avgustinov
eca31908ab HashCons: Make some functionality apparent.
The user knows that an expression functionally determines its
hashCons value, and that an expression functionally determines
its number of children, but this is not provable from the
definitions, and so not usable by the optimiser. By storing
the result of those known-functional calls in a variable,
rather than repeating the call, we enable better join orders.
2019-09-18 12:54:48 +01:00
Pavel Avgustinov
03502863cf Distribute a recursive call into a recursive disjunction.
As the linearity of the disjuncts is different, this enables us to
pick better join orders for each disjunct separately.
2019-09-18 12:54:48 +01:00
Jonas Jensen
55edfe4224 C++: Test for pointer-to-member-function CFG 2019-09-18 13:37:52 +02:00
Tom Hvitved
6318cc9a71 Java: Update expected test output 2019-09-18 13:36:15 +02:00
Tom Hvitved
09e4e7901a C#: Update expected test output 2019-09-18 13:36:15 +02:00
Tom Hvitved
d8074ddfa6 Sync files 2019-09-18 13:36:15 +02:00
Tom Hvitved
48aec33769 Java/C++/C#: Simplify PathNode successor logic 2019-09-18 13:36:14 +02:00
semmle-qlci
479fca9e30 Merge pull request #1946 from xiemaisi/js/top-level-await
Approved by asger-semmle
2019-09-18 12:32:09 +01:00
semmle-qlci
b4b7314757 Merge pull request #1941 from xiemaisi/js/fix-incorrect-suffix-check-performance
Approved by asger-semmle
2019-09-18 12:31:46 +01:00
Max Schaefer
3970ead7ab JavaScript: Add support for rate-limiter-flexible package. 2019-09-18 12:25:33 +01:00
Taus
bbc98513c0 Merge pull request #1942 from RasmusWL/python-modernise-consistent-tuple-size
Python: Modernise the `py/mixed-tuple-returns` query.
2019-09-18 13:19:36 +02:00
Geoffrey White
ae9f35be00 Merge pull request #1947 from jbj/autoformat-followup
C++: Autoformat five files
2019-09-18 12:15:47 +01:00
Luke Cartey
407f6349a3 C#: Fix potential bug in CaptureOutNode.
In theory this bug could associated CaptureOutNodes with the wrong transitively called
callable. However, in practice I could not create a test case that revealed incorrect
behaviour. I've included one such test case in the commit.

I believe that the cause of this is that OutNode::getACall() is not actually used in the
data flow libraries. Instead, DataFlowDispatch::Cached::getAnOutNode is the predicate
which is used to associated OutNode's with DataFlowCall's in practice, and that is always
used in a context that correctly binds the runtime target of the call.
2019-09-18 11:48:29 +01:00
Tom Hvitved
bb83b92c6b C#: Autoformat 2019-09-18 12:02:59 +02:00
Luke Cartey
4ecfe97e7b C#: Adjust line numbers in test case. 2019-09-18 10:55:59 +01:00
Jonas Jensen
571c96bb2f C++: Autoformat five files
These files have come out of autoformat since the big commit that
autoformatted everything.
2019-09-18 11:55:19 +02:00
Jonas Jensen
e7d8fa4251 Merge pull request #1945 from geoffw0/more-tests
CPP: Add a test of ConditionalDeclExpr.
2019-09-18 11:11:16 +02:00
Max Schaefer
9ff5c7007a JavaScript: Add support for top-level await. 2019-09-18 09:56:21 +01:00
AndreiDiaconu1
0e32639af9 Address PR comments 2019-09-18 09:53:14 +01:00
Luke Cartey
29e4fa349a C# autobuilder: Build all solutions at the highest depth
The most common reason for the C# autobuilder to fail is because it
cannot determine a single unique .sln or .proj file to build, instead
reporting multiple sln or proj files at the same shortest depth. This
commit changes this to build all such files, rather than reporting an
error.
2019-09-17 21:27:01 +01:00
Geoffrey White
07e29bb627 CPP: Add a test of ConditionalDeclExpr. 2019-09-17 17:38:54 +01:00
AndreiDiaconu1
f589033364 PR fixes 2019-09-17 16:17:39 +01:00
AndreiDiaconu1
5e0addc776 C# IR: using, checked, unchecked stmts
Added basic support for the using stmt, checked stmt, unchecked stmt
Note that the translations do not use the compiler generated element framework and hence they are just rough approximations. For accuracy, in the future their translation should use it.
2019-09-17 16:16:32 +01:00
Luke Cartey
3c07caefe4 C#: Add test for transitive capture calls. 2019-09-17 15:21:30 +01:00
Luke Cartey
70c2cc595b C#: Add capture test for nested lambdas, commented out
Add a commented out version of the test, and modify the expected files
to contain the same results at new offsets.
2019-09-17 15:13:10 +01:00
Rasmus Wriedt Larsen
631603fa92 Python: Modernise the py/mixed-tuple-returns query. 2019-09-17 16:07:56 +02:00
semmle-qlci
e314a2ce88 Merge pull request #1939 from felicitymay/1.22/fix-blog-links
Approved by jf205
2019-09-17 12:35:48 +01:00
Esben Sparre Andreasen
ac6554b7da Merge branch 'master' into js/improve-getAResponseDataNode 2019-09-17 13:18:41 +02:00
Jonas Jensen
b2df18ab78 C++: Document tests better
This addresses PR comments by @rdmarsh2.
2019-09-17 13:17:25 +02:00
Jonas Jensen
ef601cf78e C++: Annotate changes in struct_init.c test 2019-09-17 13:16:36 +02:00
Jonas Jensen
655f940085 C++: Accept changes in CWE-{119,120} tests
These new results seem better than the previous ones, but the previous
ones are still there. Perhaps the `Buffer.qll` library could use some
adjustment, but this seems like an improvement in isolation.
2019-09-17 13:16:36 +02:00
Jonas Jensen
fd6d06fe6f C++: Data flow through address-of operator (&)
The data flow library conflates pointers and their objects in some
places but not others. For example, a member function call `x.f()` will
cause flow from `x` of type `T` to `this` of type `T*` inside `f`. It
might be ideal to avoid that conflation, but that's not realistic
without using the IR.

We've had good experience in the taint tracking library with conflating
pointers and objects, and it improves results for field flow, so perhaps
it's time to try it out for all data flow.
2019-09-17 13:16:34 +02:00
Asger F
f8eff06aa1 JS: Change note 2019-09-17 11:20:39 +01:00
Luke Cartey
92b94c1a39 C#: Include runtime target in TTransitiveCaptureCall
TTransitiveCaptureCall represents a control flow node that may
transitively call many different callables which capture a variable from
the current scope. Captured variables are represented as synthetic
parameters to the callable, at negative indices. However, each of the
different targets may capture a different subset of variables from the
enclosing scope, so we must include the target along side the CFN in
order to prevent incorrect capture flow.
2019-09-17 03:05:29 -07:00
Tom Hvitved
396a72db5f Merge pull request #1898 from AndreiDiaconu1/ircsharp-collections
C# IR: Object creation refactor and collection initializers
2019-09-17 10:48:07 +02:00
Felicity Chapman
8a27af2016 Update remaining links to blog 2019-09-17 09:30:15 +01:00
Dave Bartolomeo
21f6ab787d C++: Rename predicates in FunctionInputsAndOutputs.qll and add QLDoc 2019-09-16 12:06:06 -07:00
Tom Hvitved
1f927516d8 Merge pull request #1936 from calumgrant/cs/nameof-qualified-namespace
C# extractor: Handle nameof(A.B) where A.B is a qualified namespace
2019-09-16 19:28:48 +02:00
Geoffrey White
3df31e6ccf CPP: Tiny qldoc fixes. 2019-09-16 16:52:48 +01:00
Calum Grant
4e6216379d Merge pull request #1935 from AndreiDiaconu1/ircsharp-forinitfix
C# IR: Fix for init
2019-09-16 16:24:30 +01:00
AndreiDiaconu1
43accd37e1 Address PR comments 2019-09-16 15:42:45 +01:00
Max Schaefer
df739e0fca JavaScript: Fix performance regression in IncorrectSuffixCheck. 2019-09-16 15:25:17 +01:00
Calum Grant
8eeded5982 C#: Handle nameof(A.B) where A.B is a nested namespace. 2019-09-16 15:12:10 +01:00
AndreiDiaconu1
fcb3d99351 C# IR: Fix for init 2019-09-16 11:57:37 +01:00
semmle-qlci
e6b748a8e7 Merge pull request #1875 from esben-semmle/js/blacklist-more-hardcoded-passwords
Approved by xiemaisi
2019-09-16 10:57:35 +01:00
Tom Hvitved
4f897b2628 C#: Address review comments 2019-09-16 10:45:37 +02:00
Esben Sparre Andreasen
a5645e168a JS: exclude keys from whitelist 2019-09-16 10:13:18 +02:00
Esben Sparre Andreasen
c9d31e90fe JS: add change notes 2019-09-16 10:11:43 +02:00
Esben Sparre Andreasen
0e2d2f8662 JS: whitelist some hardcoded dummy-passwords in two queries 2019-09-16 10:11:43 +02:00
Esben Sparre Andreasen
aa3f4a7048 JS: change passwords in tests 2019-09-16 10:09:59 +02:00
jf205
526c123016 Merge pull request #1931 from shati-patel/docs/ql-lexer
Docs/QL lexer: Require whitespace character after annotation
2019-09-14 07:00:31 +01:00
Dave Bartolomeo
553238a9e8 Merge pull request #1922 from jbj/qlcfg-const-pointer-to-member
C++: Add PointerToFieldLiteral class
2019-09-13 10:44:52 -07:00
Shati Patel
9187db585c QL lexer: Require whitespace character after annotation 2019-09-13 16:13:13 +01:00
shati-patel
fd4709d43a Merge pull request #1930 from jf205/js-links-122
docs: update some links in a couple of javascript topics
2019-09-13 15:58:23 +01:00
Asger F
a8e8ae868a JS: Update extractor version string 2019-09-13 15:48:31 +01:00
Asger F
173f32d2ba JS: Recognize 'require' calls in more cases 2019-09-13 15:48:31 +01:00
Asger F
3b7ecd5ccf JS: Add NumModules metric 2019-09-13 15:48:31 +01:00
Max Schaefer
fa4db5a841 JavaScript: Fix link to restify in library tutorial.
(cherry picked from commit af24d125388ed89dcd364697d955026a1f46fd33)
2019-09-13 15:28:21 +01:00
Max Schaefer
f1588b2622 JavaScript: Fix description of call graphs.
(cherry picked from commit 2817cf060f6a506ee51a0296b3745e7406fc7cfc)
2019-09-13 15:28:21 +01:00
james
ffa370a8ad docs: fix broken links in js topics
(cherry picked from commit e8f867204d)
2019-09-13 15:28:20 +01:00
semmle-qlci
82097f63ac Merge pull request #1903 from jf205/js-links
Approved by asger-semmle
2019-09-13 15:25:02 +01:00
Erik Krogh Kristensen
9dc9adda64 fix capitalization in test case
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-09-13 14:54:18 +01:00
Erik Krogh Kristensen
3fb64abb09 fix consistency and spelling in the documentation
suggestions from the documentation team

Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-09-13 14:52:11 +01:00
Erik Krogh Kristensen
c4f27ed4cc rename TaintedLength to LoopBoundInjection 2019-09-13 11:12:01 +01:00
Erik Krogh Kristensen
673e883c21 use superscript to denote the size of the tainted object 2019-09-13 11:00:11 +01:00
semmle-qlci
d0d3882121 Merge pull request #1919 from esben-semmle/js/fixup-1
Approved by asger-semmle, xiemaisi
2019-09-13 10:40:38 +01:00
semmle-qlci
1313821a25 Merge pull request #1904 from erik-semmle/passportModel
Approved by asger-semmle, esben-semmle
2019-09-13 10:38:14 +01:00
Erik Krogh Kristensen
5b2b60f132 change DOS to DoS, and other small documentation fixes
Co-Authored-By: Max Schaefer <max@semmle.com>
2019-09-13 10:26:01 +01:00
Tom Hvitved
f5cae9b6ea Merge pull request #1881 from aschackmull/java/pathgraph-nodes
Java/C++/C#: Add nodes predicate to PathGraph.
2019-09-13 10:32:47 +02:00
Dave Bartolomeo
e8cf3f876e Merge pull request #1660 from zlaski-semmle/zlaski/builtin-va-list
Add a `__builtin_va_list` type, to complement `__builtin_va_*`
2019-09-12 14:04:55 -07:00
Dave Bartolomeo
9072f6231f Merge pull request #1928 from jbj/autoformat-ssa
C++: Autoformat IR SSA files
2019-09-12 14:03:20 -07:00
zlaski-semmle
45640395a9 Merge pull request #1803 from geoffw0/qldoceg9
CPP: Add syntax examples to QLDoc in Variable.qll
2019-09-12 12:32:58 -07:00
Robert Marsh
7f6108259e Merge pull request #1927 from jbj/instructionNode
C++: Add DataFlow::instructionNode
2019-09-12 12:06:01 -07:00
Rebecca Valentine
f503e042fc Merge pull request #1877 from taus-semmle/python-modernise-non-iterator-query
Python: Modernise the `py/non-iterable-in-for-loop` query.
2019-09-12 11:14:40 -07:00
Calum Grant
b7db15646c Merge pull request #1858 from AndreiDiaconu1/ircsharp-continue
C# IR: Add support for `ContinueStmt`
2019-09-12 17:37:01 +01:00
Erik Krogh Kristensen
c2efb0afe7 two tiny qldoc changes 2019-09-12 16:58:07 +01:00
Erik Krogh Kristensen
119b1ffb80 changes based on review from max 2019-09-12 16:30:42 +01:00
Erik Krogh Kristensen
dc891dc420 added js/loop-bound-injection to javascript security suite 2019-09-12 15:50:50 +01:00
Erik Krogh Kristensen
17a71a97c5 add loop-bound-injection to change-notes 2019-09-12 15:28:14 +01:00
Erik Krogh Kristensen
3d359bc8dc Merge remote-tracking branch 'upstream/master' into taintedLength 2019-09-12 15:24:36 +01:00
Erik Krogh Kristensen
30f1bcf5bc updated query ID and expected output 2019-09-12 15:24:33 +01:00
Jonas Jensen
0c092e21b0 C++: Autoformat IR SSA files
One autoformat omission had also slipped into
`DefaultTaintTracking.qll`.
2019-09-12 15:45:08 +02:00
Jonas Jensen
10270cb36d C++: Turn a comment into QLDoc 2019-09-12 15:44:04 +02:00
AndreiDiaconu1
e55f16d990 Fix comment 2019-09-12 13:57:28 +01:00
AndreiDiaconu1
91fdfd48e5 Fixed CP problem 2019-09-12 13:09:49 +01:00
Jonas Jensen
c7e6081079 C++: Add DataFlow::instructionNode
This is for symmetry with `exprNode` etc., and it should be handy for
the same reasons. I found one caller of `asInstruction` that got simpler
by using the new predicate instead.
2019-09-12 11:44:17 +02:00
Tom Hvitved
5070270605 C#: Fix CFG for nested finally blocks 2019-09-12 11:44:04 +02:00
Tom Hvitved
b9fa837963 C#: Add new CFG test for try/finally 2019-09-12 11:44:04 +02:00
Tom Hvitved
3d32f3d173 C#: Restructure existing CFG tests for try/finally 2019-09-12 11:44:04 +02:00
AndreiDiaconu1
47120bc923 PR fixes 2019-09-12 10:34:00 +01:00
Calum Grant
e330d5a6c6 Merge pull request #1549 from hvitved/csharp/cfg/loop-unrolling
C#: Loop unrolling for `foreach` statements
2019-09-12 10:24:26 +01:00
AndreiDiaconu1
420abbf3dc C# IR: Support for ContinueStmt
Added support for continue stmt.
Minimal refactoring of the `TranslatedSpecificJump` classes.
Added a new test file, `jumps.cs` and updated the expected output.
2019-09-12 10:01:48 +01:00
Anders Schack-Mulligen
6299625b3d C#: Adjust qltest expected output. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
61e4e61087 C++: Adjust qltest expected output. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
2d620698d8 Java: Adjust qltest expected output. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
95e2f162d9 Java/C++/C#: Adjust toString of empty accesspath. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
0a4b15d40b Java/C++/C#: Add nodes predicate to PathGraph. 2019-09-12 11:00:49 +02:00
Erik Krogh Kristensen
2db0cdf4e2 two small qhelp fixes 2019-09-12 10:00:08 +01:00
semmle-qlci
10076a6b2b Merge pull request #1886 from jbj/ir-taint-shared
Approved by rdmarsh2
2019-09-12 06:48:24 +01:00
Robert Marsh
e71a39f6b6 Merge pull request #1912 from jbj/tainttracking-ir-1
C++: Stub replacement for security.TaintTracking
2019-09-11 13:44:39 -07:00
Tom Hvitved
8f3f9406e2 C#: Early identification of duplicate extraction 2019-09-11 20:47:20 +02:00
Geoffrey White
d1cc28e253 CPP: Address review comments. 2019-09-11 17:14:05 +01:00
Geoffrey White
ee07c705a4 CPP: More review suggestions. 2019-09-11 17:14:05 +01:00
Geoffrey White
8134d80c46 CPP: Review suggestions. 2019-09-11 17:14:05 +01:00
Geoffrey White
120b0c0c2c CPP: Modernize the TemplateVariables test and have the TemplateVariables actually included in the scope of the test. 2019-09-11 17:14:05 +01:00
Geoffrey White
68196df561 CPP: Examples Variable.qll. 2019-09-11 17:11:53 +01:00
semmle-qlci
72db219c13 Merge pull request #1910 from xiemaisi/js/unused-index-variable
Approved by esben-semmle, shati-semmle
2019-09-11 14:33:32 +01:00
Jonas Jensen
6912cafc54 C++: Use the RelationalOperation class 2019-09-11 15:21:49 +02:00
Jonas Jensen
0d0ab9157c C++: Address review comments 2019-09-11 15:20:36 +02:00
Taus Brock-Nannestad
1013fb7b25 Update .expected file for Python 3 tests. 2019-09-11 14:13:05 +02:00
Calum Grant
b85823bec5 Merge pull request #1857 from AndreiDiaconu1/ircsharp-forstmt
C# IR: More support for `ForStmt`s
2019-09-11 13:11:05 +01:00
Jonas Jensen
6021b4f04a C++: Remove local flow from additional taint step
This case was not supposed to be there -- that was the whole point of
having the `localAdditionalTaintStep` predicate.
2019-09-11 14:09:17 +02:00
Erik Krogh Kristensen
493a31d98d more fixes based on review 2019-09-11 12:53:59 +01:00
Jonas Jensen
ee16b239de C++: Add PointerToFieldLiteral class
Marking these expressions as constants fixes the CFG discrepancies that
can be observed on the affected test and on snapshots of MySQL.
2019-09-11 13:40:24 +02:00
Max Schaefer
500cde68c3 JavaScript: Add new query UnusedIndexVariable. 2019-09-11 11:36:50 +01:00
Esben Sparre Andreasen
9aa0e711b2 JS: update expected output 2019-09-11 12:33:41 +02:00
Erik Krogh Kristensen
bec522f0df small changes based on review feedback 2019-09-11 11:26:59 +01:00
shati-semmle
6924a88368 Merge pull request #1917 from jf205/recent-changes-122
docs: port some recent changes to rc/1.22 branch
2019-09-11 11:21:39 +01:00
Esben Sparre Andreasen
086c473c18 JS: sharpen js/http-to-file-access 2019-09-11 12:05:33 +02:00
Esben Sparre Andreasen
0e31cad027 JS: simplify this.getStringValue() to getStringValue() 2019-09-11 10:56:49 +02:00
Esben Sparre Andreasen
ee106ccff9 JS: simplify asExpr().getStringValue() calls 2019-09-11 10:56:57 +02:00
Esben Sparre Andreasen
aab17850d1 JS: eliminate redundant ConstantString casts 2019-09-11 10:56:49 +02:00
AndreiDiaconu1
195b99cf96 PR fixes 2019-09-11 09:54:01 +01:00
semmle-qlci
16c95d8c5e Merge pull request #1876 from esben-semmle/js/more-delimiter-stripping-whitelisting
Approved by xiemaisi
2019-09-11 09:16:57 +01:00
Esben Sparre Andreasen
f3de75ae07 JS: update a js/code-injection test 2019-09-11 09:45:54 +02:00
Esben Sparre Andreasen
e41080fb40 JS: add RemoteServerResponse as a heuristic remote flow source 2019-09-11 09:38:18 +02:00
Esben Sparre Andreasen
f7bfc472c1 JS: treat server responses as untrusted for command injections 2019-09-11 09:38:18 +02:00
Esben Sparre Andreasen
3e42b078e8 JS: minor additions to ClientRequest::getAResponseDataNode 2019-09-11 09:24:59 +02:00
Robert Marsh
6d8a4388cb Merge pull request #1883 from jbj/partial-definitions-const
C++: Don't create partial defs for calls to const functions
2019-09-10 12:46:39 -07:00
Erik Krogh Kristensen
72bbd4ded1 fix spelling mistake 2019-09-10 17:13:44 +01:00
Erik Krogh Kristensen
62d1f66fda avoid extending the abstract LoopStmt class 2019-09-10 17:08:00 +01:00
Erik Krogh Kristensen
6bb9781466 remove <br/> tags 2019-09-10 16:57:15 +01:00
Shati Patel
4a6ee7f4b3 QL HB: Add predicate call example [SD-3864]
(cherry picked from commit cfa51a0e8b)
2019-09-10 16:04:41 +01:00
Shati Patel
52583d0b86 QL HB: Explain use of cast [SD-3865]
(cherry picked from commit f5de1dc999)
2019-09-10 16:04:40 +01:00
Shati Patel
ab77d02f87 QL HB: Expand bindingset example [SD-3863]
(cherry picked from commit 4f2c9fa3cb)
2019-09-10 16:04:40 +01:00
Shati Patel
6b10ddf8fc QL HB: Fix typo [SD-3862]
(cherry picked from commit acca48bd8f)
2019-09-10 16:04:40 +01:00
james
3f4f9ec9e3 docs: update readme
(cherry picked from commit 54342a6daa)
2019-09-10 16:04:40 +01:00
james
f2baf43f74 docs: fix broken Expr links
(cherry picked from commit 9437c2d007)
2019-09-10 16:04:34 +01:00
semmle-qlci
05247849b0 Merge pull request #1913 from xiemaisi/csharp/update-a-qlref
Approved by hvitved
2019-09-10 16:04:19 +01:00
shati-semmle
2a3c6a9ac4 Vale linter: fix typo
(cherry picked from commit 4d98b4c3a1)
2019-09-10 16:03:10 +01:00
james
cf8fbca218 docs: improve slide layout for printing
(cherry picked from commit f78ce146f1)
2019-09-10 16:03:09 +01:00
james
358be7419d docs: updated slide background
(cherry picked from commit ecc2449c1c)
2019-09-10 16:03:09 +01:00
james
be14eea5a4 docs: slides fix for edge and ff
(cherry picked from commit f93359a472)
2019-09-10 16:03:09 +01:00
james
a2c87c9890 docs: fix typo
(cherry picked from commit 09a0b562e5)
2019-09-10 16:03:06 +01:00
jf205
b1d4843a95 Update docs/language/README.rst
Co-Authored-By: shati-semmle <42641846+shati-semmle@users.noreply.github.com>
(cherry picked from commit ce2326cc6e)
2019-09-10 16:03:06 +01:00
jf205
20df58f400 Update docs/language/learn-ql/ql-training.rst
Co-Authored-By: shati-semmle <42641846+shati-semmle@users.noreply.github.com>
(cherry picked from commit 1f67d71f5f)
2019-09-10 16:03:06 +01:00
jf205
1c0db5dce8 Update docs/language/learn-ql/ql-training.rst
Co-Authored-By: shati-semmle <42641846+shati-semmle@users.noreply.github.com>
(cherry picked from commit 4ec828a719)
2019-09-10 16:03:06 +01:00
james
985751b128 docs: update layout.html
(cherry picked from commit 1a7c79bd7c)
2019-09-10 16:03:05 +01:00
james
1d3cf2002a docs: specify sphinx 1.7.9 in readme
(cherry picked from commit 99614d98e1)
2019-09-10 16:03:05 +01:00
james
fcba260393 docs: fix a couple of links
(cherry picked from commit 16aaa95566)
2019-09-10 16:03:05 +01:00
james
7e7b9e5578 docs: remove VA section from writing-queries.rst
(cherry picked from commit 6f9d4c8562)
2019-09-10 16:03:04 +01:00
james
8efcabf237 docs: rework ql-training.rst
(cherry picked from commit 49955c56be)
2019-09-10 16:03:04 +01:00
james
b56b28e228 docs: reorganize and add some ref bookmarks to learn-ql index
(cherry picked from commit 593818b71a)
2019-09-10 16:03:04 +01:00
james
40be3bc8cf docs: rename ql-training-rst > ql-training
(cherry picked from commit 65573492e7)
2019-09-10 16:03:03 +01:00
james
d1d19bf744 docs: add ql-training page to learn-ql project
(cherry picked from commit c8dd5e620c)
2019-09-10 16:03:02 +01:00
jf205
e19799f1eb Update docs/language/ql-training-rst/slide-snippets/local-data-flow.rst
Co-Authored-By: Luke Cartey <5377966+lukecartey@users.noreply.github.com>
(cherry picked from commit 64c4548aca)
2019-09-10 16:03:00 +01:00
james
32d56fbd93 docs: update images
(cherry picked from commit f0e2a2ea71)
2019-09-10 16:02:59 +01:00
james
b701d1d8cf docs: toctree path
(cherry picked from commit acb3e742e6)
2019-09-10 16:02:59 +01:00
james
4e4388d688 docs: address review comments
(cherry picked from commit 8c88cbba3a)
2019-09-10 16:02:59 +01:00
Mark Shannon
541706ed53 Python docs: Fix typos and rst formatting issue.
(cherry picked from commit d096644773)
2019-09-10 15:57:52 +01:00
james
d592af1c22 docs: fix speaker note bug
(cherry picked from commit 0b31ca46b1)
2019-09-10 15:57:52 +01:00
james
9eefeb770a docs: fix include in data flow slides
(cherry picked from commit 387147ede2)
2019-09-10 15:57:52 +01:00
james
6dcf9997e9 docs: make use of includes for local and global data flow slides
(cherry picked from commit b89f0161aa)
2019-09-10 15:57:52 +01:00
james
dfeab086db docs: add template slide deck
(cherry picked from commit ec9ca6852b)
2019-09-10 15:57:52 +01:00
james
6b9566a6e4 docs: add rst versions of java slide decks and improve a few c++ slides
(cherry picked from commit 7fa7f2dd65)
2019-09-10 15:57:51 +01:00
Mark Shannon
63a391a654 Python docs: remove confusing reference to SSA as 'dataflow' and add a reference to the taint-tracking library from the library overview page.
(cherry picked from commit dafed6b93e)
2019-09-10 15:57:51 +01:00
Mark Shannon
1fe5d0cb97 Python docs: Remove all references to ClassExpr and FunctionExpr; we want to remove them eventually.
(cherry picked from commit 562f4ef604)
2019-09-10 15:57:51 +01:00
Mark Shannon
ff64aedc0a Python docs: Replace remaining references to old 'Object' API are replaced by new 'Value' API.
(cherry picked from commit 6edf9efe1b)
2019-09-10 15:57:51 +01:00
Jonas Jensen
bd59029e2b C++: Add pointer-to-member test to syntax-zoo
This test was inspired by problems observed in a MySQL snapshot. The
results show there are problems with both the QL CFG and the IR.
2019-09-10 16:23:23 +02:00
Erik Krogh Kristensen
97fc10e669 Add query for detecting potential DOS form a tainted .length property 2019-09-10 14:59:48 +01:00
Max Schaefer
ea81531a7b C#: Update a .qlref.
This currently relies on the fact that qltest includes `ql/csharp/ql/src/Metrics` in addition to `ql/csharp/ql/src` on its search path when run internally, which is inconsistent with the other languages. Since this is the only test that relies on it, I'd like to update it and get rid of the extra search root eventually.
2019-09-10 13:01:04 +01:00
Jonas Jensen
de4e2a259e C++: Stub replacement for security.TaintTracking
This commit adds a `semmle.code.cpp.ir.dataflow.DefaultTaintTracking`
library that's API-compatible with the
`semmle.code.cpp.security.TaintTracking` library. The new library is
implemented on top of the IR data flow library.

The idea is to evolve this library until it can replace
`semmle.code.cpp.security.TaintTracking` without decreasing our SAMATE
score. Then we'll have the IR in production use, and we will have one
less taint-tracking library in production.
2019-09-10 13:40:45 +02:00
semmle-qlci
df1bf4a95b Merge pull request #1907 from asger-semmle/mongoose-types
Approved by xiemaisi
2019-09-10 12:05:57 +01:00
Sam Lanning
2f54437c10 Merge pull request #1889 from AlexTereshenkov/master
Add a new issue template for false positive in LGTM.com
2019-09-10 11:33:09 +01:00
AlexTereshenkov
49ee205b46 Update issue templates 2019-09-10 11:02:02 +01:00
AlexTereshenkov
77871f6d51 Update .github/ISSUE_TEMPLATE/lgtm-com---false-positive.md
Co-Authored-By: Sam Lanning <sam@lanni.ng>
2019-09-10 10:25:03 +01:00
AndreiDiaconu1
442c9f2cc8 Delete useless file 2019-09-10 09:52:35 +01:00
AndreiDiaconu1
241a40c145 C# IR: Initializers
Add support for collection initializers.
Instead of using `AssignExpr` for the translation of object initializers, `MemberInitializer` is now used.
2019-09-10 09:32:00 +01:00
AndreiDiaconu1
0528d8ef39 C# IR: Object creation refactoring
The way object creation was translated has been changed: now creations are treated as expressions.
The main motivation for this was the inability to have creation expressions as arguments to
function calls (a test case has been added to showcase this).
All code that dealt with creation expressions has been moved from `TranslatedInitialization.qll` to `TranslatedExpr.qll`.
Some light refactoring has also been done, mainly removing code that was useless after the changes mentioned above.
2019-09-10 09:20:21 +01:00
AndreiDiaconu1
d9f3c14c9c C# IR: Add support for multiple decls and updates
Added support for multiple declarations and updates in a for stmt.
Added test cases and updated the expected output.
2019-09-10 09:17:41 +01:00
Jonas Jensen
d6fba0ef46 C++: Don't create partial defs for calls to const
These partial defs don't do any harm, but they could hurt performance.
In typical C++ snapshots, between 5% and 20% of all calls are to `const`
functions.
2019-09-10 09:49:16 +02:00
Jonas Jensen
fd3615d120 C++: Show that there are too many partial defs 2019-09-10 09:44:07 +02:00
jf205
ad4715fd52 Merge pull request #1908 from shati-semmle/ql-hb/fixes
QL handbook: Add examples and fix typos
2019-09-10 08:42:14 +01:00
Jonas Jensen
7b09e4177e C++: Add localExprTaint for IR
This is for ODASA-8053.
2019-09-10 09:40:31 +02:00
Jonas Jensen
80a0027808 C++: Shared TaintTrackingImpl for IR TaintTracking 2019-09-10 09:40:27 +02:00
Jonas Jensen
770212567f C++: Fix up IR data flow QLDoc 2019-09-10 09:34:54 +02:00
Tom Hvitved
41cd13a637 C#: Update expected test output 2019-09-10 09:17:50 +02:00
Robert Marsh
2806a52ec5 Merge pull request #1888 from jbj/ir-dataflow-node-ipa
C++: Hide that IR DataFlow::Node is Instruction
2019-09-09 11:00:37 -07:00
Geoffrey White
4283a1508d Merge pull request #1870 from jbj/autoformat-all
C++: Autoformat everything
2019-09-09 16:05:32 +01:00
Shati Patel
cfa51a0e8b QL HB: Add predicate call example [SD-3864] 2019-09-09 16:01:42 +01:00
Shati Patel
f5de1dc999 QL HB: Explain use of cast [SD-3865] 2019-09-09 16:01:41 +01:00
Shati Patel
4f2c9fa3cb QL HB: Expand bindingset example [SD-3863] 2019-09-09 16:01:14 +01:00
Shati Patel
acca48bd8f QL HB: Fix typo [SD-3862] 2019-09-09 16:01:07 +01:00
Max Schaefer
bdba647bf5 Merge pull request #1893 from erik-semmle/addXLinkHref
JS: add xlink:href as xss target when using setAttribute
2019-09-09 15:56:47 +01:00
Jonas Jensen
79f456e8bd Merge pull request #1905 from ian-semmle/mangling_more
C++: Resolve all classes
2019-09-09 16:48:30 +02:00
Asger F
194a1c3530 JS: Change note 2019-09-09 15:42:43 +01:00
Calum Grant
79a750dfaf Merge pull request #1845 from AndreiDiaconu1/ircsharp-compiler-generated
C# IR: Framework for translating compiler generated elements
2019-09-09 15:42:07 +01:00
Asger F
ad5abc61cc JS: Move typed test into separate test 2019-09-09 15:35:26 +01:00
Asger F
ea446f2aa1 JS: Use type info in mongodb/mongoose model 2019-09-09 15:35:26 +01:00
Asger F
8e397ad203 JS: Use type tracking in mongodb/mongoose model 2019-09-09 15:35:23 +01:00
semmle-qlci
e899250e87 Merge pull request #1894 from asger-semmle/fp-incorrect-suffix-check
Approved by xiemaisi
2019-09-09 15:33:47 +01:00
semmle-qlci
89cba089b4 Merge pull request #1892 from asger-semmle/event-handler-sink
Approved by esben-semmle
2019-09-09 15:33:21 +01:00
Erik Krogh Kristensen
03b210a8e1 made the two Passport classes in the Express model private 2019-09-09 13:04:47 +01:00
Erik Krogh Kristensen
3ebe6608c2 updated expected values for the Express test 2019-09-09 13:02:35 +01:00
erik-semmle
d01f84f015 fix comment in passport test
Co-Authored-By: Esben Sparre Andreasen <42067045+esben-semmle@users.noreply.github.com>
2019-09-09 12:59:38 +01:00
Asger F
b6690bb644 JS: Add change note 2019-09-09 12:45:03 +01:00
Tom Hvitved
170621d1cc C#: Address review comments 2019-09-09 13:38:23 +02:00
AndreiDiaconu1
53ebe23db6 Better retrieval for the GetEnumerator call 2019-09-09 12:33:19 +01:00
Felicity Chapman
28fece0f75 Merge pull request #1906 from jf205/readme-updates
docs: update readme following recent project changes
2019-09-09 12:27:24 +01:00
semmle-qlci
2283195ebd Merge pull request #1871 from asger-semmle/type-tracking-through-imports
Approved by xiemaisi
2019-09-09 12:25:06 +01:00
Erik Krogh Kristensen
26f6b1d186 add model for passport.use in the Express model 2019-09-09 12:01:11 +01:00
james
54342a6daa docs: update readme 2019-09-09 11:57:08 +01:00
Geoffrey White
22e1715368 Merge pull request #1900 from jbj/dataflow-this-by-ref
C++: Fix flow out of `this` by reference
2019-09-09 11:15:32 +01:00
james
e8f867204d docs: fix broken links in js topics 2019-09-09 11:15:18 +01:00
Geoffrey White
26490bd97f Merge pull request #1885 from jbj/dataflow-D.cpp
C++: Add D.cpp, ported from D.java
2019-09-09 10:55:33 +01:00
Asger F
65862c922c JS: Update tests 2019-09-09 10:53:13 +01:00
Asger F
631ff27d31 JS: Use ValueNode for all ImportSpecifiers 2019-09-09 10:53:13 +01:00
Asger F
61e1d793df JS: Fixes in DeadStoreOfLocal 2019-09-09 10:51:21 +01:00
Asger F
5573279580 JS: regression test for DeadStoreOfLocal 2019-09-09 10:51:21 +01:00
Asger F
3b962dce22 JS: Add explicit type tracking test 2019-09-09 10:51:21 +01:00
Asger F
afcdc12e7b JS: Use ValueNode, not SSA node, to model NamedImportSpecifier 2019-09-09 10:51:17 +01:00
semmle-qlci
57afde0240 Merge pull request #1872 from esben-semmle/js/extraction_metrics
Approved by xiemaisi
2019-09-09 10:45:33 +01:00
Jonas Jensen
4ef5c9af62 C++: Autoformat everything
Some files that will change in #1736 have been spared.

    ./build -j4 target/jars/qlformat
    find ql/cpp/ql -name "*.ql"  -print0 | xargs -0 target/jars/qlformat --input
    find ql/cpp/ql -name "*.qll" -print0 | xargs -0 target/jars/qlformat --input
    (cd ql && git checkout 'cpp/ql/src/semmle/code/cpp/ir/implementation/**/*SSA*.qll')
    buildutils-internal/scripts/pr-checks/sync-identical-files.py --latest
2019-09-09 11:25:53 +02:00
Tom Hvitved
77d7db323d Merge pull request #1895 from calumgrant/cs/date-queries
C#: Tidy up cs/unsafe-year-construction and cs/mishandling-japanese-era
2019-09-09 11:24:49 +02:00
Jonas Jensen
1784122929 C++: Fixes from Geoffrey's review round 4 2019-09-09 11:21:55 +02:00
Jonas Jensen
969d76671e C++: Tidy up long comments that attach to items 2019-09-09 11:04:05 +02:00
Jonas Jensen
4769d00c50 C++: Fix autoformat of //-comments after +
The autoformatter would associate these comments to the following term
instead of the preceding term.
2019-09-09 11:04:05 +02:00
Jonas Jensen
3324bfb198 C++: Fix long comments without * on each line
Comments like these will make the autoformatter produce bad indentation.

For the record (not for explainability), these issues were found with

    git grep -P -A1 '^( */\*| +\*( |$))(.(?!\*/))*$' cpp/ql/src/'**/*.ql*' |grep -B10 'qll\?- [^*]*$'
2019-09-09 11:04:04 +02:00
Jonas Jensen
44aca8a0f4 C++: Prepare BufferWrite.qll for autoformat
The autoformatter cannot process these long end-of-line comments
properly when the line starts with `or`.
2019-09-09 11:04:04 +02:00
Jonas Jensen
29c83537b4 C++: Fixes from Geoffrey's review round 3 2019-09-09 11:04:04 +02:00
Jonas Jensen
c8725766bd C++: Fixes from Geoffrey's review round 2 2019-09-09 11:04:04 +02:00
Jonas Jensen
64e2277904 C++: Don't use @param in QLDoc
It superficially looks like `@param` is supported in QLDoc, but this is
mostly an accident of how its parser works. Attributes starting with `@`
are only intended to be used in the top-level QLDoc of a query, and
there can only be one of each attribute. If there are multiple `@param`
entries, the QLDoc parser will only keep the first one.

Even though `parseConvSpec` in `Scanf.qll` documented multiple
parameters, only the first one would be shown in an IDE. The
corresponding predicate in `Print.qll` documented only its first
parameter, perhaps because of an autoformatting accident earlier in
time. I've attempted to reconstruct documentation for its other
parameters based on its sibling in `Scanf.qll`.
2019-09-09 11:04:04 +02:00
Jonas Jensen
8524b95baa C++: Simplify has{Copy,Move}Signature
These functions were overly complicated, and the comments explaining the
complications did not auto-format well. A reference type cannot have
specifiers on it, so it's fine to call `getUnspecifiedType` before
checking if it's a reference type.
2019-09-09 11:04:04 +02:00
Jonas Jensen
8e98d42504 C++: Turn more "short" comments into "long"
The autoformatter is opinionated about comment styles and assumes that
"short" comments attach to the following item while "long" comments are
items themselves. I found top-level short comments with the following
two commands and then searched the output for empty lines that came
after the comment.

    git grep -A1 '^/\* .*\*/' cpp/ql/src
    git grep -A1 '^//' 'cpp/ql/src/**/*.ql*'
2019-09-09 11:04:04 +02:00
Jonas Jensen
95f53639b1 C++: Fixes to avoid confusing autoformat
These issues were found by Geoffrey in PR review.
2019-09-09 11:04:04 +02:00
Jonas Jensen
b14b65ecf0 C++: Don't use deprecated predicates in test
This made the `expected` file contain QL line numbers.
2019-09-09 11:04:04 +02:00
Jonas Jensen
ea3d066661 C++: Add D.cpp, ported from D.java
The original port of the Java field-flow tests did not include this
file. It's added here for completeness, and the results are the same as
for Java.
2019-09-09 10:45:06 +02:00
Erik Krogh Kristensen
2729566bbf add setAttributeNS('xlink', 'href',..) example in XSS test 2019-09-09 09:41:08 +01:00
Jonas Jensen
745e321e3b Merge pull request #1901 from jf205/cpp-links
docs: fix broken `Expr` links
2019-09-09 10:38:02 +02:00
Jonas Jensen
10b69358ae C++: Fix flow from this by ref. 2019-09-09 10:36:58 +02:00
Jonas Jensen
08b63d4342 C++: Test to show lack of flow from this by ref.
The `test_nonMemberSetA` also shows how the lack of flow through `&` is
a problem for non-member getters, but that's addressed on a separate
branch.
2019-09-09 10:36:11 +02:00
Jonas Jensen
ef96288303 C++: Make PartialDefinitionNode private
This class is undocumented and exposes implementation details through
its `getPartialDefinition` member. It does not need to be public.
2019-09-09 10:34:51 +02:00
Esben Sparre Andreasen
2a22471975 JS: address review comments 2019-09-09 10:31:40 +02:00
Tom Hvitved
ef4f954b58 Merge pull request #1797 from jbj/dataflow-TTwo
C++/C#/Java: data flow AccessPath up to length 2
2019-09-09 10:28:48 +02:00
james
9437c2d007 docs: fix broken Expr links 2019-09-09 09:25:19 +01:00
Esben Sparre Andreasen
ec58ccc0ec JS: fixup dbscheme in upgrade directory 2019-09-09 09:05:12 +02:00
Esben Sparre Andreasen
5d6997c1c9 JS: additional extraction metrics cleanup 2019-09-09 09:05:12 +02:00
Esben Sparre Andreasen
03d38ca54b JS: simplify cache interaction 2019-09-09 09:05:12 +02:00
Esben Sparre Andreasen
6dbe827dd3 JS: add QL classes for the extraction metrics 2019-09-09 09:05:12 +02:00
Esben Sparre Andreasen
5665cf9328 JS: record metrics during extraction 2019-09-09 09:05:12 +02:00
Esben Sparre Andreasen
7fcde4c130 JS: add extraction metrics to the dbscheme 2019-09-09 09:05:12 +02:00
Esben Sparre Andreasen
27e36cfe05 JS: apply google-java-format to extractor source code 2019-09-09 09:05:12 +02:00
Jonas Jensen
d51e5212fb Merge remote-tracking branch 'upstream/master' into dataflow-TTwo
Conflicts:
      cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll
      cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll
      cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll
      cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll
      cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll
      cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
      cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
      cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
      cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
      cpp/ql/test/library-tests/dataflow/fields/flow.expected
      csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll
      csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll
      csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll
      csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll
      csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll
      java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll
      java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll
      java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll
      java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll
      java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll
2019-09-08 21:08:43 +02:00
Rebecca Valentine
9eebe00b33 Merge pull request #1869 from taus-semmle/python-fix-typehint-divergence
Python: Prevent divergence in type-hint analysis. (ODASA-8075)
2019-09-06 14:33:20 -07:00
Erik Krogh Kristensen
c780956f0d add setAttributeNS method in the XSS test 2019-09-06 21:56:29 +01:00
AndreiDiaconu1
320cd6b96c More PR fixes 2019-09-06 18:10:54 +01:00
AndreiDiaconu1
765414430d More PR fixes 2019-09-06 18:10:54 +01:00
AndreiDiaconu1
9ecbb4a3f3 More fixes for the PR comments 2019-09-06 18:10:54 +01:00
AndreiDiaconu1
fe3645f26d Fix some PR comments 2019-09-06 18:09:15 +01:00
AndreiDiaconu1
db213bbf80 Fixed sanity checks
The foreach was erroneously labelling the `True` and `False` edges as backedges.
Added a case for the compiler generated while in the predicate `getInstructionBackEdgeSuccessor/2`
from the file `IRConstruction.qll` so that only the edges from inside the body are labeled as back edges.
2019-09-06 18:09:15 +01:00
AndreiDiaconu1
46d7b9e3bf Lock stmt
Added support for the lock stmt
Added a test case and updated the expected output
2019-09-06 18:09:15 +01:00
AndreiDiaconu1
4dd548bfa2 Foreach stmt
Addded support for the foreach stmt (for now only the "canonical" desugaring).
Added a test and updated the expected output.
2019-09-06 18:09:15 +01:00
AndreiDiaconu1
a5ec763035 Delegate creation and call
Added support for delegate creation and call.
Added a test case and updated the expected output.
2019-09-06 18:08:03 +01:00
AndreiDiaconu1
331707f3a3 Framework for the translation of compiler elements
Added a framework for the translation of compiler generated elements, so that the process of adding a new desugaring process is almost mechanical.
The files in `internal` serve as the superclasses for all the compiler generated elements.
The file `Common.qll` captures common patterns for the compiler generated code to improve code sharing (by pattern I mean an element that appears in multiple desugarings). For example the `try...finally` pattern appears in the desugaring process of both the `lock` and the `foreach` stmts, so a class the provides a blueprint for this pattern is exposed. Several other patterns are present.
The expected output has also been updated (after a rebase) and it should be ignored.
2019-09-06 18:08:03 +01:00
AndreiDiaconu1
80b7512fe2 Initial restructure
The `raw/internal` folder has been restructured to better enhance code sharing between compiler generated elements and AST generated elements.
The translated calls classes have been refactored to better fit the C# library.
A new folder has been added, `common` that provides blueprints for the classes that deal with translations of calls, declarations, exprs and conditions.
Several `TranslatedX.qll` files have been modified so that they use those blueprint classes.
2019-09-06 18:08:03 +01:00
Ian Lynagh
4190a53574 C++: Update test output 2019-09-06 17:31:08 +01:00
Ian Lynagh
a32214d41e C++: Resolve all classes
We used to only resolve top-level classes.
2019-09-06 17:31:08 +01:00
Felicity Chapman
4952ad5cff Merge pull request #1896 from shati-semmle/vale-typo
Vale linter: fix typo
2019-09-06 16:56:22 +01:00
shati-semmle
4d98b4c3a1 Vale linter: fix typo 2019-09-06 16:47:20 +01:00
Calum Grant
3734552081 C#: Add change note for datetime queries. 2019-09-06 16:45:02 +01:00
Calum Grant
f9b99ae245 C#: Adjust date query severity and add precisions. Tidy up tags. 2019-09-06 16:44:29 +01:00
Nick Rolfe
09036a3bdf Merge pull request #1760 from ian-semmle/mangling
C++: Use mangled names to resolve classes
2019-09-06 16:38:47 +01:00
Asger F
dfd18a51ee JS: Change note 2019-09-06 16:03:16 +01:00
shati-semmle
486707c90e Merge pull request #1891 from jf205/slide-fixes
docs: improve slide layout for printing
2019-09-06 15:52:32 +01:00
Asger F
7007698de4 JS: Fix the FP 2019-09-06 15:39:40 +01:00
Asger F
ebd7875cae JS: Add regression test 2019-09-06 15:38:55 +01:00
yh-semmle
79a0a56adf Merge pull request #1890 from aschackmull/java/best-bound-rangeanalysis
Java: Restrict the output of Range Analysis to the best bounds.
2019-09-06 10:35:11 -04:00
Erik Krogh Kristensen
ccdc821c5d add xlink:href as xss target when using setAttribute 2019-09-06 14:43:47 +01:00
Asger F
f7654d6f1c JS: Add test 2019-09-06 14:42:07 +01:00
james
f78ce146f1 docs: improve slide layout for printing 2019-09-06 14:42:06 +01:00
Anders Schack-Mulligen
6b85fe087a Java: Restrict the output of Range Analysis to the best bounds. 2019-09-06 15:39:46 +02:00
AlexTereshenkov
523d055194 Add a new issue template for false positive in LGTM.com
Add a new issue template for false positive in LGTM.com
2019-09-06 14:39:06 +01:00
Calum Grant
d2336dc8cf Merge pull request #1882 from aschackmull/lang/autoformat
Java/C#/JavaScript: Autoformat
2019-09-06 14:37:40 +01:00
Asger F
fa95871f46 JS: Add event handler sink to code injection 2019-09-06 14:33:00 +01:00
Jonas Jensen
e4c9dd79ca C++: Hide that IR DataFlow::Node is Instruction
We haven't come to a conclusion on whether these two types will remain
identical forever. To make sure we're able to change it in the future,
this change makes it impossible to cast between the two types. Callers
must use the `asInstruction` member predicate to convert.
2019-09-06 15:31:41 +02:00
shati-semmle
434c20f294 Merge pull request #1887 from jf205/slide-fixes
docs: a couple of slide fixes
2019-09-06 14:28:14 +01:00
james
ecc2449c1c docs: updated slide background 2019-09-06 14:00:57 +01:00
james
f93359a472 docs: slides fix for edge and ff 2019-09-06 14:00:19 +01:00
Taus Brock-Nannestad
8882f1410a Add test cases for nested subscripts. 2019-09-06 12:01:18 +02:00
Anders Schack-Mulligen
ae351be968 C++: Sync files. 2019-09-06 09:05:29 +02:00
Anders Schack-Mulligen
ca45fb5a60 JavaScript: Autoformat. 2019-09-06 09:04:51 +02:00
Anders Schack-Mulligen
343230402a C#: Autoformat. 2019-09-06 09:04:16 +02:00
Anders Schack-Mulligen
aa07020d9d Java: Autoformat. 2019-09-06 09:03:45 +02:00
Robert Marsh
94c625f03f Merge pull request #1777 from jbj/ast-field-flow-defbyref
C++: Don't use definitionByReference for data flow
2019-09-05 10:23:28 -07:00
semmle-qlci
33329f95c2 Merge pull request #1874 from asger-semmle/express-types
Approved by esben-semmle, xiemaisi
2019-09-05 16:42:28 +01:00
semmle-qlci
48b6b67994 Merge pull request #1880 from ian-semmle/clang
Approved by jbj
2019-09-05 16:13:53 +01:00
shati-semmle
6b0bbd5a9e Merge pull request #1878 from jf205/training-homepage/sd-3764
docs: rework ql training homepage (sd-3764)
2019-09-05 16:05:14 +01:00
Ian Lynagh
1d56407c72 C++: Pull some of library-tests/dataflow/dataflow-tests into clang.cpp
g++ doesn't support this code:

    sorry, unimplemented: non-trivial designated initializers not supported
       twoIntFields sSwapped = { .m2 = source(), .m1 = 0 };

so we need to build it in clang mode.
2019-09-05 15:12:17 +01:00
james
131e88dfbe Merge remote-tracking branch 'origin/training-homepage/sd-3764' into training-homepage/sd-3764 2019-09-05 14:53:04 +01:00
james
09a0b562e5 docs: fix typo 2019-09-05 14:50:14 +01:00
jf205
ce2326cc6e Update docs/language/README.rst
Co-Authored-By: shati-semmle <42641846+shati-semmle@users.noreply.github.com>
2019-09-05 14:29:23 +01:00
jf205
1f67d71f5f Update docs/language/learn-ql/ql-training.rst
Co-Authored-By: shati-semmle <42641846+shati-semmle@users.noreply.github.com>
2019-09-05 14:29:11 +01:00
jf205
4ec828a719 Update docs/language/learn-ql/ql-training.rst
Co-Authored-By: shati-semmle <42641846+shati-semmle@users.noreply.github.com>
2019-09-05 14:24:36 +01:00
semmle-qlci
fd2e8486e4 Merge pull request #1862 from asger-semmle/prototype-pollution-angular-merge
Approved by esben-semmle
2019-09-05 12:50:58 +01:00
semmle-qlci
e6bfe2bd5d Merge pull request #1873 from asger-semmle/type-inf-consistency
Approved by xiemaisi
2019-09-05 12:46:59 +01:00
james
1a7c79bd7c docs: update layout.html 2019-09-05 12:33:55 +01:00
james
99614d98e1 docs: specify sphinx 1.7.9 in readme 2019-09-05 12:33:55 +01:00
james
16aaa95566 docs: fix a couple of links 2019-09-05 12:33:54 +01:00
james
6f9d4c8562 docs: remove VA section from writing-queries.rst 2019-09-05 12:33:49 +01:00
james
49955c56be docs: rework ql-training.rst 2019-09-05 12:33:42 +01:00
james
593818b71a docs: reorganize and add some ref bookmarks to learn-ql index 2019-09-05 12:33:33 +01:00
Taus Brock-Nannestad
2d45c23d19 Comment out diverging example for now.
Otherwise it'll keep timing out until the fix has been pushed to LGTM.com
2019-09-05 13:18:01 +02:00
Asger F
61c4d30dd6 JS: Use express module instead 2019-09-05 12:09:24 +01:00
Ian Lynagh
99dd8d0c51 C++: Add an upgrade script 2019-09-05 12:01:02 +01:00
Ian Lynagh
acc1d664f6 C++: Updates stats to include mangled_name table 2019-09-05 12:01:02 +01:00
Ian Lynagh
0c09af977c C++: Use mangled_name in ResolveClass.qll
The old code is still around to handle upgraded databases.
2019-09-05 12:01:02 +01:00
Taus Brock-Nannestad
d336140c19 Python: Modernise the py/non-iterable-in-for-loop query.
Also adds a small test case exhibiting the same false positive seen in
ODASA-8042.
2019-09-05 12:24:51 +02:00
Esben Sparre Andreasen
a9665f53b8 JS: whitelist quote stripping for js/incomplete-sanitization 2019-09-05 09:47:49 +01:00
james
65573492e7 docs: rename ql-training-rst > ql-training 2019-09-05 08:40:36 +01:00
james
c8dd5e620c docs: add ql-training page to learn-ql project 2019-09-05 08:40:33 +01:00
Jonas Jensen
79c713bd87 C++: Remark in DefinitionByReference charpred 2019-09-05 09:36:46 +02:00
Jonas Jensen
114c2fe0d4 Merge remote-tracking branch 'upstream/master' into ast-field-flow-defbyref 2019-09-05 09:33:45 +02:00
Robert Marsh
1bb57daf6f Merge pull request #1866 from jbj/dataflow-test-alias-nested
C++: Tests for aliasing of nested structs
2019-09-04 10:48:20 -07:00
Robert Marsh
a3290503ec Merge pull request #1806 from jbj/localExprFlow
C++: Add localExprFlow and localExprTaint
2019-09-04 10:38:46 -07:00
Asger F
0e4c34bd81 JS: Add deprecated predicate alias 2019-09-04 16:14:51 +01:00
Asger F
93a3f571ec JS: Add change note 2019-09-04 16:14:51 +01:00
Asger F
27567e41c5 JS: Add angular.fromJson as JSON parser 2019-09-04 16:14:51 +01:00
Asger F
5aa948cd17 JS: Add angular.merge sink to prototype pollution query 2019-09-04 16:14:51 +01:00
Felicity Chapman
ef7984d1cb Merge pull request #1842 from jf205/add-java-slides/sd-3762
docs: add rst versions of java training slides
2019-09-04 13:53:13 +01:00
jf205
64c4548aca Update docs/language/ql-training-rst/slide-snippets/local-data-flow.rst
Co-Authored-By: Luke Cartey <5377966+lukecartey@users.noreply.github.com>
2019-09-04 12:53:51 +01:00
james
f0e2a2ea71 docs: update images 2019-09-04 12:51:14 +01:00
Taus Brock-Nannestad
4440e02fa5 Add test case for divergence. 2019-09-04 13:23:06 +02:00
Jonas Jensen
cdcc716675 Merge pull request #1867 from geoffw0/erafix9
CPP: Add date to JapaneseEraDate.ql
2019-09-04 13:16:04 +02:00
Jonas Jensen
bd32931f45 Merge pull request #1868 from geoffw0/tinyfix
CPP: Tiny fixes
2019-09-04 13:15:38 +02:00
Asger F
9f8bf90424 JS: Update Express test 2019-09-04 11:43:21 +01:00
Asger F
744f0b1aa3 JS: Use type info to recognize routers 2019-09-04 11:43:21 +01:00
Asger F
c06fd451d6 JS: Handle router chaining in type tracking predicate 2019-09-04 11:43:21 +01:00
Asger F
f3aea0706a JS: Use type info in Express Request/Response 2019-09-04 11:43:21 +01:00
Geoffrey White
707f95c829 CPP: Alignment. 2019-09-04 09:59:21 +01:00
Geoffrey White
13e2109a38 CPP: Remove an unnecessary include. 2019-09-04 09:42:07 +01:00
Jonas Jensen
8579d7d1cf C++: Tests for aliasing of nested structs
This test shows that local pointers into structs do propagate data flow
like pass-by-reference does in calls.
2019-09-04 10:26:49 +02:00
Jonas Jensen
3ba650911c Merge pull request #1847 from geoffw0/erafix8
CPP: Deal with two very similar Japanese era queries
2019-09-04 09:57:10 +02:00
Jonas Jensen
0e54709d47 Merge pull request #1859 from geoffw0/qldocpartialdef
CPP: Document PartialDefinitions
2019-09-04 09:54:55 +02:00
Jonas Jensen
067c55adb9 C++: Fix ConditionDeclExpr data flow
Data flow probably never worked when a variable declared in a
`ConditionDeclExpr` was modeled with `BlockVar`. That combination did
not come up in testing before the last commit.
2019-09-04 09:33:00 +02:00
Geoffrey White
84112d3630 CPP: Change note. 2019-09-03 18:30:24 +01:00
Geoffrey White
3a3bef3a03 CPP: Add the new Japanese era. 2019-09-03 18:28:24 +01:00
Geoffrey White
bac39e6288 CPP: Add test cases. 2019-09-03 17:46:30 +01:00
Taus Brock-Nannestad
1b432076c4 Python: Prevent divergence in type-hint analysis. (ODASA-8075) 2019-09-03 13:38:46 +02:00
james
acb3e742e6 docs: toctree path 2019-09-03 12:34:58 +01:00
Nick Rolfe
641232a9d7 Merge pull request #1855 from mgrettondann/cpp-343-lambda-names-simplification
C++: Update tests for lambda description changes
2019-09-03 11:45:50 +01:00
james
8c88cbba3a docs: address review comments 2019-09-03 11:16:45 +01:00
semmle-qlci
6778f28424 Merge pull request #1854 from asger-semmle/prototype-pollution-precision
Approved by esben-semmle, xiemaisi
2019-09-03 10:50:24 +01:00
Jonas Jensen
d7681bf122 C++: Don't use definitionByReference for data flow
The data flow library conflates pointers and objects enough for the
`definitionByReference` predicate to be too strict in some cases. It was
too permissive in other cases that are now (or will be) handled better
by field flow.

See also the change note entry.
2019-09-03 11:49:01 +02:00
semmle-qlci
e4d59c361a Merge pull request #1856 from asger-semmle/ts-base-types
Approved by xiemaisi
2019-09-03 10:12:30 +01:00
Geoffrey White
84da3e3431 CPP: Effect of 'Support nested field flow'. 2019-09-03 09:27:50 +01:00
Geoffrey White
8105d153b1 CPP: Add a test of PartialDefinitions. 2019-09-03 09:27:50 +01:00
Geoffrey White
0f295c65f9 CPP: Add QLDoc to the PartialDefinitions class. 2019-09-03 09:27:50 +01:00
Geoffrey White
d092905c66 Merge pull request #1772 from jbj/ast-field-flow-nested
C++: Support nested field flow
2019-09-03 09:12:47 +01:00
Tom Hvitved
4b32ee77e6 C#: Add change note 2019-09-03 09:35:58 +02:00
Jonas Jensen
d3a6ae5657 C++: Support nested field flow
This is the C/C++ side of PR #1766.
2019-09-03 08:50:15 +02:00
Asger F
7790d4b667 JS: Make getALocalValue overriders include super 2019-09-02 16:45:06 +01:00
Asger F
2006826101 JS: Avoid breaking local object analysis 2019-09-02 16:45:06 +01:00
Asger F
9f2f10fa15 JS: Make type inference flow go through ssa definition node 2019-09-02 16:45:06 +01:00
semmle-qlci
c8ffbf3b87 Merge pull request #1852 from xiemaisi/js/async-generator-methods
Approved by esben-semmle
2019-09-02 16:18:04 +01:00
Matthew Gretton-Dann
03eb1ff785 C++: Update taint-tests for changed lambda support 2019-09-02 15:18:27 +01:00
Jonas Jensen
9c9b7ac651 C#/C++/Java: Revert AccessPathNil.toString changes
This caused too many `*.expected` files to change, also in our internal
repo.
2019-09-02 15:59:36 +02:00
Asger F
8737dbb73d JS: Add test 2019-09-02 14:31:40 +01:00
Asger F
54d47f60da JS: Include base types in TypeName 2019-09-02 14:18:48 +01:00
Jonas Jensen
a98992f0f9 C#/C++/Java: distinguish toString of nil from cons 2019-09-02 14:22:03 +02:00
Jonas Jensen
cdede8744f C#/C++/Java: Prettier PartialAccessPath.toString 2019-09-02 14:05:50 +02:00
Asger F
e9159acecb TS: Fix skewed arrays due to recursive call 2019-09-02 13:03:25 +01:00
Jonas Jensen
c3bc9f8575 C#/C++/Java: Unbreak partial data flow support
Partial data flow had a semantic merge conflict with this branch. The
problem is that partial data flow doesn't (and shouldn't) cause the
initial pruning steps to run, but the length-2 access paths depend on
the `consCand` information that comes from that initial pruning. The
solution is to restore the old `AccessPath` class, now called
`PartialAccessPath` for use only by partial data flow.

With this change, partial data flow will in some cases allow more field
flow than non-partial data flow.
2019-09-02 14:02:39 +02:00
Geoffrey White
c4d74c3922 CPP: Replace query paths with @name and @id. 2019-09-02 12:36:36 +01:00
Jonas Jensen
dec0c3a0ee C#/C++/Java: Make AccessPath abstract
This was requested by @hvitved in code review. There is no difference in
the generated DIL.
2019-09-02 13:14:30 +02:00
Jonas Jensen
b1be123e31 C#/C++/Java: Prettier AccessPath.toString
The `ppReprType` predicate should now be `none()` instead of `result=""`
to signal that there is nothing to print. That seems clearer to me.
2019-09-02 13:14:20 +02:00
Jonas Jensen
dbe8034e04 C#: Accept test results 2019-09-02 13:14:17 +02:00
Jonas Jensen
6c96a8d339 Java: Accept test changes
Note: the results in `partial` have regressed and will need to be fixed
in a follow-up commit.
2019-09-02 13:14:17 +02:00
Jonas Jensen
9f0f2f7c04 C++: Accept test changes 2019-09-02 13:14:17 +02:00
Jonas Jensen
b2c94cc6b4 C++/C#/Java: Restore the AccessPathCons class 2019-09-02 13:14:13 +02:00
Jonas Jensen
fbe34015f3 C++/C#/Java: AccessPath class names reflect length
One -> ConsNil
Two -> ConsCons
2019-09-02 13:13:59 +02:00
Jonas Jensen
e8006bb2cc C++/C#/Java: data flow AccessPath up to length 2
This commit does not include updates to test results.
2019-09-02 13:13:46 +02:00
Geoffrey White
aa009d07fd Merge pull request #1787 from jbj/ast-field-flow-local-fields
C++: Local field flow using global library
2019-09-02 11:17:37 +01:00
Asger F
c71a66a045 JS: Add change note 2019-09-02 11:05:07 +01:00
Asger F
a41a23fdba JS: Raise precision of prototype-pollution query 2019-09-02 11:00:24 +01:00
Jonas Jensen
e9a029cba3 C++: Local field flow using global library
This commit removes fields from the responsibilities of `FlowVar.qll`.
The treatment of fields in that file was slow and imprecise.

It then adds another copy of the shared global data flow library, used
only to find local field flow, and it exposes that local field flow
through `localFlow` and `localFlowStep`.

This has a performance cost. It adds two cached stages to any query that
uses `localFlow`: the stage from `DataFlowImplCommon`, which is shared
with all queries that use global data flow, and a new stage just for
`localFlowStep`.
2019-09-02 11:17:27 +02:00
Jonas Jensen
4f57f37b31 C++: Test to show false flow through object copy 2019-09-02 11:16:48 +02:00
Max Schaefer
91e46cd6fd JavaScript: Fix parsing of asynchronous generator methods. 2019-09-02 09:56:42 +01:00
semmle-qlci
6d55d1f7c0 Merge pull request #1707 from asger-semmle/canonical-name-call-graph
Approved by xiemaisi
2019-09-02 09:45:24 +01:00
Jonas Jensen
8ee87fd9fc C++: Make TaintTracking2 QLDoc more like DataFlow2 2019-09-02 09:43:52 +02:00
Max Schaefer
742c9708a9 Merge pull request #1828 from asger-semmle/jsdoc-relation
JS: Make getDocumentation handle chain assignments
2019-09-02 08:43:40 +01:00
Jonas Jensen
26c81eaae9 C++: Mention localExpr{Flow,Taint} in module QLDoc 2019-09-02 09:43:23 +02:00
semmle-qlci
0cf872ed32 Merge pull request #1846 from hvitved/csharp/autoformat
Approved by jbj
2019-09-02 08:31:43 +01:00
Jonas Jensen
f1d7fde49d C++: Use localExprFlow in existing queries
This shortens the queries a bit and ensures test coverage of the new
predicate.
2019-09-02 09:29:12 +02:00
Jonas Jensen
63311739a5 C++: Add localExprFlow and localExprTaint
This is for ODASA-8053.
2019-09-02 09:29:10 +02:00
Tom Hvitved
675255755b C#: Speedup Completion::isValidFor() 2019-09-01 10:34:52 +02:00
Tom Hvitved
508055fdc8 C#: Add a few pragma[nomagic] 2019-09-01 10:34:51 +02:00
Tom Hvitved
1e7ee8ddad C#: Loop unrolling for foreach statements 2019-09-01 10:34:51 +02:00
Tom Hvitved
1bfef706e2 C#: Add loop unrolling tests 2019-09-01 10:34:51 +02:00
Tom Hvitved
bb735c0220 C#: Teach guards library about collections 2019-09-01 10:34:51 +02:00
semmle-qlci
00fe4734ac Merge pull request #1850 from hvitved/csharp/remove-ref-equal
Approved by calumgrant
2019-09-01 09:31:50 +01:00
yh-semmle
c359675fa9 Merge pull request #1802 from aschackmull/java/taint-step-extension-point
Java: Add a global extension point for taint steps.
2019-08-30 17:19:58 -04:00
yh-semmle
f54545522e Merge pull request #1759 from aschackmull/java/flow-exploration
Java/C++/C#: Add support for dataflow exploration by partial paths.
2019-08-30 17:00:17 -04:00
Asger F
45941869ad JS: Change note 2019-08-30 18:25:39 +01:00
Asger F
89b91af6db JS: Make getDocumentation handle chain assignments 2019-08-30 18:20:54 +01:00
Asger F
9533ca0926 JS: Change note 2019-08-30 18:19:49 +01:00
Asger F
3926436bd4 JS: Explain use of t.call() 2019-08-30 18:19:19 +01:00
Asger F
d6578e10c8 JS: Handle constructor calls to avoid regression 2019-08-30 18:19:19 +01:00
Asger F
1b6cc4ebcc JS: Update test 2019-08-30 18:19:19 +01:00
Asger F
a13fb8e2ba JS: Handle RHS in more cases 2019-08-30 18:19:19 +01:00
Asger F
1e5f0a4e2f JS: Update DataFlow tests 2019-08-30 18:19:19 +01:00
Asger F
5512846e6f JS: Update TypeTracking test 2019-08-30 18:19:19 +01:00
Asger F
bd6768e2c8 JS: Fix closure namespace prefix and update tests 2019-08-30 18:19:19 +01:00
Asger F
b1f9db9145 JS: Make getAFunctionValue follow global access paths 2019-08-30 18:19:19 +01:00
Asger F
8d59df229a JS: Allow calls to externs 2019-08-30 18:19:19 +01:00
Asger F
cfa2ec1084 JS: Remove fake JSONType from es5.js externs 2019-08-30 18:19:19 +01:00
Asger F
e7166c2a1c JS: Workaround for JSON externs 2019-08-30 18:19:19 +01:00
Asger F
221d94961a JS: Resolve simple calls based on qualified name 2019-08-30 18:19:19 +01:00
Asger F
ca71d3117e JS: Use access paths from Closure module 2019-08-30 18:19:19 +01:00
Asger F
8c5b6b256b JS: Remove globalFlowPred() 2019-08-30 18:19:18 +01:00
Asger F
96d9e66ced JS: cache things 2019-08-30 18:19:18 +01:00
Asger F
313579c258 JS: Restrict flow to access paths assigned in a unique file 2019-08-30 18:19:18 +01:00
Asger F
48b70c4f1d JS: Add type-tracking test case 2019-08-30 18:19:18 +01:00
Asger F
7315a2baee JS: Make type tracking work through access paths 2019-08-30 18:19:18 +01:00
Asger F
2105e0bdee JS: use JSDoc types in class tracking 2019-08-30 18:19:18 +01:00
Asger F
6b05aa129c JS: Use global access paths to recognize .prototype 2019-08-30 18:19:18 +01:00
semmle-qlci
61034be186 Merge pull request #1844 from asger-semmle/more-type-info
Approved by xiemaisi
2019-08-30 18:17:07 +01:00
Taus
89778ef61d Merge pull request #1849 from markshannon/python-add-syntax-comments
Python: Add syntax example comments for automatic document generation.
2019-08-30 17:46:50 +02:00
Asger F
3186942906 JS: Add change note 2019-08-30 16:05:13 +01:00
Asger F
f219598281 JS: Update DeclarationFiles test 2019-08-30 16:02:42 +01:00
Asger F
5874c14a9c JS: Avoid materializing JSONValue.getFile() 2019-08-30 16:02:42 +01:00
Asger F
6c0f9be6df JS: Avoid materializing HTML::Element.getFile() 2019-08-30 16:02:42 +01:00
Asger F
33267067e0 JS: Deprecate and remove path resolution for reference comments 2019-08-30 16:02:42 +01:00
Asger F
fa3532ca8c TS: Handle locally defined packages 2019-08-30 16:02:42 +01:00
Asger F
d8cda5e268 JS: Add Firebase test with types 2019-08-30 16:02:41 +01:00
Asger F
ec81e368da JS: Use type info in Firebase model 2019-08-30 16:02:41 +01:00
Asger F
f4144831ab TS: Emit module bindings for all files in node_modules 2019-08-30 16:02:41 +01:00
Asger F
efa7e1112b JS: Add Node.hasUnderlyingType 2019-08-30 16:02:41 +01:00
Mark Shannon
ad463038f8 Python: Clarify comment about 'syntax:' comment and add ... to for and async for comments. 2019-08-30 15:34:14 +01:00
Jonas Jensen
c3e1fb424e Merge pull request #1658 from zlaski-semmle/zlaski/cpp387
[CPP-387] Create a new PR against new location of introduce-libraries…
2019-08-30 16:25:13 +02:00
Taus
f8bd3770d6 Merge pull request #1848 from markshannon/python-rationalize-taint-tracking
Python: Move TaintTracking.qll
2019-08-30 16:21:49 +02:00
Tom Hvitved
6dc869d5c6 C#: Remove reference equality 2019-08-30 15:52:42 +02:00
semmle-qlci
a97aefe0c3 Merge pull request #1835 from xiemaisi/js/dom-fixes
Approved by asger-semmle
2019-08-30 14:45:06 +01:00
Tom Hvitved
3e716bf806 Merge pull request #1749 from calumgrant/cs/extractor-tidy
C#: Refactor extractor trap generation code
2019-08-30 15:44:35 +02:00
Taus
a2841b4245 Merge pull request #1763 from markshannon/python-cwe-312
Python: Two new queries for CWE-312.
2019-08-30 15:28:56 +02:00
Tom Hvitved
c9275fdc0a Merge pull request #1692 from calumgrant/cs/roslyn-3.2
C#: Upgrade to Roslyn 3.2
2019-08-30 15:09:11 +02:00
Anders Schack-Mulligen
8a318ce4e7 Java: Extend test with graph. 2019-08-30 14:35:21 +02:00
Anders Schack-Mulligen
455bb6cd15 Java/C++/C#: Add change notes. 2019-08-30 14:35:21 +02:00
Anders Schack-Mulligen
6582734733 Java: Add test. 2019-08-30 14:32:55 +02:00
Anders Schack-Mulligen
5e6326d1d5 Java/C++/C#: Add support for dataflow exploration by partial paths. 2019-08-30 14:32:55 +02:00
Anders Schack-Mulligen
6749f7a1b7 Merge pull request #1843 from lukecartey/java/add-missing-sql-apis
Java: Add missing SQL query APIs.
2019-08-30 14:27:40 +02:00
Mark Shannon
637677d515 Python: Move TaintTracking.qll from semmle.python.security to semmle.python.dataflow, for consistency with other code. 2019-08-30 12:57:47 +01:00
Mark Shannon
a256945938 Python: Add syntax example comments for document generation. 2019-08-30 12:46:08 +01:00
semmle-qlci
394563de43 Merge pull request #1807 from hvitved/csharp/dataflow/barrier-guard
Approved by calumgrant
2019-08-30 12:40:25 +01:00
Taus
3d3797f829 Merge pull request #1830 from markshannon/python-update-docs
Python: Update the documentation
2019-08-30 13:01:50 +02:00
Max Schaefer
b6220998d1 JavaScript: Restrict setAttribute sink to potentially dangerous attribute names. 2019-08-30 11:57:29 +01:00
Calum Grant
c7b685b3b8 C#: Fix changed qltest. 2019-08-30 11:47:43 +01:00
Calum Grant
611af1e2c2 C#: Upgrade to Roslyn 3.2. 2019-08-30 11:47:43 +01:00
Mark Shannon
3f740d6efe Python: Update CWE-312 queries to use new taint-tracking configuration. 2019-08-30 11:21:04 +01:00
Luke Cartey
e118f9a5f9 Add change note. 2019-08-30 10:48:37 +01:00
Luke Cartey
dfa371c65b Java: Add missing SQL query APIs.
* executeLargeUpdate
 * prepareCall
2019-08-30 10:40:49 +01:00
Mark Shannon
811815aa4e Merge branch 'master' into python-cwe-312 2019-08-30 10:39:04 +01:00
Calum Grant
ec61877ce8 Merge pull request #1805 from hvitved/csharp/dataflow/nested-fields
C#: Nested field flow
2019-08-30 10:26:10 +01:00
Calum Grant
0129b42c54 C#: Address review comments. 2019-08-30 10:11:01 +01:00
Calum Grant
7df90f13ed C#: Address review comments. Tidy up tuple generation, consolidating code and use run-time type information instead of FirstParam/NextParam. 2019-08-30 10:11:01 +01:00
Calum Grant
40f56ff4b3 C#: Code tidy. Rename variables, delete dead code, format whitespace, improve comments. 2019-08-30 10:11:01 +01:00
Calum Grant
b3d5e405a6 C#: Fix violations 2019-08-30 10:11:01 +01:00
Calum Grant
97522c506e C#: Add more CIL consistency tests. 2019-08-30 10:11:01 +01:00
Calum Grant
b776421602 C#: Fix up tests. Fix cil_class, and add locations for constructed methods and types. 2019-08-30 10:11:01 +01:00
Calum Grant
02fd51ae61 C#: Resolve merge conflicts. 2019-08-30 10:11:00 +01:00
Calum Grant
b500a02b1e C#: Compare CIL entities directly by handle rather than by label.
C#: Remove IDs from the CIL extractor and make consistent with C# extractor.
C#: Fix method collisions.
2019-08-30 10:11:00 +01:00
Calum Grant
685c494bcb C#: Make the trap compression algorithm configurable. 2019-08-30 10:11:00 +01:00
Calum Grant
fe7e90e25a C#: Remove the tuples from the C# extractor. 2019-08-30 10:11:00 +01:00
Calum Grant
486c192dda C#: Refactoring expression and statement population. 2019-08-30 10:11:00 +01:00
Calum Grant
e41e8d6547 C#: Remove ITrapBuilder in favour of TextWriter. 2019-08-30 10:00:06 +01:00
Calum Grant
aeb38a1757 C#: Refactoring tuple writing to remove Tuple intermediate object and write straight to trap file. 2019-08-30 10:00:06 +01:00
Calum Grant
bd1b0018b0 C#: Rename some methods. 2019-08-30 10:00:06 +01:00
Calum Grant
58e6d236ff C#: Tidy up CommentProcessing. 2019-08-30 10:00:06 +01:00
Taus
4f26b58a1a Merge pull request #1747 from markshannon/python-extend-taint-tracking-config
Python: Extend taint-tracking configuration to match API of Javascript implementation.
2019-08-30 10:39:53 +02:00
Tom Hvitved
75eb7f92a2 C++: Sync identical files 2019-08-30 09:54:05 +02:00
Tom Hvitved
9f59e385d1 C#: Autoformat 2019-08-30 09:53:50 +02:00
Tom Hvitved
6e7ef66642 C#: Revert to using GuardedDataFlowNode in TaintedPath.qll 2019-08-30 09:37:23 +02:00
Tom Hvitved
751985dcf2 C#: Address review comments 2019-08-30 09:37:23 +02:00
Tom Hvitved
ae5fb7f330 C#: Introduce BarrierGuards 2019-08-30 09:37:16 +02:00
Tom Hvitved
c642e726c6 Merge pull request #1555 from calumgrant/cs/typemention-fixes
C#: Fix various extraction errors
2019-08-30 09:34:18 +02:00
zlaski-semmle
f2025116d5 Merge pull request #1771 from geoffw0/qldoceg8
CPP: Add syntax examples to QLDoc in NameQualifiers.qll
2019-08-29 15:16:37 -07:00
Geoffrey White
b254e1f48e CPP: Change note. 2019-08-29 18:24:29 +01:00
Calum Grant
4dd4167a5a C#: Update test output (following merge). 2019-08-29 18:22:37 +01:00
Geoffrey White
2b1871fd2b CPP: Remove the old test. I don't think preserving a duplicate test of deprecated queries is helpful. 2019-08-29 18:18:23 +01:00
Geoffrey White
ed7586d829 CPP: Add a combined test for the combined query. 2019-08-29 18:18:22 +01:00
Calum Grant
424ab3ed6a C#: Analysis change notes. 2019-08-29 18:12:58 +01:00
Calum Grant
83d1e0eaa6 C#: Name DotNet::Namespace a declaration. 2019-08-29 18:12:58 +01:00
Calum Grant
83ab044a73 C#: Update expected test output. 2019-08-29 18:12:58 +01:00
Calum Grant
dfbb1946d3 C#: Minor edits 2019-08-29 18:11:00 +01:00
Calum Grant
5613769654 C#: Add NamespaceAccess, and make namespaces declarations. 2019-08-29 18:11:00 +01:00
Calum Grant
0e62377dd2 C#: Treat _ as an ordinary variable in a foreach. 2019-08-29 18:11:00 +01:00
Calum Grant
8aeeec01ff C#: Add namespace_access_expr because of nameof(Namespace) 2019-08-29 18:11:00 +01:00
Calum Grant
ae36359058 C#: Fix typementions of arrays. 2019-08-29 18:11:00 +01:00
Geoffrey White
ed53aef4dd CPP: Deprecate the two old queries. 2019-08-29 17:47:42 +01:00
Geoffrey White
7c14c68486 CPP: Add a new, combined Japanese era query. 2019-08-29 17:47:42 +01:00
Geoffrey White
b441b65918 CPP: Give the two japanese era queries unique @names. 2019-08-29 17:47:42 +01:00
Nick Rolfe
36b42def1c Merge pull request #1841 from ian-semmle/valuetext
C++: Split valuetext off into its own table
2019-08-29 17:42:14 +01:00
Geoffrey White
11da14c5f2 Merge pull request #1838 from jbj/leap-year-name
C++: Change name of UncheckedReturnValueForTimeFunctions.ql
2019-08-29 17:32:31 +01:00
Mark Shannon
4f172bd075 Python: Add change note for CWE-312 queries. 2019-08-29 16:05:11 +01:00
Mark Shannon
989d7aeace Merge branch 'master' into python-cwe-312 2019-08-29 15:57:49 +01:00
Mark Shannon
d096644773 Python docs: Fix typos and rst formatting issue. 2019-08-29 15:55:05 +01:00
Geoffrey White
1215da2d6c Merge pull request #1827 from jbj/sbb-tidy
C++: Tidy up SubBasicBlocks.qll
2019-08-29 15:42:40 +01:00
Geoffrey White
a84f19238b CPP: Add a scoped enum example. 2019-08-29 15:38:17 +01:00
Ian Lynagh
c08eb7e8c7 C++: Tweak the getValueText() code 2019-08-29 14:59:05 +01:00
james
0b31ca46b1 docs: fix speaker note bug 2019-08-29 14:55:02 +01:00
Jonas Jensen
be7be1fb38 C++: Improve name/descr. of leap year queries 2019-08-29 15:53:51 +02:00
Mark Shannon
22f55d25c2 Python taint-tracking. Reorder columns in some tests for easier comprehension of expected output. 2019-08-29 14:36:10 +01:00
Mark Shannon
e51b797c03 Python taint-tracking. Add an adapter for old 'dataflow config'. 2019-08-29 14:30:09 +01:00
Mark Shannon
179f4ee88f Python taint-tracking: Add documented example test. 2019-08-29 13:03:58 +01:00
Tom Hvitved
982f90dc2b C#: Refactor local data flow step relations 2019-08-29 13:35:19 +02:00
james
387147ede2 docs: fix include in data flow slides 2019-08-29 11:53:19 +01:00
semmle-qlci
f980d20d6d Merge pull request #1809 from hvitved/csharp/cfg/tests
Approved by calumgrant
2019-08-29 11:35:21 +01:00
james
b89f0161aa docs: make use of includes for local and global data flow slides 2019-08-29 11:03:45 +01:00
james
ec9ca6852b docs: add template slide deck 2019-08-29 11:03:45 +01:00
Mark Shannon
10fddbc19b Python new taint-tracking: Fix some typos and clarify documentation. 2019-08-29 11:03:35 +01:00
james
7fa7f2dd65 docs: add rst versions of java slide decks and improve a few c++ slides 2019-08-29 11:03:19 +01:00
Ian Lynagh
28832c9021 C++: Add a comment 2019-08-29 10:32:34 +01:00
Mark Shannon
5bb528d236 Python taint-tracking: Fix performance of 'flowsTo' and 'testEvaluates'. 2019-08-29 10:31:50 +01:00
Mark Shannon
3872c7a1f9 Python taint-tracking. Rework handling of sequences and dicts of taint for performance. 2019-08-29 10:31:50 +01:00
Mark Shannon
a36453b2e2 Python taint-tracking. Fix performance for a couple of predicates. 2019-08-29 10:31:50 +01:00
Mark Shannon
76c11c4575 Python: Update a test result. 2019-08-29 10:31:50 +01:00
Mark Shannon
45abe09494 Python taint-tracking: Improve layout and documentation. 2019-08-29 10:31:50 +01:00
Mark Shannon
91aefab7aa Python: Reorganise code a bit to minimize diff for PR. 2019-08-29 10:31:50 +01:00
Mark Shannon
e5900921e7 Python taint-tracking: Remove warnings from test output. 2019-08-29 10:31:50 +01:00
Mark Shannon
691165d1c6 Python: Check-in two missing files. 2019-08-29 10:31:50 +01:00
Mark Shannon
c7ec5690a5 Python taint-tracking: make sure all features of legacy extensions are supported. 2019-08-29 10:31:50 +01:00
Mark Shannon
64c160b75c Python taint-tracking: Fix ambiguous flow through class instantiation. Tweak the path query to ensure edge to sink is always present. 2019-08-29 10:31:50 +01:00
Mark Shannon
d31e55f88e Python taint-tracking: Avoid ambiguous flows through calls. Fix up tests. 2019-08-29 10:31:50 +01:00
Mark Shannon
78ce19678a Python taint-tracking: Fix up SQL injection query. 2019-08-29 10:31:50 +01:00
Mark Shannon
3f8066878a Python taint-tracking: Fix up handling of contexts for __init__ and for context-free taints. 2019-08-29 10:31:50 +01:00
Mark Shannon
fe9c9d479d Python taint-tracking. Fix bug in legacy API. 2019-08-29 10:31:50 +01:00
Mark Shannon
7c4a18eee3 Python taint-tracking: Fix up handling of legacy (config-less) taint-tracking 2019-08-29 10:31:50 +01:00
Mark Shannon
2d9d292ee4 Python: Fix up pi-node handling in taint-tracking. 2019-08-29 10:31:50 +01:00
Mark Shannon
955e54b360 Python: Update unitialized local to use new taint-tracking config. 2019-08-29 10:31:50 +01:00
Mark Shannon
24b4a4102c Python taint-tracking: Further enhancements to new implementation for better debugging and backwards compatibility. 2019-08-29 10:31:50 +01:00
Mark Shannon
1addfaac1a Python taint-tracking: update test results. 2019-08-29 10:31:50 +01:00
Mark Shannon
a7845ae0e1 Python taint-tracking: Remove old implementation. 2019-08-29 10:31:50 +01:00
Mark Shannon
133909d7fe Python taint-tracking: Lengthen steps to better conform to old edge relation. 2019-08-29 10:31:50 +01:00
Mark Shannon
da6a66975c Python taint-tracking. Further improvements to new taint-tracking. 2019-08-29 10:31:50 +01:00
Mark Shannon
74f1dd3ec0 Python taint-tracking. Add some tests and fix up various parts of the implementation. 2019-08-29 10:31:50 +01:00
Mark Shannon
eed2090168 Python taint-tracking. Fill in most of new configuration-base taint-tracking implementation. 2019-08-29 10:31:47 +01:00
Mark Shannon
e8bd9e7341 Python: Add new API for taint-tracking configuration. As yet, unsupported. 2019-08-29 10:27:08 +01:00
Anders Schack-Mulligen
ae98d4fd8e Java: Change extension point to use a unit type. 2019-08-29 11:05:45 +02:00
Calum Grant
d2bee79370 Merge pull request #1600 from AndreiDiaconu1/ircsharp
C#: Initial port of IR for C#
2019-08-29 09:26:34 +01:00
Ian Lynagh
395197432f C++: Update stats for valuetext 2019-08-28 22:52:14 +01:00
Rebecca Valentine
36f99c19bc Merge pull request #1840 from markshannon/python-better-hasattribute-handling
Python: Add 'hasAttribute' predicate to ObjectInternal and Value.
2019-08-28 10:45:44 -07:00
Rebecca Valentine
cac775880f Merge pull request #1839 from markshannon/python-rationalize-library
Python: rationalize library a bit.
2019-08-28 10:15:36 -07:00
Rebecca Valentine
602b99e01f Merge pull request #1834 from markshannon/python-verify-unreachable-code
Python: Add test to verify fix.
2019-08-28 10:15:26 -07:00
Rebecca Valentine
ac78d10277 Merge pull request #1821 from markshannon/python-speedup-binary-points-to
Python points-to: Speed up binaryPointsTo predicate.
2019-08-28 10:14:40 -07:00
Mark Shannon
5892ce2a2b Python: Implement 'hasAttribute()' on ObjectInternal and use it to implement the same predicate on Value, ModuleObject and ClassObject. 2019-08-28 17:18:25 +01:00
Geoffrey White
2e0c1af6c4 Merge pull request #1836 from jbj/xheader-undef
C++: Support x-macros that are #undef'ed in header
2019-08-28 17:16:50 +01:00
Ian Lynagh
cc031183bc C++: Add an upgrade script 2019-08-28 16:06:28 +01:00
AndreiDiaconu1
deeff07322 Fixed unused predicate error 2019-08-28 15:50:39 +01:00
Mark Shannon
f64f6e6d2e Python: Move classes for lists of AST nodes into AstExtended.qll 2019-08-28 15:43:02 +01:00
Tom Hvitved
853a3aa998 Merge pull request #1799 from aschackmull/java/fieldflow-perf
Java/C++/C#: Improve performance of data flow with fields.
2019-08-28 16:30:25 +02:00
Geoffrey White
fbeed9113b Merge pull request #1837 from jbj/change-note-1.23
C++: New empty change-notes file for 1.23
2019-08-28 14:57:47 +01:00
Ian Lynagh
6d18b4e894 C++: If we don't have a valuetext, then see if one of our conversions does 2019-08-28 14:49:51 +01:00
Mark Shannon
97f9920a69 Python: Move NameNode class in Flow.qll with other CFG classes. 2019-08-28 14:39:27 +01:00
Mark Shannon
68da13cdc2 Python remove a couple of small AST related modules, moving contents to more appropriate modules. 2019-08-28 14:28:04 +01:00
Ian Lynagh
95794f9227 C++: Handle values with no valuetext 2019-08-28 14:27:08 +01:00
AndreiDiaconu1
489dbe1d01 Fixed errors
Added some new classes for built in operations that for the moment
have no effect (added to remove errors)
2019-08-28 14:23:42 +01:00
Ian Lynagh
754612d257 C++: Split valuetext off into its own table 2019-08-28 14:09:13 +01:00
Luke Cartey
1669d283fe Merge pull request #1795 from aschackmull/java/localexprflow
Java: Add localExprFlow and localExprTaint.
2019-08-28 14:04:49 +01:00
Jonas Jensen
d4f8e73a66 C++: Change name of UncheckedReturn...Functions.ql
The previous name was identical to the name of
`Adding365DaysPerYear.ql`. It may have been a copy-paste error.
2019-08-28 14:05:31 +02:00
Jonas Jensen
c8a9ec465e C++: New change-notes file for 1.23 2019-08-28 13:36:57 +02:00
AndreiDiaconu1
05ae04df72 Synced files 2019-08-28 12:30:17 +01:00
AndreiDiaconu1
66948b4f57 Fixed PR errors 2019-08-28 12:25:14 +01:00
AndreiDiaconu1
c74898ec9f Synced files
Synced the files that are needed for this PR
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
7390606370 Tidy up + more comment
Tidied up the code for review
Added more comments
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
0c6ffc9f4d Casts and IsExpr
Fixed some inconsistencies with casts
Fixed some bugs related to which translated elements need loads
Added support for IsExpr expressions
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
c8a3f6fac8 Added cast exprs + deleted commented code 2019-08-28 12:25:14 +01:00
AndreiDiaconu1
34bafa7230 Fixed sanity checks
Fixed a bug in `TranslatedArrayExpr` that would prevent the element to produce the correct instruction result, hence creating problems with loads and stores.
`ElementsAddress` opcode now inherits from the `UnaryOpcode`, as it should.
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
23694bdd14 Work on classes + refactor
Began working o inheritance, polymorphism and constructor init. Correct code is produced for them (though some more work is needed to accurately treat conversions between classes).
Removed commented code.
Added classes to properly deal with constructor init and modified and refactored TranslatedFunction to accomodate for the changes.
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
9018b25177 Properties
Properties and property access produce correct code.
Fixed a function qualifier bug in `TranslatedCall.qll`.
Added a new class to translate `ExprStmt`s whose expr is an `AssignExpr` whose lvalue is an accessor call: we translate only the accessor call in for the translated AST.
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
1acabc7d87 Jump statements
Broke down the class `TranslatedJump` to have more control on the IR control flow.
Now GotoLabelStmt, GotoCaseStmt, GotoDefaultStmt and BreakStmt are translated separately.
This also fixes an issue when having a switch as the last statement of a void function would create an incorrect CFG.
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
2724075dec Added stmts
Added support for `ForStmt` and `DoWhileStmt`
Added test cases
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
b6287b904c Preliminary refactoring
Some preliminary refactoring of the TranslatedDeclaration.qll file
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
1e4b3fafb6 Updated expected for crement ops 2019-08-28 12:25:13 +01:00
AndreiDiaconu1
940ba694d2 Arithmetic increment and decrement expressions
Correct code is now produced for increment and decrement expressions
Modified producesExprResult() and TTranslatedLoad() so that no loads are done from outside the crement exprs and that the VariableAddress generated from the access of the operator variable is recognized as an expr that produces result.
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
3bc6456572 Work on throw statements, bug fixes, small refactor.
Throw statements now give correct code, apart from the case of rethrows: need to make explicit the fact that a finally block is executed even if stack unwinding happens.
Added 2 new classes to TranslatedStmt.qll, one for throws that have an exception, one for rethrows.
Fixed a bug in TranslatedDeclarationEntry.qll where some local declaration would be missed.
Changed toString into getQualifiedName for more clarity when generating the instructions in Instruction.qll.
Some general refactoring in TranslatedExpr.qll and TranslatedStmt.qll.
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
b90bc96cb5 Objects tests and fix in PrintIR
Added tests to showcase the instructions generated for object creation and object initialization
Updated raw_ir.expected
PrintIR now uses the qualified name (with types) when printing the IR for more clarity
2019-08-28 12:25:13 +01:00
Andrei Diaconu
8661074fc3 Object creation and initialization + refactoring
Correct code is now generated from ObjectCreation exprs and ObjectInitializer exprs.
Removed TranslatedFieldInitialization and its subclasses and further refactored TranslatedInitialization
2019-08-28 12:25:13 +01:00
Andrei Diaconu
dae37e5472 Fixed bugs, updated tests
Fixed a bug in TranslatedExpr: decl + init where the rhs is a reference now work as expected
Uncommented the code for the switch statement
2019-08-28 12:25:13 +01:00
Andrei Diaconu
be01b031b0 Fixed and refactored code for arrays
Introduced 2 new tags to support multidimensional arrays
Multidimensional arrays produce correct code
All types of initializations for arrays work correctly
2019-08-28 12:25:13 +01:00
Andrei Diaconu
35b028e626 Initial work for objects and statements
Objects now work, although I will refactor the code quite a bit for clarity
If and while statements now produce good code
Began work on try statements
2019-08-28 12:25:13 +01:00
Andrei Diaconu
4462babc0b Added support for switch stmt (CS 6.0 style) 2019-08-28 12:25:13 +01:00
AndreiDiaconu1
de6f547088 Synced more files 2019-08-28 12:25:13 +01:00
AndreiDiaconu1
49777636aa Applied the review comments 2019-08-28 12:25:13 +01:00
AndreiDiaconu1
ffb22bfff8 Locatable -> Language::AST 2019-08-28 12:25:13 +01:00
Andrei Diaconu
9105641741 Update csharp/ql/src/semmle/code/csharp/ir/IRSanity.ql
Co-Authored-By: Dave Bartolomeo <42150477+dave-bartolomeo@users.noreply.github.com>
2019-08-28 12:25:13 +01:00
Andrei Diaconu
81d8905a0f Update csharp/ql/src/semmle/code/csharp/ir/PrintIR.ql
Co-Authored-By: Dave Bartolomeo <42150477+dave-bartolomeo@users.noreply.github.com>
2019-08-28 12:25:13 +01:00
Andrei Diaconu
ce06bd8af3 Update csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRSanity.ql
Co-Authored-By: Dave Bartolomeo <42150477+dave-bartolomeo@users.noreply.github.com>
2019-08-28 12:25:13 +01:00
Andrei Diaconu
d8f8b47605 Update csharp/ql/src/semmle/code/csharp/ir/implementation/raw/PrintIR.ql
Co-Authored-By: Dave Bartolomeo <42150477+dave-bartolomeo@users.noreply.github.com>
2019-08-28 12:25:13 +01:00
Dave Bartolomeo
073812b6f1 Rename Cpp -> CSharp 2019-08-28 12:25:13 +01:00
Dave Bartolomeo
609ca034c0 C#/C++: Share IR implementation 2019-08-28 12:25:13 +01:00
Andrei Diaconu
50ba4d1fda Deleted folder 2019-08-28 12:25:13 +01:00
Andrei Diaconu
45455a12d6 Fixed function calls
Function calls now produce correct code.
Added 2 test cases to showcase this.
2019-08-28 12:25:13 +01:00
Andrei Diaconu
26bf7e116d Arrays fixed, simple variable initialization fixed.
Correct code is now generated for array initialization and element access.
Created a new binary Opcode, `IndexedElementAddress`, used to get the address of an array element, similar to how CIL does it.
Fixed simple variable initialization.
2019-08-28 12:25:13 +01:00
Andrei Diaconu
2a41e7b5c0 Fixed issues mentioned in the PR comments
Modified _.getCallable() to _.getFunction()
Deleted both *ssa folders from ir/implementation
Deleted the ValueCategory.qll file
2019-08-28 12:25:13 +01:00
Andrei Diaconu
aea0356994 Fixed var addressing and other changes
Now variables addressing correctly gets translated
Added a new test case to showcase this
Changed VoidType to ObjectType for the type of the 2 instructions
generated by as the prelude of a translated function
(UnmodeledDefinition and AliasedDefinition)
2019-08-28 12:25:13 +01:00
Andrei Diaconu
7ef9bf6eea Fixed whitespace errors in PR 2019-08-28 12:25:13 +01:00
Andrei Diaconu
025d68f07a General tidy up and refactor
Refactored the C++ specific names
Tidied the code
Updated TODOs
2019-08-28 12:25:13 +01:00
Andrei Diaconu
c733bc0ae9 Functional basic porting
Ported basic functionalities from the C++ IR
Added a simple test that passes the IR sanity check and produces
sensible IR (together with the .expected files) to the C# test folder
2019-08-28 12:25:13 +01:00
Andrei Diaconu
fc69c1201d Initial copy of C++ IR with some modifications 2019-08-28 12:25:13 +01:00
Jonas Jensen
2c253f360a C++: Support x-macros that are #undef'ed in header
This fixes a false positive on https://github.com/zduka/tpp.
2019-08-28 13:03:16 +02:00
Jonas Jensen
e7dfb3e61b C++: Test for x-macro FP observed in the wild 2019-08-28 13:03:09 +02:00
Mark Shannon
1c8ce418d9 Python: Add test to confirm #1212 is fixed. 2019-08-28 12:01:04 +01:00
Max Schaefer
78ce290de3 JavaScript: Fix DomMethodCallExpr.interpretsArgumentsAsHTML. 2019-08-28 11:22:03 +01:00
Jonas Jensen
8c610e4f68 C++: Don't use deprecated interface in test 2019-08-28 08:31:05 +02:00
Jonas Jensen
b98d6379e9 C++: Restore and deprecate getPosInBasicBlock
This predicte was still used in a test, so it might be used in external
code too.
2019-08-28 08:29:06 +02:00
Pavel Avgustinov
1bd0c69f0e Merge pull request #1831 from jbj/existsCompleteWithName-perf
C++: Performance fix for existsCompleteWithName
2019-08-27 16:30:40 +01:00
Jonas Jensen
3700a631a6 C++: Performance fix for existsCompleteWithName 2019-08-27 16:28:57 +02:00
Mark Shannon
dafed6b93e Python docs: remove confusing reference to SSA as 'dataflow' and add a reference to the taint-tracking library from the library overview page. 2019-08-27 14:45:33 +01:00
Nick Rolfe
45a3dcd770 Merge pull request #1829 from jf205/update-cpp-lang-support
docs: mention clang-ci support
2019-08-27 14:45:18 +01:00
Mark Shannon
562f4ef604 Python docs: Remove all references to ClassExpr and FunctionExpr; we want to remove them eventually. 2019-08-27 14:20:08 +01:00
Mark Shannon
6edf9efe1b Python docs: Replace remaining references to old 'Object' API are replaced by new 'Value' API. 2019-08-27 14:15:27 +01:00
james
be5b5e1617 docs: clang-ci support 2019-08-27 14:04:05 +01:00
Luke Cartey
8d33f31b0d Merge pull request #1725 from jf205/add-rst-slide/sd-3717
docs: add rst files for C/C++ training and a few styling improvements
2019-08-27 11:43:44 +01:00
Pavel Avgustinov
b3081154fa Merge pull request #1823 from markshannon/python-dont-prune-in-ql
Python: removing pruning in QL.
2019-08-27 11:32:23 +01:00
Jonas Jensen
4cae5917cb C++: Remove one nomagic and explain the other 2019-08-26 21:48:18 +02:00
Jonas Jensen
2332dada1a C++: s/pos/index/ in SubBasicBlocks 2019-08-26 21:35:58 +02:00
Jonas Jensen
92c354e8e8 C++: Simplify SubBasicBlock::getNumberOfNodes 2019-08-26 21:11:42 +02:00
jf205
baeb1d549e Merge pull request #1826 from felicity-semmle/ql-support/updates
QL docs: Update global variables
2019-08-26 15:21:57 +01:00
Jonas Jensen
2b94bb9eda C++: Use the word "rank" to denote a rank
Previously, the word "position" was used ambiguously in this library.
2019-08-26 16:13:08 +02:00
Jonas Jensen
17ee3f555c C++: Sync the two copies of SubBasicBlocks.qll
These files are now added to `identical-files.json` so they will remain
in sync.
2019-08-26 16:01:36 +02:00
semmle-qlci
f123916f53 Merge pull request #1825 from asger-semmle/js-change-notes
Approved by xiemaisi
2019-08-26 14:00:32 +01:00
Esben Sparre Andreasen
43ede52e29 Merge pull request #1670 from sjvs/patch-2
Remove reference to internal emacs tooling from public repository
2019-08-26 14:54:07 +02:00
Asger F
17f5984101 Update change-notes/1.22/analysis-javascript.md
Co-Authored-By: Felicity Chapman <felicity@semmle.com>
2019-08-26 13:10:19 +01:00
Felicity Chapman
5e21af2ca9 Update global variables 2019-08-26 13:08:54 +01:00
Pavel Avgustinov
deacc23465 Merge pull request #1824 from jbj/sbb-perf
C++: Optimize SubBasicBlocks library
2019-08-26 13:02:43 +01:00
Asger F
6364f8bbf7 JS: Change notes for jump-to-def and documentation improvements 2019-08-26 12:55:14 +01:00
Jonas Jensen
5e674825e3 C++: Optimize SubBasicBlock::getPosInBasicBlock() 2019-08-26 12:47:40 +02:00
Jonas Jensen
d4f1cf97fd C++: Optimize SubBasicBlock::getNode(int) 2019-08-26 12:22:37 +02:00
Jonas Jensen
be24c6418b C++: Optimize SubBasicBlock::getNumberOfNodes() 2019-08-26 12:22:34 +02:00
Jonas Jensen
27b6ed3be4 Merge pull request #1822 from pavgust/fix/multiloc-defs
definitions.qll: Suppress multi-location links.
2019-08-26 10:50:21 +02:00
Ziemowit Laski
7f00d3fdf3 [PR/1660] Fix up charpred. 2019-08-25 20:34:18 -07:00
zlaski-semmle
c276d0b8ac Merge pull request #1770 from geoffw0/qldoceg7
CPP: Add syntax examples to QLDoc in various files
2019-08-25 20:15:51 -07:00
Ziemowit Laski
161b0e2f5b [PR/1660] Rename BuiltinVarList to BuiltinVarArgsList. 2019-08-25 19:44:37 -07:00
Ziemowit Laski
18611bcfb4 [CPP-387] Remove duplicate EnumConstant entry. 2019-08-25 16:42:06 -07:00
Ziemowit Laski
b3730a0955 [CPP-387] Remove duplicate FriendDecl entry. 2019-08-25 16:40:44 -07:00
Ziemowit Laski
c29b63809b [CPP-387] Add ClassDerivatio, VirtualClassDerivation, ExprCall. Remove ParenthesizedBracedInitializerList. 2019-08-25 16:37:59 -07:00
Mark Shannon
ca75a393b4 Python: Remove pruning in QL; rely on the extractor to do it. 2019-08-25 17:03:22 +01:00
Mark Shannon
f11d0638cf Python: Remove tests for pruning in QL. 2019-08-25 17:00:08 +01:00
Pavel Avgustinov
b9b0c3bc5d definitions.qll: Suppress multi-location links. 2019-08-25 15:59:17 +01:00
Mark Shannon
9b1fbac929 Python points-to: Speed up binaryPointsTo predicate. 2019-08-25 15:14:42 +01:00
semmle-qlci
30921d5ee7 Merge pull request #1817 from taus-semmle/python-change-notes-1.22
Approved by felicity-semmle
2019-08-25 13:28:14 +01:00
Taus Brock-Nannestad
f08d8573c7 Address review comments and add missing notes. 2019-08-25 13:55:42 +02:00
semmle-qlci
a22ada1289 Merge pull request #1819 from jbj/1.22-changenote
Approved by felicity-semmle
2019-08-24 18:55:41 +01:00
ian-semmle
8d037da049 Merge pull request #1818 from jbj/lambda_capture-upgrade-perf
C++: Fix lambda_capture upgrade query join order
2019-08-24 18:26:05 +01:00
yh-semmle
2590019058 Merge pull request #1815 from felicity-semmle/1.22/java-finalize-change-notes
Java 1.22: Minor tidy up to release notes
2019-08-24 13:03:41 -04:00
Jonas Jensen
83e0a65c71 C++: improved wording 2019-08-24 17:09:58 +02:00
Jonas Jensen
e379a60142 C++: Change note for flow through fields 2019-08-24 16:53:46 +02:00
Jonas Jensen
1900734484 C++: Reorganize the data flow change note
This groups the change notes that concern the `DataFlow` library and
clarifies the change notes that concern the two different
`TaintTracking` libraries.
2019-08-24 16:49:39 +02:00
semmle-qlci
e37751e365 Merge pull request #1816 from felicity-semmle/1.22/js-finalize-change-notes
Approved by asger-semmle
2019-08-24 14:52:41 +01:00
Jonas Jensen
52e4058903 C++: Fix lambda_capture upgrade query join order
When this query was run as an upgrade script, the optimizer picked a bad
join order, making the upgrade very slow on large databases. It picked a
bad join order because upgrade scripts are run with no stats.
2019-08-24 15:33:50 +02:00
Taus Brock-Nannestad
76c0113155 Python: Update change note for 1.22. 2019-08-24 15:32:26 +02:00
Tom Hvitved
f17c670f90 Merge pull request #1814 from felicity-semmle/1.22/csharp-finalize-change-notes
C# 1.22: Finalize change notes
2019-08-24 14:59:10 +02:00
Felicity Chapman
0ef81b5932 Merge pull request #1 from asger-semmle/class-change-notes
JS: Add change note about CHA
2019-08-24 13:31:55 +01:00
Asger F
28d0e890a8 JS: Add change note about CHA 2019-08-24 13:23:34 +01:00
Jonas Jensen
bd9bebc096 Merge pull request #1811 from felicity-semmle/1.22/cpp-finalize-change-notes
C/C++ 1.22: finalize change notes
2019-08-24 14:09:01 +02:00
Felicity Chapman
71ac4003f5 Finalize release notes 2019-08-24 12:30:33 +01:00
Felicity Chapman
64dbb88efe Minor tidy up to release notes 2019-08-24 12:10:53 +01:00
semmle-qlci
fc59dd6819 Merge pull request #1788 from asger-semmle/additional-type-tracking-step
Approved by xiemaisi
2019-08-24 11:55:16 +01:00
Geoffrey White
c164d9390c Add a note about QLDoc comments
The changes aren't finished in this release, but there widespread enough we should acknowledge them.

Originally https://github.com/Semmle/ql/pull/1812.
2019-08-24 11:48:07 +01:00
Felicity Chapman
88a6cc0914 Update change-notes/1.22/analysis-cpp.md
Co-Authored-By: Nick Rolfe <nickrolfe@gmail.com>
2019-08-24 11:40:38 +01:00
Nick Rolfe
ead003e440 Merge pull request #1813 from pavgust/attribute
Improve attribution on some stub files
2019-08-24 11:40:32 +01:00
Felicity Chapman
9ccb0af133 Tidy up release notes 2019-08-24 11:37:07 +01:00
Felicity Chapman
22833251db Minor tidying up 2019-08-24 10:55:50 +01:00
Felicity Chapman
7a6f33890f Fix sort order for table 2019-08-24 10:48:42 +01:00
Taus
c6c307ffef Merge pull request #1810 from markshannon/python-speedup-slow-predicate
Python: Prevent bad magic in one predicate.
2019-08-24 11:35:09 +02:00
Pavel Avgustinov
da29d99560 Merge branch 'master' of github.com:Semmle/ql into attribute 2019-08-23 21:47:31 +01:00
semmle-qlci
af469fdeb8 Merge pull request #1773 from xiemaisi/js/undocumented-parameter-precision
Approved by esben-semmle
2019-08-23 21:29:10 +01:00
Mark Shannon
8909c3d6ab Python: Fix tags and message for CWE-312 queries. 2019-08-23 15:20:19 +01:00
Mark Shannon
20fc64c673 Python: Prevent bad magic in one predicate. 2019-08-23 15:08:19 +01:00
Tom Hvitved
16f40fd45a C#: Consolidate CFG tests 2019-08-23 15:25:01 +02:00
Jonas Jensen
1c51c34685 Merge pull request #1700 from geoffw0/lambdacaptureelement
CPP: Make LambdaCaptures Elements
2019-08-23 14:38:12 +02:00
Jonas Jensen
ec268c12f7 Merge pull request #1794 from aschackmull/java/changenotes-dataflow
Java/C#/C++: Add change notes for in/out barriers and barrierguards.
2019-08-23 11:55:33 +02:00
Anders Schack-Mulligen
66ea66582e Java/C#/C++: Add change notes for in/out barriers and barrierguards. 2019-08-23 11:42:07 +02:00
Anders Schack-Mulligen
2bea0a459a Java/C++/C#: Sync. 2019-08-23 11:34:17 +02:00
Anders Schack-Mulligen
6e97f22b43 Java/C++/C#: Improve performance of pruning in field flow. 2019-08-23 11:32:45 +02:00
Mark Shannon
06f5545f39 Merge pull request #1798 from taus-semmle/python-regex-support-short-mode-flags
Python: Support short mode flags (e.g. `re.M`) in regexes. (ODASA-8056)
2019-08-23 10:07:03 +01:00
Pavel Avgustinov
cc854dd937 Merge branch 'master' of github.com:Semmle/ql into attribute 2019-08-23 09:55:35 +01:00
semmle-qlci
cf24c9ff4a Merge pull request #1804 from asger-semmle/template-literal-tag
Approved by esben-semmle
2019-08-23 09:37:38 +01:00
james
aea7d5689f docs: address review comments 2019-08-23 09:32:58 +01:00
Geoffrey White
fbeb79729b CPP: Upgrade script. 2019-08-23 08:44:30 +01:00
Geoffrey White
cf6ada5758 CPP: Update stats. 2019-08-23 08:44:29 +01:00
Geoffrey White
29000c411c CPP: Make LambdaCapture an Element. 2019-08-23 08:44:29 +01:00
Geoffrey White
6462da736b CPP: Another test case. 2019-08-23 08:44:29 +01:00
Geoffrey White
19a0d4697e CPP: More thorough test of LambdaCapture. 2019-08-23 08:44:29 +01:00
Tom Hvitved
c5d9d74c0a C#: Nested field flow 2019-08-23 09:25:05 +02:00
Ziemowit Laski
e6f7f16aee [CPP-387] Address more feedback. 2019-08-22 17:52:12 -07:00
Robert Marsh
23b74b5521 Merge pull request #1750 from dave-bartolomeo/dave/ZooKeeper
C++: Minimal IR support for `GNUVectorType`
2019-08-22 14:34:59 -07:00
Calum Grant
ff20a2ceb9 Merge pull request #1761 from hvitved/csharp/dataflow/fields
C#: Data flow through fields
2019-08-22 20:46:00 +01:00
Dave Bartolomeo
a84a7e8c8a C++: Fixup after rebase 2019-08-22 11:36:15 -07:00
Dave Bartolomeo
8a9528b1a8 C++: Accept test output after fixes for PointerAdd element sizes 2019-08-22 10:43:31 -07:00
Dave Bartolomeo
3108d97ea5 C++: Minimal IR support for GNUVectorType
Lack of support for the GCC vector extensions was causing a bunch of sanity failures in the syntax zoo. This PR adds minimal IR generation support for these types.

Added `VectorAggregateLiteral`, and factored most of `ArrayAggregateLiteral` out into the common base class `ArrayOrVectorAggregateLiteral`. I'd be happy to merge these all into `ArrayAggregateLiteral` if we don't care about the distinction.

Made a few tweaks to `TranslatedArrayExpr` to compute the element type by looking at the result type of the `ArrayExpr`, not the type of the base operand. Note that this means that for `T a[10]; a[i] = foo;`, the result of the `PointerAdd` for `a[i]` will now be `glvalue<T>`, not `T*`. This is actually more faithful to the source language, and has no semantic difference on the IR.

Added some missing `getInstructionElementSize()` overrides.

Added the new `BuiltIn` opcode, renamed the existing `BuiltInInstruction` to `BuiltInOperationInstruction`, and made any `BuiltInOperation` that we don't specifically handle translate to `BuiltIn`. `BuiltInOperationInstruction` now has a way to get the specific `BuiltInOperation`.

Added `getCanonicalQLClass()` overrides for `GNUVectorType` and `BuiltInOperation`.

Added a simple IR test for vector types.
2019-08-22 10:43:30 -07:00
Asger F
45d4b83fc8 TS: Extract type args to tagged template exprs 2019-08-22 18:07:29 +01:00
Jonas Jensen
f5a63e3a91 Merge pull request #1801 from geoffw0/lambdar
CPP: Update taint test comments.
2019-08-22 18:45:41 +02:00
Nick Rolfe
bea1f687e7 Merge pull request #1796 from mgrettondann/enable-usingentry-getenclosingelement
C++: Add support for UsingEntry.getEnclosingElement
2019-08-22 17:01:57 +01:00
Taus Brock-Nannestad
92f48191c2 Update test results for UndefinedGlobal.ql. 2019-08-22 17:53:36 +02:00
Geoffrey White
a70975f95f CPP: Update test comments. 2019-08-22 15:40:38 +01:00
Anders Schack-Mulligen
ef0c6d01eb Java: Add a global extension point for taint steps. 2019-08-22 16:38:59 +02:00
Geoffrey White
c007d4ffd7 Merge pull request #1781 from jbj/dataflow-location-workaround
C++: Workaround for lambda expression locations
2019-08-22 15:36:22 +01:00
james
372243aa1a docs: some more slide fixes 2019-08-22 15:30:37 +01:00
Taus Brock-Nannestad
b82ebf2a37 Add tests. 2019-08-22 16:30:14 +02:00
Mark Shannon
4759044ee4 Python tests: Fix up tests for CWE-312 to not use external locations. 2019-08-22 15:27:49 +01:00
Mark Shannon
9df205b288 Python tests: Fix up CWE-327 tests to use new sensitive-data library. 2019-08-22 15:27:48 +01:00
Mark Shannon
6cd0087d9d Python: Use Value API for sensitive data analysis. 2019-08-22 15:27:48 +01:00
Mark Shannon
81c65cd37c Add missing html tag 2019-08-22 15:27:48 +01:00
Mark Shannon
816938369e Python: Add tests for clear-text storage and logging. 2019-08-22 15:27:48 +01:00
Mark Shannon
15bb8b5f70 Python add new queries for clear-text logging and storage. 2019-08-22 15:27:48 +01:00
Mark Shannon
79ebd5652a Python: Add library support for cookies. Update and extend sensitive data library. 2019-08-22 15:27:48 +01:00
Taus Brock-Nannestad
b9ef8a0526 Python: Extend hasAttribute to unknown-but-defined module variables. 2019-08-22 16:22:53 +02:00
james
110b02a556 docs: improve scaling behaviour, fix fonts and headings
docs: better responsive behaviour

docs: improve c/c++ slides

docs: titles and fonts

docs: tidy up layout and css

docs: update layout to scale font-size by slide height

docs: tidy up templates and fix font headings
2019-08-22 14:59:08 +01:00
james
a35241e4cd docs: 2nd round of suggestions 2019-08-22 14:58:29 +01:00
james
feb4d26de8 docs: address first round of review comments on other slides and add intro to ql decks 2019-08-22 14:58:29 +01:00
james
4c714981f0 docs: address comments on bad overflow guard slides 2019-08-22 14:58:28 +01:00
james
a9a0b9a5d0 docs: fix some errors picked up by vale linter 2019-08-22 14:58:28 +01:00
james
c97f5829a2 docs: rationalize images and slide backgrounds 2019-08-22 14:58:28 +01:00
james
b0ff09b04d docs: further css tweaks 2019-08-22 14:58:27 +01:00
james
1d31a78d27 docs: rename QL training sphinx project 2019-08-22 14:58:27 +01:00
james
819f308010 docs: add several cpp training slides 2019-08-22 14:58:27 +01:00
Matthew Gretton-Dann
855ce8dd9d C++: Add support for UsingEntry.getEnclosingElement 2019-08-22 14:23:38 +01:00
Taus Brock-Nannestad
f9c002e441 Python: Support short mode flags (e.g. re.M) in regexes. 2019-08-22 14:53:58 +02:00
Tom Hvitved
0801e51175 Merge pull request #1790 from jbj/tainttracking-cross-language
C++/C#/Java: Shared TaintTrackingImpl.qll
2019-08-22 14:17:23 +02:00
Jonas Jensen
d38dbf0f63 C++: Workaround for lambda expression locations
See CPP-427.
2019-08-22 11:52:56 +02:00
Anders Schack-Mulligen
3aedadcb35 Java: Add localExprFlow and localExprTaint. 2019-08-22 11:25:23 +02:00
Taus
ae2a68b988 Merge pull request #1791 from markshannon/python-revert-tests
Python: Revert and update tests removed in #1767
2019-08-22 11:20:24 +02:00
Jonas Jensen
ad9ee54b65 C++/C#/Java: defaultAdditionalTaintStep 2019-08-22 11:14:06 +02:00
Tom Hvitved
ef6cf57597 C#: Add change note 2019-08-22 10:51:31 +02:00
Tom Hvitved
d2f8b0bc20 C#: Handle constructors with member initializers and base() calls in CFG 2019-08-22 10:34:23 +02:00
Tom Hvitved
e6ba282e05 C#: Revert a few changes 2019-08-22 09:26:13 +02:00
Ziemowit Laski
f3fc1be6fc [CPP-387] Address review comments; some line reordering. 2019-08-21 17:14:14 -07:00
Robert Marsh
1b6339528c Merge pull request #1783 from jbj/taint-fields-structs
C++: Don't propagate taint between field and struct [CPP-410]
2019-08-21 11:20:26 -07:00
yh-semmle
9012c3240f Merge pull request #1789 from aschackmull/java/autoformat
Java: Autoformat.
2019-08-21 12:36:55 -04:00
Taus
c595d0f27b Merge pull request #1784 from markshannon/python-move-essa-together
Python: Move all ESSA related code into one folder.
2019-08-21 17:51:45 +02:00
Tom Hvitved
5d140930d0 C#: Add field initializers to CFG for constructors
This commit adds field initializers to the CFG for non-static constructors. For
example, in

```
class C
{
    int Field1 = 0;
    int Field2 = Field1 + 1;
    int Field3;

    public C()
    {
        Field3 = 2;
    }

    public C(int i)
    {
        Field3 = 3;
    }
}
```

the initializer expressions `Field1 = 0` and `Field2 = Field1 + 1` are added
to the two constructors, mimicking

```
public C()
{
    Field1 = 0;
    Field2 = Field1 + 1;
    Field3 = 2;
}
```

and

```
public C()
{
    Field1 = 0;
    Field2 = Field1 + 1;
    Field3 = 3;
}
```

respectively. This means that we no longer have to synthesize calls, callables,
parameters, and arguments in the data flow library, so much of the work from
d1755500e4 can be simplified.
2019-08-21 16:21:38 +02:00
Tom Hvitved
a2ffddec5f Merge pull request #1785 from jbj/dataflow-recursion-prevention-shared
C++/C#/Java: Pyrameterize ConfigurationRecursionPrevention
2019-08-21 15:56:50 +02:00
Mark Shannon
e77ae09a86 Python tests: Update test results to account for better handling of branches in finally blocks. 2019-08-21 14:47:57 +01:00
Mark Shannon
714fecbf5e Python: Revert tests removed in #1767. 2019-08-21 14:39:53 +01:00
semmle-qlci
ddc716d2d3 Merge pull request #1768 from asger-semmle/ts-debugging
Approved by esben-semmle, xiemaisi
2019-08-21 14:21:45 +01:00
Felicity Chapman
4e355ce497 Merge pull request #1786 from jf205/gtm-sphinx
Sphinx docs: update references on `layout.html`
2019-08-21 14:17:21 +01:00
Jonas Jensen
25701f203d C++/C#/Java: Shared TaintTrackingImpl.qll
This file is now identical in all languages. Unifying this file led to
the following changes:
- The documentation spelling fixes and example from the C++ version
  were copied to the other versions and updated.
- The steps through `NonLocalJumpNode` from C# were abstracted into a
  `globalAdditionalTaintStep` predicate that's empty for C++ and Java.
- The `defaultTaintBarrier` predicate from Java is now present but empty
  on C++ and C#.
- The C++ `isAdditionalFlowStep` predicate on
  `TaintTracking::Configuration` no longer includes `localFlowStep`.
  That should avoid some unnecessary tuple copying.
2019-08-21 14:55:54 +02:00
jf205
79477a45cf Merge pull request #1748 from asger-semmle/type-tracking-tutorial
JS: Type tracking tutorial
2019-08-21 13:47:53 +01:00
james
419d07e1e5 docs: remove HS, GA, add GTM ref 2019-08-21 13:45:54 +01:00
Asger F
fd7cfedf4b JS: Add AdditionalTypeTrackingStep 2019-08-21 13:44:03 +01:00
Anders Schack-Mulligen
629c19e719 Java: Autoformat. 2019-08-21 14:38:17 +02:00
Pavel Avgustinov
cb3551b4d6 Merge commit '76982404' into attribute 2019-08-21 12:44:07 +01:00
Jonas Jensen
863bf523d6 C++/C#/Java: Autoformat 2019-08-21 13:24:01 +02:00
Asger F
d5f43fb7cb Update docs/language/learn-ql/javascript/type-tracking.rst
Co-Authored-By: jf205 <42464962+jf205@users.noreply.github.com>
2019-08-21 12:23:09 +01:00
Anders Schack-Mulligen
b4856e928b Merge pull request #1780 from jbj/simpleLocalFlowStep
C++/C#/Java: Split localFlowStep predicate in two
2019-08-21 13:16:58 +02:00
Jonas Jensen
846e3734ce C++: Change note for recursion prevention 2019-08-21 13:12:48 +02:00
Jonas Jensen
fdd3b901f7 C/C#/Java: Share ConfigurationRecursionPrevention
This class was copy-pasted in all `DataFlowN.qll` files without using
the identical-files system to keep the copies in sync. The class is now
moved to the `DataFlowImplN.qll` files.

This also has the effect of preventing recursion through first data flow
library copy for C/C++. Such recursion has been deprecated for over a
year, and some forms of recursions are already ruled out by the library
implementation.
2019-08-21 13:04:10 +02:00
Mark Shannon
857cd9196b Merge pull request #1782 from taus-semmle/python-pruning-nomagic
Python: Prevent bad magic during pruning.
2019-08-21 11:55:59 +01:00
Asger F
0785c1b17b JS: Address comments 2019-08-21 11:48:05 +01:00
Asger F
17573afa0c JS: Hyphenate type-tracking when used as adjective 2019-08-21 11:47:58 +01:00
Jonas Jensen
2f4ed45dac C++: No taint between field and struct
To compensate for the lack of field flow, the taint tracking library has
previously considered taint to flow from fields to their containing
structs and back again from the structs to any of their fields. This
leads to false flow between unrelated fields and is not needed now that
we have proper flow through fields.
2019-08-21 11:57:12 +02:00
Jonas Jensen
6fc3a62edb C++/C#/Java: Change another caller of localFlow
There was also a use of `localFlowStep` in `DataFlowImplCommon` that
should now be `simpleLocalFlowStep`.
2019-08-21 10:20:15 +02:00
Jonas Jensen
ec2cc5a80e C#: Refactor how simpleLocalFlowStep is called
`localFlowStep` is no longer an alias because it should not have the
same QLDoc as `simpleLocalFlowStep`.
2019-08-21 10:05:54 +02:00
Tom Hvitved
eb97d7beaa Revert "C#: Generalize CFG entry/exit nodes to include field/property initializers"
This reverts commit b7e732fddb.
2019-08-21 09:55:24 +02:00
Jonas Jensen
c9ea5ad9a3 C#/Java: Remove cached from wrapper predicate 2019-08-21 09:43:13 +02:00
Jonas Jensen
4b7813b98e C++/C#/Java: Split localFlowStep predicate in two
There's now a `localFlowStep` predicate for use directly in queries and
other libraries and a `simpleLocalFlowStep` for use only by the global
data flow library. The former predicate is intended to include field
flow, but the latter may not.

This will let Java and C# (and possibly C++ IR) avoid getting two kinds
of field flow at the same time, both from SSA and from the global data
flow library. It should let C++ AST add some form of field flow to
`localFlowStep` without making it an input to the global data flow
library.
2019-08-21 09:27:01 +02:00
zlaski-semmle
c2d1a52b39 Merge pull request #1732 from geoffw0/qldoceg6
CPP: Add syntax examples to QLDoc in Block.qll, Stmt.qll
2019-08-20 16:34:35 -07:00
Ziemowit Laski
d102b66af1 [CPP-387] Finished multi-line syntax examples. Awaiting feedback. 2019-08-20 16:08:39 -07:00
Geoffrey White
675e1cc349 CPP: Add a reverse-link for consistency between Field and MemberVariable. 2019-08-20 15:38:02 +01:00
Anders Schack-Mulligen
9150682ada Merge pull request #1757 from jbj/pyrameterized-taint
C++: Use pyrameterized modules for TaintTracking
2019-08-20 16:33:22 +02:00
Taus Brock-Nannestad
a58c16f91c Python: Prevent bad magic during pruning.
Fixes the performance regression seen on `uncompyle2` and similar projects.
2019-08-20 16:18:42 +02:00
Calum Grant
35017786cf Merge pull request #1739 from hvitved/csharp/ssa/delegate-call-source
C#: Search from delegate creation in `delegateCallSource()`
2019-08-20 15:16:20 +01:00
Pavel Avgustinov
7176b438c4 Merge commit '7bfed6e517cbcabfe06cf614981baee8cbde5342' into attribute 2019-08-20 14:08:57 +01:00
Tom Hvitved
7ab9c8b90d Java/C++/C#: flowCandFwdRead() refactor 2019-08-20 14:44:04 +02:00
Tom Hvitved
80e91cceb1 C#: Disable field flow for cs/inappropriate-encoding 2019-08-20 13:59:46 +02:00
Tom Hvitved
14378ee41a Java/C++/C#: Remove some unbind() calls from shared data flow implementation 2019-08-20 13:59:01 +02:00
Jonas Jensen
7c4938c035 C#: Get rid of TaintTrackingUtil.qll 2019-08-20 13:56:13 +02:00
Jonas Jensen
bc702debf9 C++/Java: Change notes for Configuration2 rename 2019-08-20 13:46:04 +02:00
Jonas Jensen
11583b69e0 C#: Use pyrameterized modules for TaintTracking
To keep the code changes minimal, and to keep the implementation similar
to C++ and Java, the `TaintTracking{Public,Private}` files are now
imported together through `TaintTrackingUtil`. This has the side effect
of exposing `localAdditionalTaintStep`. The corresponding predicate for
Java was already exposed.
2019-08-20 13:45:38 +02:00
Jonas Jensen
f1e6e36ce6 Java: Remove wrong definition of taint tracking
This explanation, taken from C/C++, was not correct for Java.
2019-08-20 13:45:38 +02:00
Jonas Jensen
9ac0cdd2a2 Java: Don't use the deprecated Configuration2 2019-08-20 13:45:37 +02:00
Jonas Jensen
aeb2323128 Java: Use pyrameterized modules for TaintTracking 2019-08-20 13:45:37 +02:00
Jonas Jensen
d65b09d94a C++: Proper fix for TaintTracking2 parameter 2019-08-20 13:45:37 +02:00
Jonas Jensen
b1cd64bbf4 C++: Fix mismatch between taint and dataflow copy 2019-08-20 13:45:37 +02:00
Jonas Jensen
d388be7d3b C++: Use pyrameterized modules for TaintTracking 2019-08-20 13:45:37 +02:00
Mark Shannon
d8531c46e7 Python ESSA: Move variable definitions into new file and unify 'generic' and 'python specific' parts. 2019-08-20 11:55:41 +01:00
Mark Shannon
523c5b1e1e Python ESSA: Remove unnecessary intermediate class. 2019-08-20 11:41:53 +01:00
Mark Shannon
2ab3bf46cf Python ESSA: Move definition sub-classes from points-to folder to essa folder. 2019-08-20 11:41:53 +01:00
Mark Shannon
e34ccae1fc Python ESSA: Move all Essa code to semmle.python.essa folder. 2019-08-20 11:41:46 +01:00
Asger F
f18f54fd0d TS: Allow changing the port 2019-08-20 10:41:25 +01:00
semmle-qlci
7698240484 Merge pull request #1769 from asger-semmle/ts-rest-pattern-default
Approved by esben-semmle
2019-08-20 10:02:43 +01:00
Asger F
6f217502f9 TS: Review 2019-08-20 09:57:32 +01:00
Max Schaefer
d105de81a3 JavaScript: Raise precision of UndocumentedParameter to high.
This is more consistent with the other JSDoc queries. Results are still not shown on LGTM by default, but the query can now be enabled selectively for projects that care about JSDoc.
2019-08-20 09:32:00 +01:00
Tom Hvitved
a0c834c83d Java/C++/C#: Improve data flow join orders for field flow 2019-08-20 10:14:08 +02:00
Jonas Jensen
432b0a4698 Merge pull request #1766 from aschackmull/java/nested-storestep
Java/C++/C#: Add field flow support for stores in nested fields.
2019-08-20 10:06:19 +02:00
Ziemowit Laski
d9b0b64af1 [CPP-387] Begin pretty-printing code examples. 2019-08-19 20:52:40 -07:00
Asger F
75e85e4402 TS: Fix handling of erroneous rest pattern with default 2019-08-19 17:34:45 +01:00
Taus
b33e9f229b Merge pull request #1767 from markshannon/temporary-test-removal
Python tests: TEMPORARILY remove 5 tests to allow modification of extractor CFG pass
2019-08-19 18:06:19 +02:00
Tom Hvitved
1e46509a2a C#: Use TaintTracking2 in cs/inappropriate-encoding 2019-08-19 17:18:49 +02:00
Tom Hvitved
2a2e07d2fc C#: Avoid recomputation in last data flow stage
Avoid recomputing the `ControlFlowReachabilityConfiguration` predicates, as well
as `DispatchCall::getStaticTarget()`.
2019-08-19 17:17:47 +02:00
Mark Shannon
edb50c129d Python tests: TEMPORARILY remove 5 tests to allow modification of extractor CFG pass. 2019-08-19 16:00:28 +01:00
Geoffrey White
f045035f5d CPP: Examples Include.qll. 2019-08-19 15:58:44 +01:00
Geoffrey White
abd4d39710 CPP: Examples NameQualifiers.qll. 2019-08-19 15:06:39 +01:00
Geoffrey White
3eec627321 CPP: Add a test of NameQualifiableElement and NameQualifyingElement. 2019-08-19 15:05:50 +01:00
Asger F
ca79b083cf TS: Add debugging flag and document how to run the debugger 2019-08-19 15:04:02 +01:00
Anders Schack-Mulligen
6ff4fe38ec Java/C++/C#: Add field flow support for stores in nested fields. 2019-08-19 14:41:06 +02:00
Geoffrey White
a889a79816 CPP: Examples Field.qll. 2019-08-19 11:48:58 +01:00
Geoffrey White
f6ccaa5caf CPP: Examples FriendDecl.qll. 2019-08-19 11:31:33 +01:00
Geoffrey White
b69df9113a CPP: Examples Comments.qll. 2019-08-19 11:29:24 +01:00
Asger F
ad67015720 JS: Address comments 2019-08-19 10:57:26 +01:00
Geoffrey White
bc3e4e4143 CPP: Examples Lambda.qll. 2019-08-19 09:59:26 +01:00
Geoffrey White
d29eefd235 CPP: Examples Macro.qll. 2019-08-19 09:59:26 +01:00
Geoffrey White
4ea999872b Merge pull request #1746 from jbj/ast-field-flow-ctor
C++: Field flow through ConstructorFieldInit
2019-08-19 09:14:02 +01:00
Anders Schack-Mulligen
4dc460bba9 Merge pull request #1764 from yh-semmle/java-vcs-remove
Java: remove unused VCS relations, library and queries
2019-08-19 10:04:01 +02:00
zlaski-semmle
ce71b45649 Zlaski/cpp386a (#1753)
* [CPP-386] Cumulative patch.

* Restore dataflow libraries clobbered by my last commit.
2019-08-19 10:03:18 +02:00
yh-semmle
7bfed6e517 Java: add change note for VCS.qll removal 2019-08-18 15:37:25 -04:00
yh-semmle
73d8e16cd0 Java: remove obsolete VCS.qll and associated queries 2019-08-18 14:53:46 -04:00
Pavel Avgustinov
127c33700c Add Java stubs readme 2019-08-17 18:57:50 +01:00
Pavel Avgustinov
7934218a48 Add PSF license 2019-08-17 16:31:19 +01:00
Pavel Avgustinov
cb6d38314f Add Babylon license 2019-08-17 16:31:19 +01:00
Pavel Avgustinov
c92eb58300 Add j2objc license 2019-08-17 16:31:18 +01:00
Pavel Avgustinov
b52ea1e21b Add Apache Shiro third-party notice 2019-08-17 16:31:18 +01:00
Pavel Avgustinov
ca951f1669 Add jquery-datatables license to make it clear which option we choose 2019-08-17 16:31:18 +01:00
yh-semmle
8cada4b154 Merge pull request #1758 from aschackmull/java/silly-dataflow-perf-fix
Java: Improve performance in all dataflow queries.
2019-08-16 21:21:10 -04:00
Geoffrey White
9b9986be58 Merge pull request #1762 from jbj/ast-field-flow-LambdaExpression
C++: Support flow through LambdaExpression
2019-08-16 16:45:59 +01:00
Jonas Jensen
84adeda167 C++: Support flow through LambdaExpression
I've checked with a temporary workaround for the locations problem that
my annotations in the test cpp files are on the correct lines.
2019-08-16 16:20:22 +02:00
Tom Hvitved
d1755500e4 C#: Data flow through fields
Initial implementation of data flow through fields, using the algorithm of the
shared data flow implementation. Fields (and field-like properties) are covered,
and stores can be either
 - ordinary assignments, `Foo = x`,
 - object initializers, `new C() { Foo = x }`, or
 - field initializers, `int Foo = x`.

For field initializers, we need to synthesize calls (`SynthesizedCall`),
callables (`SynthesizedCallable`), parameters (`InstanceParameterNode`), and
arguments (`SynthesizedThisArgumentNode`), as the C# extractor does not (yet)
extract such entities. For example, in

```
class C
{
    int Field1 = 1;
    int Field2 = 2;

    C() { }
}
```

there is a synthesized call from the constructor `C`, with a synthesized `this`
argument, and the targets of that call are two synthesized callables with bodies
`this.Field1 = 1` and `this.Field2 = 2`, respectively.

A consequence of this is that `DataFlowCallable` is no longer an alias for
`DotNet::Callable`, but instead an IPA type.
2019-08-16 15:49:37 +02:00
Anders Schack-Mulligen
9e4f2f8594 Java: Don't use default dataflow in libs imported by default. 2019-08-16 13:27:53 +02:00
Calum Grant
0df9a625ba Merge pull request #1717 from hvitved/csharp/ssa/adjacent-perf
C#: Improve performance of SSA adjacent reads calculation
2019-08-16 12:11:57 +01:00
Tom Hvitved
b7e732fddb C#: Generalize CFG entry/exit nodes to include field/property initializers 2019-08-16 13:06:51 +02:00
Asger F
d05b90473c JS: Add type tracking templates to cheat sheet 2019-08-16 12:06:32 +01:00
Asger F
54661f0e14 JS: Rename the two tutorials 2019-08-16 12:01:28 +01:00
Calum Grant
b28241ac6d Merge pull request #1741 from hvitved/csharp/extract-field-inits
C#: Extract assignments for field/property initializers
2019-08-16 11:51:37 +01:00
Asger F
366ebbcbf5 JS: Address review comments 2019-08-16 11:39:55 +01:00
Taus
a6db9efd0c Merge pull request #1756 from markshannon/python-forward-compatible-taint-api
Python points-to: add .getAstNode() method to TaintedNode
2019-08-16 12:34:08 +02:00
Geoffrey White
eb39346d85 Merge pull request #1744 from jbj/ast-field-flow-aggregate-init
C++: Field flow through ClassAggregateLiteral
2019-08-16 09:56:11 +01:00
Mark Shannon
453ae19881 Python points-to: Add .getAstNode() method to TaintedNode for forward compatibility with upcoming taint-tracking enhancements. 2019-08-16 09:54:11 +01:00
jf205
eead7f6106 Merge pull request #1610 from xiemaisi/js/library-customizations
JavaScript: Start documenting extension points provided by the standard library.
2019-08-16 09:49:57 +01:00
Jonas Jensen
ee8c0cb29a C++: Support member initializer lists > 1000 items 2019-08-16 09:36:34 +02:00
Max Schaefer
50b1ddfef8 JavaScript: Apply suggestions from code review
Co-Authored-By: jf205 <42464962+jf205@users.noreply.github.com>
2019-08-16 08:26:39 +01:00
Jonas Jensen
503cbf13bb C++: Flow from parameters to ConstructorFieldInit
Because `ConstructorFieldInit` (member initializer lists) are not part
of the control flow graph, there was no data flow from the initial value
of parameters to their uses in member initializers. This commit adds the
necessary flow under the assumption that parameters are not overwritten
in member initializers.
2019-08-16 09:10:31 +02:00
Jonas Jensen
45eefdb218 C++: Field flow through ConstructorFieldInit
This allows a member initializer list to be seen as a sequence of field
assignments. For example, the constructor

    C() : a(taint()) { }

now has data flow similar to

    C() { this.a = taint(); }
2019-08-16 09:10:17 +02:00
Jonas Jensen
1be2380511 C++: Rephrase ThisFlow to get space for ctor inits 2019-08-16 08:46:11 +02:00
Jonas Jensen
f3f89ffe3f Merge pull request #1742 from geoffw0/lambdataint
CPP: Tests for taint through lambdas
2019-08-16 08:45:14 +02:00
Geoffrey White
a6902bdb37 CPP: Test dataflow through lambdas. 2019-08-15 19:43:24 +01:00
Asger F
e68e84fe77 JS: Type tracking tutorial 2019-08-15 18:24:20 +01:00
Dave Bartolomeo
f1bbc9bb7e Merge pull request #1745 from jbj/ast-field-flow-ABC
C++: Annotate field-flow tests in [ABC].cpp
2019-08-15 09:13:26 -07:00
Dave Bartolomeo
230ff92c03 Merge pull request #1743 from nickrolfe/hmap
C++: delete headermaps test
2019-08-15 09:01:23 -07:00
Tom Hvitved
495e5bc628 C#: Extract assignments for field/property initializers 2019-08-15 16:18:23 +02:00
Max Schaefer
e92a1c3169 JavaScript: Apply suggestions from code review
Co-Authored-By: jf205 <42464962+jf205@users.noreply.github.com>
2019-08-15 14:46:07 +01:00
Geoffrey White
1bd4aeebad CPP: Effects of #1715. 2019-08-15 14:05:09 +01:00
Geoffrey White
02e1edd640 CPP: Test taint through lambdas. 2019-08-15 14:00:45 +01:00
Geoffrey White
b6cf341124 Merge pull request #1715 from jbj/ast-field-flow
C++: Initial AST-based flow through fields
2019-08-15 13:38:58 +01:00
Taus
f5bc8b5b5f Merge pull request #1728 from markshannon/python-points-to-support-type-checking
Python: Enhance points-to to support type-hint analysis.
2019-08-15 14:17:53 +02:00
Nick Rolfe
c26aef2381 C++: delete headermaps test 2019-08-15 12:39:58 +01:00
Mark Shannon
902871bd48 Python: update tests results after rebase. 2019-08-15 11:37:07 +01:00
Mark Shannon
45f5825b47 Python API: Add ClassValue.getABaseType() 2019-08-15 11:35:14 +01:00
Mark Shannon
6c6e35f541 Python: Enhance points-to to support type-hint analysis. 2019-08-15 11:35:14 +01:00
Jonas Jensen
1b4b352316 C++: Field flow through ClassAggregateLiteral 2019-08-15 12:01:42 +02:00
Jonas Jensen
e419ea0140 C++: Test showing no flow through aggregate init 2019-08-15 11:33:25 +02:00
Jonas Jensen
fdd8de79da C++: Remove redundant toString override
This time I left a comment to prevent myself from getting confused again
and adding the override in the future.
2019-08-15 11:32:11 +02:00
Calum Grant
3fab5140a7 Merge pull request #1673 from hvitved/csharp/cfg/split-static-limit
C#: Apply static CFG splitting limit
2019-08-15 10:04:38 +01:00
Jonas Jensen
ed1e3ed1ef C++: Annotate field-flow tests in [ABC].cpp
This brings the annotation style in sync with how we annotate new tests
these days. I also changed a few annotations to have different expected
outcome based on my understanding of the code.
2019-08-15 10:30:46 +02:00
Ziemowit Laski
52cd025c2d Incorporate PR feedback. 2019-08-14 22:06:45 -07:00
Ziemowit Laski
7f42dd2a08 More minor tweaks. File is now in new location. 2019-08-14 14:36:58 -07:00
Ziemowit Laski
72e6d18d36 Merge branch 'master' of git.semmle.com:Semmle/ql
git pull upstream master
2019-08-14 12:31:04 -07:00
Jonas Jensen
e94dbe926b C++: Add forgotten toString override
This makes `PostConstructorCallNode`s show up in the test output.
2019-08-14 16:26:49 +02:00
semmle-qlci
01fd161c03 Merge pull request #1740 from Semmle/fix/yaml-javad0c
Approved by xiemaisi
2019-08-14 15:12:56 +01:00
Jonas Jensen
4662e71d4d Merge pull request #1738 from aschackmull/java/dataflow-joinorder-fix
Java: Dataflow joinorder fix
2019-08-14 13:39:01 +02:00
Pavel Avgustinov
356424308b YAMLExtractor: Update javadoc link
Recent SnakeYAML has removed the linked method; replace the
link with a reference to what it became.
2019-08-14 12:36:26 +01:00
semmle-qlci
09b87d8957 Merge pull request #1733 from pavgust/imp/yaml-snippets
Approved by esben-semmle
2019-08-14 11:09:44 +01:00
Anders Schack-Mulligen
1938ac4937 Java/C++/C#: Sync. 2019-08-14 10:32:15 +02:00
Felicity Chapman
24f407c104 Merge pull request #1689 from markshannon/python-modernize-learn-ql
Python docs: Modernize the learn-ql pages to use the Value API.
2019-08-14 09:19:24 +01:00
Anders Schack-Mulligen
0c56f955e8 Java: Fix bad join order. 2019-08-14 10:10:19 +02:00
Ziemowit Laski
7d93cd0b92 Merge branch 'zlaski-semmle-zlaski/cpp387'
Conflict resolution step as per GitHub PR page
2019-08-13 18:29:21 -07:00
Ziemowit Laski
2522529cdb Merge branch 'zlaski/cpp387' of https://github.com/zlaski-semmle/ql into zlaski-semmle-zlaski/cpp387
Conflict resolution step as per GitHub PR page
2019-08-13 18:27:56 -07:00
Ziemowit Laski
8a58a1939e Combine adjacent elements with the same formatting. 2019-08-13 18:15:38 -07:00
zlaski
a69b26c7f8 [CPP-386] A few more. 2019-08-13 17:52:38 -07:00
zlaski
23776c5290 [CPP-386] Minor tweaks. 2019-08-13 17:18:10 -07:00
zlaski
0dbc8e3950 [CPP-386] Closer to finality. 2019-08-13 16:35:27 -07:00
yh-semmle
badfc23ce4 Merge pull request #1718 from aschackmull/java/barrierguard
Java/C++/C#: Add support for BarrierGuards.
2019-08-13 14:11:54 -04:00
Anders Schack-Mulligen
c99d0e7bd5 Java: Add change note. 2019-08-13 16:59:59 +02:00
Anders Schack-Mulligen
411bc16f44 Java/C++/C#: Address review comment. 2019-08-13 16:57:48 +02:00
Anders Schack-Mulligen
9e902066ad Java/C++/C#: Elaborate qldoc. 2019-08-13 16:57:48 +02:00
Anders Schack-Mulligen
4550175b16 Java/C++/C#: Add support for BarrierGuards. 2019-08-13 16:57:48 +02:00
Jonas Jensen
e93598e476 Merge pull request #1716 from geoffw0/qldoceg4
CPP: Add syntax examples to QLDoc in Function.qll
2019-08-13 16:27:20 +02:00
yh-semmle
5e910a4808 Merge pull request #1724 from aschackmull/java/google-xmlreader
Java: Treat SecureJDKXercesXMLReader as a secure XMLReader.
2019-08-13 09:52:32 -04:00
Pavel Avgustinov
eb77b86b03 YAML extraction: Improve toString computation 2019-08-13 12:59:52 +01:00
Geoffrey White
e4bbfb9a79 CPP: Corrections. 2019-08-13 11:25:39 +01:00
Tom Hvitved
36043d04bd Merge pull request #1729 from xiemaisi/data-flow-nodes-location
Java/C++/C#: Provide path-node locations via `hasLocationInfo`, not `getLocation`.
2019-08-13 12:22:59 +02:00
Geoffrey White
95749bdff8 CPP: Examples Stmt.qll. 2019-08-13 10:56:59 +01:00
semmle-qlci
e24137324f Merge pull request #1711 from aschackmull/java/arithmetic-barriers
Approved by yh-semmle
2019-08-13 10:19:09 +01:00
Jonas Jensen
38ec693ead C++: Improved ConstructorCall field flow
This commit changes C++ `ConstructorCall` to behave like
`new`-expressions in Java: they are both `ExprNode`s and
`PostUpdateNodes`, and there's a "pre-update node" (here called
`PreConstructorCallNode`) to play the role of the qualifier argument
when calling a constructor.
2019-08-13 11:05:13 +02:00
Taus
34106ec739 Merge pull request #1730 from markshannon/python-prepare-for-unrolling
Python prepare for implementing loop unrolling in extractor.
2019-08-13 10:54:24 +02:00
Taus
ee06c4021f Merge pull request #1727 from markshannon/python-no-rhs-tuple-points-to
Python points-to: Do not track tuples on lhs of assignment or in deletions.
2019-08-13 10:53:40 +02:00
Taus
e956b057e4 Merge pull request #1690 from markshannon/python-modernize-snippets
Python examples: Modernize example snippets.
2019-08-13 10:52:40 +02:00
Tom Hvitved
e4bd1980ab C#: Search from delegate creation in delegateCallSource() 2019-08-13 10:22:29 +02:00
Jonas Jensen
18c3bfe596 Merge pull request #1731 from geoffw0/qldoceg5
CPP: Add syntax examples to QLDoc in Initializer.qll, Parameter.qll
2019-08-13 08:52:05 +02:00
Ziemowit Laski
50813541f4 Squelch Jenkins error (hopefully).
More progress.  Attempts to create bold monospace have failed.
2019-08-12 14:19:36 -07:00
semmle-qlci
e27b373062 Merge pull request #1548 from hvitved/csharp/cfg/simplify-goto-completions
Approved by calumgrant
2019-08-12 19:20:48 +01:00
Ziemowit Laski
e98ff57e6f Progress. 2019-08-12 08:53:36 -07:00
Jonas Jensen
1f1824cb9b C++: Exclude BlockVar computation for "large" vars 2019-08-12 16:53:48 +02:00
Taus
5f55cb046d Merge pull request #1691 from markshannon/python-fewer-missing-edges
Python: Make a few more expressions point-to the 'unknown' value.
2019-08-12 16:15:09 +02:00
Geoffrey White
beada95014 CPP: Examples Block.qll. 2019-08-12 15:08:37 +01:00
Dave Bartolomeo
5d6ac2bb74 Merge pull request #1583 from jbj/ir-sanity-qlcfg
C++: Share tests between IR and QL-CFG
2019-08-12 07:04:40 -07:00
Max Schaefer
485d4269a0 C#: Fix use of PathNode.getLocation(). 2019-08-12 15:04:37 +01:00
Jonas Jensen
3f531380d1 C++: Reduce number of SubBasicBlocks in FlowVar
by cutting basic blocks at the same place for the `x.a` partial
definition in `x.a = ...` as they were already cut for assignment to
`a`.
2019-08-12 15:58:35 +02:00
Dave Bartolomeo
19d2f3a54e Merge pull request #1550 from jbj/array-aggregate-perf
C++ IR: Fix performance of large value-initialized arrays
2019-08-12 06:53:16 -07:00
Mark Shannon
8dd3963546 Python tests: Temporarily remove some analysis tests prior to implementing loop-unrolling in extractor. 2019-08-12 14:12:02 +01:00
Mark Shannon
d96a009975 Python tests: Temporarily comment out loops prior to implementing loop-unrolling in extractor. 2019-08-12 14:10:44 +01:00
Geoffrey White
2d2890e401 CPP: Add examples Parameter.qll. 2019-08-12 13:29:07 +01:00
Geoffrey White
ceec0278e5 CPP: Add examples Initializer.qll. 2019-08-12 13:16:34 +01:00
Max Schaefer
eb8087f4ea Java/C++/C#: Provide path-node locations via hasLocationInfo, not getLocation. 2019-08-12 12:52:30 +01:00
Mark Shannon
5e0b263aef Python docs: Fix up grammar and links for type inference page. 2019-08-12 12:42:58 +01:00
Mark Shannon
06dd8e97f0 Python docs: Modernize the learn-ql pages to use the Value API. 2019-08-12 12:42:58 +01:00
Jonas Jensen
0652d2a92b Merge pull request #1705 from geoffw0/qldoceg2
CPP: Add syntax examples to QLDoc in Enum.qll.
2019-08-12 13:39:05 +02:00
semmle-qlci
0bf9529bc9 Merge pull request #1726 from xiemaisi/js/help-fixes
Approved by esben-semmle
2019-08-12 11:41:36 +01:00
Geoffrey White
dc1ec635fb CPP: Undo an accidentally committed change to the test. 2019-08-12 11:17:02 +01:00
Mark Shannon
96ba9a2dfd Python points-to. Do not track tuples on lhs of assignment or in deletions. 2019-08-12 11:04:28 +01:00
semmle-qlci
e890aba4fe Merge pull request #1712 from hvitved/csharp/remove-nomagic
Approved by calumgrant
2019-08-12 10:59:10 +01:00
Max Schaefer
020d31c3b6 JavaScript: Fix inconisstency in TaintedPath.qhelp. 2019-08-12 10:29:41 +01:00
Max Schaefer
80cfe070d4 JavaScript: Fix inconsistency in MissingRegExpAnchor.qhelp. 2019-08-12 10:29:21 +01:00
Anders Schack-Mulligen
de13d0cced Java: Adjust change note. 2019-08-12 10:39:59 +02:00
Tom Hvitved
98ab2b26dc C#: Fix bad join-order in guardImpliesNotEqual() 2019-08-12 09:50:17 +02:00
Jonas Jensen
5724fb0df0 Merge pull request #1706 from geoffw0/qldoceg3
CPP: Add syntax examples to QLDoc in Struct.qll, Union.qll.
2019-08-12 07:57:40 +02:00
Ziemowit Laski
6eda7f354a Remove builtin functions and macros; minor fixes and tweaks. 2019-08-09 13:06:14 -07:00
Geoffrey White
208f533245 CPP: Brace placement. 2019-08-09 17:48:57 +01:00
Geoffrey White
11d17b891e CPP: Brace placement. 2019-08-09 17:44:55 +01:00
Geoffrey White
e149b6a332 CPP: Brace placement. 2019-08-09 17:42:02 +01:00
semmle-qlci
a6cae2bf3e Merge pull request #1723 from xiemaisi/js/overlapping-barriers
Approved by asger-semmle
2019-08-09 16:19:32 +01:00
Jonas Jensen
0507d51f0c C++: Prune getAReachedBlockVarSBB using live vars
On a Postgres snapshot, where the `getAReachedBlockVarSBB` predicate
performs badly because of a Yacc-generated 20,000-line parser loop, that
predicate is reduced from 4m22s to 1m32s plus 5.2s for the live
variables analysis.

This change removes 17,142 rows from `BlockVar.getAnAccess` on Postgres.
I sampled some of them, and they were all of the following form:

    while (...) {
      T x;
      f1(&x); // access
      f2(&x); // definition
    }

Such accesses are ruled out now because we deliberately lose track of
variables when they go out of scope.
2019-08-09 16:06:28 +02:00
Anders Schack-Mulligen
41763e6025 Java: Treat SecureJDKXercesXMLReader as a secure XMLReader. 2019-08-09 16:00:41 +02:00
Jonas Jensen
b348803a66 Merge pull request #1594 from geoffw0/erafix7
CPP: Add test coverage for LeapYearFieldAccess.isModifiedByArithmeticOperation.
2019-08-09 15:57:35 +02:00
Felicity Chapman
ab07128833 Merge pull request #1722 from jf205/rename-docs-folder
docs: add CODEOWNERS entries and rename `ql-documentation` > `language`
2019-08-09 14:56:14 +01:00
Max Schaefer
d2f4575978 JavaScript: Expand qldoc for {Barrier,Sanitizer}GuardNode. 2019-08-09 14:19:53 +01:00
Jonas Jensen
8aa24fe5c9 C++: Improve QLDoc on assignmentLikeOperation 2019-08-09 15:06:19 +02:00
semmle-qlci
3b0ddf54bc Merge pull request #1719 from Semmle/xiemaisi-patch-2
Approved by jf205
2019-08-09 12:46:57 +01:00
Max Schaefer
fd93998dee Fix typos in CONTRIBUTING.md 2019-08-09 12:44:28 +01:00
james
3800b44e51 add CODEOWNERS entry for ql language docs 2019-08-09 12:38:58 +01:00
james
79a1583ed5 add docs team to CODEOWNERS for relevant qhelp files 2019-08-09 12:35:32 +01:00
james
b6d6774329 docs: rename ql-documentation > language 2019-08-09 12:30:31 +01:00
Anders Schack-Mulligen
079b453f39 Java: Add change note. 2019-08-09 13:04:34 +02:00
Geoffrey White
67eb37f460 CPP: Update test annotations. 2019-08-09 09:31:47 +01:00
Ziemowit Laski
810c884921 Rough first draft of final document. 2019-08-08 14:48:19 -07:00
Jonas Jensen
605b56f8ca Merge pull request #1563 from geoffw0/constexprif
CPP: Test cases for EmptyBlock.ql with 'if constexpr'
2019-08-08 20:57:28 +02:00
Rebecca Valentine
8823cdfdbc Merge pull request #1713 from markshannon/python-remove-parents
Python taint-tracking: Remove 'parents' query from path-queries.
2019-08-08 10:01:40 -07:00
Rebecca Valentine
56c3a4d6e5 Merge pull request #1632 from markshannon/python-account-for-dynamically-defined-builtin-instances
Python points-to: track more instances.
2019-08-08 09:59:11 -07:00
Rebecca Valentine
bb19d45066 Merge pull request #1638 from markshannon/python-port-to-new-api
Python: port a few queries to new API.
2019-08-08 09:58:15 -07:00
Geoffrey White
1173daefca CPP: Minor changes. 2019-08-08 17:55:50 +01:00
Geoffrey White
950bc6e3d0 CPP: Brace placement. 2019-08-08 17:51:27 +01:00
Geoffrey White
c406746190 CPP: Brace placement. 2019-08-08 17:16:47 +01:00
Geoffrey White
5bdaefd504 CPP: Brace placement. 2019-08-08 17:13:58 +01:00
Geoffrey White
f0e6730eba Update cpp/ql/src/semmle/code/cpp/Union.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:11:05 +01:00
Geoffrey White
a1cf7b50a9 Update cpp/ql/src/semmle/code/cpp/Struct.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:10:52 +01:00
Geoffrey White
7086004f8a Update cpp/ql/src/semmle/code/cpp/Union.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:06:44 +01:00
Geoffrey White
b3bcc33bce Update cpp/ql/src/semmle/code/cpp/Struct.qll
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-08-08 17:06:17 +01:00
Calum Grant
9512b701bf Merge pull request #1599 from jf205/contributing-queries/sd-3476
docs: add more information about contributing queries to the public repo
2019-08-08 16:55:32 +01:00
semmledocs-ac
ec5b2da7dc Merge pull request #1681 from jf205/responsive-slides
Docs: a few CSS tweaks to improve slide appearance on small screens
2019-08-08 16:35:57 +01:00
james
e25749d5de docs: 2nd review comment 2019-08-08 15:52:22 +01:00
Tom Hvitved
5ecf680cc2 C#: Improve performance of SSA adjacent reads calculation
- Speedup the `varBlockReaches()` predicate, by restricting to basic blocks
  in which a given SSA definition may still be live, in constrast to just
  being able to reach *any* access (read or write) to the underlying source
  variable.
- Account for some missing cases in the `lastRead()` predicate.
2019-08-08 16:21:57 +02:00
Geoffrey White
82bf631541 CPP: Add test cases. 2019-08-08 15:02:56 +01:00
Geoffrey White
ef37893d15 CPP: Improve the MemberFunctions test. 2019-08-08 15:02:56 +01:00
Geoffrey White
843b85c0e6 CPP: Test PureVirtualFunction. 2019-08-08 15:02:55 +01:00
Geoffrey White
44ea685bf3 CPP: Simplify the VirtualFunctions test. 2019-08-08 15:02:55 +01:00
Geoffrey White
be25338e44 CPP: QLDoc Function.qll. 2019-08-08 15:02:55 +01:00
Calum Grant
cb8544d6e4 Merge pull request #1695 from hvitved/csharp/multiple-dataflow-copies
C#: Add more copies of the data flow library (ODASA-8039)
2019-08-08 13:24:54 +01:00
Jonas Jensen
2c6dbacd2b C++: Tidy up DataFlowUtil.qll 2019-08-08 14:05:03 +02:00
Jonas Jensen
0a13d7a337 C++: PartialDefNode -> PartialDefinitionNode 2019-08-08 14:05:03 +02:00
Jonas Jensen
98d6f3cada C++: Unify partial def and def-by-ref
This removes a lot of flow steps, but it all seems to be flow that was
present twice: both exiting a `PartialDefNode` and a
`DefinitionByReferenceNode`. All `DefinitionByReferenceNode`s are now
`PartialDefNode`s.
2019-08-08 14:05:03 +02:00
Jonas Jensen
5370e7d693 C++: Remove TThisVar
There's no need to model `this` as a variable because it's never
reassigned.
2019-08-08 14:05:03 +02:00
Jonas Jensen
6a3f5efc1b C++: Accept AST field flow test output 2019-08-08 14:05:03 +02:00
Jonas Jensen
861964337c C++: Undo autoformat of FlowVar.qll
The formatting changes were good, but were tangled in with other
changes, making it hard to review this file.
2019-08-08 14:05:03 +02:00
Pavel Avgustinov
79d75d7d18 Add extra test cases 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
835e495e7c Remove unused args 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
b1632587bc Use more meaningful name 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
6d4d131ad4 C++ field flow: Add test.
This is a fairly direct translation of the Java field flow test to
C++. Not all the `// flow` annotations are currently accurate.
2019-08-08 14:05:03 +02:00
Pavel Avgustinov
dccc0f4db1 Add handling of post-constructor-call nodes 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
9e6c240ee2 Override getFunction on PostUpdateNodes 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
abcaeded23 Only split BBs for var-defining partial-defs 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
46e6b587bc Exclude partial defs from ordinary SSA handling 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
5fbe982084 Add missing getType override 2019-08-08 14:05:03 +02:00
Pavel Avgustinov
1b9a2d3d87 Reduce partial definition flow edge redundancy 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
bb8eb235e0 Handle constructor call qualifiers 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
66164eb06f Propagate data flow through NewExprs 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
623652247d Introduce partial-definition nodes 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
15b56d93bd No implicit instances for constructor call 2019-08-08 14:05:02 +02:00
Pavel Avgustinov
04454ef184 Begin extending dataflow node model for field flow (and other stuff) 2019-08-08 14:05:02 +02:00
james
38e42edf04 docs: fix text overlap on small screen and dynamically resize images 2019-08-08 12:42:35 +01:00
semmle-qlci
6c3d1d676b Merge pull request #1694 from asger-semmle/concatenation-operand
Approved by xiemaisi
2019-08-08 12:41:30 +01:00
semmle-qlci
7482233a02 Merge pull request #1693 from asger-semmle/request-response
Approved by esben-semmle, xiemaisi
2019-08-08 12:40:35 +01:00
Felicity Chapman
b7568a08a9 Merge pull request #1714 from jf205/typo/sd-3739
docs: fix typo in Java data flow exercise
2019-08-08 12:33:56 +01:00
Mark Shannon
e6b27b37b2 Python: Update incorrect comparison queries to use new API. WORK IN PROGRESS. 2019-08-08 12:06:22 +01:00
Mark Shannon
c2f9189286 Python: Make a few more expressions point-to the 'unknown' value to improve reachability by about 1%. 2019-08-08 12:01:41 +01:00
Mark Shannon
4b242ddc86 Python: Port a few queries to new API. 2019-08-08 11:58:23 +01:00
Anders Schack-Mulligen
a50ea54ff6 Java: Fix tests. 2019-08-08 12:03:01 +02:00
james
2707b2fe2b docs: fix typos 2019-08-08 10:56:38 +01:00
Mark Shannon
562d959915 Python examples: Modernize snippets. 2019-08-08 10:55:45 +01:00
Mark Shannon
cb719a8998 Python points-to: track instances of int, float or str without a specific value, and calls to bool(). 2019-08-08 10:49:58 +01:00
Anders Schack-Mulligen
b3e56d5b04 Java: Fix copy-paste typo. 2019-08-08 11:44:44 +02:00
jf205
50520e7a6e Merge pull request #1651 from xiemaisi/js/flow-label-tutorial
JavaScript: Add tutorial on flow labels.
2019-08-08 10:41:20 +01:00
Mark Shannon
6bd5158f9e Python taint-tracking: Remove 'parents' query from path-queries, as it unused by the tooling. 2019-08-08 10:15:06 +01:00
james
575b4143b7 docs: fix typo in dataflow exercise answer 2019-08-08 09:38:40 +01:00
Max Schaefer
89bdf95082 JavaScript: Address review suggestions. 2019-08-08 09:22:41 +01:00
Ziemowit Laski
1a3a2871dc More declarations. 2019-08-07 19:37:24 -07:00
Rebecca Valentine
fc4bb028b7 Merge pull request #1636 from markshannon/python-api-odds-and-ends
Python: Assorted improvements to API.
2019-08-07 09:50:44 -07:00
Tom Hvitved
c1604caa31 C#: Remove two pragma[nomagic] 2019-08-07 16:04:23 +02:00
Anders Schack-Mulligen
20e6f5594f Java: Improve barriers for the CWE-190 Arithmetic* queries. 2019-08-07 15:22:23 +02:00
jf205
4969298ad3 Merge pull request #1708 from felicity-semmle/support/add-note
Support: add note about compiler versions
2019-08-07 14:08:01 +01:00
Jonas Jensen
3b2ef44195 Merge pull request #1710 from geoffw0/oddsandends
CPP: Delete invalid URL
2019-08-07 15:02:37 +02:00
Felicity Chapman
2e81448814 Apply suggestions from code review
Thanks for the suggestions. I shouldn't have rushed writing the README file!

Co-Authored-By: jf205 <42464962+jf205@users.noreply.github.com>
2019-08-07 13:09:40 +01:00
Felicity Chapman
6317c8668a Add a readme file to the old file location 2019-08-07 12:57:57 +01:00
Asger F
d83f152f39 JS: Address review comments 2019-08-07 10:53:17 +01:00
Asger F
5e87d5c751 JS: Update syntactic heuristics 2019-08-07 10:53:17 +01:00
Asger F
f173e3024a JS: Add getConstantStringParts() and HTML concat node 2019-08-07 10:53:17 +01:00
Asger F
f101944c92 JS: Expand on the StringOps::Concatenation API 2019-08-07 10:53:17 +01:00
Asger F
687534e647 JS: Address review comments 2019-08-07 10:47:08 +01:00
Asger F
41bdd8a7cc JS: Fix qldoc indentation 2019-08-07 10:38:22 +01:00
Mark Shannon
44a27c39b1 Python: Add a few addition qldoc comments. 2019-08-07 10:06:01 +01:00
Tom Hvitved
96e1732f94 C#: Address review comments 2019-08-07 10:41:43 +02:00
Tom Hvitved
6749bbd438 C#: Make use of extra data flow copies 2019-08-07 10:41:43 +02:00
Tom Hvitved
081ee9944d C#: Add more copies of the data flow library 2019-08-07 10:41:39 +02:00
semmle-qlci
d0a761477b Merge pull request #1704 from xiemaisi/js/fix-export-default-examples
Approved by asger-semmle
2019-08-07 09:34:36 +01:00
Geoffrey White
d1093cae2e CPP: Delete invalid URL and strange comment. 2019-08-07 09:25:36 +01:00
yh-semmle
033879f5a6 Merge pull request #1639 from aschackmull/java/in-out-barriers
Java/C++/C# DataFlow: Add support for in/out barriers on sources and sinks.
2019-08-07 01:07:19 -04:00
Jonas Jensen
077f372f98 Merge pull request #1570 from geoffw0/qldoceg
CPP: Add syntax examples to QLDoc in Class.qll.
2019-08-06 21:17:45 +02:00
zlaski-semmle
3ad0bcf3de Merge pull request #1701 from Semmle/geoffw0-patch-1
CPP: QLDoc tidy up Declaration.qll
2019-08-06 11:53:20 -07:00
Felicity Chapman
e8bf1b678d Update email link for Sumitra's feedback 2019-08-06 19:27:23 +01:00
Felicity Chapman
20555c12e3 Add note emphasizing compiler/version support 2019-08-06 17:57:08 +01:00
Geoffrey White
bbe7691a3d CPP: Fix indentation. 2019-08-06 17:56:24 +01:00
Geoffrey White
42bf1be0fd CPP: 'if constexpr' test cases. 2019-08-06 17:56:24 +01:00
Geoffrey White
6a5ac08578 CPP: Add c++17 flag to the test. 2019-08-06 17:56:24 +01:00
Geoffrey White
3550fc7137 CPP: Merge the two unions tests. 2019-08-06 16:05:10 +01:00
Geoffrey White
4ed559ee0b CPP: Extend the unions test. 2019-08-06 16:00:35 +01:00
Geoffrey White
cf20647765 CPP: Extend the structs test. 2019-08-06 15:52:25 +01:00
Asger F
2df0b08b26 JS: Add test with header access 2019-08-06 15:43:39 +01:00
Asger F
075e47dce2 JS: Add header/headers response type 2019-08-06 15:42:22 +01:00
Geoffrey White
2466299df5 CPP: Improve the Enums3 test. 2019-08-06 15:38:10 +01:00
Geoffrey White
064b8773a4 CPP: Test LocalEnum and NestedEnum. 2019-08-06 15:38:10 +01:00
Geoffrey White
33d38ac090 CPP: QLDoc Enum.qll. 2019-08-06 15:38:10 +01:00
Geoffrey White
5d4fba4446 CPP: QLDoc examples in Struct.qll and Union.qll. 2019-08-06 15:36:38 +01:00
Asger F
ea4bfda2d1 JS: Add predicate that disappeared during conflict resolution 2019-08-06 15:33:33 +01:00
Asger F
c4006be0e8 JS: Add more axios tests 2019-08-06 15:28:53 +01:00
Asger F
af7b942eec JS: Add newline in test 2019-08-06 15:28:53 +01:00
Asger F
4fb3fd992d JS: Address comments 2019-08-06 15:28:53 +01:00
Asger F
55ab7e6abf JS: Add qldoc 2019-08-06 15:28:53 +01:00
Asger F
64f1260220 JS: Rename getResponseFormat => getResponseType 2019-08-06 15:28:53 +01:00
Asger F
7fb6615970 JS: Test for XhrIo 2019-08-06 15:28:53 +01:00
Asger F
4eb072a376 JS: Test for 'superagent' package 2019-08-06 15:28:53 +01:00
Asger F
ce4f098625 JS: Test for 'got' package 2019-08-06 15:28:52 +01:00
Asger F
f88a7162c5 JS: Test for fetch 2019-08-06 15:28:52 +01:00
Asger F
b8c1714ba9 JS: Test for 'axios' package 2019-08-06 15:28:52 +01:00
Asger F
4f6b6d12e0 JS: Test for 'request' package 2019-08-06 15:28:52 +01:00
Asger F
93be5ab715 JS: Test for XMLHttpRequest 2019-08-06 15:28:52 +01:00
Asger F
250a5997e2 JS: Add test query for getAResponseDataNode 2019-08-06 15:28:52 +01:00
Asger F
d1179be757 JS: Move ClientRequest tests into shared ql file 2019-08-06 15:28:52 +01:00
Asger F
ea507db638 JS: Fix a qldoc comment 2019-08-06 15:28:52 +01:00
Asger F
a697a1b700 JS: Fix indentation of qldoc comment 2019-08-06 15:28:52 +01:00
Asger F
d3e796decc JS: Add caution to XMLHttpRequest class 2019-08-06 15:28:52 +01:00
Asger F
02fba482fa JS: Bugfixes 2019-08-06 15:28:52 +01:00
Asger F
0950b4d0f7 JS: Move ClientRequest classes into a module and publish them 2019-08-06 15:28:49 +01:00
Asger F
55ad3bb65f JS: add ClientRequest.getAResponseDataNode() 2019-08-06 15:28:13 +01:00
Nick Rolfe
257daddf3b Merge pull request #1702 from mgrettondann/cpp-add-thread_local-support-external
C++: add thread_local support
2019-08-06 14:51:27 +01:00
semmle-qlci
327d5acdcf Merge pull request #1686 from asger-semmle/lvalue-node
Approved by xiemaisi
2019-08-06 14:43:46 +01:00
Max Schaefer
82e15ada5f JavaScript: Fix export default examples.
Only hoistable (function) declarations and class declarations can be default-exported (https://www.ecma-international.org/ecma-262/10.0/index.html#sec-exports).
2019-08-06 14:40:53 +01:00
semmledocs-ac
927e00b6a6 Merge pull request #1699 from jf205/print-view
docs: add `@media print` query to QL language documentation CSS
2019-08-06 14:15:20 +01:00
Jonas Jensen
b4b940ae50 C++ IR: Remove unused predicate 2019-08-06 14:50:59 +02:00
Jonas Jensen
aab6c072c7 C++ IR: Remove fields from InstructionTag
Like array indexes were seemingly not needed in instruction tags, the
same appears to apply to fields.
2019-08-06 14:50:59 +02:00
Jonas Jensen
d378da33e8 C++ IR: Fix performance of large array value init
There were two problems here.

1. The inline predicates `isInitialized` and `isValueInitialized` on
   `ArrayAggregateLiteral` caused their callers to materialize every
   `int` that was a valid index into the array. This was slow on huge
   value-initialized arrays.
2. The `isInitialized` predicate was used in the `TInstructionTag` IPA
   type, creating a numbered tuple for each integer in it. This seemed
   to be entirely unnecessary since the `TranslatedElement`s using those
   tags were already indexed appropriately.
2019-08-06 14:50:57 +02:00
Jonas Jensen
f160447c20 C++: Update test results to latest master 2019-08-06 14:42:47 +02:00
Geoffrey White
73736675ce CPP: Bits and bobs. 2019-08-06 13:32:04 +01:00
Geoffrey White
ab823f45fc CPP: class, struct or union where appropriate. 2019-08-06 13:32:04 +01:00
Geoffrey White
8d22eb87f0 CPP: Improvements to qldoc. 2019-08-06 13:29:42 +01:00
Geoffrey White
4dd1267d6d CPP: Bracket consistency. 2019-08-06 13:29:42 +01:00
Geoffrey White
cf1869cfaa CPP: Indentation. 2019-08-06 13:29:42 +01:00
Geoffrey White
0029a33ee6 CPP: Deprecate Interface and remove the test. 2019-08-06 13:29:42 +01:00
Geoffrey White
49f6ac7358 CPP: Clean up Class, ClassDerivation and ClassTemplateSpecialization QLDoc. 2019-08-06 13:29:42 +01:00
Geoffrey White
2b408490a1 CPP: Implement simple changes. 2019-08-06 13:29:42 +01:00
Geoffrey White
99880bc4ea CPP: Add syntax examples for Class.qll. 2019-08-06 13:29:42 +01:00
Felicity Chapman
119f458b50 Move support topics into 'support' directory 2019-08-06 13:10:37 +01:00
Jonas Jensen
d0d6b2b70c C++: Add IR sanity queries to syntax-zoo test dir 2019-08-06 14:10:25 +02:00
Jonas Jensen
d18181f032 C++: Rename qlcfg -> syntax-zoo 2019-08-06 14:10:25 +02:00
Felicity Chapman
725fab099e Remove include files for support topics 2019-08-06 13:09:04 +01:00
Felicity Chapman
0b06cb866b Merge pull request #1703 from mgrettondann/fix-bar-unicode-codepoint-typo
Docs: Correct Unicode Codepoint for '|'
2019-08-06 12:47:41 +01:00
Jonas Jensen
4dfd4f1dda Merge pull request #1674 from dave-bartolomeo/dave/ExternDecls2
C++: Two IR fixes and a PrintAST workaround
2019-08-06 13:46:04 +02:00
Matthew Gretton-Dann
5667d369b5 Docs: Correct Unicode Codepoint for '|' 2019-08-06 12:36:44 +01:00
Matthew Gretton-Dann
90cfde53b3 C++: Add thread_local support - typo fix 2019-08-06 12:09:43 +01:00
semmle-qlci
77eac2c980 Merge pull request #1687 from esben-semmle/js/hide-conflicting-html-attribute
Approved by xiemaisi
2019-08-06 11:38:33 +01:00
semmle-qlci
5de6da4ee4 Merge pull request #1697 from esben-semmle/js/fix-missing-this-in-method
Approved by xiemaisi
2019-08-06 11:38:11 +01:00
Matthew Gretton-Dann
0e50a143af C++: Improve ReturnStackAllocatedMemory query
Update the ReturnStackAllocatedMmeory query to not give a false positive
for thread_local variables.
2019-08-06 11:22:32 +01:00
Matthew Gretton-Dann
a733625646 C++: Add Variable.isThreadLocal() 2019-08-06 11:22:26 +01:00
Geoffrey White
de9b936d76 QLDoc tidy up Declaration.qll
Mostly just adding backticks in QLDoc comments.  I'm trying out the edit-in-github workflow @jbj showed me, which seems like it will be a quicker way to do minor changes like these.
2019-08-06 10:54:20 +01:00
Tom Hvitved
4774bc969a C#: Apply static CFG splitting limit
The predicate `maxSplits()` was previously applied dynamically to ensure that
any control flow node would keep track of at most `maxSplits()` number of splits.
However, there was no guarantee that two different copies of the same AST element
wouldn't contain different splits, so in general the number of copies for a given
AST element `e` could be on the order `$\binom{n}{k}c^k$`, where `n` is the total
number of splits that apply to `e`, `k = maxSplits()`, and `c` is a constant.

With this change, the relevant splits for `e` are instead computed statically,
meaning that the order is instead `$c^k$`.
2019-08-06 11:38:03 +02:00
james
f34fbd72c5 docs: hide nav bar in print view 2019-08-06 10:30:27 +01:00
Calum Grant
2df05090b5 Merge pull request #1685 from hvitved/csharp/dataflow/out-flow-fix
C#: Fix data flow for `out`/`ref` parameters
2019-08-06 09:31:17 +01:00
james
cded4a563f docs: a few slide updates 2019-08-06 09:29:52 +01:00
james
f3c0af19f6 docs: tweak css to improve reponsive behaviour 2019-08-06 09:29:52 +01:00
Felicity Chapman
3e987732c1 Merge pull request #1698 from jf205/links
Docs: Update ql training homepage
2019-08-06 08:56:43 +01:00
james
6a75d64f87 docs: link update 2019-08-06 08:48:31 +01:00
semmle-qlci
0089ad471b Merge pull request #1696 from xiemaisi/js/ql4ql-fixes
Approved by asger-semmle
2019-08-06 08:06:06 +01:00
yh-semmle
9e4405f385 Merge pull request #1688 from aschackmull/java-cookbook/int-literal-value
Java Cookbook: Slight improvement to the IntegerLiteral pattern.
2019-08-05 20:37:58 -04:00
Rebecca Valentine
5fdf6a8e11 Merge pull request #1640 from markshannon/python-update-all-taint-tracking-to-use-config
Python: Update all remaining taint-tracking queries to use configurations
2019-08-05 14:30:30 -07:00
Rebecca Valentine
9d2061b439 Merge pull request #1669 from markshannon/python-better-handling-unknown-decorators
Python: Treat the result of calling a missing module member as 'unknown'.
2019-08-05 14:30:00 -07:00
Ziemowit Laski
f734d7e281 [CPP-387] Incremental progress. 2019-08-05 13:22:20 -07:00
yh-semmle
7e90728c67 Merge pull request #1679 from aschackmull/java/reader-taint
Java: Adjust taint steps for Reader::read.
2019-08-05 12:46:12 -04:00
james
62fb745eac docs: address review comments 2019-08-05 15:58:00 +01:00
Max Schaefer
5026a55c25 JavaScript: Fix a Cartesian product. 2019-08-05 15:42:20 +01:00
Max Schaefer
d230921b89 JavaScript: Remove two unused fields. 2019-08-05 15:41:55 +01:00
james
1f076efd5e docs: fix select clause section 2019-08-05 15:40:41 +01:00
james
7ec2c05796 docs: address review comments and fix a few other things 2019-08-05 15:40:41 +01:00
james
0ebc396ed1 docs: expand contributing a query information 2019-08-05 15:40:40 +01:00
Anders Schack-Mulligen
a80cb262fc Java/C++/C#: Elaborate qldoc. 2019-08-05 16:28:25 +02:00
Anders Schack-Mulligen
9ebb83497d Java/C++/C#: Fix small mistake. 2019-08-05 15:34:12 +02:00
Esben Sparre Andreasen
bc2785d143 JS: add missing binding for this in BuiltinServiceCall 2019-08-05 14:10:21 +02:00
Esben Sparre Andreasen
bc296e74a1 JS: generalize internal AngularJS::BuiltinServiceCall to handle calls 2019-08-05 13:59:48 +02:00
Esben Sparre Andreasen
a652f754ee JS: rename internal AngularJS::ServiceMethodCall 2019-08-05 13:56:49 +02:00
Anders Schack-Mulligen
2dc83c539c Java/C++/C#: Sync dataflow. 2019-08-05 12:07:32 +02:00
semmle-qlci
f60af2cfba Merge pull request #1683 from asger-semmle/type-tracking-non-exp
Approved by xiemaisi
2019-08-05 11:06:53 +01:00
semmle-qlci
77ae2bc8b7 Merge pull request #1684 from asger-semmle/protopollution-qhelp
Approved by xiemaisi
2019-08-05 11:06:34 +01:00
Anders Schack-Mulligen
f8804943ee Java: Change in/out barriers to be explicit in the configuration. 2019-08-05 12:05:12 +02:00
Asger F
8bec2fe7bf JS: Address comments 2019-08-05 10:44:39 +01:00
Calum Grant
3e143093f0 Merge pull request #1475 from hvitved/csharp/remove-file
C#: Remove unused `PasswordInConfigurationFile.config`
2019-08-05 10:29:50 +01:00
Anders Schack-Mulligen
15c61b57f7 Java Cookbook: Slight improvement to the IntegerLiteral pattern. 2019-08-05 11:03:30 +02:00
Jonas Jensen
73d8bf38a9 Merge pull request #1680 from aschackmull/cookbook/autoformat
Cookbook examples: Autoformat
2019-08-05 10:24:56 +02:00
Esben Sparre Andreasen
c4eb258f5b JS: lower precision of js/conflicting-html-attribute 2019-08-05 09:22:10 +02:00
Luke Cartey
54d01bdeff Merge pull request #1648 from hvitved/csharp/unchecked-return-lambda
C#: Fix false positives in `cs/unchecked-return-value`
2019-08-02 21:48:38 -07:00
Ziemowit Laski
0ca6d0c1b9 [CPP-387] Start on Declarations section. 2019-08-02 16:07:55 -07:00
Tom Hvitved
4d58154ff5 C#: Fix data flow for out/ref parameters 2019-08-02 14:25:38 -07:00
Tom Hvitved
04db1bf3f4 C#: Add data flow test for methods with multiple out/ref parameters 2019-08-02 13:46:18 -07:00
Asger F
5397da7579 JS: Handle implicit return in getImmediatePredecessor 2019-08-02 20:35:22 +01:00
Asger F
8e1893d0ed JS: Update range analysis to use getImmediatePredecessor 2019-08-02 20:35:22 +01:00
Asger F
9e949d0f44 JS: Add taint step through destructuring for-of loop 2019-08-02 20:35:21 +01:00
Asger F
de3c8bf711 JS: Introduce DataFlow::lvalueNode 2019-08-02 20:35:21 +01:00
Tom Hvitved
b03cf6f34e Merge pull request #1678 from calumgrant/cs/remove-analyzer-NRE
C#: Remove compilation warning
2019-08-02 10:38:27 -07:00
semmle-qlci
d4e39a250d Merge pull request #1667 from xiemaisi/js/more-ranges
Approved by esben-semmle
2019-08-02 16:46:30 +01:00
Asger F
fcc51a8407 JS: Fix lodash version in proto pollution qhelp 2019-08-02 16:42:36 +01:00
yh-semmle
251d441f6a Merge pull request #1682 from aschackmull/java/hardcoded-credentials-precision
Java: Improve the precision of java/hardcoded-credential-api-call.
2019-08-02 11:37:06 -04:00
Asger F
eb543c1ceb JS: Remove experimental warning from type tracking 2019-08-02 16:30:44 +01:00
Anders Schack-Mulligen
b1b1ede6b0 Java: Improve the precision of java/hardcoded-credential-api-call. 2019-08-02 16:50:58 +02:00
Anders Schack-Mulligen
59fb59d109 JavaScript: Autoformat cookbook examples. 2019-08-02 15:33:40 +02:00
Anders Schack-Mulligen
40f2cec0de C#: Autoformat cookbook examples. 2019-08-02 15:30:32 +02:00
Anders Schack-Mulligen
d6e1ba6bed CPP: Autoformat cookbook examples. 2019-08-02 15:29:20 +02:00
Anders Schack-Mulligen
9b74e9c4a4 Java: Autoformat cookbook examples. 2019-08-02 15:27:28 +02:00
Max Schaefer
3daa974255 JavaScript: Rename a test.
The old test name would cause a compiler warning, which we don't want to include in the expected output.
2019-08-02 14:05:57 +01:00
semmle-qlci
34cdf7c96b Merge pull request #1677 from xiemaisi/js/flow-summary-fixes
Approved by esben-semmle
2019-08-02 14:02:47 +01:00
semmle-qlci
635a8edacc Merge pull request #1676 from xiemaisi/js/more-tests-classification
Approved by esben-semmle
2019-08-02 14:02:24 +01:00
Anders Schack-Mulligen
4ffc41277a Java: Adjust taint steps for Reader::read. 2019-08-02 14:21:06 +02:00
Calum Grant
169dbf1be3 C#: Remove rule CA1022, which caused the analyzer to crash, generating a compilation warning (and possibly, instability). 2019-08-02 12:14:03 +01:00
Max Schaefer
e06ed503ec JavaScript: Make flow summaries work for non-taint configurations.
With flow labels it often makes more sense to use a `DataFlow::Configuration` rather than a `TaintTracking::Configuration`, so flow summaries should support both.
2019-08-02 11:45:41 +01:00
Max Schaefer
97c0c97b28 JavaScript: Classify __mocks__ and __tests_ as tests.
These are conventions used by jest: https://jestjs.io/docs/en/manual-mocks#mocking-user-modules.
2019-08-02 11:15:02 +01:00
Mark Shannon
63f24dfe18 Python: Add some more utility predicates and classes to the new 'Value' API. 2019-08-02 10:50:51 +01:00
Mark Shannon
4a6f385feb Python objects: Add clarify comments on callResult predicates. 2019-08-02 10:10:47 +01:00
semmle-qlci
07b97dcc07 Merge pull request #1672 from asger-semmle/flowlabel-issers
Approved by xiemaisi
2019-08-02 10:05:41 +01:00
semmle-qlci
bb4f00d770 Merge pull request #1015 from esben-semmle/js/cli-cli
Approved by xiemaisi
2019-08-02 09:57:19 +01:00
semmle-qlci
1b30a25977 Merge pull request #1668 from esben-semmle/js/ignore-mocked-callee-argument-count
Approved by xiemaisi
2019-08-02 09:56:52 +01:00
semmle-qlci
108e5bc431 Merge pull request #1675 from hvitved/csharp/xss-path-problem
Approved by lukecartey
2019-08-02 04:17:03 +01:00
Ziemowit Laski
94ccc5fa73 [CPP-387] Fill in a few more types. Remove the Superclass column as it is redundant and may lead to documentation inconsistencies. 2019-08-01 16:27:06 -07:00
Tom Hvitved
b7d6165d42 C#: Convert cs/web/xss to a path-problem 2019-08-01 15:58:57 -07:00
Dave Bartolomeo
6370391dbd C++: Add sanity test for definitions that don't dominate their uses. 2019-08-01 15:01:42 -07:00
Ziemowit Laski
4aa9049c47 [CPP-387] Finished declarations, started on types. 2019-08-01 14:51:17 -07:00
Dave Bartolomeo
912679ef8c C++: Two IR fixes
My original fix in https://github.com/Semmle/ql/pull/1661 fixed my minimal test case, but did not fix the original failure in a Linux snapshot. The real fix is to simply not create a `TranslatedDeclarationEntry` for an extern declaration, and have `TranslatedDeclStmt` skip any such declarations. I've added a regression test for that case (multiple extern declarations with same location in a macro expansion, with control flow between them). I did verify that it generates correct IR, and that it fixes all of the "use not dominated by definition" failures in Linux.

The underlying extractor bug, that caused the above issue also caused PrintAST to print garbage. I've worked around the bug in PrintAST.qll.

I've also fixed a bug in the control flow for `try`/`catch`, where there was missing flow from the `CatchByType` of the last handler of a `try` to the enclosing handler (or `Unwind`). Hat tip to @AndreiDiaconu1 for spotting this bug.
2019-08-01 14:38:19 -07:00
Rebecca Valentine
40d7f5a332 Merge pull request #1671 from markshannon/python-flask-escape
Python: Add missing function to flask test stub.
2019-08-01 11:47:09 -07:00
Asger F
e09c22e67d JS: Add FlowLabel.isData() and .isTaint() 2019-08-01 15:22:51 +01:00
Max Schaefer
3a240b39d9 JavaScript: Address further review comments. 2019-08-01 15:03:53 +01:00
Mark Shannon
fab2cb5a32 Python: Add missing function to flask test stub. 2019-08-01 13:11:41 +01:00
Bas van Schaik
c7f45010c5 Remove reference to internal tooling from public repository 2019-08-01 11:02:03 +01:00
Esben Sparre Andreasen
90862fea99 JS: whitelist trivial throwers in js/superfluous-trailing-arguments 2019-08-01 11:49:43 +02:00
Mark Shannon
ebd5829bfb Python: Treat the result of calling a missing module member as 'unknown'. 2019-08-01 10:37:41 +01:00
semmle-qlci
691df0508e Merge pull request #1652 from xiemaisi/js/deprecate-isBarrier/2
Approved by asger-semmle
2019-08-01 09:47:04 +01:00
Max Schaefer
4141a98616 JavaScript: Replace Custom* with *::Range.
The old names are kept as deprecated aliases.
2019-08-01 09:45:44 +01:00
Anders Schack-Mulligen
1a779179e7 Merge pull request #1666 from yh-semmle/java-xxe-qhelp
Java: update XXE qhelp with note on processing limits
2019-08-01 10:01:53 +02:00
Ziemowit Laski
4afd6587e4 [CPP-387] Have almost all expressions done... 2019-07-31 19:57:46 -07:00
zlaski-semmle
2bc66ae553 Merge pull request #1661 from dave-bartolomeo/dave/ExternDeclarations
C++: Stop generating `NoOp` instructions for declarations of externs
2019-07-31 19:09:06 -07:00
yh-semmle
dc45ba5627 Java: update XXE qhelp with note on processing limits 2019-07-31 15:45:28 -04:00
Felicity Chapman
d61b5569c5 Merge pull request #1665 from jf205/update-support
QL docs: update paths to change notes in support project
2019-07-31 16:53:54 +01:00
james
735a2cbe06 docs: exclude readme from build 2019-07-31 15:42:46 +01:00
james
21e5d8c6b8 docs: update paths to change notes 2019-07-31 15:38:30 +01:00
semmle-qlci
1d806971ed Merge pull request #1634 from aibaars/cookbook
Approved by aschackmull, dave-bartolomeo, hvitved, markshannon, xiemaisi, yh-semmle
2019-07-31 14:31:28 +01:00
Felicity Chapman
7123067bd0 Merge pull request #1663 from jf205/vscode-readme
docs: update readme to mention vscode extension
2019-07-31 13:52:58 +01:00
james
862f716058 docs: update readme to mention vscode extension 2019-07-31 13:42:58 +01:00
Mark Shannon
5496fa41c8 Python: Add a way to easily specify constant values for in new Value API. 2019-07-31 12:41:51 +01:00
semmle-qlci
4722ec585d Merge pull request #1662 from jf205/add-gitignored
Approved by asger-semmle
2019-07-31 12:23:11 +01:00
Max Schaefer
33ea421841 JavaScript: Accept review suggestion.
Co-Authored-By: Esben Sparre Andreasen <42067045+esben-semmle@users.noreply.github.com>
2019-07-31 11:16:18 +01:00
Max Schaefer
785ecafd47 JavaScript: Address review comments. 2019-07-31 11:03:06 +01:00
Nick Rolfe
d83faaf714 Merge pull request #1659 from ian-semmle/getValueText
C++: Accept changes to getValueText
2019-07-31 10:59:00 +01:00
jf205
b64ecfb711 Merge pull request #1654 from felicity-semmle/ql-handbook/SD-3691-vale-corrections
Ql handbook: Corrections for issues found using Vale
2019-07-31 10:54:42 +01:00
jf205
eec91807c4 Merge pull request #1657 from asger-semmle/js/cheat-sheet
JS: Add data flow cheat sheet
2019-07-31 10:44:07 +01:00
Max Schaefer
967a5788b2 JavaScript: Address review comments. 2019-07-31 10:24:33 +01:00
semmle-qlci
0e64c84f7e Merge pull request #1656 from asger-semmle/rephrase-useless-def
Approved by xiemaisi
2019-07-31 09:55:38 +01:00
semmle-qlci
cff826221c Merge pull request #1655 from asger-semmle/hardcoded-creds-fp
Approved by xiemaisi
2019-07-31 09:55:16 +01:00
james
dc2d66c334 docs: gitignore rst vscode settings 2019-07-31 09:51:47 +01:00
Esben Sparre Andreasen
bf4a324a86 JS: add query js/indirect-command-line-injection 2019-07-31 09:24:25 +02:00
Asger F
7a27ccdaf3 JS: Move a comment 2019-07-31 08:19:26 +01:00
james
e69ba84e65 docs: gitignore .pyc files generated during sphinx-build 2019-07-31 06:38:49 +01:00
Dave Bartolomeo
972f0d97d3 C++: Stop generating NoOp instructions for declarations of externs
Previously, where we had a function-scoped `DeclarationEntry` for an extern variable or function, we would generate a `NoOp` instruction for it. There's nothing wrong with this by itself, although it was unnecessary. However, I've hit an extractor issue (Jira ticket already opened) that commonly causes multiple `DeclStmt`s to share a single `DeclarationEntry` child on extern declarations, so removing the `NoOp` instructions is an easy way to work around the extractor issue.
2019-07-30 16:49:24 -07:00
Ziemowit Laski
78ebdad1ea Add a __builtin_va_list type, to complement __builtin_va_*
expressions.
2019-07-30 16:36:37 -07:00
Ziemowit Laski
2a12bf8e62 [CPP-387] Add placeholder for declarations. 2019-07-30 15:55:04 -07:00
Ian Lynagh
8d8a2201b7 C++: Accept changes to getValueText 2019-07-30 23:24:52 +01:00
semmle-qlci
07fa55f331 Merge pull request #1647 from zlaski-semmle/zlaski/builtin-types-compatible-p
Approved by dave-bartolomeo
2019-07-30 20:43:39 +01:00
Ziemowit Laski
49adba0b51 [CPP-387] Create a new PR against new location of introduce-libraries-cpp.rst. 2019-07-30 12:32:01 -07:00
zlaski-semmle
075e4ab159 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Dave Bartolomeo <42150477+dave-bartolomeo@users.noreply.github.com>
2019-07-30 11:39:42 -07:00
Nick Rolfe
9e8e63038f Merge pull request #1649 from ian-semmle/constexpr_if
C++: Add 'constexpr if' support
2019-07-30 18:45:08 +01:00
Asger F
eafd46221b JS: Add data flow cheat sheet 2019-07-30 18:11:32 +01:00
Asger F
ea563f8b97 JS: Rephrase dead store of local at declaration site 2019-07-30 18:02:27 +01:00
Asger F
378b0bfb74 JS: Do not treat the empty string as a credential 2019-07-30 17:29:12 +01:00
Felicity Chapman
2f9a3eb6fd Update the Spelling whitelist 2019-07-30 17:15:19 +01:00
Felicity Chapman
6ae842cec0 Update QL handbook issues highlighted by Vale 2019-07-30 17:11:34 +01:00
jf205
6d10731b8f Merge pull request #1653 from felicity-semmle/learn-ql/SD-3690-vale-corrections
Learn QL: corrections for issues found using Vale
2019-07-30 16:43:40 +01:00
Max Schaefer
3e6629d007 JavaScript: Deprecate multi-argument isBarrier and isSanitizer predicates.
We informally deprecated them in 1.21, this commit deprecates them properly and removes support from the implementation. The predicates themselves will be removed in a future release.
2019-07-30 16:32:08 +01:00
Max Schaefer
ad5194e8c1 JavaScript: Add tutorial on flow labels. 2019-07-30 16:31:12 +01:00
Felicity Chapman
2060fdc581 Update whitelist for Headings and Spelling rules 2019-07-30 16:29:05 +01:00
Felicity Chapman
91101632ad Update learning QL topics for issues found by Vale 2019-07-30 16:27:53 +01:00
Felicity Chapman
bf0201a36e Merge pull request #1641 from jf205/move-ql-docs
Docs: add QL language documentation to `semmle/ql` repo
2019-07-30 15:59:21 +01:00
Ian Lynagh
96a21238d1 C++: Add an upgrade script 2019-07-30 14:07:35 +01:00
Ian Lynagh
5d9d289eb7 C++: Add stats for 'constexpr if' 2019-07-30 14:07:35 +01:00
Ian Lynagh
6cce7ef2b7 C++: Add CFG test for constexpr_if 2019-07-30 14:07:35 +01:00
Ian Lynagh
7c763cc3bd C++: Add a test for constexpr if 2019-07-30 14:07:35 +01:00
Ian Lynagh
f705c25c74 C++: Add support for constexpr if 2019-07-30 14:07:35 +01:00
semmle-qlci
9f97165e7b Merge pull request #1650 from xiemaisi/js/fix-semantic-merge-conflict
Approved by asger-semmle
2019-07-30 14:02:59 +01:00
Max Schaefer
7b3c835bc6 JavaScript: Fix semantic merge conflict.
https://github.com/Semmle/ql/pull/1621 vs https://github.com/Semmle/ql/pull/1613
2019-07-30 12:34:30 +01:00
semmle-qlci
0f9a286284 Merge pull request #1621 from asger-semmle/no-recursive-import
Approved by xiemaisi
2019-07-30 11:25:11 +01:00
semmle-qlci
d63e53f3a4 Merge pull request #1628 from asger-semmle/self-globalobj
Approved by xiemaisi
2019-07-30 11:23:54 +01:00
yh-semmle
37395877a7 Merge pull request #1633 from aschackmull/java/taint-string-concat
Java: Add taint step for String::concat.
2019-07-30 00:21:52 -04:00
Ziemowit Laski
2abf7681e0 Point the old BuiltInOperationBuiltInTypes at our new BuiltInOperationBuiltInTypesCompatibleP,
for backward compatibility.
2019-07-29 19:43:18 -07:00
Tom Hvitved
5c127ef20d C#: Fix false positives in cs/unchecked-return-value 2019-07-29 17:32:21 -07:00
Ziemowit Laski
889408be8f Add test case. 2019-07-29 17:17:42 -07:00
Ziemowit Laski
80ca950ae7 Change __builtin_types to __builtin_types_compatible_p 2019-07-29 15:41:41 -07:00
Tom Hvitved
b6f3f7866b C#: Add more tests for cs/unchecked-return-value 2019-07-29 15:40:22 -07:00
Robert Marsh
6bd22b01b3 Merge pull request #1607 from dave-bartolomeo/dave/CrossLanguageIR
C++: Start preparing IR for supporting multiple languages
2019-07-29 12:34:21 -07:00
semmle-qlci
5125a41345 Merge pull request #1645 from Semmle/js/fix-missing-regexp-anchor-qhelp
Approved by asger-semmle
2019-07-29 16:46:36 +01:00
Mark Shannon
6b2938a387 Python: Extends new Value API a bit to support callable subclasses and sequences. 2019-07-29 16:25:31 +01:00
Tom Hvitved
902825f8ac Merge pull request #1564 from calumgrant/cs/no-logger-writethrough
C#: Disable logger AutoFlush
2019-07-29 15:20:00 +00:00
Max Schaefer
d3016593e4 JavaScript: Remove extra backslashes in MissingRegExpAnchor.qhelp. 2019-07-29 15:23:09 +01:00
semmle-qlci
3dfc697585 Merge pull request #1642 from xiemaisi/json_locations
Approved by asger-semmle
2019-07-29 14:55:33 +01:00
semmle-qlci
904c94ec9e Merge pull request #1644 from xiemaisi/js/more-examples
Approved by asger-semmle
2019-07-29 14:36:20 +01:00
Max Schaefer
d282ba04ae JavaScript: Add concrete syntax examples to JSDoc, RegExp, Tokens, Variables and XML. 2019-07-29 12:17:25 +01:00
Nick Rolfe
54b30f5cb9 Merge pull request #1611 from ian-semmle/lambda
C++: Follow changes to how lambdas are extracted
2019-07-29 10:52:50 +01:00
Max Schaefer
fcf35dc3c2 JavaScript: Add configuration-file snippet to dbscheme. 2019-07-29 10:46:56 +01:00
james
a1cabfd030 docs: update read-me-project and change format 2019-07-29 09:39:22 +01:00
james
faf4727a78 docs: move ql docs to ql repo 2019-07-29 09:39:21 +01:00
Ian Lynagh
b2a68d7eaa C++: Update stats following lambda change 2019-07-26 20:39:22 +01:00
Ian Lynagh
cff1bb0b96 C++: Update lambda test output
Indexes are now 0-based.
2019-07-26 20:39:22 +01:00
Ian Lynagh
6c21fbaade C++: Add an upgrade script 2019-07-26 20:39:22 +01:00
Ian Lynagh
4385ca1ab6 C++: Follow changes to how lambdas are extracted 2019-07-26 20:39:22 +01:00
Arthur Baars
b3c403a142 Update javascript example queries 2019-07-26 17:47:11 +02:00
Arthur Baars
89906e610a Use js/examples instead of js/cookbook in @id 2019-07-26 17:47:11 +02:00
Arthur Baars
ccde7cf6cf Add @id to example queries 2019-07-26 17:47:11 +02:00
Arthur Baars
bdce7d07c1 Move 'snippet' queries to 'snippets' folders 2019-07-26 17:47:11 +02:00
Arthur Baars
30860daac4 Add cookbook queries 2019-07-26 17:47:11 +02:00
Mark Shannon
3e5fddd776 Python: Update all remaining taint-tracking queries to use configurations. 2019-07-26 16:39:10 +01:00
yh-semmle
a1b4d09b42 Merge pull request #1630 from aschackmull/java/switchexpr-tostring
Java: Add toString override for SwitchExpr.
2019-07-26 11:32:24 -04:00
Mark Shannon
f69ea7f65e Python: Add redimentary tests for new Value API. 2019-07-26 15:11:48 +01:00
Mark Shannon
f0bb07fc24 Python: Assorted improvements to API. 2019-07-26 15:11:47 +01:00
Taus
8443f68a33 Merge pull request #1624 from markshannon/python-fix-pruning-for-constants
Python: Fix up pruning in QL to better handle constraints from constants.
2019-07-26 16:05:14 +02:00
Taus
0258f799df Merge pull request #1591 from markshannon/python-fix-property-setter-handling
Python: fix property setter handling in points-to.
2019-07-26 14:01:41 +02:00
Anders Schack-Mulligen
6d022aa359 Java/C++/C#: Sync dataflow. 2019-07-26 13:17:12 +02:00
Anders Schack-Mulligen
7c30c1a01c Java: Deprecate isBarrierEdge. 2019-07-26 13:16:19 +02:00
Mark Shannon
59ea825bbc Python objects: Add explanatory comment. 2019-07-26 12:07:16 +01:00
Mark Shannon
159b111aa8 Python: remove some unnecessary pragmas. 2019-07-26 11:07:39 +01:00
Anders Schack-Mulligen
d3c5644229 Java: Add support for in/out barriers on sources and sinks. 2019-07-26 11:52:55 +02:00
semmle-qlci
143016ed96 Merge pull request #1635 from xiemaisi/js/dont-taint-for-in
Approved by asger-semmle
2019-07-26 08:32:14 +01:00
yh-semmle
9fdb964622 Merge pull request #1511 from aschackmull/java/typeflow-precision
Java: Minor TypeFlow precision improvement and refactor.
2019-07-25 23:06:16 -04:00
yh-semmle
0a321f59ab Merge pull request #1631 from aschackmull/java/delete-deprecated-dataflow-copy
Java: Delete deprecated dependency DataFlowImplDepr.
2019-07-25 22:42:49 -04:00
Max Schaefer
2e760bf5b5 JavaScript: Add upgrade script. 2019-07-25 16:52:44 +01:00
Max Schaefer
31b4d8dfb0 JavaScript: Update TRAP test outputs. 2019-07-25 16:52:44 +01:00
Max Schaefer
9a00f4d0f0 JavaScript: store YAML locations in yaml_locations table instead of hasLocation. 2019-07-25 16:52:44 +01:00
Max Schaefer
37cb4e4023 JavaScript: Add upgrade script. 2019-07-25 16:52:44 +01:00
Max Schaefer
79a7a8c6a7 JavaScript: Update TRAP test outputs. 2019-07-25 16:52:44 +01:00
Max Schaefer
6b3abbbde5 JavaScript: Store JSON locations in json_locations table instead of hasLocation. 2019-07-25 16:52:44 +01:00
Max Schaefer
2df41c43e2 JavaScript: Make name of hasLocation relation in location manager configurable. 2019-07-25 16:52:44 +01:00
Taus
a557c6a3ea Merge pull request #1627 from markshannon/python-points-to-from-comprehensions
Python points-to: Infer types for comprehensions.
2019-07-25 16:09:33 +02:00
Taus
76fe36aa48 Merge pull request #1618 from markshannon/python-refine-module-names
Python refine module naming.
2019-07-25 15:29:47 +02:00
Mark Shannon
27c0571a86 Python points-to: Infer types for comprehensions. 2019-07-25 14:18:05 +01:00
Taus
85a0566c43 Merge pull request #1597 from markshannon/python-tracking-special-variable-attributes-through-phis
Python points-to: Track implicit module attributes through phi-nodes.
2019-07-25 11:43:16 +02:00
Anders Schack-Mulligen
046d4a01de Java: Add taint step for String::concat. 2019-07-25 11:38:34 +02:00
Taus
cca1593ea4 Merge pull request #1598 from markshannon/python-better-parameter-api
Python: Better API for parameters.
2019-07-25 11:35:51 +02:00
Anders Schack-Mulligen
3d340d4fba Java: Delete deprecated dependency DataFlowImplDepr. 2019-07-25 11:18:01 +02:00
Anders Schack-Mulligen
e8aae19556 Java: Add toString override for SwitchExpr. 2019-07-25 10:53:16 +02:00
Mark Shannon
2e8c7a9d20 Python points-to: Support property setters and deleters. 2019-07-25 09:35:56 +01:00
Mark Shannon
9b00177544 Python: Add failing test for analysis of property with .setter. 2019-07-25 09:33:41 +01:00
yh-semmle
a42d9b1f96 Merge pull request #1616 from aschackmull/java/dataflow-prunetype-bugfix
Java: Bugfix for flow through methods with taint step and upcast.
2019-07-24 22:28:05 -04:00
Robert Marsh
05cad96086 Merge pull request #1605 from geoffw0/bitwiseneg
CPP: Make BitwiseSignCheck.ql more accurate
2019-07-24 12:33:40 -07:00
Robert Marsh
fa43ae241d Merge pull request #1615 from geoffw0/exprowninit
CPP: Test + workaround for UseInOwnInitializer.ql
2019-07-24 12:13:24 -07:00
semmle-qlci
137427fc40 Merge pull request #1613 from asger-semmle/canonical-name-defs
Approved by xiemaisi
2019-07-24 18:51:08 +01:00
Asger F
6f158182d1 JS: Add self as global object alias 2019-07-24 17:10:59 +01:00
Mark Shannon
90475fa7ef Python: Do not give module names to folders without __init__.py unless specified during extraction. 2019-07-24 15:35:57 +01:00
Max Schaefer
97e8b5fa99 JavaScript: Address review comments. 2019-07-24 15:32:13 +01:00
Mark Shannon
05e498dfdc Python: Clarify pruning code. 2019-07-24 14:47:46 +01:00
semmle-qlci
2a292c7dee Merge pull request #1626 from xiemaisi/js/more-examples
Approved by asger-semmle
2019-07-24 14:15:04 +01:00
Felicity Chapman
b7be2f5045 Merge pull request #1625 from taus-semmle/python-fix-commented-out-code-qhelp-include
Python: Fix missing include in `FCommentedOutCode.qhelp`.
2019-07-24 11:59:40 +01:00
Max Schaefer
74397daeb8 JavaScript: Add concrete syntax examples to ES2015Modules, Externs, JSON, YAML. 2019-07-24 11:56:11 +01:00
Taus Brock-Nannestad
8c6a4bcd9d Python: Fix missing include in FCommentedOutCode.qhelp. 2019-07-24 11:13:33 +02:00
Taus
f214f0e742 Merge pull request #1589 from markshannon/python-fix-sanity
Python: Fix a couple of  false positives in sanity query
2019-07-24 10:59:01 +02:00
semmle-qlci
29e49ae9b2 Merge pull request #1620 from asger-semmle/hardcoded-creds-import
Approved by xiemaisi
2019-07-24 09:57:12 +01:00
Geoffrey White
75f77b5f47 Merge pull request #1532 from zlaski-semmle/zlaski/cpp386
[CPP-386] Add `getCanonicalQLClass()` for AST QL elements.
2019-07-24 09:38:39 +01:00
yh-semmle
8140b68f15 Merge pull request #1623 from aschackmull/java/delete-deprecated
Java: Delete old deprecated code.
2019-07-23 20:20:45 -04:00
Asger F
ff8529d3ec JS: Address comments 2019-07-23 17:14:56 +01:00
Asger F
1c3ce09607 JS: Downgrade the contract for getImmediatePredecessor 2019-07-23 17:14:56 +01:00
Asger F
28efadea73 JS: Use defSourceNode from getRhsNode 2019-07-23 17:14:56 +01:00
Asger F
747c320c35 JS: cache getEnclosingContainer 2019-07-23 17:14:56 +01:00
Asger F
498e4d2d57 JS: Avoid materializing DataFlow::Node.getFile 2019-07-23 17:14:56 +01:00
Asger F
d8165d0313 JS: Restrict importLookup to ASTNode 2019-07-23 17:14:56 +01:00
Asger F
421ad89bf9 JS: Fix join order 2019-07-23 17:14:56 +01:00
Asger F
e39725114a JS: Add jsdoc type lookup to definitions.ql 2019-07-23 17:14:56 +01:00
Asger F
197b4d5637 JS: Add TypeAnnotation.getClass 2019-07-23 17:14:56 +01:00
Asger F
106539c495 JS: Compute qualified name of classes 2019-07-23 17:14:56 +01:00
Asger F
44f7e2d5c5 JS: Handle IIFE parameters 2019-07-23 17:14:56 +01:00
Asger F
7d2e83710a JS: Add JSDoc name resolution test 2019-07-23 17:14:56 +01:00
Asger F
80fa9915fd JS: Rename JSDoc.qll to avoid conflict with JSDoc module 2019-07-23 17:14:56 +01:00
Asger F
f3b8e39848 JS: Move JSDoc tests into JSDoc/Nodes 2019-07-23 17:13:01 +01:00
Asger F
225e96ddc3 JS: Resolve qualified name of JSDoc types 2019-07-23 17:08:02 +01:00
Asger F
13da242576 JS: Add GlobalAccessPaths library 2019-07-23 17:08:02 +01:00
Asger F
aded18b7dd JS: Add DataFlow::Node.getImmediatePredecessor() 2019-07-23 17:08:02 +01:00
Asger F
c97b9af4b8 JS: Add SsaExplicitDefinition.getRhsNode 2019-07-23 17:08:02 +01:00
Mark Shannon
2bdf42388c Python: Fix up pruning in QL to better handle constraints from constants. 2019-07-23 16:28:13 +01:00
semmle-qlci
8b60314d85 Merge pull request #1617 from asger-semmle/documentable
Approved by xiemaisi
2019-07-23 14:55:51 +01:00
Max Schaefer
8b3e647ae9 JavaScript: Do not taint for-in loop variable. 2019-07-23 10:52:55 +01:00
Anders Schack-Mulligen
a8c10e218c Java: Delete old deprecated code. 2019-07-23 10:09:51 +02:00
Asger F
e98061a2e9 JS: Do not recursively import javascript into DataFlow:: scope 2019-07-23 00:03:14 +01:00
Asger F
ce095d0681 JS: Avoid unnecessary import of configuration 2019-07-22 23:10:34 +01:00
semmle-qlci
247848c931 Merge pull request #1577 from asger-semmle/infername
Approved by xiemaisi
2019-07-22 21:01:48 +01:00
Ziemowit Laski
e989eabc0a Update test case (remove references to MacroInvocationStmt and MacroInvocationExpr) 2019-07-22 11:09:30 -07:00
Ziemowit Laski
f8d52a3bea Remove getCanonicalQLClass() from MacroInvocationExpr and MacroInvocationStmt. 2019-07-22 11:04:30 -07:00
Anders Schack-Mulligen
cd8d16183c Java/CPP/C#: Sync dataflow. 2019-07-22 15:41:37 +02:00
Anders Schack-Mulligen
3024b5cb9e Java: Bugfix for flow through methods with taintstep and upcast. 2019-07-22 15:39:30 +02:00
Geoffrey White
85707cfe3e CPP: Change note. 2019-07-22 11:55:29 +01:00
Geoffrey White
d39d9bf1f0 CPP: Workaround FPs. 2019-07-22 11:48:25 +01:00
Geoffrey White
185ca590f2 CPP: Test exposing UseInOwnInitializer FPs. 2019-07-22 11:34:01 +01:00
Ziemowit Laski
dbf655253f Get rid of tabs. 2019-07-19 17:01:34 -07:00
Ziemowit Laski
a0570213d7 [CPP-386] Separate printing of casts and conversion, per Dave's request. 2019-07-19 16:56:22 -07:00
Dave Bartolomeo
efa854ea3e C++: Add *Imports.qll files to identical-files.json 2019-07-19 15:38:11 -07:00
Dave Bartolomeo
8456bdd6eb C++: Move IR files that are now pyrameterized into implementation. 2019-07-19 15:37:45 -07:00
Dave Bartolomeo
832807401b C++: Move imports from instantiated pyrameterized modules into separate file
Rather than have IR.qll (which depends on the flavor) import EdgeKind.qll (which does not) with an non-relative import, I've moved these imports into internal.IRImports relative to IR.qll. These imports files can be shared across flavors within one language, but are different between C# and C++ due to the difference in paths.
2019-07-19 13:09:36 -07:00
yh-semmle
12c906c9de Merge pull request #1503 from aschackmull/java/object-tostring-dispatch
Java: Restrict Object.toString() dispatch based on a more closed-world assumption.
2019-07-19 09:23:21 -04:00
Taus
24b596dae6 Merge pull request #1612 from markshannon/merge-121
Merge rc/1.21 into master
2019-07-19 10:08:59 +01:00
Dave Bartolomeo
ac6e0cedaf Merge pull request #1614 from rdmarsh2/rdmarsh/cpp/ir-overlap-speedup
C++: further optimization of overlap computation
2019-07-18 19:48:59 -07:00
Ziemowit Laski
45d944411f [CPP-386] Fix Local{Class,Struct,Union}, macro invocations,
printing of member functions and operators.
2019-07-18 16:09:04 -07:00
Robert Marsh
2f27c1c2f5 C++: further optimization of overlap computation 2019-07-18 14:57:48 -07:00
Dave Bartolomeo
8d8c66fc49 C++: Delete unused file ValueCategory.qll 2019-07-18 13:55:34 -07:00
Dave Bartolomeo
add1702bf6 C++: Fix test breaks due to private imports of cpp 2019-07-18 12:29:41 -07:00
semmle-qlci
2d82a5517f Merge pull request #1608 from asger-semmle/thisnode-basicblock
Approved by xiemaisi
2019-07-18 17:03:29 +01:00
Anders Schack-Mulligen
3588066ba1 Java: Add qldoc and change note. 2019-07-18 17:53:40 +02:00
Mark Shannon
88f9685d40 Merge rc/1.21 into master 2019-07-18 16:40:32 +01:00
Taus
7a510f5d1b Merge pull request #1609 from markshannon/python-better-points-to-extensions
Python points-to: Remove negative recursion when using legacy points-to extensions
2019-07-18 16:28:39 +01:00
Mark Shannon
3343f6bd2f Fix typo. 2019-07-18 15:44:29 +01:00
Mark Shannon
c6ae06f1df Python: modernize regex library to use new points-to. 2019-07-18 14:16:57 +01:00
Mark Shannon
54a8c64b23 Python points-to: Remove negative recursion when using legacy points-to in legacy points-to extensions. 2019-07-18 14:16:52 +01:00
Asger F
1e451bc541 JS: Restrict Expr.getDocumentation() 2019-07-18 13:14:23 +01:00
Max Schaefer
502a7aacfc JavaScript: Start documenting extension points provided by the standard library. 2019-07-18 13:03:40 +01:00
Asger F
ed56939650 JS: Add array literal elements 2019-07-18 12:56:41 +01:00
Asger F
87ceb1bbda JS: Add test for other expressions that have docs 2019-07-18 12:55:55 +01:00
Asger F
416b1b4ba8 JS: Move getDocumentation tests into one file 2019-07-18 12:54:02 +01:00
Taus
f70e7d774f Merge pull request #1604 from markshannon/python-performance-fixes
Python: Performance improvements to points-to.
2019-07-18 10:58:15 +01:00
Asger F
e9c03c9820 JS: Implement getBasicBlock() for exceptional nodes 2019-07-18 10:01:28 +01:00
Asger F
44a270a43d JS: Add test 2019-07-18 09:37:45 +01:00
Asger F
3347b7d977 JS: Implement ThisNode.getBasicBlock 2019-07-18 09:25:19 +01:00
Dave Bartolomeo
5d1d082a4f C++: Pull a bunch of language-dependent code that the IR depends on out into a separate module 2019-07-17 17:05:06 -07:00
Dave Bartolomeo
1fdce43484 Merge pull request #1587 from rdmarsh2/rdmarsh/cpp/ir-overlap-speedup
C++: improve performance of overlap computation
2019-07-17 16:54:41 -07:00
Ziemowit Laski
926742561b [CPP-340] Eliminate superfluous print-outs of NestedStruct,
`NestedUnion` and `MemberFunction`
2019-07-17 13:39:43 -07:00
semmle-qlci
81b78dce56 Merge pull request #1603 from xiemaisi/js/more-examples
Approved by asger-semmle
2019-07-17 14:07:07 +01:00
Geoffrey White
72d01789a3 CPP: Change note. 2019-07-17 13:23:59 +01:00
Max Schaefer
ae07546026 JavaScript: Add syntax examples to Comments.qll, E4X.qll, Functions.qll, HTML.qll and NodeJS.qll. 2019-07-17 13:03:45 +01:00
Geoffrey White
48a60651b6 CPP: Fix query. 2019-07-17 11:43:05 +01:00
Geoffrey White
aa368d8763 CPP: Add test cases. 2019-07-17 11:38:59 +01:00
Mark Shannon
71d353f03b Python: Performance improvements to points-to. Uses extensional (not IPA) for origins and prevents some harmful magic. 2019-07-17 10:25:23 +01:00
Pavel Avgustinov
de24bec41f Merge pull request #1596 from Semmle/xiemaisi-patch-1
Fix indentation of list item in code of conduct
2019-07-17 10:07:37 +01:00
Asger F
cee742152d JS: Update test outputs 2019-07-17 09:16:15 +01:00
Ziemowit Laski
f0982791e3 [CPP-340] Remove colons and extraenous QLDoc comments; add a few more classes. 2019-07-16 17:58:39 -07:00
Dave Bartolomeo
e58df94672 Remove unnecessary dependencies on cpp 2019-07-16 15:10:46 -07:00
Dave Bartolomeo
60b3ffe3d5 Make all imports of cpp private 2019-07-16 15:02:26 -07:00
zlaski-semmle
6764390970 Merge pull request #1586 from geoffw0/norm-taint-test
CPP: Normalize the taint tests
2019-07-16 11:49:42 -07:00
Asger F
b2fcea4fd2 JS: Allow PropAccess when guessing name 2019-07-16 17:29:56 +01:00
Geoffrey White
1b7d1c37ec CPP: Test showing that Adding365daysPerYear.ql doesn't actually care whether the return value of the time conversion function is checked. 2019-07-16 17:29:30 +01:00
Mark Shannon
3035178391 Python: Better API for parameters. 2019-07-16 16:50:40 +01:00
Asger F
1c2d874c55 JS: Quantify of ValueProperty instead of Property 2019-07-16 16:27:11 +01:00
Asger F
4e77a368c3 JS: Avoid having multiple names again 2019-07-16 16:23:27 +01:00
Asger F
9408b96b9a JS: Update yet more tests 2019-07-16 16:09:29 +01:00
Mark Shannon
b4d413cfa8 Python points-to: Track implicit module attributes through phi-nodes. 2019-07-16 15:39:58 +01:00
Asger F
448f143566 JS: Update change note 2019-07-16 11:23:26 +01:00
Asger F
7da341ba04 JS: Merge getInferredName() => getName() 2019-07-16 11:21:33 +01:00
Asger F
b2da2d2a4b JS: update tests again 2019-07-16 10:47:23 +01:00
semmle-qlci
5944ec685a Merge pull request #1592 from Semmle/revert-1538-TypeTrackingInPortals
Approved by asger-semmle
2019-07-16 10:34:21 +01:00
Calum Grant
87a43718e9 Merge pull request #1588 from felicity-semmle/qhelp/SD-3447-commented-out-code
Update Python and C# help for commented-out code to use common qhelp
2019-07-16 09:38:33 +01:00
Max Schaefer
3eb0542d7e Fix indentation of list item in code of conduct 2019-07-16 08:49:29 +01:00
Robert Marsh
1f17cfb8ad C++: add comments and private annotations 2019-07-15 14:47:21 -07:00
zlaski-semmle
48842c8fb5 Merge pull request #1593 from geoffw0/stackforreturn
CPP: Fix FP in AllocaInLoop.ql
2019-07-15 12:08:46 -07:00
Geoffrey White
4df176ae34 CPP: Add test coverage for isModifiedByArithmeticOperation. 2019-07-15 19:42:50 +01:00
Robert Marsh
86a018b0b4 C++: overlapping def/use must share IRVariable 2019-07-15 10:35:57 -07:00
Robert Marsh
20e67eb37a C++: improve performance of overlap computation
This is still quadratic in the number of MemoryLocations for a vvar, but
only for a single pipeline step, which is not materialized. It seems to be
fast enough in practice for the IR.
2019-07-15 10:15:58 -07:00
Mark Shannon
d750f38532 Python: Fix a couple of false positives for AST and CFG sanity and improve reporting for ClassValue sanity. 2019-07-15 16:28:28 +01:00
Max Schaefer
ca36c7aa9a Revert "JavaScript: Use type tracking to identify more portal entry/exit nodes."
This reverts commit 39c37f519d.
2019-07-15 16:27:55 +01:00
Taus
59a402fcce Merge pull request #1590 from markshannon/fix-semantic-merge-conflict
Fix semantic merge conflict between #1470 and #1487.
2019-07-15 16:25:04 +01:00
Mark Shannon
2c5b1c0810 Fix semantic merge conflict between #1470 and #1487. 2019-07-15 15:34:00 +01:00
Geoffrey White
0a49a68001 CPP: Change note. 2019-07-15 15:01:50 +01:00
Geoffrey White
cf194219b9 CPP: Fix FPs. 2019-07-15 14:58:35 +01:00
Geoffrey White
5362fef81c CPP: Additional AllocaInLoop test cases. 2019-07-15 14:50:02 +01:00
Taus
f12c057826 Merge pull request #1470 from markshannon/python-tarslip
Python: "TarSlip" query
2019-07-15 12:43:47 +02:00
Felicity Chapman
cb48af7395 Update Python and C# help for commented-out code to use common qhelp 2019-07-15 09:26:17 +01:00
Ziemowit Laski
c906560edd Fix up expected IR output after rebase. 2019-07-13 12:57:25 -07:00
Ziemowit Laski
960a41be85 Handle __builtin_addressof. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
175ba7b3b0 Fix up .expected on the IR side. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
2637c22732 Fix up .expected file. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
2459d2ab92 Reformat PrintAST.qll ONLY. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
49b0fc0a57 [CPP-386] A few more QL classes. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
ab82aebbd7 [CPP-386] Add override keyword as needed; annotate a few more classes. 2019-07-13 12:23:40 -07:00
Ziemowit Laski
e5fc07660d [CPP-386] Print QL AST classes next to elements in PrintAST trees. 2019-07-13 12:23:09 -07:00
Ziemowit Laski
ddb0fd90e9 [CPP-386] Provide getCanonicalQLClass() predicate for many AST elements. 2019-07-13 12:19:40 -07:00
Ziemowit Laski
a4affbebbf [CPP-386] Add ElementBase::getCanonicalQLClass(). 2019-07-13 12:19:40 -07:00
Robert Marsh
41e46f6686 Merge pull request #1584 from geoffw0/swap
CPP: Model std::swap
2019-07-12 10:41:14 -07:00
Geoffrey White
a9b953f89a CPP: Flip test output for consistency and easy comparison with the other tests. 2019-07-12 18:18:08 +01:00
Geoffrey White
cd449e1336 CPP: Change note. 2019-07-12 18:00:39 +01:00
Geoffrey White
c2fd2e273e CPP: Model taint flow through std::swap. 2019-07-12 18:00:39 +01:00
Geoffrey White
f132bca06e CPP: Add a taint flow test of 'std::swap'. 2019-07-12 16:37:01 +01:00
semmle-qlci
e1454abaf4 Merge pull request #1582 from xiemaisi/js/more-examples
Approved by asger-semmle
2019-07-12 13:01:46 +01:00
Max Schaefer
a41fb6571c JavaScript: Address review comment. 2019-07-12 10:47:55 +01:00
semmledocs-ac
e1da6e915c Merge pull request #1515 from geoffw0/continuefalseloop
CPP: Improvements to ContinueInFalseLoop.ql
2019-07-12 08:38:22 +01:00
Max Schaefer
0ad51ac273 JavaScript: Add syntax examples in Classes.qll, JSX.qll and Templates.qll. 2019-07-12 08:37:49 +01:00
Dave Bartolomeo
1b38208bab Merge pull request #1567 from jbj/ir-operand-cycles
C++ IR: guard against cycles in operand graph
2019-07-11 13:14:10 -07:00
Dave Bartolomeo
c73b516862 Merge pull request #1541 from jbj/ir-operand-exact
C++ IR: Make instruction operand getters have only exact results
2019-07-11 13:13:20 -07:00
Dave Bartolomeo
00ff2bb6c4 Merge pull request #1554 from jbj/ir-ErrorExpr
C++ IR: support for translating ErrorExpr
2019-07-11 13:05:04 -07:00
Jonas Jensen
23001d5471 Merge pull request #1566 from rdmarsh2/rdmarsh/cpp/pure-functions-effect-model
C++: alias and side effect info for pure functions
2019-07-11 21:21:54 +02:00
Geoffrey White
bfe570399a CPP: Update change note. 2019-07-11 20:06:29 +01:00
Geoffrey White
ed069fe3cc CPP: Upgrade precision/severity. 2019-07-11 20:00:50 +01:00
Geoffrey White
62fb216102 CPP: Fix false positive. 2019-07-11 20:00:50 +01:00
Geoffrey White
629d127174 CPP: QLDoc comments. 2019-07-11 20:00:50 +01:00
Geoffrey White
e1efdd7d47 CPP: Add a test where continue is used in a switch to exit the loop. 2019-07-11 20:00:50 +01:00
Geoffrey White
3337a859aa CPP: Corrections to qhelp. 2019-07-11 20:00:50 +01:00
Geoffrey White
83b0906f67 CPP: Change note. 2019-07-11 20:00:50 +01:00
Geoffrey White
4c4be2d3c2 CPP: Add (basic) qhelp. 2019-07-11 20:00:50 +01:00
Geoffrey White
8a3f8c5c1d CPP: Add precision/tags and adjust severity. 2019-07-11 20:00:50 +01:00
Geoffrey White
83d4b23ae3 CPP: Fix false positives in while/for loops. 2019-07-11 20:00:50 +01:00
Geoffrey White
136ca72297 CPP: Add a test. 2019-07-11 20:00:49 +01:00
Robert Marsh
c195420ba1 C++: respond to PR comments 2019-07-11 11:00:52 -07:00
semmle-qlci
3f464926a2 Merge pull request #1579 from adityasharad/merge/1.20-1.21
Approved by asger-semmle
2019-07-11 17:35:10 +01:00
Geoffrey White
db6be05a92 Merge pull request #1580 from jbj/inconsistent-loop-direction-perf
C++: Fix inconsistent-loop-direction performance
2019-07-11 16:39:05 +01:00
Asger F
ab00da763d JS: Autoformat 2019-07-11 16:24:09 +01:00
Asger F
ec288c1eb1 JS: Update more expected test output 2019-07-11 16:23:48 +01:00
Asger F
5124fae7b4 JS: Add a change note 2019-07-11 16:23:48 +01:00
Asger F
06e9e5ca39 JS: Make FunctionNode and ClassNode use inferred names 2019-07-11 16:23:48 +01:00
Asger F
c44a3b4735 JS: Add ClassDefinition.getInferredName 2019-07-11 16:19:11 +01:00
Asger F
eead67ac6d JS: Add Function.getInferredName() 2019-07-11 16:15:53 +01:00
semmle-qlci
40f6dc1692 Merge pull request #1578 from asger-semmle/splice
Approved by xiemaisi
2019-07-11 15:44:21 +01:00
Jonas Jensen
2324ce77ae C++ IR: Fix soundness of ConstantAnalysis
Now that `PhiInstruction.getAnInput` only has results for congruent
operands, a previous optimization I made to `getConstantValue` is no
longer sound. We have to check that all phi inputs give the same value,
not just the congruent ones. After this change, if there are any
non-congruent operands on a phi instruction, the whole aggregate will
have no result.
2019-07-11 15:51:09 +02:00
Asger F
30265537b2 Update javascript/ql/src/semmle/javascript/dataflow/Nodes.qll
Co-Authored-By: Max Schaefer <max@semmle.com>
2019-07-11 14:38:47 +01:00
Jonas Jensen
7fb43a5a03 C++ IR: getAnyDef -> getDef in RangeUtils.qll
As recommended by Dave in PR review.
2019-07-11 15:35:14 +02:00
ian-semmle
463547f810 Merge pull request #1581 from jbj/revert-noTarget-workaround
Revert "C++: Work around extractor issue CPP-383"
2019-07-11 14:26:15 +01:00
Jonas Jensen
c831c4b58e C++ IR: Fix SignAnalysis after getAnyDef -> getDef
In the `SignAnalysis` abstract interpretation, "unknown sign"
corresponds to the set of _all_ `Sign`, but using `getDef` leads to the
operand having _no_ `Sign`. To fix that, we assign all signs to inexact
operands.
2019-07-11 15:17:55 +02:00
Geoffrey White
59964bd9a4 Merge pull request #1575 from jbj/UncheckedLeapYear-bb
C++: Fix performance of unchecked leap year query
2019-07-11 13:57:07 +01:00
Jonas Jensen
ee5eaef5e4 Revert "C++: Work around extractor issue CPP-383"
The issue is now fixed in the extractor, and I've confirmed that the
workaround is no longer needed for g/an-tao/drogon.

This reverts commit 48a3385809.
2019-07-11 14:18:29 +02:00
Aditya Sharad
e8bacd2816 Merge rc/1.20 into rc/1.21. 2019-07-11 12:10:21 +01:00
Jonas Jensen
e523f93d91 C++: Fix inconsistent-loop-direction performance
This query seems to have been de-optimized by recent optimizer or stats
changes. On libretro/libretro-uae, the query took 1 second on a warm
cache with dist 89ad5f1 but took 9979 seconds with dist a3b9b6eb9.

The slowness was due to a Cartesian product in
`illDefined{Decr,Incr}ForStmt` between all the definitions and all the
uses of `Variable v`. This would be no problem with the right join
order, but that has apparently been lost. This commit factors out a pair
of `pragma[noinline]` helper predicates to make sure the definitions
(`v.getAnAssignedValue()`) and the uses (`v.getAnAccess()`) are queried
and filtered in separate predicates.

The performance problem can be seen in the tuple counts of this pipeline
I interrupted during evaluation of
`inconsistentLoopDirection::illDefinedDecrForStmt#ffff#shared`:

    89716     ~3%     {2} r1 = SCAN Variable::Variable::getAnAssignedValue_dispred#ff OUTPUT FIELDS {Variable::Variable::getAnAssignedValue_dispred#ff.<1>,Variable::Variable::getAnAssignedValue_dispred#ff.<0>}
    89716     ~0%     {3} r2 = JOIN r1 WITH DataFlowUtil::TExprNode#ff@staged_ext ON r1.<0>=DataFlowUtil::TExprNode#ff@staged_ext.<0> OUTPUT FIELDS {r1.<1>,DataFlowUtil::TExprNode#ff@staged_ext.<0>,DataFlowUtil::TExprNode#ff@staged_ext.<1>}
    502539405 ~0%     {4} r3 = JOIN r2 WITH Variable::Variable::getAnAccess_dispred#fb ON r2.<0>=Variable::Variable::getAnAccess_dispred#fb.<0> OUTPUT FIELDS {Variable::Variable::getAnAccess_dispred#fb.<1>,r2.<1>,r2.<2>,r2.<0>}
                      return r3
2019-07-11 12:09:17 +02:00
Asger F
cf23c50f0c JS: Add convenience layer
Adds getASpreadArgument() and defines getCalleeName() for reflective
calls to be the name of the property being invoked, if there is one.
2019-07-11 10:55:28 +01:00
Asger F
83908464e0 JS: more taint steps through array manipulation 2019-07-11 10:55:28 +01:00
semmle-qlci
66464b5c48 Merge pull request #1574 from xiemaisi/js/more-examples
Approved by esben-semmle
2019-07-11 08:09:59 +01:00
Robert Marsh
72f9addd0b C++: move strstr back into main pure str model 2019-07-10 12:27:04 -07:00
yh-semmle
bed1b747e7 Merge pull request #1576 from rneatherway/java/is-not-empty-null-guards-1.21
Java: Add `isNotEmpty` to NullGuards
2019-07-10 13:32:19 -04:00
Robin Neatherway
5c19e00084 Java: Add isNotEmpty to NullGuards 2019-07-10 16:04:45 +01:00
Jonas Jensen
52cfbffb95 C++ IR: Fix calls to non-existent predicates
The last commit introduced calls to two predicates that did not exist. I
created `Instruction.getResultAddress` so it now exists and changed the
other call back to use the predicate that does exist.
2019-07-10 15:18:17 +02:00
Jonas Jensen
6d87c05155 Apply suggestions from code review
Co-Authored-By: Dave Bartolomeo <42150477+dave-bartolomeo@users.noreply.github.com>
2019-07-10 15:07:44 +02:00
Jonas Jensen
70f81badcb C++ IR: Move ErrorExpr filter to TranslatedElement
The convention in the IR translation is to handle all ignored
expressions in this central place.
2019-07-10 14:20:09 +02:00
Jonas Jensen
21c6340180 C++: Fix performance of unchecked leap year query
This query used `getASuccessor()` on the CFG, which worked in many cases
but became quadratic on certain projects including PostgreSQL and
MySQL. The problem was that there was just enough context for magic to
apply to the transitive closure, but the use of magic meant that the
fast transitive closure algorithm wasn't used. In projects where the
magic had little effect, that led to the
`#ControlFlowGraph::ControlFlowNode::getASuccessor_dispred#bfPlus`
predicate taking quadratic time and space.

This commit changes the query to use basic blocks to find successors,
which is much faster because (1) there are many more `ControlFlowNode`s
than `BasicBlocks`, and (2) the optimizer does not apply magic but uses
fast transitive closure instead.

Behavior changes slightly in the `isUsedInCorrectLeapYearCheck` case: we
now accept a `yfacheck` that comes _before_ `yfa` if they are in the
same basic block. I don't think that matters in practice.
2019-07-10 13:20:32 +02:00
semmle-qlci
d3a880ee4d Merge pull request #1565 from asger-semmle/uncalled-function-metric
Approved by xiemaisi
2019-07-10 09:59:51 +01:00
semmle-qlci
a1f9fe3738 Merge pull request #1573 from asger-semmle/restrict-receiver-type
Approved by xiemaisi
2019-07-10 09:58:48 +01:00
Max Schaefer
1dc685b94b JavaScript: Address review comments. 2019-07-10 08:45:17 +01:00
Max Schaefer
96a0766f3a JavaScript: Add syntax examples in AMD.qll, AST.qll and Stmt.qll. 2019-07-10 08:19:47 +01:00
Dave Bartolomeo
e087b6c82a Merge pull request #1571 from jbj/ir-operand-cached
C++ IR: Make TOperand cached
2019-07-09 16:14:58 -07:00
Dave Bartolomeo
ad5a16e1b1 Merge pull request #1568 from jbj/ir-valuenumbering-copy
C++ IR: Don't propagate GVN through non-exact Copy
2019-07-09 16:13:55 -07:00
Asger F
badca07606 JS: Add test 2019-07-09 21:37:02 +01:00
Asger F
78adcd4a85 JS: Fix join ordering 2019-07-09 21:36:55 +01:00
Asger F
6a986a9179 JS: Avoid tracking classes into receiver of other classes 2019-07-09 21:32:04 +01:00
Robert Marsh
3804c1fbcf C++: model returns of strstr and strpbrk 2019-07-09 11:45:27 -07:00
Jonas Jensen
523fc9c1ce C++ IR: make isInCycle fast
Without this `pragma[noopt]`, `isInCycle` gets compiled into RA that
unpacks every tuple of the fast TC:

                      0          ~0%     {2} r1 = SELECT #Operand::getNonPhiOperandDef#3#ffPlus ON FIELDS #Operand::getNonPhiOperandDef#3#ffPlus.<0>=#Operand::getNonPhiOperandDef#3#ffPlus.<1>
                      0          ~0%     {1} r2 = SCAN r1 OUTPUT FIELDS {r1.<0>}
                                         return r2

With this change, it just becomes one lookup in the fast TC data
structure per instruction.
2019-07-09 16:28:55 +02:00
Jonas Jensen
9ee8a89492 C++ IR: Make TOperand cached
Just like `TInstruction` is cached to prevent re-numbering its tuples in
every IR query, I think `TOperand` should be cached too. I tested it on
the small comdb2 snapshot, where it only saves one second of work when
running a second IR query, but the savings should grow when snapshots
are larger and when there are more IR queries in a suite. Tuple
numbering is mildly quadratic, so it should be good to avoid repeating
it.

Adding these annotations adds three cached stages to the existing four
cached stages of the IR. The new cached stages are small and do not
appear to repeat any work from the other stages, so I see no advantage
to merging them with the existing stages.
2019-07-09 16:07:55 +02:00
semmle-qlci
d497fd26c0 Merge pull request #1569 from Semmle/js/examples-Expr.qll
Approved by asger-semmle, esben-semmle
2019-07-09 14:07:31 +01:00
Jonas Jensen
0889d5d27a C++ IR: Improve ErrorExpr test
The previous version of the test used `0 = 1;` to test an lvalue-typed
`ErrorExpr`, but the extractor replaced the whole assignment expression
with `ErrorExpr` instead of just the LHS. This variation of the test
only leads to an `ErrorExpr` for the part of the syntax that's supposed
to be an lvalue-typed expression, so that's an improvement.
Unfortunately it still doesn't demonstrate that we can `Store` into an
address computed by an `ErrorExpr`.
2019-07-09 13:35:20 +02:00
Jonas Jensen
4324c97d39 C++: Use Opcode::Error for ErrorExpr translation 2019-07-09 13:26:00 +02:00
Jonas Jensen
a86ddd50de C++ IR: Translate ErrorExpr to NoOp 2019-07-09 13:18:11 +02:00
Jonas Jensen
e2a43eeed6 C++ IR: Tests with ErrorExpr 2019-07-09 13:18:09 +02:00
Max Schaefer
e9ba66f5eb JavaScript: Address review comments. 2019-07-09 12:01:30 +01:00
Anders Schack-Mulligen
eeb7bdba95 Merge pull request #1553 from rneatherway/java/add-null-guard
Java: Add `isNotEmpty` to NullGuards
2019-07-09 11:25:21 +02:00
Max Schaefer
9479ae3069 JavaScript: Add concrete syntax examples to all API classes in Expr.qll. 2019-07-09 10:01:53 +01:00
Jonas Jensen
39854a3f7b C++ IR: guard against cycles in operand graph
This doesn't fix the underlying problem that for some reason there are
cycles in the operand graph on our snapshots of the Linux kernel, but it
ensures that the cycles don't lead to non-termination of
`ConstantAnalysis` and `ValueNumbering`.
2019-07-09 11:00:27 +02:00
Jonas Jensen
da13dc6442 C++ IR: Don't propagate GVN through non-exact Copy
The `ValueNumbering` library is supposed to propagate value numberings
through a `CopyInstruction` only when it's _congruent_, meaning it must
have exact overlap with its source. A `CopyInstruction` can be a
`LoadInstruction`, a `StoreInstruction`, or a `CopyValueInstruction`.
The latter is also a `UnaryInstruction`, and the value numbering rule
for `UnaryInstruction` applied to it as well.

This meant that value numbering would propagate even through a
non-congruent `CopyValueInstruction`. That's semantically wrong but
probably only an issue in very rare circumstances, and it should get
corrected when we change the definition of `getUnary` to require
congruence.

What's worse is the performance implications. It meant that the value
numbering IPA witness could take two different paths through every
`CopyValueInstruction`. If multiple `CopyValueInstruction`s were
chained, this would lead to an exponential number of variable numbers
for the same `Instruction`, and we would run out of time and space
while performing value numbering.

This fixes the performance of `ValueNumbering.qll` on
https://github.com/asterisk/asterisk, although this project might also
require a separate change for fixing an infinite loop in the IR constant
analysis.
2019-07-09 10:58:03 +02:00
Jonas Jensen
46d779248d Merge pull request #1559 from zlaski-semmle/zlaski/futile-params-fix
Reduce precision from `very-high` to `low` due to inability to handle…
2019-07-09 06:51:56 +02:00
Dave Bartolomeo
7bbfffec4d Merge pull request #1552 from jbj/ir-builtin_addressof
C++ IR: Support __builtin_addressof
2019-07-08 17:08:38 -07:00
Dave Bartolomeo
52e0f3fb62 Merge pull request #1551 from jbj/ir-DeleteExpr-placeholder
C++: Placeholder translation of delete expressions
2019-07-08 17:07:16 -07:00
Robert Marsh
41e4d920e3 C++: alias and side effect info for pure functions 2019-07-08 12:26:58 -07:00
Ziemowit Laski
ed5e2f3211 It turns out that the bminor/bash alert spewage was caused by
a bug in the extractor, which is verified fixed in the next release.
Reverting query to its original form.
2019-07-08 12:11:15 -07:00
Robert Marsh
ea7602b571 C++: add test for Alias and SideEffect models 2019-07-08 11:41:46 -07:00
Robert Marsh
11581e4720 Merge pull request #1562 from geoffw0/models
CPP: Extend StrcpyFunction and update UsingStrcpyAsBoolean.ql
2019-07-08 09:56:16 -07:00
Asger F
7fd4d192b2 JS: Add metric for uncalled functions 2019-07-08 17:38:17 +01:00
semmle-qlci
c5d0abaf8a Merge pull request #1560 from asger-semmle/static-calls
Approved by xiemaisi
2019-07-08 16:42:32 +01:00
Anders Schack-Mulligen
d8395b7268 Merge pull request #1539 from taus-semmle/python-controlflownode-getchild-performance-hotfix
Python: Fix bad join ordering in `ControlFlowNode::getAChild()`.
2019-07-08 17:41:46 +02:00
Calum Grant
ce12312ff2 C#: Disable the write-through of the logger, as this is a theoretical slowdown, and results in less readable log files when multiple extractors are running concurrently. 2019-07-08 15:58:49 +01:00
Asger F
6019e48917 JS: Add annotated call graph test case 2019-07-08 13:55:29 +01:00
Asger F
b63f14fe94 JS: Move CallGraphs test into subfolder 2019-07-08 12:57:34 +01:00
Geoffrey White
29e3e2a5bd CPP: Fix typo. 2019-07-08 09:45:40 +01:00
semmle-qlci
a6b7f2d1f6 Merge pull request #1561 from xiemaisi/js/await-sourcenode
Approved by asger-semmle
2019-07-08 09:44:05 +01:00
Max Schaefer
fec87ac716 JavaScript: Address review comment. 2019-07-08 08:29:12 +01:00
Ziemowit Laski
07ee9be9b6 Set query precision to high 2019-07-06 14:33:00 -07:00
Asger F
37ccfd0036 JS: Resolve static calls using type tracking 2019-07-06 22:32:00 +01:00
Ziemowit Laski
be0db66a55 Squelch bminor/bash alerts and set query precision to high. 2019-07-06 14:27:02 -07:00
Ziemowit Laski
9e600e3768 Reduce precision from very-high to low due to inability to handle K&R definitions correctly. 2019-07-05 18:10:03 -07:00
Robert Marsh
10172af401 Merge pull request #1557 from jbj/hiding-range-based-for
C++: Fix DeclarationHidesVariable FP for nested range-based for loops
2019-07-05 14:56:02 -07:00
Jonas Jensen
8d3cb78a9d C++: Fix DeclarationHidesVariable FP
We don't want alerts about the compiler-generated variables that appear
in the desugaring of range-based `for`.
2019-07-05 20:39:43 +02:00
Jonas Jensen
443a8fbc07 C++: Test for DeclarationHidesVariable FP 2019-07-05 20:34:30 +02:00
Taus Brock-Nannestad
4ddebb9349 Better names for helper predicates. 2019-07-05 16:38:39 +02:00
Taus Brock-Nannestad
703139142a More performance fixes. 2019-07-05 14:44:56 +02:00
Robin Neatherway
204a28df94 Java: Add isNotEmpty to NullGuards 2019-07-05 12:41:46 +01:00
Jonas Jensen
4b4e7caf9f C++ IR: Support __builtin_addressof 2019-07-05 11:05:00 +02:00
Jonas Jensen
6fe9945c04 C++: Placeholder translation of delete expressions
Before this change, `delete` and `delete[]` expressions had no control
flow after them, which caused the reachability analysis to remove all
code after a delete expression. This commit adds placeholder support for
delete expression by translating them to `NoOp` instructions so their
presence doesn't cause large chunks of the program to be removed.
2019-07-05 10:54:35 +02:00
semmle-qlci
50e8034b0b Merge pull request #1544 from esben-semmle/js/additional-configuration-splitting
Approved by xiemaisi
2019-07-05 09:10:22 +01:00
Ellen Arteca
39c37f519d JavaScript: Use type tracking to identify more portal entry/exit nodes. 2019-07-05 09:03:37 +01:00
Tom Hvitved
f56c17fc77 C#: Fix bad join-orders in lastNonRec() 2019-07-05 07:21:34 +02:00
Tom Hvitved
e6c258c6ba C#: Restructure Completion::isValidFor() 2019-07-05 07:21:34 +02:00
Tom Hvitved
8a35813e1c C#: Unify goto completions 2019-07-05 07:21:34 +02:00
Arthur Baars
9bf0a3f2cd Merge pull request #1547 from Semmle/rc/1.21
Merge rc/1.21 into master
2019-07-05 07:20:28 +02:00
Esben Sparre Andreasen
fca815f96d JS: make use of the recent Configuration split 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
6d5b84fa88 JS: split XmlBomb.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
5163ccfd39 JS: split InsufficientPasswordHash.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
8664908f78 JS: split PrototypePollution.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
289c29828f JS: split UnvalidatedDynamicMethodCall.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
9e675d9973 JS: split TaintedFormatString.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
26c29cbde5 JS: split TypeConfusionThroughParameterTampering.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
8225d9923c JS: split ClientSideUrlRedirect.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
c3973c061e JS: split ZipSlip.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
29e69b32b0 JS: split XpathInjection.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
48b655f1c7 JS: split CommandInjection.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
ccc171ce18 JS: split RemotePropertyInjection.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
063abb5af9 JS: split PostMessageStar.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
3ad46cd5bf JS: split HardcodedCredentials.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
ec6d233180 JS: split CleartextLogging.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
813253e0ac JS: split BrokenCryptoAlgorithm.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
27d0caed3e JS: split RegExpInjection.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
c8a60f74f0 JS: split StackTraceExposure.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
f2b3fa57eb JS: split RequestForgery.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
6f6887993c JS: split Xxe.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
9d670f7d39 JS: split CleartextStorage.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
013f471cf6 JS: split TaintedPath.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
2bb702ceea JS: split SqlInjection.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
2972c28e58 JS: split NosqlInjection.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
057b18c316 JS: split ServerSideUrlRedirect.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
a89a073623 JS: split FileAccessToHttp.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
efe7ba4f3d JS: split InsecureRandomness.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
b85d3756b0 JS: split DifferentKindsComparisonBypass.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
56172317ed JS: split HardCodedDataInterpretedAsCode.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
d786f36120 JS: split CorsMisconfigurationForCredentials.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
1f54f3269d JS: split HttpToFileAccess.qll 2019-07-04 22:42:55 +02:00
Esben Sparre Andreasen
ee6003655a JS: split UnsafeDynamicMethodAccess.qll 2019-07-04 22:42:55 +02:00
Jonas Jensen
2f8787379a Merge pull request #1535 from geoffw0/nospacezero
CPP: Fix false positives from NoSpaceForZeroTerminator.ql
2019-07-04 22:36:04 +02:00
Jonas Jensen
8c733fd58d Merge pull request #1537 from geoffw0/add-tests
CPP: Add some tests
2019-07-04 21:20:55 +02:00
Jonas Jensen
b51c78a92a Merge pull request #1546 from geoffw0/eraperf
CPP: Speed up LeapYear.qll 'ChecksForLeapYearFunctionCall'.
2019-07-04 21:19:34 +02:00
semmle-qlci
0290c79c54 Merge pull request #1486 from hvitved/csharp/inherited-completions
Approved by calumgrant
2019-07-04 19:45:25 +01:00
Geoffrey White
1fd08f4e47 CPP: Change note. 2019-07-04 17:27:40 +01:00
Geoffrey White
73c7bc1db9 CPP: Generalize a little. 2019-07-04 17:27:40 +01:00
Geoffrey White
7fc31f263a CPP: Basic fix. 2019-07-04 17:27:40 +01:00
Geoffrey White
34d307ecef CPP: Test a common false positive. 2019-07-04 17:27:40 +01:00
Geoffrey White
8ce6822d6f CPP: Fix format literal. 2019-07-04 16:31:35 +01:00
Taus Brock-Nannestad
d2113f1ced More performance stuff. (Possibly not all needed.) 2019-07-04 17:28:40 +02:00
Geoffrey White
70b996f721 CPP: Speed up LeapYear.qll 'ChecksForLeapYearFunctionCall'. 2019-07-04 15:59:32 +01:00
Tom Hvitved
349e0e8e62 C#: Address more review comments 2019-07-04 16:46:01 +02:00
semmle-qlci
298aa92814 Merge pull request #1543 from xiemaisi/js/reflective-call-flow
Approved by asger-semmle
2019-07-04 12:02:24 +01:00
Tom Hvitved
421e75d4c1 C#: Address review comments 2019-07-04 11:57:48 +02:00
Max Schaefer
91a718cfe5 JavaScript: Fix data flow out of reflective calls.
We were previously missing a data-flow edge from reflected calls to the corresponding reflective call, that is, for `f.call(...)` we didn't have a flow edge from the implicit call to `f` to the result of `f.call(...)`.
2019-07-04 08:29:04 +01:00
Esben Sparre Andreasen
bb452bea45 JS: split UnsafeDeserialization.qll 2019-07-04 08:39:10 +02:00
Esben Sparre Andreasen
626f3fa598 JS: split ConditionalBypass.qll 2019-07-04 08:33:39 +02:00
semmle-qlci
40f7e6f514 Merge pull request #1540 from esben-semmle/js/bump-prototype-pollution-lodash
Approved by xiemaisi
2019-07-04 07:19:45 +01:00
semmle-qlci
6cda33c39e Merge pull request #511 from esben-semmle/js/classify-minified-by-variable-names
Approved by xiemaisi
2019-07-03 16:31:43 +01:00
semmle-qlci
b07a3e6725 Merge pull request #1439 from esben-semmle/js/configuration-node-separation
Approved by asger-semmle, xiemaisi
2019-07-03 16:31:10 +01:00
Taus Brock-Nannestad
11ceaf3e3c Fix bad join order in SsaDefinitionsImpl::reachesEndOfBlock. 2019-07-03 16:26:10 +02:00
Pavel Avgustinov
ba4812c4ed Merge pull request #1534 from hvitved/csharp/remove-vcs
C#: Remove libraries and queries related to version history
2019-07-03 13:25:15 +01:00
Taus Brock-Nannestad
315dcb8720 Fix performance of multi_assignment_points_to. 2019-07-03 13:17:07 +02:00
Jonas Jensen
2111bf5387 C++ IR: getAnyDef -> getDef in RangeAnalysis 2019-07-03 11:05:06 +02:00
Jonas Jensen
c62f73e2a2 C++ IR: getAnyDef -> getDef in SignAnalysis
For signs that follow from guards, we want the guard and the guarded
access to overlap exactly.
2019-07-03 11:05:06 +02:00
Jonas Jensen
a16ed7d613 C++ IR: getAnyDef -> getDef in ValueNumbering
This change seems more in line with what users would expect.
2019-07-03 11:05:06 +02:00
Jonas Jensen
2ce8612a05 C++ IR: allow inexact defs in taint tracking 2019-07-03 11:05:06 +02:00
Jonas Jensen
984405be2e C++ IR: Change many uses of getAnyDef to getDef
This changes all the getters on `Instruction` to use `getDef` instead of
`getAnyDef`, with the result that these getters now only have a result
if the definition is exact.

This is a backwards-INCOMPATIBLE change.
2019-07-03 11:04:57 +02:00
Jonas Jensen
e082451352 C++ IR: add getDef and deprecated predicates
These are the hand-written changes that complete the automatic changes
from the previous commit.
- Add deprecated compatibility wrappers for the renamed predicates.
- Add a new `Operand.getDef` predicate.
- Clarify the QLDoc for all these predicates.
2019-07-03 10:06:48 +02:00
Jonas Jensen
206a96df94 C++ IR: Rename getters for def/use on Operand
This renames `getDefinitionInstruction` to `getAnyDef`, reflecting that
it includes definitions without exact overlap. It renames
`getUseInstruction` to `getUse` for consistency.

    perl -p -i -e 's/\bgetUseInstruction\b/getUse/g; s/\bgetDefinitionInstruction\b/getAnyDef/g' \
      cpp/ql/src/semmle/code/cpp/ir/**/*.ql* \
      cpp/ql/test/**/*.ql* \
      cpp/ql/src/semmle/code/cpp/rangeanalysis/**/*.ql*
2019-07-03 10:06:48 +02:00
Jonas Jensen
f8722f978f Merge pull request #1533 from zlaski-semmle/zlaski/cpp370cl
[CPP-370] Non-const format strings: Add change note for the 1.22 release.
2019-07-03 09:47:58 +02:00
semmle-qlci
7fbc730b05 Merge pull request #1517 from asger-semmle/instance-type-tracking-final
Approved by xiemaisi
2019-07-03 08:26:16 +01:00
semmle-qlci
44823ca46d Merge pull request #1522 from asger-semmle/ts-stringify-recursive-type-alias
Approved by xiemaisi
2019-07-03 08:25:50 +01:00
semmle-qlci
02bded38da Merge pull request #1528 from asger-semmle/jsdoc-source-location-fix
Approved by xiemaisi
2019-07-03 08:25:19 +01:00
Esben Sparre Andreasen
051c6ca31f JS: split CodeInjection.qll into two parts 2019-07-03 09:18:27 +02:00
Esben Sparre Andreasen
ecf367fa65 JS: bump vulnerable lodash version for prototype pollution
See https://github.com/lodash/lodash/pull/4336
2019-07-03 08:18:16 +02:00
Ziemowit Laski
1118601273 [CPP-370] Rework release note per Jonas' suggestions. 2019-07-02 17:37:17 -07:00
Asger F
70cbecaf1b JS: Update more test outputs 2019-07-02 21:08:13 +01:00
Asger F
52a5bce10d TS: Update test affected by new stringification 2019-07-02 21:01:47 +01:00
Geoffrey White
e079406a5f Merge pull request #1536 from jbj/leap-year-sameBaseType-perf
C++: Fix performance of leap year queries
2019-07-02 17:04:00 +01:00
Taus Brock-Nannestad
a40f0e0d14 Python: Fix bad join ordering in ControlFlowNode::getAChild(). 2019-07-02 15:42:41 +02:00
Tom Hvitved
a54ee160a3 C#: Update change note 2019-07-02 14:17:28 +02:00
Tom Hvitved
b6bbe1a5c0 C#: Add DB upgrade script 2019-07-02 14:01:41 +02:00
Jonas Jensen
2a6000c270 C++: getter/setter performance in StructLikeClass
The predicates `getter` and `setter` in `StructLikeClass.qll` were very
slow on some snapshots. On https://github.com/dotnet/coreclr they had
this performance:

    StructLikeClass::getter#fff#antijoin_rhs ........... 3m55s
    Variable::Variable::getAnAssignedValue_dispred#bb .. 3m36s
    StructLikeClass::setter#fff#antijoin_rhs ........... 20.5s

The `getAnAssignedValue_dispred` predicate in the middle was slow due to
magic propagated from `setter`.

With this commit, performance is instead:

   StructLikeClass::getter#fff#antijoin_rhs ........... 497ms
   Variable::Variable::getAnAssignedValue_dispred#ff .. 617ms
   StructLikeClass::setter#fff#antijoin_rhs ........... 158ms

Instead of hand-optimizing the QL for performance, I simplified `setter`
and `getter` to require slightly stronger conditions. Previously, a
function was only considered a setter if it had no writes to other
fields on the same class. That requirement is now relaxed by dropping
the "on the same class" part. I made the corresponding change for what
defines a getter. I think that still captures the spirit of what getters
and setters are.

I also changed the double-negation with `exists` into a `forall`.
2019-07-02 13:49:52 +02:00
Tom Hvitved
16b6791914 C#: Minor performance rewrite 2019-07-02 13:11:27 +02:00
Geoffrey White
01ce34449d Merge pull request #1530 from Semmle/getExpr-qldoc
C++: expand MacroInvocation.getExpr QLDoc
2019-07-02 11:00:57 +01:00
Jonas Jensen
5ea69601c3 Merge pull request #1525 from aibaars/drop-import-additional-libraries
Drop ImportAdditionalLibraries.ql
2019-07-02 11:26:31 +02:00
Jonas Jensen
5ad0b39f0c C++: Fix performance of leap year queries
The `sameBaseType` predicate was fundamentally quadratic, and this blew
up on large C++ code bases. Replacing it with calls to `Type.stripType`
fixes performance and does not affect the qltests. It looks like
`sameBaseType` was used purely an ad hoc heuristic, so I'm not worried
about the slight semantic difference between `sameBaseType` and
`stripType`.
2019-07-02 11:17:18 +02:00
Asger F
329ff0db1b JS: Add an use getAPropertySource() 2019-07-02 10:09:06 +01:00
Asger F
5ce08e2c78 JS: Address review comments 2019-07-02 10:09:06 +01:00
Asger F
408fd3e106 JS: Augment call graph using type-tracked class instances 2019-07-02 10:09:06 +01:00
Asger F
779d98a143 JS: Prevent bad join in hasOwnProperty 2019-07-02 10:09:05 +01:00
Tom Hvitved
9a24d3a69c C#: Remove libraries and queries related to version history
The VCS relations are no longer populated, so there is no reason to keep them,
and the queries/libraries that use the relations.
2019-07-02 10:43:38 +02:00
Max Schaefer
bfb236f56d JavaScript: Add more default source nodes.
In particular, `await`, `yield` and dynamic `import` expressions are now source nodes, as well as a few other experimental and legacy language features involving non-local flow.
2019-07-02 08:10:28 +01:00
semmle-qlci
71c86fa69b Merge pull request #1527 from esben-semmle/js/classify-more-generated-and-tests
Approved by asger-semmle
2019-07-02 07:38:10 +01:00
semmle-qlci
26fd1b91cf Merge pull request #1485 from esben-semmle/js/fix-yaml-strings
Approved by xiemaisi
2019-07-02 07:00:43 +01:00
semmle-qlci
b0b152aaaa Merge pull request #1529 from xiemaisi/js/getter-summaries
Approved by asger-semmle
2019-07-02 06:16:34 +01:00
Ziemowit Laski
ef7e051b50 [CPP-370] Add change note for the 1.22 release. 2019-07-01 13:47:53 -07:00
Jonas Jensen
bf99a0ee15 C++: expand MacroInvocation.getExpr QLDoc 2019-07-01 20:22:24 +02:00
Max Schaefer
7f95c20345 JavaScript: Add support for tracking flow into receivers of reflective calls. 2019-07-01 17:54:43 +01:00
semmle-qlci
3b126d9c4e Merge pull request #1488 from asger-semmle/call-graph-metric
Approved by xiemaisi
2019-07-01 16:09:34 +01:00
Max Schaefer
a04c2c65cb JavaScript: Add change note. 2019-07-01 15:45:57 +01:00
Max Schaefer
895055f30e JavaScript: Avoid unhelpful magic.
The constraint `exists(callback.getParameter(i))` was getting pushed into `higherOrderCall`, which isn't a bad thing to do. However, this then led to a join on `i`, which is a very bad thing to do.
2019-07-01 15:45:57 +01:00
Max Schaefer
b5b89c0eac JavaScript: Track flow into method receivers. 2019-07-01 15:45:57 +01:00
Esben Sparre Andreasen
062778bdd8 JS: heuristically recognize x.spec.y and x.test.y as test files 2019-07-01 15:49:17 +02:00
Esben Sparre Andreasen
7cab308205 fixup! JS: classify numeric file names as generated 2019-07-01 15:49:03 +02:00
Jonas Jensen
757ec97e7a Merge pull request #1251 from zlaski-semmle/zlaski/cpp370
[CPP-370] Non-constant `format` arguments to `printf` and friends
2019-07-01 14:43:19 +02:00
Asger F
0c04580b5e JS: fix typo in doc 2019-07-01 13:25:55 +01:00
Asger F
ff4d6ece80 JS: Rename metrics to ResolvableCallX 2019-07-01 12:34:48 +01:00
Asger F
16e6dd12d0 JS: Address review comments part 1 2019-07-01 12:30:51 +01:00
Esben Sparre Andreasen
41e568d1f7 JS: classify files with many short variables as minified 2019-07-01 13:25:07 +02:00
Asger F
2ab72c4eef JS: Support line breaks in types 2019-07-01 11:46:30 +01:00
Asger F
625cdb8765 JS: Update test output 2019-07-01 11:29:55 +01:00
Asger F
4f05eab3fd JS: Make docs match reality 2019-07-01 11:29:55 +01:00
Asger F
2822e493ae JS: Switch to absolute offsets 2019-07-01 11:29:55 +01:00
Asger F
d6ba1ffa8a JS: Some loc() fixes 2019-07-01 11:29:55 +01:00
Asger F
fd0791bd8c JS: Parse types from original source string 2019-07-01 11:29:55 +01:00
Asger F
a3c7b631f4 JS: Extract type source text with substring 2019-07-01 11:29:55 +01:00
Asger F
edd96b056e JS: Remove redundant source field 2019-07-01 11:29:55 +01:00
Asger F
9403834af5 JS: Include leading star in parsed source 2019-07-01 11:29:55 +01:00
Asger F
9b4bdaecce JS: Remove unneeded replace call 2019-07-01 11:29:55 +01:00
semmle-qlci
a4fa2982de Merge pull request #1526 from xiemaisi/js/remove-TrackedExpr
Approved by esben-semmle
2019-07-01 11:10:44 +01:00
semmle-qlci
4f3cbe0029 Merge pull request #1521 from hvitved/csharp/constant-condition-fp
Approved by calumgrant
2019-07-01 10:52:14 +01:00
Esben Sparre Andreasen
2eb7e4a818 JS: classify x.test.js files with test(...) calls as jest tests 2019-07-01 10:28:10 +02:00
Esben Sparre Andreasen
5ebcef41fa JS: classify numeric file names as generated 2019-07-01 10:25:38 +02:00
Tom Hvitved
e6e606232d C#: Address review comments 2019-07-01 09:37:15 +02:00
semmle-qlci
ae3a48db58 Merge pull request #1510 from hvitved/csharp/date-queries-remove-precision
Approved by calumgrant
2019-07-01 08:28:08 +01:00
zlaski-semmle
bc98a80efe Merge pull request #1 from jbj/NonConstantFormat-ArrayExpr
C++: NonConstantFormat taint only for string types
2019-06-28 12:03:31 -07:00
yh-semmle
a0dc84010a Merge pull request #1518 from Semmle/rc/1.21
Merge rc/1.21 into master
2019-06-28 13:52:18 -04:00
Arthur Baars
af68fd4904 Merge pull request #1408 from calumgrant/cs/suppress-null-expr
C#: C#8 Nullable expressions and type annotations
2019-06-28 19:21:46 +02:00
yh-semmle
01028812a9 Merge pull request #1524 from aschackmull/java/dead-lambda
Java: Don't report lambdas (or other anonymous classes) as dead.
2019-06-28 10:48:17 -04:00
Arthur Baars
9197c186e1 Drop: ImportAdditionalLibraries.ql 2019-06-28 15:53:07 +02:00
Tom Hvitved
f91e460869 C#: Introduce inherited CFG completions
When completions are inherited by elements inside `finally` blocks, we previously
threw away the underlying completion. For example, in

```
try
{
    if (b)
        throw new Exception();
}
finally
{
    if (b)
        ...
}
```

the completions for `b` inside the `finally` block are `true` and `throw(Exception)`,
where the latter is inherited from the `try` block, with an underlying `false`
completion. Throwing away the `false` completion meant that we were unable to prune
the `false` edge (Boolean CFG splitting).
2019-06-28 15:41:49 +02:00
Tom Hvitved
8d7ea2f49f C#: Add CFG test that mixes Boolean/finally/catch splitting 2019-06-28 15:41:49 +02:00
Taus
61a196d2d4 Merge pull request #1523 from markshannon/python-speed-up-get-a-child
Python speed up calculation of ControlFlowNode.getAChild()
2019-06-28 15:23:08 +02:00
Calum Grant
8130342062 Merge pull request #1520 from hvitved/csharp/mono-tracing
C#: Generalize `mono` pattern in tracer config
2019-06-28 14:21:35 +01:00
Calum Grant
4d383001ac C#: Address review comment 2019-06-28 14:17:16 +01:00
Calum Grant
a5543699b2 Merge pull request #1460 from hvitved/csharp/cfg-last
C#: Refactor `last` predicate
2019-06-28 14:13:43 +01:00
Taus
fbe7615258 Merge pull request #1512 from markshannon/python-better-handling-decorators
Python: Add opaque 'decorated object' object.
2019-06-28 14:10:49 +02:00
Mark Shannon
8570b4117f Python: Add opaque 'decorated function' for complex decorated functions. Allows finding calls in taint-tracking without contaminating points-to results. 2019-06-28 12:14:10 +01:00
Tom Hvitved
3d4316da1c C#: Address review comments 2019-06-28 13:00:18 +02:00
Anders Schack-Mulligen
a93ecae1ae Java: Don't report lambdas (or other anon classes) as dead. 2019-06-28 12:59:54 +02:00
Taus
8251553771 Merge pull request #1494 from markshannon/python-better-handling-calls-on-edge-of-context
Python: better handling calls on edge of context
2019-06-28 12:39:09 +02:00
Mark Shannon
775214e467 Python speed up calculation of ControlFlowNode.getAChild() 2019-06-28 11:19:25 +01:00
Asger F
aff90b1082 TS: Add a missing semicolon 2019-06-28 10:53:33 +01:00
Asger F
f5569b8b58 TS: Avoid infinite recursion in stringifyType 2019-06-28 10:53:33 +01:00
Tom Hvitved
db565c5a88 C#: Remove false positives in cs/constant-condition 2019-06-28 11:50:53 +02:00
Taus
1b98f248e5 Merge branch 'master' into python-better-handling-calls-on-edge-of-context 2019-06-28 11:27:42 +02:00
Max Schaefer
3c3422e221 JavaScript: Refactor unpromoted-candidate queries to no longer rely on tracked nodes. 2019-06-28 10:25:23 +01:00
Tom Hvitved
4da7a17f4b C#: Add more tests for cs/constant-condition 2019-06-28 11:25:18 +02:00
Taus
fad37bd6c9 Merge pull request #1487 from markshannon/python-tuple-assignment-points-to
Python ESSA dataflow: better handling of tuple unpacking.
2019-06-28 11:05:03 +02:00
Max Schaefer
ff62c56df1 JavaScript: Replace remaining uses of TrackedExpr with type tracking. 2019-06-28 09:21:41 +01:00
Max Schaefer
b3e8103dce JavaScript: Track flow through property getter functions. 2019-06-28 08:51:27 +01:00
Max Schaefer
1c175cbe71 JavaScript: Rename loadStep to basicLoadStep. 2019-06-28 08:51:27 +01:00
Tom Hvitved
051ec83ae0 C#: Generalize mono pattern in tracer config 2019-06-28 09:16:38 +02:00
yh-semmle
0d4ff2d7fe Merge pull request #1513 from aschackmull/java/whitelist-sha512
Java: Add SHA512 to the crypto whitelist.
2019-06-27 19:48:13 -04:00
yh-semmle
0bbc0d966e Merge pull request #1516 from aschackmull/java/http-response-splitting-fp-fix
Java: Add simple sanitizer for java/http-response-splitting.
2019-06-27 19:47:48 -04:00
Pavel Avgustinov
da7591d1f6 Merge pull request #1519 from geoffw0/depkind
CPP: Deprecate Expr.getKind() and Stmt.getKind().
2019-06-27 19:22:57 +01:00
Jonas Jensen
c29ef904e0 Merge pull request #1498 from rdmarsh2/rdmarsh/exprHasNoEffect-defaulted-functions
C++: fix FP with ExprHasNoEffect in defaulted func
2019-06-27 20:10:37 +02:00
Geoffrey White
95ab8cc706 CPP: Add a test of More64BitWaste.ql. 2019-06-27 17:14:46 +01:00
Geoffrey White
5e328908a0 CPP: Modify violation message of NonPortablePrintf.ql for consistency with WrongTypeFormatArguments.ql. 2019-06-27 17:11:37 +01:00
Geoffrey White
5cef0e21c6 CPP: Add a test of NonPortablePrintf.ql. 2019-06-27 16:51:07 +01:00
Taus
2576884667 Merge pull request #1499 from markshannon/python-fix-regex-parsing
Python regex: Fix handling of character sets.
2019-06-27 17:49:21 +02:00
Geoffrey White
65bf778b3a CPP: Deprecate Expr.getKind() and Stmt.getKind(). 2019-06-27 16:15:22 +01:00
Mark Shannon
9c2b506f2d Python points-to: Add clarifying comment on internal object predicate. 2019-06-27 16:13:33 +01:00
Calum Grant
2504754e8e C#: Remove use of deprecated predicates. 2019-06-27 15:35:37 +01:00
semmle-qlci
7ff6d8262d Merge pull request #1514 from hvitved/cil/consistency
Approved by calumgrant
2019-06-27 15:15:43 +01:00
Taus
c0ff67beb7 Merge pull request #1496 from markshannon/python-uninitial-local-fix
Python: Don't report uninitialized locals in unreachable code.
2019-06-27 16:00:07 +02:00
Mark Shannon
fbe20a96dc Python: Add change note for tarslip query. 2019-06-27 14:48:37 +01:00
semmle-qlci
c4cb75eff5 Merge pull request #1508 from xiemaisi/js/fix-MessageEvent-externs
Approved by asger-semmle
2019-06-27 14:32:21 +01:00
semmle-qlci
74ad6e87c1 Merge pull request #1509 from hvitved/csharp/rename-queries
Approved by aibaars, felicity-semmle
2019-06-27 13:37:05 +01:00
Anders Schack-Mulligen
85eac80be9 Java: Add simple sanitizer for java/http-response-splitting. 2019-06-27 14:03:48 +02:00
Tom Hvitved
481bf77d5f CIL: Speedup consistency tests
- Make `InstructionViolation` abstract to avoid computing `getInstructionsUpTo()`
  for all instructions in the database.
- Enable `consistency.ql`, which reports all consistency violations, and remove
  all other specialized tests.
2019-06-27 13:40:07 +02:00
Anders Schack-Mulligen
93646974a6 Java: Add SHA512 to the crypto whitelist. 2019-06-27 13:38:04 +02:00
Asger F
8f4228b7c3 JS: Ignore RemoteFlowSource case due to bad join ordering 2019-06-27 12:23:07 +01:00
Anders Schack-Mulligen
a583f000c1 Java: Fix tests. 2019-06-27 13:20:03 +02:00
semmle-qlci
44bd540c44 Merge pull request #1495 from asger-semmle/array-taint-step
Approved by xiemaisi
2019-06-27 12:16:17 +01:00
Anders Schack-Mulligen
ff45387ead Java: Minor TypeFlow precision improvement and refactor. 2019-06-27 12:42:46 +02:00
Tom Hvitved
ccc30ea650 C#: Update change note 2019-06-27 11:55:31 +02:00
Tom Hvitved
04279531e7 C#: Remove @precision for new date queries
Removing the `@precision` annotation until we know how precise these queries
actually are for projects on LGTM.com.
2019-06-27 10:33:27 +02:00
Tom Hvitved
b6cf13510c C#: Update @name for two queries 2019-06-27 10:22:56 +02:00
Jonas Jensen
d45b4175cb Merge pull request #1497 from geoffw0/dates-5
CPP: General clean up for the new dates queries
2019-06-27 10:20:30 +02:00
semmledocs-ac
31614fd4f4 Merge pull request #1500 from jbj/alistair-codeowners
Add Alistair as code owner for *.qhelp within cpp
2019-06-27 08:32:01 +01:00
semmle-qlci
1c25e17812 Merge pull request #1505 from hvitved/csharp/autoformat
Approved by calumgrant
2019-06-27 08:03:58 +01:00
semmle-qlci
f58c7cc79c Merge pull request #1446 from hvitved/csharp/cached-stages
Approved by calumgrant
2019-06-27 08:03:24 +01:00
Max Schaefer
7565eb263e JavaScript: Update externs for MessageEvent. 2019-06-26 19:12:05 -07:00
Calum Grant
76454ed68a C#: Fix formatting of arrays and NullableTypes 2019-06-26 20:24:56 +01:00
Calum Grant
abf43dabe5 C#: Address review comments. Fix up toStringWithTypes(), and deprecate predicates in TypeParameterConstraints. 2019-06-26 20:24:56 +01:00
Calum Grant
620ecc8128 C#: Address review comments part 1. 2019-06-26 20:24:56 +01:00
Calum Grant
35ecb948fc C#: Fix qltests. 2019-06-26 20:24:55 +01:00
Calum Grant
abe961f094 C#: Remove disabled and not-applicable nullability annotations since they can be deduced. 2019-06-26 20:24:55 +01:00
Calum Grant
d46848ed10 C#: Make Annotations module private. Update comments. 2019-06-26 20:24:55 +01:00
Calum Grant
64534d4a7a C#: Analysis change notes 2019-06-26 20:24:55 +01:00
Calum Grant
b7e8f46172 C#: DB upgrade script. 2019-06-26 20:24:55 +01:00
Calum Grant
f9099653a6 C#: Do not extract type annotations that can be deduced. Put specific_type_parameter_annotation on the side of specific_type_parameter_constraints. 2019-06-26 20:24:55 +01:00
Calum Grant
31655c22f1 C#: Stats update 2019-06-26 20:24:55 +01:00
Calum Grant
4aa1947a23 C#: Implement type annotations for nullability, parameter kinds and method returns. 2019-06-26 20:24:55 +01:00
Tom Hvitved
bd03e7a590 C#: Auto format 2019-06-26 19:32:08 +02:00
semmle-qlci
1a9f3624c2 Merge pull request #1504 from xiemaisi/js/shift-bigint
Approved by asger-semmle
2019-06-26 18:30:48 +01:00
Tom Hvitved
ead50999a3 C#: Remove unused EmptyPasswordInConfigurationFile.config 2019-06-26 19:30:04 +02:00
Geoffrey White
47644b08b2 CPP: Normalize spacing. 2019-06-26 17:19:56 +01:00
Max Schaefer
e35fde322b JavaScript: Teach ShiftOutOfRange about BigInt. 2019-06-26 09:16:34 -07:00
Robert Marsh
8994a5acf1 C++: fix FP with ExprHasNoEffect in defaulted func
This is a workaround for an extractor issue where expressions in a
defaulted function are not always marked as generated. I haven't yet been
able to reproduce the issue in a test case.
2019-06-26 09:11:23 -07:00
Geoffrey White
4326699aa7 CPP: Extend the StrcpyFunction model. 2019-06-26 17:01:15 +01:00
Geoffrey White
39be9c3125 CPP: Use StrcpyFunction model in UsingStrcpyAsBoolean.ql. 2019-06-26 16:51:48 +01:00
Anders Schack-Mulligen
2af3598223 Java: Restrict Object.toString dispatch based on a more closed-world assumption. 2019-06-26 17:42:40 +02:00
Geoffrey White
a7fb2e1261 CPP: More test cases for ArithmeticWithExtremeValues. 2019-06-26 15:38:23 +01:00
Geoffrey White
f8655b1664 CPP: Add a test that uses Function.getAThrownType() and Function.isNoThrow(). 2019-06-26 15:20:46 +01:00
Geoffrey White
e237507208 CPP: Add a reference to the ReturnConstType tests. 2019-06-26 15:20:46 +01:00
Calum Grant
c7983a0d9d Merge pull request #1501 from felicity-semmle/1.21/new-c#-queries
Update C# change notes for 1.21 to mention two new queries
2019-06-26 14:40:14 +01:00
Felicity Chapman
dcbe765e58 Merge pull request #1502 from markshannon/python-pythag-change-note
Python: Add change note for pythagorean query.
2019-06-26 13:49:50 +01:00
Felicity Chapman
637608cae0 Add information on LGTM visibility and fix typo 2019-06-26 13:45:37 +01:00
Mark Shannon
208d313b3f Python: Add comment. 2019-06-26 12:54:43 +01:00
Mark Shannon
1bb003b1dc Python: Add change note for pythagorean query. 2019-06-26 12:03:19 +01:00
Felicity Chapman
9645e48c98 Update C# change notes to mention two new queries 2019-06-26 11:33:37 +01:00
Jonas Jensen
473d4d44a3 Add Alistair as code owner for *.qhelp within cpp 2019-06-26 12:10:22 +02:00
Mark Shannon
347e3f3bd0 Python regex: Fix handling of character sets where first character in set is '['. 2019-06-26 10:55:47 +01:00
Asger F
102fd11e8d JS: Change to queries of @kind metric 2019-06-25 22:12:11 +01:00
Taus
76f8da8986 Merge pull request #1484 from markshannon/python-aggressive-pruning
Python: Use aggressive dead-code elimination when pruning.
2019-06-25 19:17:44 +02:00
Geoffrey White
ac5b62ccff CPP: Update comment in qhelp sample for accuracy and consistency. 2019-06-25 17:26:46 +01:00
Geoffrey White
fe315a9a1c CPP: Make things private. 2019-06-25 17:08:35 +01:00
Geoffrey White
cb80aa3772 CPP: Rename the classes for time structs. 2019-06-25 16:49:25 +01:00
Geoffrey White
2e31f48a7a CPP: Clean up StructFieldAccess. 2019-06-25 16:43:24 +01:00
Asger F
57dac1d0d5 JS: Update test output to reflect new edge relation 2019-06-25 16:41:29 +01:00
Geoffrey White
66dffdde05 CPP: Correct overuse of 'toString'. 2019-06-25 16:38:16 +01:00
Mark Shannon
6f1399be9b Python: Better handle calls on edge of context. 2019-06-25 16:15:39 +01:00
Tom Hvitved
51d093add0 C#: Address review comments 2019-06-25 17:01:48 +02:00
Mark Shannon
7bbe39ef01 Python: Don't report uninitialized locals in unreachable code. 2019-06-25 15:52:48 +01:00
Geoffrey White
bc5fb24371 CPP: Correct overuse of 'matches'. 2019-06-25 15:13:38 +01:00
Geoffrey White
ab543aa0eb CPP: QLDoc pass. 2019-06-25 15:12:27 +01:00
Geoffrey White
627fba81ce CPP: Improve wording of UnsafeArrayForDAysOfYear.ql. 2019-06-25 14:42:18 +01:00
Geoffrey White
db6e2904a8 CPP: Simplify to 'CrementOperation'. 2019-06-25 14:17:20 +01:00
Geoffrey White
51caee67b0 CPP: Update comment so that it no longer contains (incorrect) line numbers. 2019-06-25 14:15:09 +01:00
Asger F
aa4d28028e JS: Add test 2019-06-25 14:15:06 +01:00
Geoffrey White
fa1347f7ef CPP: Remove security tags that haven't been justified. 2019-06-25 14:11:56 +01:00
Asger F
71100bb68a JS: Do not require predecessor to be a SourceNode 2019-06-25 14:03:57 +01:00
Jonas Jensen
d2f8029625 Merge pull request #1492 from geoffw0/exprnoeffectweak
CPP: Fix for 'Expression has no effect' on calls to weak functions
2019-06-25 10:58:28 +02:00
Jonas Jensen
de65dc5501 Merge pull request #1490 from geoffw0/leapyeararith
CPP: Improvements to LeapYear.qll
2019-06-25 10:46:12 +02:00
Max Schaefer
0fa41f7a21 Merge pull request #1493 from chrisgavin/owasp-cheat-sheet
JavaScript: Update link to the OWASP XSS prevetion cheat sheet.
2019-06-24 16:09:02 -07:00
Chris Gavin
bce153648e JavaScript: Update link to the OWASP XSS prevetion cheat sheet. 2019-06-24 23:21:14 +01:00
Geoffrey White
6800abdf23 CPP: Change note. 2019-06-24 22:07:55 +01:00
Geoffrey White
9a0645ac0b CPP: Calls to weak functions should be considered impure. 2019-06-24 22:04:12 +01:00
Geoffrey White
aee2af7ca1 CPP: Add a test of ExprHasNoEffect.ql with a call to a 'weak' function. 2019-06-24 22:01:46 +01:00
Taus
a254a84cca Merge pull request #1489 from markshannon/python-fix-nested-import-stars
Python: fix nested import stars
2019-06-24 17:37:20 +02:00
Geoffrey White
562141759a CPP: Autoformat LeapYear.qll. 2019-06-24 15:20:24 +01:00
Mark Shannon
9bf67e19c2 Python points-to: Fix up some oddities with nested from ... import *. 2019-06-24 15:20:15 +01:00
Geoffrey White
69533a7fd3 CPP: Clean up duplication in Adding365DaysPerYear.ql. 2019-06-24 15:18:29 +01:00
Mark Shannon
a917019915 Python: Add failing tests for undefined variable as value and nested 'from import *'. 2019-06-24 14:54:25 +01:00
Geoffrey White
7fca220eda CPP: Fix UncheckedLeapYearAfterYearModification FPs. 2019-06-24 11:21:48 +01:00
Esben Sparre Andreasen
4f9a7d0b71 JS: updated expected output for different SnakeYaml version 2019-06-24 09:24:12 +02:00
Asger F
207ed1e14a JS: Add query for measuring call graph quality 2019-06-24 01:01:13 +01:00
Max Schaefer
a417884173 JavaScript: Fix potential null-pointer exception in YAML extractor.
`ScalarEvent.getStyle()` is documented as returning `null` for plain
scalars, so we need to handle that specially (cf
https://github.com/Semmle/ql/blob/master/javascript/ql/src/semmle/javascript/YAML.qll#L100
for the corresponding code in the library, which expects plain style to
be encoded as zero).
2019-06-23 21:56:02 +02:00
Geoffrey White
cff3f9bdaf CPP: Add another test case based on a real world case. 2019-06-21 17:43:17 +01:00
Mark Shannon
9d6df78d44 Python: Dataflow: Remove IterationDefinition ESSA definition and add iteration assignment to ESSA assignment definition.
Enhance points-to and taint-tracking to add operational step sequence to next(iter(seq)) in for statement.
2019-06-21 15:55:27 +01:00
Geoffrey White
b1f6294083 CPP: Add a test case where a date is created. 2019-06-21 14:32:44 +01:00
Esben Sparre Andreasen
6885b5cf1f JS: fix yaml StringIndexOutOfBoundsException 2019-06-21 15:18:56 +02:00
Taus
1c91b926a8 Merge pull request #1482 from markshannon/python-fix-odasa-7104
Backport #1407 to rc/1.21
2019-06-21 15:05:32 +02:00
Taus
927d72414b Merge pull request #1483 from markshannon/merge-121
Merge rc/1.21 into master
2019-06-21 14:11:07 +02:00
Mark Shannon
a5f741e504 Python: Use aggressive dead-code elimination when pruning. 2019-06-21 13:03:36 +01:00
Geoffrey White
09b33bc1a7 CPP: Adjust file name case for consistency. 2019-06-21 12:53:04 +01:00
Geoffrey White
1a7269b206 CPP: Rename the test subdirectories. 2019-06-21 12:51:25 +01:00
semmle-qlci
59dd3b2fb7 Merge pull request #1477 from asger-semmle/ts-debug-failure-in-tsconfig
Approved by xiemaisi
2019-06-21 12:45:13 +01:00
Taus
832abc7835 Merge pull request #1473 from markshannon/python-points-to-more-unknowns
Python: Fix getOperand for 'not' node and make sure it can only point-to a boolean.
2019-06-21 11:03:23 +02:00
Mark Shannon
26f870bc7f Merge branch 'rc/1.21' into master 2019-06-21 09:52:44 +01:00
Mark Shannon
bbf25f3a23 Python points-to. If __all__ is overly complex, treat all 'public' symbols as exported. 2019-06-21 09:47:50 +01:00
semmle-qlci
4d779026d2 Merge pull request #1479 from xiemaisi/js/remove-circularity
Approved by asger-semmle
2019-06-21 09:03:13 +01:00
semmle-qlci
eccf153d86 Merge pull request #1481 from xiemaisi/js/fix-yaml-extractor-npe
Approved by asger-semmle
2019-06-20 21:10:22 +01:00
Max Schaefer
4370f25b32 JavaScript: Remove dependency of module import on globalVarRef. 2019-06-20 21:08:34 +01:00
Max Schaefer
544a55dd0e JavaScript: Fix potential null-pointer exception in YAML extractor.
`ScalarEvent.getStyle()` is documented as returning `null` for plain
scalars, so we need to handle that specially (cf
https://github.com/Semmle/ql/blob/master/javascript/ql/src/semmle/javascript/YAML.qll#L100
for the corresponding code in the library, which expects plain style to
be encoded as zero).
2019-06-20 17:04:47 +01:00
Jonas Jensen
cace411974 C++: NonConstantFormat taint only for string types
To speed up the taint analysis in `NonConstantFormat.ql` and to remove
FPs that were due to taint spreading from `i` to `a[i]`, this commit
stops the taint tracking in `NonConstantFormat.ql` at every node that
could not possibly contain a string.

I tested performance on Wireshark, and it's fine. Pulling out the
`isSanitizerNode` prevented `isSanitizer` from turning into four
half-slow RA predicates due to both CPE and `#antijoin_rhs`
transformations happening.
2019-06-20 15:39:47 +02:00
Jonas Jensen
364100f043 Merge pull request #1480 from geoffw0/time
CPP: Speed up StructWithExactEraDate.ql
2019-06-20 15:27:52 +02:00
Taus
524a184fdb Merge pull request #1478 from markshannon/python-loop-unrolling-prepare
Python : Prepare for loop unrolling in extractor
2019-06-20 15:01:54 +02:00
Jonas Jensen
e99c68885c C++: Demonstrate ArrayExpr FP 2019-06-20 14:00:42 +02:00
Geoffrey White
0e69063e3c CPP: Restore the query precision. 2019-06-20 12:39:16 +01:00
Geoffrey White
936afadc43 CPP: Speed up StructWithExactEraDate.ql. 2019-06-20 12:21:06 +01:00
Ellen Arteca
99c32f08fb JavaScript: Recognize imports from TypeScript type annotations 2019-06-20 10:45:30 +01:00
Mark Shannon
eb23c11142 Python: Fix ForNode class to support loop unrolling. 2019-06-20 10:41:55 +01:00
Calum Grant
a3d5d2c8e4 Merge pull request #1345 from denislevin/denisl/cs/MishandlingJapaneseDatesAndLeapYear
C#: Japanese Era and Leap Year checks (Likely Bugs)
2019-06-20 10:21:26 +01:00
Arthur Baars
8b58b80e5f Merge pull request #1453 from markshannon/python-remove-redundant-override
Python: Remove redundant override.
2019-06-19 19:00:52 +02:00
Arthur Baars
d4bbb0f21f Merge pull request #1474 from yh-semmle/java-dbscheme-diagnostics-rc
Java: add compilation/diagnostic relations to dbscheme (rc/1.21)
2019-06-19 18:59:58 +02:00
Calum Grant
3c9c0e943b Merge pull request #1459 from hvitved/csharp/remove-deprecated
C#: Remove deprecated predicates
2019-06-19 17:56:20 +01:00
Calum Grant
07eb0ec5b2 Merge pull request #1462 from hvitved/csharp/controlflowgraph-depr
C#: Remove uses of deprecated `ControlFlowGraph` module
2019-06-19 17:55:04 +01:00
Calum Grant
df2a46eb80 Merge pull request #1468 from hvitved/csharp/extractor-error
C#: Include extractor message in diagnostic queries
2019-06-19 17:47:11 +01:00
Mark Shannon
217214c9e5 Merge pull request #1476 from aeyerstaylor/more-python-performance
Python: Further performance improvements on large databases.
2019-06-19 17:43:51 +01:00
alexet
78bf75544e Python: Improve performance of implicit_submodule_points_to 2019-06-19 16:01:13 +01:00
alexet
6472588569 Python: Remove pointless charpred. 2019-06-19 16:01:13 +01:00
alexet
4d1e4e0261 Python: Add no-inline to force correct join-order. 2019-06-19 16:01:12 +01:00
Taus
85ad89c299 Merge pull request #1292 from markshannon/python-prune-in-ql
Python: Do pruning in QL.
2019-06-19 16:58:27 +02:00
Jonas Jensen
1affd30a5a Merge pull request #1431 from geoffw0/taintedallocfp
CPP: Fix TaintedAllocationSize.ql false positives
2019-06-19 16:27:01 +02:00
Mark Shannon
39b7a69abd Python: Tarslip query: Fix up sanitizers. 2019-06-19 15:00:02 +01:00
Jonas Jensen
ad337de6ce Merge branch 'master' into taintedallocfp 2019-06-19 15:35:09 +02:00
Mark Shannon
2040b010f4 Python: Clarify qldoc. 2019-06-19 14:02:24 +01:00
Mark Shannon
30f2df8ac4 Python: Refactor pruning to be more clearly symmetric and complete. 2019-06-19 13:09:20 +01:00
Asger F
52f31dcb07 TS: Rely on ts.sys.readFile for decoding 2019-06-19 11:57:22 +01:00
Mark Shannon
a15a89206e Python: Fix typos in qhelp file. 2019-06-19 11:48:31 +01:00
Mark Shannon
6f15c84bdc Python: Tarslip query; Add sink for members and sanitizers for tarinfo objects. 2019-06-19 11:48:31 +01:00
Mark Shannon
e14f7ef466 Python: Tarslip query; track info objects and handle sanitization. 2019-06-19 11:48:31 +01:00
Mark Shannon
ea4e263060 Python: Initial version and help of tar-slip (CWE-022) query. 2019-06-19 11:48:31 +01:00
Mark Shannon
5b145edc3f Python: Fix getOperand() for not node and make sure it can only point-to a boolean. 2019-06-19 11:23:02 +01:00
Taus
cb43d27344 Merge pull request #1472 from markshannon/python-taint-through-iterators
Python: Track taint through iteration and iterators including generators.
2019-06-19 11:33:10 +02:00
Taus
b43df7439e Merge pull request #1471 from markshannon/python-no-taint-past-sinks
Python: Don't record taint past sinks.
2019-06-19 11:23:27 +02:00
Jonas Jensen
53d4b2dfc9 Merge pull request #1365 from geoffw0/uninit
CPP: Fix for the 'LoopConditionAlwaysTrueUponEntry' logic
2019-06-19 11:01:57 +02:00
Tom Hvitved
dca27927dc C#: Remove unused PasswordInConfigurationFile.config 2019-06-19 10:57:14 +02:00
yh-semmle
f8f217be31 Java: add db stats for compilation/diagnostic relations 2019-06-19 10:44:30 +02:00
yh-semmle
b31b8b2403 Java: add compilation/diagnostic relations to dbscheme 2019-06-19 10:44:30 +02:00
Taus
bc7e6af979 Merge pull request #1463 from markshannon/python-no-duplicate-modules
Python: Avoid duplicate modules in points-to and resulting blow-up.
2019-06-19 10:35:26 +02:00
Jonas Jensen
9d18b351cc Merge pull request #1469 from geoffw0/av95perf
CPP: Fix AV Rule 95 performance issue.
2019-06-19 10:32:57 +02:00
Taus
7ea4b6a52f Merge pull request #1465 from markshannon/python-performance-tweaks
Python: Minor performance enhancements.
2019-06-19 10:28:10 +02:00
Jonas Jensen
0b891013a4 Merge pull request #1466 from geoffw0/castarrayperf
CPP: Resolve performance issue in CastArrayPointerArithmetic.ql
2019-06-19 10:23:23 +02:00
Denis Levin
aab4351efb A few more changes from code review 2019-06-18 17:49:48 -07:00
Jonas Jensen
ba3ec500fd Merge pull request #1467 from geoffw0/dates-cleanup1
CPP: Follow-up for Mishandling Japanese Era and Leap Year in calculations
2019-06-18 20:13:33 +02:00
Mark Shannon
e8190d9a7b Python: Track taint through 'yield' expressions. 2019-06-18 16:39:52 +01:00
Mark Shannon
97c98f29e4 Python taint-tracking: Support iterables of taint. 2019-06-18 16:39:47 +01:00
Mark Shannon
918bdecba5 Python: Don't record taint past sinks. 2019-06-18 16:34:23 +01:00
Geoffrey White
659fa477df CPP: Change note. 2019-06-18 16:12:08 +01:00
Geoffrey White
98d80deefb CPP: Improved solution (mostly performance). 2019-06-18 15:56:22 +01:00
Geoffrey White
47ff38ef22 CPP: Add a warning to getFollowingStmt. 2019-06-18 15:56:22 +01:00
Geoffrey White
ef3ceb5910 CPP: Don't use getFollowingStmt. 2019-06-18 15:56:22 +01:00
Geoffrey White
536adaae7f CPP: Additional test cases. 2019-06-18 15:56:22 +01:00
Geoffrey White
52b68a77bd CPP: Remove commented out code. 2019-06-18 15:56:22 +01:00
Geoffrey White
56adcff2c9 CPP: Fix for LocalScopeReachability. 2019-06-18 15:56:22 +01:00
Geoffrey White
f4b4ddbdaf CPP: Add a test examining the LoopEntryConditionEvaluator on this code. 2019-06-18 15:56:22 +01:00
Geoffrey White
12bbb0755f CPP: Additional test cases. 2019-06-18 15:56:22 +01:00
Geoffrey White
6cca2d54f4 CPP: Autoformat. 2019-06-18 13:26:54 +01:00
Geoffrey White
717522f469 CPP: Fix qhelp more. 2019-06-18 13:00:41 +01:00
Calum Grant
196ad7613f Merge pull request #1464 from hvitved/csharp/netcoreapp2.2
C#: Update to `netcoreapp2.2`
2019-06-18 12:56:44 +01:00
Geoffrey White
fb5d02a634 CPP: Remove a redundant line. 2019-06-18 11:40:12 +01:00
Geoffrey White
bdb495d58a CPP: Fix AV Rule 95 performance issue. 2019-06-18 11:25:48 +01:00
Tom Hvitved
5443f74660 C#: Reintroduce deprecated ControlFlowGraph module 2019-06-18 11:44:12 +02:00
Tom Hvitved
70c5e39c5d C#: Include extractor message in diagnostic queries 2019-06-18 11:01:26 +02:00
Geoffrey White
83ec5f1ae9 Merge pull request #1354 from denislevin/denisl/cpp/MishandlingJapaneseDatesAndLeapYear
C++: Mishandling Japanese Era and Leap Year in calculations
2019-06-18 09:26:35 +01:00
Geoffrey White
b9a57a46d2 CPP: More accurate qldoc comment. 2019-06-18 08:56:52 +01:00
Tom Hvitved
a1d7382a67 C#: Update expected test output 2019-06-17 20:07:54 +02:00
Mark Shannon
62591e469e Python: Avoid duplicate modules in points-to and resulting blow-up. 2019-06-17 17:53:17 +01:00
Geoffrey White
ce29047840 CPP: Resolve performance issue in CastArrayPointerArithmetic.ql's 'introducesNewField' predicate. 2019-06-17 16:33:48 +01:00
Tom Hvitved
5cc11ba232 C#: Update nuget packages 2019-06-17 13:26:11 +02:00
Tom Hvitved
d333ffb57a C#: Update to netcoreapp2.2 2019-06-17 13:21:00 +02:00
Geoffrey White
413788ae2d CPP: Fix qhelp. 2019-06-17 11:55:24 +01:00
Tom Hvitved
f408a6ddfc Merge pull request #1404 from calumgrant/cs/dispose-not-called-on-throw
C#: Improvement to cs/dispose-not-called-on-throw
2019-06-17 11:25:16 +02:00
Geoffrey White
415655ac23 CPP: Remove precision (for now) from a query that I've seen time out. 2019-06-17 10:07:34 +01:00
Geoffrey White
df230d2ba6 CPP: Make precision/severity more conservative for now. 2019-06-17 10:07:32 +01:00
Geoffrey White
93c4f1eea5 CPP: Autoformat. 2019-06-17 10:07:22 +01:00
Tom Hvitved
e70f17f260 C#: Remove uses of deprecated ControlFlowGraph module 2019-06-17 10:23:23 +02:00
semmle-qlci
03cf8ef94f Merge pull request #1422 from hvitved/csharp/switch-expr-completion
Approved by calumgrant
2019-06-17 08:33:43 +01:00
Tom Hvitved
97d2813666 C#: Refactor last predicate
- Split up the `last` predicate into a non-recursive part `lastNonRec` and a recursive
  part `last`.
- Almost all syntactic constructs have a very simple `last` definition; a set of
  disjuncts with exactly one recursive call -- those are defined in `lastNonRec`.
- `try` statements and (last) `catch` clauses require multiple recursive calls in
  the same disjunct, and are therefore handled in the `last` predicate (as before).
- The benefit is that we only need to take care of the join order in the recursive
  call (for non-`try`/`catch` statements) in one place (the predicate `lastRec`),
  so we can get rid of many `nomagic`'ed `last`-specialisations.
2019-06-17 09:28:56 +02:00
Denis Levin
da2422cb17 Addressed code review comments 2019-06-14 18:25:17 -07:00
Denis Levin
6a05c84282 Merge pull request #3 from geoffw0/dates-fix
CPP: Fixes for C++: Mishandling Japanese Era and Leap Year in calculations #1354
2019-06-14 11:21:52 -07:00
Mark Shannon
f29dfa5112 Python: Add clarifying comment and pragma. 2019-06-14 16:57:32 +01:00
Calum Grant
1e7ce8cd31 Merge pull request #1451 from hvitved/csharp/element-preds
C#: Move two predicates from `csharp/Element.qll` to `dotnet/Element.qll`
2019-06-14 16:21:28 +01:00
Mark Shannon
a5fbbdeaf1 Python: Minor performance enhancements. 2019-06-14 16:16:06 +01:00
Geoffrey White
8ebc0b9c39 CPP: Add basic .qhelp for Adding365daysPerYear.ql. 2019-06-14 14:25:02 +01:00
Geoffrey White
f1b76be57f CPP: Fix LeapYear.qhelp. 2019-06-14 14:25:01 +01:00
yh-semmle
87ebc178cc Merge pull request #1457 from felicity-semmle/1.21/java-ecj-support
Java 1.21: clarify ECJ support
2019-06-14 07:38:39 -04:00
Taus
584b0a36ad Merge pull request #1458 from markshannon/fix-typo
Python: Fix 2 typos.
2019-06-14 13:33:39 +02:00
Taus
51e06376a3 Merge pull request #1456 from markshannon/python-remove-value-get-source
Python: Remove Value.getSource(). It has no use.
2019-06-14 13:33:08 +02:00
Tom Hvitved
f56c1df732 C#: Remove deprecated predicates 2019-06-14 13:26:24 +02:00
Mark Shannon
91efce92bd Python: Fix 2 typos. 2019-06-14 11:49:15 +01:00
Mark Shannon
1d269b0cd5 Python: Add extra test for pruning. 2019-06-14 09:59:28 +01:00
Felicity Chapman
f6aa9b648b Add footnote about the Maven Compiler and Takari Lifecycle plugins 2019-06-14 08:56:42 +01:00
Jonas Jensen
41d5d5ab86 Merge pull request #1438 from geoffw0/assignedvalue
CPP: Support for aggregate initializers in getAnAssignedValue()
2019-06-14 00:37:46 -07:00
Denis Levin
7ff8fcd50e Some more typo fixes and a fix to test files 2019-06-13 17:16:30 -07:00
Denis Levin
ad489db815 Corrections related to the review comments. 2019-06-13 13:04:42 -07:00
Mark Shannon
30e1cbc5fc Python: Remove Value.getSource(). It has no use. 2019-06-13 18:23:54 +01:00
Mark Shannon
00fa80346b Python (pruning): Fix up handling of integer inequality. 2019-06-13 18:20:15 +01:00
Mark Shannon
a3d50e88cd Python (pruning): Refactor a bit and all comments for clarity. 2019-06-13 17:42:53 +01:00
Mark Shannon
e1fb1d27a1 Python: Fix logic in pruning for tests like 'x != 0' as that does not imply that 'x is None' is false. 2019-06-13 17:26:43 +01:00
Geoffrey White
37a1c48071 CPP: Optimize AV Rule 71.ql. 2019-06-13 15:30:56 +01:00
Max Schaefer
b9703b70ed Merge pull request #1452 from markshannon/merge-121
Merge rc/1.21 into master.
2019-06-13 15:05:09 +01:00
Calum Grant
8354f813f7 Merge pull request #1419 from hvitved/csharp/stubs
C#: Improvements to `Stubs.qll`
2019-06-13 14:17:24 +01:00
Taus
635de7cbe9 Merge pull request #1440 from markshannon/python-sanity-improvements
Python sanity improvements
2019-06-13 14:59:43 +02:00
Mark Shannon
660eda9f81 Python: Remove redundant override. 2019-06-13 12:41:56 +01:00
Mark Shannon
77030c4dde Merge branch 'rc/1.21' into 'master' 2019-06-13 12:32:45 +01:00
Mark Shannon
4a4ed69ade Python: Make sure that all Modules and ModuleObjects (even unused packages) have a working toString(). 2019-06-13 12:22:38 +01:00
Tom Hvitved
8c8929a702 C#: Move two predicates from csharp/Element.qll to dotnet/Element.qll 2019-06-13 13:00:18 +02:00
semmle-qlci
8a43fdc806 Merge pull request #1448 from xiemaisi/js/fix-access-paths-perf-regression
Approved by esben-semmle
2019-06-13 10:13:27 +01:00
semmle-qlci
bffc3307b5 Merge pull request #1450 from esben-semmle/js/classify-json-js-as-generated
Approved by xiemaisi
2019-06-13 09:45:37 +01:00
Anders Schack-Mulligen
37931a92e2 Merge pull request #1383 from yh-semmle/java-dbscheme-diagnostics
Java: add compilation/diagnostic relations to dbscheme
2019-06-13 10:13:40 +02:00
yh-semmle
32f48f4351 Java: add db stats for compilation/diagnostic relations 2019-06-12 17:21:35 -04:00
yh-semmle
ca7a5b3926 Java: add compilation/diagnostic relations to dbscheme 2019-06-12 17:21:34 -04:00
semmle-qlci
7332446ee1 Merge pull request #1444 from esben-semmle/js/express-node-inheritance
Approved by xiemaisi
2019-06-12 21:43:44 +01:00
semmle-qlci
913544600a Merge pull request #1449 from xiemaisi/js/fix-http-response-sink-perf-regression
Approved by esben-semmle
2019-06-12 21:36:23 +01:00
Ziemowit Laski
88a39d9454 [CPP-370] Fix up // GOOD and // BAD test annotations so that they're consistent. 2019-06-12 12:56:11 -07:00
Taus
e1b61d3163 Merge pull request #1423 from markshannon/python-extend-api
Python: Extend the object API.
2019-06-12 17:24:20 +02:00
Max Schaefer
60964efce5 JavaScript: Avoid bad context pushing in ReflectedXss::HttpResponseSink. 2019-06-12 16:20:35 +01:00
Tom Hvitved
946be967f8 C#: Break up a big cached stage into multiple stages
- Add `Caching.qll` for controlling caching across multiple files.
- Move `isUncertainRefCall()` out of cached module in `Assignable.qll` to avoid
  collapsing with CFG stage.
- Remove dependency on `AlwaysNullExpr` in `NullValue::getAnExpr()` to avoid
  collapsing with CFG stage.
- Avoid caching pre-SSA library as it should only be used during the CFG construction
  stage.
2019-06-12 16:05:45 +02:00
Mark Shannon
97294e16e0 Python: Update tests to account for improved API. 2019-06-12 15:00:20 +01:00
Mark Shannon
3b31b9cf58 Python: Extend object API. Clearly differentiate between what an object is called, and what it is named. 2019-06-12 14:59:39 +01:00
yh-semmle
547bd584a0 Merge pull request #1447 from aschackmull/java/equals-type-test
Java: Improve precision of java/unchecked-cast-in-equals
2019-06-12 09:49:18 -04:00
Mark Shannon
0b7d73456e Remove incorrect metadata from test query. 2019-06-12 14:31:21 +01:00
semmle-qlci
42ab0fff4a Merge pull request #1445 from esben-semmle/mb/rc-1.21/06-12
Approved by aschackmull, jbj, xiemaisi
2019-06-12 14:00:33 +01:00
Anders Schack-Mulligen
c199f2e8fe Java: Improve precision of MissingInstanceofInEquals.ql 2019-06-12 14:05:42 +02:00
Tom Hvitved
8e38511aeb C#: Address review comments 2019-06-12 13:21:49 +02:00
Esben Sparre Andreasen
3f11ae7eaa Merge remote-tracking branch 'rc/1.21' into master 2019-06-12 12:57:55 +02:00
Esben Sparre Andreasen
6e022f66c4 JS: formatting of Express and NodeJSLib.qll 2019-06-12 12:45:01 +02:00
Esben Sparre Andreasen
59b7b0757a JS: make Express' res/req extend Node's res/req 2019-06-12 12:45:01 +02:00
Anders Schack-Mulligen
cc70817a61 Merge pull request #1437 from jbj/bb-shortestDistances
C++: use shortestDistances in PrimitiveBasicBlocks
2019-06-12 11:31:07 +02:00
Calum Grant
02875721df C#: Address review comment. 2019-06-12 09:50:03 +01:00
Esben Sparre Andreasen
29f9103b39 JS: classify single-line JSON files as generated 2019-06-12 09:05:12 +02:00
Tom Hvitved
a25acd0128 Merge pull request #1441 from calumgrant/cs/nullable-warning-expressions
C#: Extract SuppressNullableWarning expressions
2019-06-11 19:36:24 +02:00
Taus
83cbad9a9d Merge pull request #1442 from markshannon/python-fixup-six-test-results
Python: fixup test results for https://github.com/Semmle/ql/pull/1433
2019-06-11 17:35:30 +02:00
Mark Shannon
0c02d3deef Python: Fix up expected test results for six test. 2019-06-11 15:44:44 +01:00
Calum Grant
3c7510b44b C#: Analysis change notes. 2019-06-11 15:20:27 +01:00
Calum Grant
d055c85ff0 C#: Exclude case from cs/dispose-not-called-on-throw where the disposable is disposed by a UsingStmt, even when explicitly disposed. 2019-06-11 15:20:27 +01:00
Calum Grant
b9d2fc3380 C#: DB upgrade script and stats. 2019-06-11 15:04:39 +01:00
semmle-qlci
821d8c9dd2 Merge pull request #1436 from yh-semmle/java-android-manifest
Approved by aschackmull
2019-06-11 14:04:21 +01:00
Jonas Jensen
32122e86b0 C++: use plain recursion in PrimitiveBasicBlocks
It's sometimes faster but sometimes up to 2x slower to use plain
recursion here. On the other hand, plain recursion won't run out of Java
heap space, and it won't make unrelated computation slower by forcing
all RAM data out to disk.
2019-06-11 14:30:21 +02:00
Calum Grant
40481fbf9d C#: Make SuppressNullableWarningExpr a nonNullValue, and add a test. 2019-06-11 12:45:50 +01:00
Calum Grant
d48ce859eb C#: Implement nullable warning suppression expressions. 2019-06-11 12:12:29 +01:00
semmle-qlci
7790ac45bd Merge pull request #1409 from esben-semmle/js/more-command-injection
Approved by xiemaisi
2019-06-11 11:59:18 +01:00
semmle-qlci
dbf085a6df Merge pull request #1432 from xiemaisi/js/process-module
Approved by esben-semmle
2019-06-11 11:58:47 +01:00
Geoffrey White
bf680161fd CPP: Optimize. 2019-06-11 11:00:45 +01:00
Taus
d14d31c26e Merge pull request #1410 from markshannon/python-no-methodcall-defs-in-tests
Python ESSA: Remove method-callsite definitions when call is in a test defining a pi-node.
2019-06-11 11:17:16 +02:00
Taus
1ff67f74e1 Merge pull request #1407 from markshannon/python-fix-odasa-7104
Python points-to. Improve handling of socket module.
2019-06-11 11:04:29 +02:00
Jonas Jensen
16b151745b C++: use shortestDistances in PrimitiveBasicBlocks
The use of transitive closure for BB index calculation has been the
cause of an out-of-memory error. This commit switches the calculation to
use the `shortestDistances` HOP, which still has the problem that the
result needs to fit in RAM, but at least the RAM requirements are sure
to be linear in the size of the result. The `shortestDistances` HOP is
already used for BB index calculation for the C++ IR and for C#.

We could guard even better against OOM by switching the calculation to
use manual recursion, but that would undo the much-needed performance
improvements we got from #123.

This change improves performance on Wireshark, which is notorious for
having long basic blocks. When I benchmarked `shortestDistances`
for #123, it was slower than TC. With the current evaluator, it looks
like `shortestDistances` is faster. Performance before was:

    PrimitiveBasicBlocks::Cached::getMemberIndex#ff ................... 9.7s (executed 8027 times)
    #PrimitiveBasicBlocks::Cached::member_step#ffPlus ................. 6.6s
    PrimitiveBasicBlocks::Cached::primitive_basic_block_entry_node#f .. 3.5s
    PrimitiveBasicBlocks::Cached::primitive_basic_block_member#fff .... 2.3s

Performance with this commit is:

    PrimitiveBasicBlocks::Cached::primitive_basic_block_entry_node#f ................................................................... 3.5s
    shortestDistances@PrimitiveBasicBlocks::Cached::primitive_basic_block_entry_node#1@PrimitiveBasicBlocks::Cached::member_step#2#fff . 3s
    PrimitiveBasicBlocks::Cached::primitive_basic_block_member#fff ..................................................................... 963ms
2019-06-11 09:44:50 +02:00
Max Schaefer
70cf32c889 JavaScript: Add a few more tests. 2019-06-11 08:44:14 +01:00
Esben Sparre Andreasen
299d4c6e93 JS: add additional SystemCommandExecutors 2019-06-11 09:38:10 +02:00
semmle-qlci
61f7c78fa9 Merge pull request #1421 from xiemaisi/js/data-flow-tutorial-tests
Approved by esben-semmle
2019-06-11 07:55:47 +01:00
Ziemowit Laski
0f5a4a7089 [CPP-370] Improve handling of _ macros by using taint sanitizers. 2019-06-10 15:50:53 -07:00
yh-semmle
6c9d68d847 Merge pull request #1412 from aschackmull/java/typeflow-basecases
Java: Include two more base cases in TypeFlow to improve virtual dispatch.
2019-06-10 17:23:24 -04:00
Calum Grant
fc0e34100a Merge pull request #1397 from hvitved/csharp/lgtm-alerts-suite
C#: Make `csharp-alerts-lgtm` a stub
2019-06-10 18:24:41 +01:00
Mark Shannon
831850fad9 Merge pull request #1435 from aeyerstaylor/python-points-to-performance
Python: Improve points-to performance on large databases.
2019-06-10 18:11:53 +01:00
yh-semmle
8e6b62a301 Java: add QL library for modeling Android components 2019-06-10 13:00:03 -04:00
yh-semmle
0fb323b5ff Java: add QL library for modeling AndroidManifest.xml files 2019-06-10 12:59:47 -04:00
alexet
f04bc26684 Python: Improve points-to performance on large databases. 2019-06-10 17:12:45 +01:00
Geoffrey White
6a95ca9743 CPP: Change note. 2019-06-10 15:38:32 +01:00
Geoffrey White
a842ed56cf CPP: Integrate and produce full results. 2019-06-10 15:33:12 +01:00
Geoffrey White
e143870b65 CPP: Pavel's sketch implementation. 2019-06-10 15:33:12 +01:00
Mark Shannon
28741dda07 Merge pull request #1433 from aeyerstaylor/faster-python
Python: Improve performance of submodule name computation.
2019-06-10 15:30:09 +01:00
Geoffrey White
2f36d81137 CPP: Add cases for fields. 2019-06-10 15:07:52 +01:00
Geoffrey White
d3f98a5a74 CPP: Create a direct test of Variable.getAnAssignedValue(). 2019-06-10 14:33:14 +01:00
Mark Shannon
c03e8040b5 Merge pull request #1434 from felicity-semmle/merge-121-back
Merge 'rc/1.21' back into 'master'
2019-06-10 12:59:51 +01:00
Felicity Chapman
4999d3e9cc Merge branch 'rc/1.21' into merge-121-back
Conflicts:
	change-notes/1.21/analysis-python.md
2019-06-10 12:31:42 +01:00
Geoffrey White
1f036c3d82 CPP: Change note. 2019-06-10 12:09:44 +01:00
alexet
e66c132bae Python: Improve performance of submodule name computation. 2019-06-10 12:07:31 +01:00
Geoffrey White
3deff9c578 CPP: Fix in dataflow. 2019-06-10 12:01:14 +01:00
Geoffrey White
d51f870053 CPP: Add test cases. 2019-06-10 12:01:13 +01:00
yh-semmle
9c7995961d Merge pull request #1426 from felicity-semmle/1.21/support
Update support info for 1.21
2019-06-10 06:58:20 -04:00
Mark Shannon
dd5cf392de Merge pull request #1430 from felicity-semmle/1.21/python-change-notes
LGTM 1.21: Finalize Python change notes
2019-06-10 11:48:27 +01:00
Felicity Chapman
9b9f257e0a Add a link to a new query on LGTM.com 2019-06-10 11:35:19 +01:00
Felicity Chapman
b242b84764 Remove boilerplate text and fix table formatting 2019-06-10 11:32:34 +01:00
Mark Shannon
0f0dc81291 Python ESSA: Remove method-callsite definitions when call is in a test defining a pi-node. 2019-06-10 11:23:15 +01:00
Felicity Chapman
54a0772821 Merge pull request #1429 from markshannon/python-points-to-change-note
Backport of https://github.com/Semmle/ql/pull/1425
2019-06-10 11:17:03 +01:00
Max Schaefer
b32a037ff2 JavaScript: Refactor a few access path computation predicates. 2019-06-10 11:15:52 +01:00
Mark Shannon
b7141ad998 Python: Clarify change note. 2019-06-10 11:13:25 +01:00
Mark Shannon
ec0c1dc70e Python: Change note for new points-to implementation. 2019-06-10 11:13:25 +01:00
Felicity Chapman
18443e3297 Merge pull request #1425 from markshannon/python-points-to-change-note
Python: Change note for new points-to implementation.
2019-06-10 11:01:04 +01:00
Mark Shannon
ff5e4d1b52 Python: Clarify change note. 2019-06-10 10:56:28 +01:00
Arthur Baars
f7620aec37 Merge pull request #1424 from markshannon/python-points-to-varargs
Backport of #1391
2019-06-07 19:54:56 +02:00
Felicity Chapman
6bfbd77326 Update description of C# 8 support 2019-06-07 17:51:13 +01:00
Nick Rolfe
2622df0262 Merge pull request #1411 from ian-semmle/qlcfg3
C++: QL CFG: Use synthetic_destructor_call table rather than SyntheticDestructorCalls
2019-06-07 16:22:24 +01:00
Geoffrey White
ab507aa3d1 Merge pull request #1400 from jbj/suspicious-pointer-scaling_medium
C++: Suspicious pointer scaling: @precision medium
2019-06-07 16:13:48 +01:00
Felicity Chapman
74ea09a36e Merge pull request #1418 from markshannon/extractor-change-notes
Add missing extractor change notes for 1.21.
2019-06-07 16:02:25 +01:00
Jonas Jensen
de4c20e7ca Merge pull request #1413 from felicity-semmle/1.21/cpp-change-notes
QL1.21: Finalize change notes for C/C++
2019-06-07 07:58:32 -07:00
Felicity Chapman
9fb31c65d9 Update support info for 1.21 2019-06-07 15:51:26 +01:00
Mark Shannon
880ce3dc04 Python: Change note for new points-to implementation. 2019-06-07 15:44:50 +01:00
Mark Shannon
2fab40111b Fix typo in qldoc. 2019-06-07 15:31:17 +01:00
Mark Shannon
cd793091ca Python points-to: Make sure that vararg tuples are only assigned to vararg parameters. 2019-06-07 15:31:17 +01:00
Mark Shannon
de39f9208b Python: Clarify and document points-to and object model for calls involving starargs. 2019-06-07 15:31:17 +01:00
Mark Shannon
9e537a76dc Python points-to: Handle varargs in caller 2019-06-07 15:31:17 +01:00
Mark Shannon
468975b0e5 Python points-to: Handle varargs in callee. 2019-06-07 15:31:17 +01:00
Felicity Chapman
1a97936d5c Further corrections 2019-06-07 15:21:45 +01:00
Mark Shannon
80909687d3 Python extractor change notes: Rephrase for clarity. 2019-06-07 15:09:22 +01:00
Max Schaefer
394e306e05 Merge pull request #1420 from felicity-semmle/1.21/javascript-change-notes
QL 1.21: javascript change notes - rc/1.21 branch
2019-06-07 14:43:31 +01:00
Tom Hvitved
17aad4b0a5 C#: Fix CFG for switch expressions in Boolean/nullness contexts 2019-06-07 15:39:33 +02:00
Tom Hvitved
e538d8e9ac C#: Add CFG tests for switch expression in Boolean/nullness context 2019-06-07 15:39:28 +02:00
Max Schaefer
398ee0c133 JavaScript: Add tests for data-flow tutorial. 2019-06-07 14:33:26 +01:00
Calum Grant
5e3b625f65 Merge pull request #1414 from felicity-semmle/1.21/csharp-change-notes
QL 1.21: Finalize change notes for C#
2019-06-07 14:27:38 +01:00
Ian Lynagh
46cce36552 C++: Add an upgrade script 2019-06-07 14:00:52 +01:00
Ian Lynagh
fa604a393b C++: Some tidyups following review comments 2019-06-07 14:00:52 +01:00
Ian Lynagh
896e64b987 C++: Update stats 2019-06-07 14:00:52 +01:00
Ian Lynagh
a14379b860 C++: Document external package tables in dbscheme 2019-06-07 14:00:52 +01:00
Ian Lynagh
79b08d2792 C++: Remove SyntheticDestructorCalls
It is now replace by the synthetic_destructor_call table.
2019-06-07 14:00:52 +01:00
Ian Lynagh
03f555dda5 C++: Update test output following QLCFG changes 2019-06-07 14:00:52 +01:00
Ian Lynagh
93afadf09a C++: Add and use synthetic_destructor_call table 2019-06-07 14:00:52 +01:00
Tom Hvitved
7c802ada40 C#: Improvements to Stubs.qll
- Handle keywords.
- Handle `const` fields.
- Handle type parameter constraints.
2019-06-07 14:50:33 +02:00
semmle-qlci
092163aad5 Merge pull request #1417 from felicity-semmle/1.21/javascript-change-notes
Approved by xiemaisi
2019-06-07 12:15:10 +01:00
Felicity Chapman
da9b9edde2 Remove redundant sentence 2019-06-07 12:03:19 +01:00
Mark Shannon
da04086385 Add missing extractor change notes for 1.21. 2019-06-07 12:01:28 +01:00
Felicity Chapman
fe38417765 Update for feedback 2019-06-07 11:54:22 +01:00
Felicity Chapman
53ea76ba48 Update for feedback 2019-06-07 10:51:19 +01:00
Felicity Chapman
e589d12d78 Update change-notes/1.21/analysis-javascript.md
Co-Authored-By: Max Schaefer <max@semmle.com>
2019-06-07 10:25:56 +01:00
Felicity Chapman
012f6adf90 Minor text changes 2019-06-07 09:44:49 +01:00
Anders Schack-Mulligen
64a8daa4b5 Merge pull request #1415 from felicity-semmle/1.21/java-change-notes
QL 1.21: Finalize Java change notes
2019-06-07 09:04:13 +02:00
Jonas Jensen
cf96035d8c C++: Suspicious pointer scaling: @precision medium
This query is not producing good enough results to justify `@precision
high`. It's fundamentally looking for a pattern that should correlate
with memory management errors, but it doesn't look for the errors
themselves.
2019-06-06 21:08:20 -07:00
Felicity Chapman
a4e2593c94 Correct table sort order 2019-06-06 18:53:10 +01:00
Felicity Chapman
5be8576ee2 Minor text updates 2019-06-06 18:48:23 +01:00
Felicity Chapman
eba8abe3d4 Minor text changes 2019-06-06 18:33:56 +01:00
Felicity Chapman
463371aeb9 Merge two rows for one query 2019-06-06 17:52:52 +01:00
Felicity Chapman
2f97aac64a Sort table rows alphabetically 2019-06-06 17:50:17 +01:00
Felicity Chapman
36a6d9ea81 Update text for consistency 2019-06-06 17:45:26 +01:00
Anders Schack-Mulligen
5fed6c78fe Java: Include two more base cases in TypeFlow to improve virtual dispatch. 2019-06-06 14:45:23 +02:00
Max Schaefer
16c33b54b6 JavaScript: Recognise references to the process global. 2019-06-06 11:48:18 +01:00
Taus
58285c08dd Merge pull request #1391 from markshannon/python-points-to-varargs
Python points to varargs
2019-06-05 20:17:01 +02:00
Mark Shannon
03d296a617 Fix typo in qldoc. 2019-06-05 17:54:09 +01:00
Taus
703fbc6976 Merge pull request #1403 from markshannon/python-builtin-inherit
Python points-to: Make sure that builtin-classes inherit attributes.
2019-06-05 17:40:10 +02:00
Max Schaefer
e11406ca90 Merge pull request #1406 from taus-semmle/mergeback-rc/1.21
Merge `rc/1.21` into `master`
2019-06-05 16:33:50 +01:00
Mark Shannon
75f87bbeda Python points-to. If __all__ is overly complex, treat all 'public' symbols as exported. 2019-06-05 14:46:51 +01:00
Taus
f7a092882b Merge pull request #1405 from markshannon/python-fix-import-analysis
Python: Fix up 'import failure' analysis query.
2019-06-05 14:47:09 +02:00
Tom Hvitved
51d6858cd0 Merge pull request #1392 from calumgrant/cs/cs8/static-using-null
C#: More C# 8 features
2019-06-05 14:21:49 +02:00
Mark Shannon
e757bce96e Python: Fix up 'import failure' analysis query. 2019-06-05 12:56:36 +01:00
Mark Shannon
cec4d55b2a Python points-to: Make sure that vararg tuples are only assigned to vararg parameters. 2019-06-05 11:56:17 +01:00
Mark Shannon
8fadb64452 Python points-to: Make sure that builtin-classes inherit attributes. 2019-06-05 11:36:44 +01:00
yh-semmle
a6da4996a7 Merge pull request #1398 from aschackmull/java/switchexpr-guards
Java: Add SwitchExpr support in Guards.qll
2019-06-05 06:35:12 -04:00
semmle-qlci
3789cb2858 Merge pull request #1402 from xiemaisi/js/pwd-in-cfg-file
Approved by esben-semmle
2019-06-05 10:45:18 +01:00
Geoffrey White
98eced973e Merge pull request #1401 from jbj/tostring-performance-1.22
C++: Move `Element.toString` performance change note to 1.22 file
2019-06-05 10:21:01 +01:00
Calum Grant
c88359b9c7 C#: Fix test. 2019-06-05 09:42:48 +01:00
Anders Schack-Mulligen
98c5dc194b Java: Rename to selector as per review comment. 2019-06-05 09:16:12 +02:00
Max Schaefer
d233cea79d JavaScript: Lower precision of PasswordInConfigurationFile.
In spite of recent improvements, this query is still too noisy to show
by default.
2019-06-05 08:09:19 +01:00
Max Schaefer
d723ab76d8 JavaScript: Fix getDelimiterMatchingRegexp to work on multi-line strings. 2019-06-05 08:09:19 +01:00
Max Schaefer
a4876270ec JavaScript: Tweak PasswordInConfigurationFile alerts.
Only highlight first line, and include the password in the alert
message.
2019-06-05 08:09:19 +01:00
Jonas Jensen
9830c69892 C++: Put tostring-performance note in 1.22 file 2019-06-04 20:47:29 -07:00
Jonas Jensen
62246ecdf5 Revert "Add release note blurb about TypeMention.toString()"
This change didn't make into 1.21, so it doesn't belong in this file.

This reverts commit 8c099000d9.
2019-06-04 20:45:35 -07:00
Jonas Jensen
e036cd70e2 Merge pull request #1366 from zlaski-semmle/zlaski/tostring-performance
C++: Improve Element::toString() performance
2019-06-04 20:42:06 -07:00
Ziemowit Laski
8f79cdb1fb [CPP-370] Add an additional test case. 2019-06-04 16:19:01 -07:00
Ziemowit Laski
8c099000d9 Add release note blurb about TypeMention.toString() 2019-06-04 12:57:43 -07:00
Ziemowit Laski
d86557cfcb Adjust .expected output. 2019-06-04 12:57:43 -07:00
Ziemowit Laski
37fe68c656 Improve Element::toString() performance by removing recursion
in TypeMention::toString().
2019-06-04 12:57:43 -07:00
semmle-qlci
601ea22bfd Merge pull request #1399 from xiemaisi/js/metric-types
Approved by esben-semmle
2019-06-04 20:39:02 +01:00
Calum Grant
9678f8eaba C#: Fix control flow graph for using declaration statements. 2019-06-04 18:10:49 +01:00
Calum Grant
20752c80c9 C#: Address review comments 2019-06-04 18:10:49 +01:00
Calum Grant
f1bb8b893b C#: Fix test. 2019-06-04 18:10:49 +01:00
Calum Grant
4b3297ceef C#: Analysis change notes 2019-06-04 18:10:49 +01:00
Calum Grant
73c2898666 C#: Minor edits. 2019-06-04 18:10:49 +01:00
Calum Grant
5679a72f37 C#: DB Upgrade script 2019-06-04 18:10:49 +01:00
Calum Grant
d6fac7bfb7 C#: Delete file. 2019-06-04 18:10:49 +01:00
Calum Grant
fa89d2b845 C#: Update stats and test output. 2019-06-04 18:10:49 +01:00
Calum Grant
923fbe4c9e C#: Implement QL model for using declarations, introducing UsingBlockStmt and a UsingDeclStmt. 2019-06-04 18:10:49 +01:00
Calum Grant
15cd1d274a C#: Implement using declaration statements. 2019-06-04 18:10:49 +01:00
Calum Grant
ac3a06f77b C#: Implement null coalescing assignment operator 2019-06-04 18:10:49 +01:00
Calum Grant
599a5b1eef C#: Make @local_function @modifiable, make LocalFunction extend Modifiable, and extract modifiers for local functions. 2019-06-04 18:10:49 +01:00
zlaski-semmle
51e543a41d Merge branch 'master' into zlaski/cpp370 2019-06-04 09:47:30 -07:00
Max Schaefer
c09b859aa7 JavaScript: Add three missing @metricType annotations. 2019-06-04 17:17:14 +01:00
Anders Schack-Mulligen
0e12df0a15 Java: Add SwitchExpr support in Guards.qll 2019-06-04 16:03:23 +02:00
Tom Hvitved
ba0aab963f C#: Make csharp-alerts-lgtm a stub 2019-06-04 15:26:16 +02:00
Nick Rolfe
813e1e7c91 Merge pull request #1395 from markshannon/python-remove-obsolete-tests
Python: Remove obsolete tests.
2019-06-04 12:47:21 +01:00
Nick Rolfe
d3c9234a11 Merge pull request #1394 from Semmle/slash-p
C++: add missing close-paragraph tag to qhelp
2019-06-04 12:42:18 +01:00
Mark Shannon
4425302542 Merge pull request #1396 from nickrolfe/big-delete
Remove Python query tests for Architect
2019-06-04 12:34:57 +01:00
Nick Rolfe
b5b7749867 Revert "Remove Python query tests for Architect"
This reverts commit 7c976848ef.
2019-06-04 12:25:38 +01:00
Mark Shannon
441282d8df Python: Remove obsolete tests. 2019-06-04 12:03:53 +01:00
Mark Shannon
53ddfce359 Python: Clarify and document points-to and object model for calls involving starargs. 2019-06-04 11:43:30 +01:00
semmle-qlci
1fa975b4c9 Merge pull request #1393 from xiemaisi/js/concretify
Approved by esben-semmle
2019-06-04 11:34:47 +01:00
Nick Rolfe
8e7521d6b8 C++: add missing close-paragraph tag to qhelp 2019-06-04 11:27:34 +01:00
Mark Shannon
5b0652473d Python points-to: Handle varargs in caller 2019-06-04 10:04:28 +01:00
Mark Shannon
30b340de68 Python points-to: Handle varargs in callee. 2019-06-04 10:03:49 +01:00
Julian Tibble
7c976848ef Remove Python query tests for Architect
These tests referred to QL libraries for a discontinued Semmle product.
2019-06-04 03:10:13 +01:00
semmle-qlci
4bfe89c320 Merge pull request #1370 from hvitved/csharp/is-case-extraction
Approved by calumgrant
2019-06-03 19:32:27 +01:00
Taus
af08f856b5 Merge pull request #1389 from markshannon/python-ipa-objects-fix-performance
Python: New points-to and object model with performance fixes
2019-06-03 18:52:28 +02:00
semmle-qlci
80ff63a3bb Merge pull request #1387 from esben-semmle/js/unanchored-url-regex
Approved by mc-semmle, xiemaisi
2019-06-03 17:27:08 +01:00
Esben Sparre Andreasen
04868e5b97 JS: format qhelp examples 2019-06-03 17:05:19 +02:00
Mark Shannon
fc2ac891f8 Python taint-tracking: Don't track strings through json.decode(). 2019-06-03 15:53:36 +01:00
Esben Sparre Andreasen
9e0a97e82f JS: address qhelp review comments 2019-06-03 16:39:39 +02:00
Tom Hvitved
2d0554a7ee C#: Address review comments 2019-06-03 16:00:22 +02:00
Tom Hvitved
f95dd6bb35 Guard tests 2019-06-03 16:00:22 +02:00
Tom Hvitved
25cb01ffea C#: Handle discard variable declarations in switch expressions 2019-06-03 15:50:41 +02:00
Tom Hvitved
8c1cab2d03 C#: Simplify extraction of is expressions and case statements 2019-06-03 15:50:41 +02:00
Esben Sparre Andreasen
bf51c54338 JS: add RegExpPatternSource::getAParse to hide the subclasses 2019-06-03 14:23:22 +02:00
Esben Sparre Andreasen
7b652214c5 JS: address docstring comments 2019-06-03 13:59:39 +02:00
Mark Shannon
6a79e0aaa7 Python points-to: Prevent bad magic on 'refersTo' member predicates. 2019-06-03 12:22:22 +01:00
Mark Shannon
8d4a8a6c6b Python: Reduce the number of strings and ints identified and possible hard-coded credentials. 2019-06-03 12:22:15 +01:00
semmle-qlci
bd1920c948 Merge pull request #1390 from xiemaisi/js/shrink-configurations
Approved by esben-semmle
2019-06-03 12:05:09 +01:00
Jonas Jensen
ab6221d48e Merge pull request #1388 from Semmle/xiemaisi-patch-1
CPP: Fix name of example file in qhelp.
2019-06-03 13:00:25 +02:00
Calum Grant
032a6b1c7c Merge pull request #1375 from hvitved/csharp/switch-expr-guard
C#: Switch expression guards
2019-06-03 11:15:10 +01:00
Max Schaefer
d8a101df6d JavaScript: Shrink Configurations.qll some more. 2019-06-03 10:32:25 +01:00
Max Schaefer
5f32e1f637 CPP: Fix name of example file in qhelp.
This seems to have been missed in https://github.com/Semmle/ql/pull/1315.
2019-06-03 08:54:54 +01:00
Esben Sparre Andreasen
14644270ac JS: fix comment typo 2019-06-03 08:32:35 +02:00
Esben Sparre Andreasen
7018a38691 JS: improve tests and regexp for js/regex/missing-regexp-anchor 2019-06-03 08:29:52 +02:00
Esben Sparre Andreasen
3289c629f7 JS: address minor review comments 2019-06-03 08:29:52 +02:00
Esben Sparre Andreasen
0fa73b8331 JS: add query js/regex/missing-regexp-anchor 2019-06-03 08:29:52 +02:00
Esben Sparre Andreasen
69db54a03a JS: add anchors to js/incomplete-hostname-regexp examples 2019-06-03 08:27:49 +02:00
Esben Sparre Andreasen
3358e49698 JS: refactor the predicate RegExp::regexp to three classes.
This preserves the ad hoc message formatting in IncompleteHostnameRegExp.ql
2019-06-03 08:27:49 +02:00
Esben Sparre Andreasen
98ae2597bb JS: refactor IncompleteHostnameRegExp::regexp to RegExp.qll 2019-06-03 08:27:49 +02:00
semmle-qlci
79406f8387 Merge pull request #987 from rdmarsh2/rdmarsh/cpp/ir-asm-stmt
Approved by dave-bartolomeo
2019-06-03 07:03:28 +01:00
Jonas Jensen
c9a0eed6e8 Merge pull request #1379 from geoffw0/ctime-repair
CPP: Add DangerousFunctionOverflow.ql to the security suite.
2019-06-02 09:56:01 +02:00
Robert Marsh
4371d02a1f C++: accept SignAnalysis.expected 2019-05-31 13:35:05 -07:00
Robert Marsh
5dd8c9cd4e C++: revert InlineAsm subclassing SideEffectOpcode 2019-05-31 13:28:26 -07:00
Robert Marsh
2770b2a9b9 C++: respond to PR comments 2019-05-31 13:19:40 -07:00
Robert Marsh
98d6f5919f C++: Treat asmStmt operands as input/output in IR 2019-05-31 12:51:44 -07:00
Robert Marsh
66d1efdb97 C++: respond to PR comments 2019-05-31 12:42:04 -07:00
Dave Bartolomeo
0bfc559cb1 Apply suggestions from code review
Co-Authored-By: rdmarsh2 <rdmarsh2@gmail.com>
2019-05-31 12:29:23 -07:00
Robert Marsh
23560436a7 C++: add minimal AsmStmt support to IR 2019-05-31 12:29:19 -07:00
semmle-qlci
3851261230 Merge pull request #1378 from jbj/hasQualifiedName-inline-namespace
Approved by dave-bartolomeo
2019-05-31 19:39:42 +01:00
semmle-qlci
c0440cf7f5 Merge pull request #1386 from asger-semmle/prototype-change-note
Approved by xiemaisi
2019-05-31 19:30:30 +01:00
semmle-qlci
d741e0b20c Merge pull request #1382 from jbj/redundant-null-check-gvn
Approved by dave-bartolomeo
2019-05-31 16:28:01 +01:00
Mark Shannon
66ba1079f3 Python points-to: Cache objects. 2019-05-31 16:26:43 +01:00
Mark Shannon
f6cc0be4a4 Python points-to. Move extension to prevent points-to being recomputed. 2019-05-31 16:26:43 +01:00
Mark Shannon
f311c2013e Python points-to: Cache a few key predicates. 2019-05-31 16:26:43 +01:00
Mark Shannon
1de0dc9282 Python taint-tracking: Fix performance of pathalogically slow predicate. 2019-05-31 16:26:43 +01:00
Mark Shannon
b182abd119 Python points-to: Fix up a number of overly slow predicates. 2019-05-31 16:26:43 +01:00
Mark Shannon
8e2d6c4fc6 Python points-to: Simplify logic w.r.t. comparisons. 2019-05-31 15:58:35 +01:00
Max Schaefer
c560096b17 JavaScript: Make Script and CodeInAttribute concrete. 2019-05-31 12:04:14 +01:00
Asger F
a4a9e951d5 JS: Add query ID to change note 2019-05-31 11:44:06 +01:00
Asger F
ffb3265b26 JS: Mention results are shown on LGTM 2019-05-31 11:35:35 +01:00
Asger F
5170fa2ded JS: Add change note for prototype pollution 2019-05-31 10:58:56 +01:00
semmle-qlci
653c8b8496 Merge pull request #1358 from AlexTereshenkov/master
Approved by taus-semmle
2019-05-31 10:16:44 +01:00
Max Schaefer
74688bb600 Merge pull request #1341 from esben-semmle/js/sync-suites
JS: Add queries to the manual suite for LGTM constistency
2019-05-31 08:18:08 +01:00
Jonas Jensen
fff6c386c9 Merge pull request #1381 from dave-bartolomeo/dave/CopyCtor
C++: Make `constructor-used-as-copy-constructor` warning/low
2019-05-31 09:15:37 +02:00
Max Schaefer
3097037a6f Merge pull request #1290 from esben-semmle/js/semver-lib
JS: add SemVer library
2019-05-31 08:09:24 +01:00
Calum Grant
5b8c6d4789 Merge pull request #1377 from hvitved/csharp/useless-upcast
C#: Teach `cs/useless-upcast` about disambiguating constructor calls
2019-05-31 06:51:39 +01:00
Robert Marsh
6167a556fd Merge pull request #1380 from dave-bartolomeo/dave/RangeFor
C++: IR support for range-based `for` loops
2019-05-30 17:21:42 -07:00
semmle-qlci
0fa06e5c8d Merge pull request #1180 from asger-semmle/tainted-path-squashed
Approved by xiemaisi
2019-05-30 17:20:19 +01:00
Mark Shannon
6689994285 Python points-to: Minor refactoring for clarity. 2019-05-30 17:18:16 +01:00
Dave Bartolomeo
f4d41a15d7 C++: Add change not 2019-05-30 08:33:57 -07:00
Dave Bartolomeo
e90403be31 C++: Make constructor-used-as-copy-constructor warning/low
This query is supposed to look for constructors that unintentionally qualify as copy constructors due to default arguments. There are quite a few real-world projects that define such constructors intentionally. I've reduced the severity to "warning" and the precision to "low" due to the high false positive rate.
2019-05-30 08:33:26 -07:00
semmle-qlci
b17eb5cc9d Merge pull request #1384 from asger-semmle/typescript-3.5
Approved by xiemaisi
2019-05-30 15:53:27 +01:00
semmle-qlci
9614a1a039 Merge pull request #1385 from xiemaisi/js/lgtm-yml-change-notes
Approved by mc-semmle
2019-05-30 15:25:49 +01:00
Asger F
be5173680d Merge pull request #2 from xiemaisi/tainted-path-squashed
JavaScript: Update expected test output.
2019-05-30 15:16:19 +01:00
Max Schaefer
a3be6be17d JavaScript: Add change notes for newly added lgtm.yml properties. 2019-05-30 15:11:35 +01:00
Max Schaefer
3c8aea26da JavaScript: Update expected test output. 2019-05-30 15:05:43 +01:00
Asger F
9b28a3adf0 Merge pull request #1 from xiemaisi/tainted-path-squashed
JavaScript: Remove a few more configurations from AllConfigurations.qll.
2019-05-30 13:26:42 +01:00
Max Schaefer
5ac408d641 JavaScript: Remove a few more configurations from AllConfigurations.qll.
This works around BDD node exhaustion we get due to the complex type
hierarchy caused by importing many configurations at once. I've also
renamed the library accordingly.
2019-05-30 13:13:16 +01:00
Asger F
320f484e7e TS: Rephrase change note 2019-05-30 12:48:05 +01:00
Asger F
d6010d7be7 TS: Update supported compiler version range 2019-05-30 12:45:26 +01:00
Asger F
72c0925967 TS: Bump to TypeScript 3.5.1 2019-05-30 11:40:25 +01:00
Geoffrey White
d672a6e13e Merge pull request #1376 from jbj/getName-direct
C++: Use Definition.qll's getName
2019-05-30 10:01:12 +01:00
Jonas Jensen
2b424bfb81 C++: Clarify getAQualifierForMembers 2019-05-30 10:06:35 +02:00
Jonas Jensen
4f304fcbf7 C++: Fix join order in RedundantNullCheckSimple
The join order broke again after the last change.
2019-05-30 09:43:56 +02:00
Jonas Jensen
a61aec9e63 C++: Fix ValueNumbering for CopyInstruction
Querying for overlap type wasn't possible when this library was first
written. This change fixes FPs in `RedundantNullCheckSimple.ql` on
Wireshark and other real-world projects.
2019-05-30 09:42:46 +02:00
Jonas Jensen
120df6054b C++: Demonstrate a FP due to GVN 2019-05-30 09:41:42 +02:00
Jonas Jensen
2e7daf2308 C++: Use GVN in RedundantNullCheckSimple 2019-05-30 09:41:42 +02:00
Dave Bartolomeo
aff85c5b24 C++: IR support for range-based for loops
IR construction was missing support for C++ 11 range-based `for` loops. The extractor generates ASTs for the compiler-generated implementation already, so I had enough information to generate IR. I've expanded on some of the predicates in `RangeBasedForStmt` to access the desugared information.

One complication was that the `DeclStmt`s for the compiler-generated variables seem to have results for `getDeclaration()` but not for `getDeclarationEntry()`. This required handling these slightly differently than we do for other `DeclStmt`s.

The flow for range-based `for` is actually easier than for a regular `for`, because all three components (init, condition, and update) are always present.
2019-05-29 14:40:29 -07:00
Calum Grant
59a006e59e Merge pull request #1368 from hvitved/csharp/cil-nullness
CIL: Account for multiple `VariableUpdate::getSource()`s in nullness analysis
2019-05-29 20:55:08 +01:00
Geoffrey White
665510a13c CPP: Add DangerousFunctionOverflow.ql to the security suite. 2019-05-29 16:36:02 +01:00
alexey
9377638834 Improve query help 2019-05-29 16:28:07 +01:00
alexey
86ec047be2 Rename files by style guide and change query metadata 2019-05-29 15:35:58 +01:00
Mark Shannon
71ae61c9f7 Python points-to: Remove duplicate import. 2019-05-29 15:02:59 +01:00
Mark Shannon
1ed3e5d9bc Python points-to: Fix ordering of string constants. 2019-05-29 15:02:59 +01:00
Mark Shannon
7181a025f8 Python points-to: Update expected results to account for fixed tuple formatting. 2019-05-29 15:02:59 +01:00
Felicity Chapman
a782585d74 Merge pull request #1374 from jf205/update-readme/sd-3458
docs: add link to style guides in readme
2019-05-29 14:42:46 +01:00
Jonas Jensen
241ef3c873 Merge pull request #1315 from geoffw0/ctime
CPP: Split PotentiallyDangerousFunction.ql
2019-05-29 15:40:34 +02:00
Jonas Jensen
df4c57648c C++: Support inline namespaces in hasQualifiedName 2019-05-29 15:22:42 +02:00
Jonas Jensen
4bb65fddf7 C++: Test that hasQualifiedName/3 ignores inline 2019-05-29 15:22:42 +02:00
Tom Hvitved
abc7cf2ef1 C#: Add change note 2019-05-29 15:18:45 +02:00
Tom Hvitved
6b99e1a1bf C#: Teach cs/useless-upcast about disambiguating constructor calls 2019-05-29 15:16:08 +02:00
Tom Hvitved
d8482083b9 C#: Add tests for disambiguated constructor calls 2019-05-29 15:14:30 +02:00
alexey
96380f6767 Edit query metadata and help and add new entry to the change-notes 1.21 2019-05-29 13:22:35 +01:00
Jonas Jensen
f8644b1023 C++: Use Definition.qll's getName
It turns out we didn't have to move the `getName` implementation into
the mirror classes in `QualifiedName`. Doing so only made it harder for
the optimiser to specialize calls to `getName` on various kinds of
`Declaration`.
2019-05-29 14:18:10 +02:00
Jonas Jensen
b4f19eebdd C++: Revert the getName() changes
This reverts the `getName()` parts of 56e88cbac0 and 0a2e28858a.
2019-05-29 14:15:45 +02:00
Tom Hvitved
884ef4c960 Merge pull request #1362 from calumgrant/cs/cs8/testing
C#: Various small C#8 features
2019-05-29 14:00:43 +02:00
Tom Hvitved
c68dfb9d68 C#: Switch expression guards 2019-05-29 13:50:42 +02:00
james
59bca9026c docs: address review comments 2019-05-29 11:53:53 +01:00
Geoffrey White
6c267f4957 CPP: Fix qhelp. 2019-05-29 10:35:49 +01:00
Geoffrey White
76d18b42b8 CPP: Repair getQualifiedName changes from elsewhere. 2019-05-29 10:35:49 +01:00
Geoffrey White
2e932b6675 CPP: Change notes. 2019-05-29 10:35:49 +01:00
Geoffrey White
eb880c3f9f CPP: Reference URLs. 2019-05-29 10:35:49 +01:00
Geoffrey White
dc44d686d4 CPP: Update CWE tag. 2019-05-29 10:35:49 +01:00
Geoffrey White
34444ace8b CPP: Update the query name and description. 2019-05-29 10:35:49 +01:00
Geoffrey White
2ae38a54af CPP: Adjust query tags. 2019-05-29 10:35:49 +01:00
Geoffrey White
9da2ead1f7 CPP: Remove redundant tests. 2019-05-29 10:35:49 +01:00
Geoffrey White
fc5e7e5e91 CPP: Test the new query. 2019-05-29 10:35:48 +01:00
Geoffrey White
88f363d564 CPP: Update the ql, qhelp and example. 2019-05-29 10:35:48 +01:00
Geoffrey White
1f80dea375 CPP: Clone PotentiallyDangerousFunction query as DangerousUseOfGets. 2019-05-29 10:35:48 +01:00
Geoffrey White
574a1d8501 Merge pull request #1037 from kevinbackhouse/RangeAnalysisAssignAddOverflow
Better overflow detection for AssignAdd/AssignSub
2019-05-29 09:54:06 +01:00
Tom Hvitved
23ce5bc7bf Merge pull request #1353 from calumgrant/cs/diagnostic-queries3
C#: Add internal queries for extractor and compiler diagnostics
2019-05-29 10:26:41 +02:00
Kevin Backhouse
b7ac03d07b Merge pull request #2 from geoffw0/assignadd2
CPP: Minor corrections to: Better overflow detection for AssignAdd/AssignSub
2019-05-29 08:36:29 +01:00
Tom Hvitved
428ad72694 C#: Improve performance of always[Not]NullMethod() 2019-05-29 09:34:54 +02:00
Calum Grant
1b264f73b4 C#: Fix test settings. 2019-05-29 08:15:51 +01:00
Calum Grant
cd41f4f415 C#: Analysis change notes. 2019-05-29 08:15:50 +01:00
Calum Grant
573646fe6a C#: Various C#8 features:
- Async streams (test only)
 - Unmanaged generic structs (extractor support)
 - Alternate interpolated strings (test only)
 - static local function (test only)
2019-05-29 08:12:11 +01:00
semmle-qlci
5bbbd26787 Merge pull request #1372 from xiemaisi/js/fail-if-no-code
Approved by esben-semmle
2019-05-29 08:06:44 +01:00
james
29e46cf347 docs: add link to style guides in readme 2019-05-28 21:33:36 +01:00
Jonas Jensen
b0a7f207e4 Merge pull request #1343 from rdmarsh2/rdmarsh/cpp/getUnspecifiedType
C++: add getUnspecifiedType() for exprs and decls
2019-05-28 20:10:28 +01:00
Calum Grant
85f275ce73 Merge pull request #1347 from hvitved/csharp/dataflow/this-flow
C#: Data flow through `this` parameter
2019-05-28 19:58:01 +01:00
Mark Shannon
77c508f954 Python points-to: More comment clarifications and typo fixes. 2019-05-28 17:52:55 +01:00
Mark Shannon
3adaf07170 Python points-to: Make purpose of '$' variable explicit. 2019-05-28 17:23:24 +01:00
Mark Shannon
66e64615ee Python points-to: Improve qldoc and internal API a bit. 2019-05-28 17:17:05 +01:00
Robert Marsh
b4ef532039 C++: change note for getUnspecifiedType() 2019-05-28 07:58:23 -07:00
Robert Marsh
d20efe49dd C++: respond to PR comments 2019-05-28 07:51:59 -07:00
Max Schaefer
38a38ab780 JavaScript: Make autobuilder fail if no JS/TS code was seen.
In particular, the autobuilder will no longer succeed for projects that
contain HTML or YAML files but no JS/TS code. Further down the line,
this prevents LGTM.com from classifying such projects as "JavaScript"
projects.
2019-05-28 14:43:59 +01:00
semmle-qlci
9fb61d5f26 Merge pull request #1371 from xiemaisi/js/index-xml
Approved by asger-semmle
2019-05-28 14:30:43 +01:00
Asger F
1a6d09cc07 JS: Add change note 2019-05-28 12:42:59 +01:00
semmle-qlci
ead59baa0e Merge pull request #1369 from xiemaisi/js/fix-autobuild-test
Approved by asger-semmle
2019-05-28 12:27:17 +01:00
semmle-qlci
bd15994bb4 Merge pull request #1367 from xiemaisi/js/configuration-api-consistency
Approved by esben-semmle
2019-05-28 12:26:58 +01:00
Asger F
ef1ad0d3b7 JS: Summary expected output (not taint-tracking config anymore) 2019-05-28 12:05:51 +01:00
Asger F
9f43844f1e JS: Remove obsolete code 2019-05-28 11:54:57 +01:00
Asger F
8d60ae7200 JS: Avoid unnecessary casts 2019-05-28 11:54:42 +01:00
Asger F
9f1617a6a8 JS: Update TaintedPath.expected (4x paths) 2019-05-28 11:22:08 +01:00
Asger F
6617747185 JS: Update DataFlowTracking output for booleanOps.js 2019-05-28 11:19:23 +01:00
Max Schaefer
7f8f126338 JavaScript: Add support for XML extraction. 2019-05-28 09:44:24 +01:00
Max Schaefer
4992970181 JavaScript: Fix an auto-build test. 2019-05-28 09:44:24 +01:00
Tom Hvitved
0ee5fe88d9 CIL: Account for multiple VariableUpdate::getSource()s in nullness analysis
For methods compiled without optimization (and possibly also with optimization),
it is possible for a variable update to have multiple possible assigned values.
For example, the non-optimized CIL for

```
return cond ? null : "not null"
```

is

```
0: nop
1: ldarg.0
2: ldfld cond
3: brtrue.s 6:
4: ldstr "not null"
5: br.s 7:
6: ldnull
7: stloc.0 L0 // stores either `null` or "not null"
8: br.s 9:
9: ldloc.0
10: ret
```

Consequently, an existential in `CallableReturns.qll` must be a `forex`.
2019-05-28 10:13:00 +02:00
Tom Hvitved
4fc61ebbf3 C#: Add tests for maybe-null CIL methods 2019-05-28 10:05:33 +02:00
semmle-qlci
9804105855 Merge pull request #1364 from asger-semmle/typescript-change-note
Approved by esben-semmle
2019-05-28 08:27:38 +01:00
Max Schaefer
86e96c6dc3 JavaScript: Introduce is{Barrier,Sanitizer}Edge predicate.
This name is more intuitive than the previous binary
`is{Barrier,Sanitizer}` predicates, and is consistent with the other
languages.
2019-05-28 08:08:14 +01:00
Max Schaefer
d9b3e461ba Merge pull request #1351 from asger-semmle/js-incomplete-nodes
JS: Mark some more nodes as incomplete
2019-05-28 07:59:23 +01:00
Max Schaefer
bad5465aad Merge pull request #1360 from asger-semmle/customize-window-document
JS: Make some DOM concepts customizable
2019-05-28 07:58:44 +01:00
Esben Sparre Andreasen
fd4c749e27 JS: change FrameworkLibraryInstance Script/TopLevel inheritance
This is theoretically a breaking change, but it preserves the
semantics of all queries in this repository, as far as I can see.
2019-05-28 08:31:23 +02:00
Esben Sparre Andreasen
1b1e9ed51a JS: cache matchMarkerComment 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
189ac6c2bd JS: add js/prototype-pollution to the security suite 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
eb13ab52cf JS: sharpen js/prototype-pollution with version analysis 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
c143e31fb5 JS: rename getDefaultNode to getImportedModuleNode 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
0660db37f6 JS: introduce SemVer matching library 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
7d57d1915a JS: introduce DataFlow::DependencyModuleImport 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
1cea29d89f JS: improve prototype pollution tests 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
af3f0b1d04 JS: add test for missing support for package-lock.json 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
ef6f4c7a5e JS: update docstring 2019-05-27 22:32:32 +02:00
Esben Sparre Andreasen
f74653be46 JS: extract getDefaultNode from DefaultRange 2019-05-27 22:32:32 +02:00
Jonas Jensen
d2fa7aad1c Merge pull request #1336 from geoffw0/cached2
CPP: Cache Expr.getType().
2019-05-27 12:48:56 +01:00
Tom Hvitved
c82a2f0fec C#: Refactor data flow predicates to be defined by dispatch 2019-05-27 13:40:41 +02:00
Tom Hvitved
641126a506 Merge pull request #1339 from calumgrant/cs/cs8/ranges
C#: Implement C#8 features
2019-05-25 09:28:22 +02:00
yh-semmle
87cbc7e199 Merge pull request #1344 from aschackmull/java/validatedvariable
Java: Replace ValidatedVariable with guarded accesses.
2019-05-24 11:23:18 -04:00
Geoffrey White
170691b467 CPP: Comment as suggested. 2019-05-24 16:16:45 +01:00
Geoffrey White
6bac1e6e99 CPP: Accept CWE-190 test change. 2019-05-24 16:16:45 +01:00
Calum Grant
ae8ecc88e6 C#: Address review comments. 2019-05-24 14:56:58 +01:00
Anders Schack-Mulligen
1a9b1d5865 Java: Add change note. 2019-05-24 15:50:45 +02:00
Calum Grant
d2aea635e4 C#: Address review comments 2019-05-24 13:49:05 +01:00
Calum Grant
fe6056b0fc C#: Analysis change notes. 2019-05-24 13:49:05 +01:00
Calum Grant
14147a1abe C#: DB upgrade script and stats 2019-05-24 13:49:05 +01:00
Tom Hvitved
a1e58cedac C#: Refactor recursive patterns implementation
- Extract names of properties in a propery match, using the `exprorstmt_name` relation.
- Simplify extraction of properties by not distinguishing between top-level patterns
  and nested patterns.
- Introduce `PatternExpr` to capture patterns in `is` expressions, `case` statements,
  and `switch` expression arms.
- Generalize `IsTypeExpr`, `IsPatternExpr`, `IsRecursivePatternExpr`, and `IsConstantExpr`
  to just `IsExpr` with a member predicate `PatternExpr getPattern()`.
- Generalize `TypeCase`, `RecursivePatternCase`, and `ConstCase` to just `CaseStmt` with
  a member predicate `PatternExpr getPattern()`.
- Introduce classes `Switch` and `Case` as base classes of switch statements/expressions
  and case statements/switch expression arms, respectively.
- Simplify CFG logic using the generalized classes.
- Generalize guards library to cover `switch` expressions tests.
- Generalize data flow library to cover `switch` expression assignments.
2019-05-24 13:49:05 +01:00
Calum Grant
b28ad9066f C#: Change notes 2019-05-24 13:49:05 +01:00
Calum Grant
21203cdf0d C#: Minor code tidy. 2019-05-24 13:49:05 +01:00
Calum Grant
aecc9e2a57 C#: Fix LGTM warnings 2019-05-24 13:49:05 +01:00
Calum Grant
55b41cfaf7 C#: DB Upgrade script 2019-05-24 13:49:05 +01:00
Calum Grant
1a40c29aba C#: DB stats 2019-05-24 13:49:05 +01:00
Calum Grant
fa57017720 C#: Minor edit. 2019-05-24 13:49:05 +01:00
calum
1428d0ba93 C#: Implement recursive patterns 2019-05-24 13:49:05 +01:00
calum
318068b52f C#: Implement range operator 2019-05-24 13:49:04 +01:00
Geoffrey White
15e2248440 Merge pull request #1359 from jbj/definitions-column-order
C++: definitions.ql performance tweaks
2019-05-24 12:43:57 +01:00
alexey
8168c0ee0a Fix typo in test for the query 2019-05-23 15:54:59 +01:00
Tom Hvitved
d30bce4f31 C#: Update expected test output 2019-05-23 16:03:54 +02:00
Max Schaefer
1bf7bcf010 Merge pull request #1356 from asger-semmle/tainted-path-cherry-picked
JS: Refactor LabelledBarrierGuard
2019-05-23 12:26:35 +01:00
Asger F
6bb011a4cc JS: Stop using data/taint as flow labels in TaintedPath 2019-05-23 10:16:41 +01:00
Asger F
0823f6c935 JS: fix use of dataOrTaint() 2019-05-23 10:16:41 +01:00
Asger F
37fa2446d4 JS: review comments 2019-05-23 10:16:31 +01:00
Asger F
07d508d1bf JS: Track taint through .replace() 2019-05-23 09:23:48 +01:00
Asger F
1ec3475457 JS: All of TaintedPath 2019-05-23 09:23:47 +01:00
Asger F
a1399d07a4 JS: Add change note for TypeScript full extraction 2019-05-23 09:19:01 +01:00
semmle-qlci
fac620d6f3 Merge pull request #1357 from asger-semmle/jump-to-namespace
Approved by xiemaisi
2019-05-23 09:00:24 +01:00
Asger F
9046fd15f7 JS: Update expected output of XSS query (benign) 2019-05-23 08:56:01 +01:00
Asger F
2fc0ab5595 JS: Stop using the AST-based isDocumentURL internally 2019-05-23 08:55:21 +01:00
Asger F
8b7dbf8b0f JS: Align DOM::locationRef with isDocumentURL 2019-05-23 08:45:08 +01:00
yh-semmle
64aa111b65 Merge pull request #1342 from aschackmull/java/field-annotation-cu
Java: Check compilation unit of the same element in both disjuncts.
2019-05-22 16:36:24 -04:00
Tom Hvitved
8fe2bccbf8 Merge pull request #1361 from calumgrant/cs/roslyn-3.1
C#: Update to Roslyn 3.1
2019-05-22 20:31:09 +02:00
Mark Shannon
e1614886c7 Python points-to. Improve API bey renaming a couple of methods and clarifying a few comments. 2019-05-22 17:28:25 +01:00
Ziemowit Laski
46b6eac955 [CPP-370] An .expected file is mismatched again. Not sure why
this is happening.
2019-05-22 09:08:44 -07:00
Ziemowit Laski
154b9aa488 [CPP-370] Reformat both Print.qll files. 2019-05-22 08:21:05 -07:00
Calum Grant
fcfb7b2b8a C#: Fix error caused by Roslyn upgrade. 2019-05-22 16:17:16 +01:00
Calum Grant
e5aa7f3ba7 C#: Upgrade to Roslyn 3.1 2019-05-22 15:54:30 +01:00
Jonas Jensen
dd5a2552c7 C++: Compute locations only for elements in result
This gains some performance by not computing locations for all
expressions since we are only interested in calls and variable accesses.
The `Top::hasLocationInfo` predicate goes from 2m28s to 1m32s on
Chromium.
2019-05-22 15:52:49 +01:00
Jonas Jensen
81f627c1c4 C++: pragma[noopt] Top::hasLocationInfo perf tweak
This predicate was slow, mostly because it's just very large. A manual
join order cuts the run time on Chromium from

    definitions::Top::hasLocationInfo_dispred#ffffff ..................... 3m23s
    definitions::MacroAccessWithHasLocationInfo::hasLocationInfo#ffffff .. 1m56s

to

    definitions::Top::hasLocationInfo#ffffff .... 2m28s

The main slowdown was the two uses of `SCAN` to reorder columns in the
RA.
2019-05-22 15:52:33 +01:00
Asger F
8590042a7e JS: customizable window, document, DOM value 2019-05-22 15:49:56 +01:00
alexey
e214174114 add return-or-yield-outside-of-function Python query 2019-05-22 15:27:32 +01:00
Asger F
153e778f7f JS: Remove jump-to-namespace 2019-05-22 14:42:48 +01:00
Asger F
deb217326d JS: Update our own queries 2019-05-22 13:13:08 +01:00
Nick Rolfe
94e3c676d5 Merge pull request #1352 from ian-semmle/edg
C++: Follow extractor changes for 0136
2019-05-22 13:11:59 +01:00
Mark Shannon
1018f27815 Python points-to: Add more comments about TObject and ObjectInternal. 2019-05-22 12:59:51 +01:00
Asger F
61ef73b0f7 JS: Add change note and deprecation member 2019-05-22 12:23:29 +01:00
Asger F
6246eb2fe3 JS: Refactor LabeledSantizerGuard 2019-05-22 12:08:03 +01:00
semmle-qlci
dc8123db8e Merge pull request #1355 from xiemaisi/js/data-flow-api-fiddling
Approved by asger-semmle
2019-05-22 10:40:32 +01:00
Anders Schack-Mulligen
3e5bbd96b1 Java: Account for non-source annotation on second field in multi-field declarations. 2019-05-22 11:33:10 +02:00
Calum Grant
fc8eccfc6b C#: Add some basic qhelp. Since these are internal queries, this is probably not needed. 2019-05-22 10:16:24 +01:00
semmle-qlci
c100c70a65 Merge pull request #1348 from xiemaisi/js/add-external-link-cwe
Approved by esben-semmle
2019-05-22 08:12:51 +01:00
Denis Levin
1b8117ba3a C++: Mishandling Japanese Era and Leap Year in calculations 2019-05-21 14:49:40 -07:00
Denis Levin
0b108fab0f Replaced tabs with spaces 2019-05-21 14:11:30 -07:00
Calum Grant
75c19e3991 C#: Add internal queries for extractor and compiler diagnostics. 2019-05-21 21:22:50 +01:00
semmle-qlci
114ba0e722 Merge pull request #1349 from EdoDodo/js-performance
Approved by xiemaisi
2019-05-21 17:50:01 +01:00
Ian Lynagh
6a77ac8a13 C++: Follow extractor changes for 0136 2019-05-21 17:07:21 +01:00
Asger F
180b5443ba JS: Update output of incomplete.ql 2019-05-21 17:02:43 +01:00
Asger F
de2f323172 JS: Mark unused parameter nodes as incomplete 2019-05-21 16:53:39 +01:00
Asger F
69dbbcf1c8 JS: Mark destructuring nodes as incomplete 2019-05-21 16:52:35 +01:00
Ziemowit Laski
81bfbc250f [CPP-370] Forgot to update an .expected file. 2019-05-21 07:08:13 -07:00
Ziemowit Laski
ae55b7b643 [CPP-370] Add new test file for testing procedurally nested format
argument violations.
2019-05-21 07:08:13 -07:00
Ziemowit Laski
f19f48dc1a [CPP-370] Revert accidental changes to Printf.qll (which belong on zlaski/cpp391 branch). 2019-05-21 06:55:32 -07:00
Ziemowit Laski
a49d82d2d6 [CPP-370] Exclude UserDefinedFormattingFunction nodes. 2019-05-21 06:55:32 -07:00
Ziemowit Laski
92054e2481 [CPP-370] Reformat test cases so that the .expect files line up with what was
checked in initially.  Check for DataFlow::DefinitionByReferenceNode
          when computing isSource() for our taint analysis.
2019-05-21 06:54:41 -07:00
Ziemowit Laski
098b6543f5 [CPP-370] Rewrite of NonConstantFormat.ql using the taint tracking library. 2019-05-21 06:51:47 -07:00
Ziemowit Laski
91902e52f6 [CPP-370] Intermediate commit, file not in usable state. 2019-05-21 06:46:52 -07:00
Ziemowit Laski
d8b8dda439 [CPP-370] First attempt at isAdditionalFlowStep(). 2019-05-21 06:45:52 -07:00
Ziemowit Laski
dbec17f85b [CPP-370] Tentative implementation of NonConstantFormat.ql using the global
DataFlow library.  This is intended solely for further discussion.
2019-05-21 06:23:51 -07:00
Ziemowit Laski
6025c03857 [CPP-370] Add nested.cpp test case, for nested calls to ...printf functions. 2019-05-21 06:21:12 -07:00
Ziemowit Laski
f6903c769a [CPP-370] Remove prohibition against UserDefinedFormattingFunction 2019-05-21 06:21:12 -07:00
Ziemowit Laski
8faf95ec84 [CPP-370] Tentatively modify CWE consts.cpp file to play nice with the dataflow library. 2019-05-21 06:21:12 -07:00
Ziemowit Laski
1fce5a5b40 [CPP-370] Revert accidental changes to Printf.qll (which belong on zlaski/cpp391 branch). 2019-05-21 06:21:11 -07:00
Ziemowit Laski
99047e51f2 [CPP-370] Exclude UserDefinedFormattingFunction nodes. 2019-05-21 06:19:52 -07:00
Ziemowit Laski
b205951e6d [CPP-370] Reformat test cases so that the .expect files line up with what was
checked in initially.  Check for DataFlow::DefinitionByReferenceNode
          when computing isSource() for our taint analysis.
2019-05-21 06:18:31 -07:00
Ziemowit Laski
ed67c9fd5a [CPP-370] Rewrite of NonConstantFormat.ql using the taint tracking library. 2019-05-21 06:18:31 -07:00
Ziemowit Laski
a962cff5df [CPP-370] Intermediate commit, file not in usable state. 2019-05-21 06:18:31 -07:00
Ziemowit Laski
fae55d5493 [CPP-370] First attempt at isAdditionalFlowStep(). 2019-05-21 06:18:30 -07:00
Ziemowit Laski
012140fcd3 [CPP-370] Reformat query. 2019-05-21 06:18:30 -07:00
Ziemowit Laski
775861c386 [CPP-370] Minor textual tweaks. 2019-05-21 06:18:30 -07:00
Ziemowit Laski
de10598dd6 [CPP-370] NonConstantFormat.expected changed for some reason. 2019-05-21 06:18:30 -07:00
Ziemowit Laski
ffddc5bff6 [CPP-370] Update the NonConstantFormat.expected result template. 2019-05-21 06:18:30 -07:00
Ziemowit Laski
0c86d4c112 [CPP-370] Tentative implementation of NonConstantFormat.ql using the global
DataFlow library.  This is intended solely for further discussion.
2019-05-21 06:18:30 -07:00
Ziemowit Laski
21eb00a5df [CPP-370] Minor fix to QHELP file. 2019-05-21 06:18:30 -07:00
Asger F
faa47029d5 JS: Mark exceptional nodes as incomplete 2019-05-21 13:51:59 +01:00
Asger F
68ae409947 JS: Test for mismatch between taint and type inference 2019-05-21 13:26:02 +01:00
Edoardo Pirovano
9d2580f778 JS: Fix performance regression of query. 2019-05-21 12:26:11 +01:00
semmle-qlci
8cd3cb501a Merge pull request #1346 from xiemaisi/js/revert-1078
Approved by esben-semmle
2019-05-21 12:19:57 +01:00
Max Schaefer
cf22761ccc JavaScript: Add CWE-1022 to TargetBlank. 2019-05-21 12:16:32 +01:00
semmle-qlci
fe920ecfaa Merge pull request #1331 from asger-semmle/destructuring-assignment-fix
Approved by xiemaisi
2019-05-21 11:32:36 +01:00
semmle-qlci
2b5b8751ea Merge pull request #1316 from asger-semmle/incorrect-suffix-check-fps
Approved by esben-semmle, xiemaisi
2019-05-21 11:30:37 +01:00
Esben Sparre Andreasen
3af3c5413b Merge pull request #1318 from asger-semmle/prototype-pollution-query2
Move prototype pollution query into suite
2019-05-21 12:23:41 +02:00
Robert Marsh
2dd1c06409 C++: fix use of getUnspecifiedType on Node 2019-05-21 11:06:15 +01:00
Max Schaefer
924664afcf JavaScript: Manually revert #1078.
In its present form, `getAnUndefinedReturn` does not handle `finally`
blocks correctly. For example, in this snippet

```
try {
  return 42;
} finally {
  cleanup();
}
```

the call to `cleanup` is erroneously considered an undefined return.

We currently don't use the predicate anywhere, so it seems best to back
it out for the time being.
2019-05-21 08:26:58 +01:00
Denis Levin
eacded27a9 Japanese Era and Leap Year checks (Likely Bugs) 2019-05-20 15:54:57 -07:00
yh-semmle
29ae7b5c3c Merge pull request #1322 from aschackmull/java/deprecate-remoteuserinput
Java: Deprecate RemoteUserInput
2019-05-20 12:56:51 -04:00
semmle-qlci
56ab013114 Merge pull request #1340 from xiemaisi/js/es2019
Approved by asger-semmle
2019-05-20 16:47:09 +01:00
Asger F
ba69e19e95 JS: Address doc review 2019-05-20 16:46:27 +01:00
Max Schaefer
7b7f92c19e JavaScript: Introduce SSA::definition and SSA::variable. 2019-05-20 16:22:01 +01:00
Max Schaefer
fb744a6c53 JavaScript: Introduce Parameter.getVariable(). 2019-05-20 16:01:12 +01:00
Geoffrey White
67527820a1 Merge pull request #1335 from EdoDodo/optimise-preprocessor
C++: Optimise quadratic code in PreprocessorBranchDirective
2019-05-20 15:58:33 +01:00
Max Schaefer
2cb33f6088 JavaScript: Introduce DataFlow::ExprNode and exprNode for consistency with other languages. 2019-05-20 15:55:03 +01:00
Anders Schack-Mulligen
48b19f1fea Java: Replace ValidatedVariable with guarded accesses. 2019-05-20 16:46:11 +02:00
Anders Schack-Mulligen
d0de0254e1 Java: Check compilation unit of the same element in both disjuncts. 2019-05-20 16:41:08 +02:00
yh-semmle
5466ae619d Merge pull request #1317 from aschackmull/java/domedge
Java: Refactor Guard.controls in terms of dominating edges.
2019-05-20 10:40:10 -04:00
Robert Marsh
dbdaa1d3f3 C++: Replace getUnderlyingType().getUnspecifiedType() 2019-05-20 15:23:08 +01:00
Robert Marsh
e899120270 C++: replace getType().getUnspecifiedType() 2019-05-20 15:08:28 +01:00
Robert Marsh
a72fff7ed0 C++: add getUnspecifiedType() for exprs and decls 2019-05-20 14:49:19 +01:00
Anders Schack-Mulligen
9ebeac25ad Merge pull request #1329 from hvitved/dataflow/performance
Data flow: performance improvements
2019-05-20 14:27:03 +02:00
Edoardo Pirovano
30198c326d C++: Optimise quadratic code in PreprocessorBranchDirective 2019-05-20 12:57:47 +01:00
Tom Hvitved
e1d4166e3c C#: Data flow through this parameter 2019-05-20 13:42:32 +02:00
Esben Sparre Andreasen
c651e3a155 JS: Add queries to the manual suite for LGTM constistency 2019-05-20 12:32:11 +02:00
Asger F
d4880540e8 JS: Update .expected after rebasing 2019-05-20 11:21:50 +01:00
Tom Hvitved
bc00877ff2 Data flow: Add nomagic to storeCand() 2019-05-20 12:05:20 +02:00
Max Schaefer
b62be049ec JavaScript: Add change note. 2019-05-20 10:56:37 +01:00
Asger F
9989fcee21 JS: Add DataFlow::Configuration test 2019-05-20 09:22:02 +01:00
Asger F
87e0831872 JS: Fix flow for nested destructurings 2019-05-20 09:22:02 +01:00
Tom Hvitved
360c7a1ac5 Address review comments 2019-05-20 09:59:17 +02:00
yh-semmle
6468721f76 Merge pull request #1324 from aschackmull/java/switchexpr-nullness
Java: Add SwitchExpr to Nullness::dereference.
2019-05-19 22:24:27 -04:00
yh-semmle
e5f4d475d0 Merge pull request #1320 from aschackmull/java/guardslogic-perf
Java: Fix join-order for GuardsLogic::conditionalAssign.
2019-05-19 22:23:18 -04:00
Geoffrey White
36cd4d44d1 CPP: Cache Expr.getType(). 2019-05-17 16:18:41 +01:00
Mark Shannon
f057d5cb6b Python: Speed up MRO calculation a bit. 2019-05-17 14:05:39 +01:00
Mark Shannon
685826e436 Python points-to: Prevent bad magic. 2019-05-17 14:04:57 +01:00
Mark Shannon
f975b8b87d Python: Avoid bad magic. 2019-05-17 12:15:51 +01:00
Kevin Backhouse
63794c89db Merge pull request #1 from geoffw0/assignadd
CPP: Tests for: Better overflow detection for AssignAdd/AssignSub
2019-05-17 09:41:29 +01:00
Esben Sparre Andreasen
8256f2e736 Merge pull request #1308 from asger-semmle/exceptional-flow
JS: Add flow through exceptions
2019-05-17 08:33:44 +02:00
Robert Marsh
762c977be7 Merge pull request #1326 from jbj/addressConstantVariable-isConstexpr
C++: Use isConstexpr instead of workaround in AddressConstantExpr
2019-05-16 15:18:56 -07:00
Robert Marsh
5f77ac4cf5 Merge pull request #1325 from jbj/reachableRecursive
C++: reachableRecursive refactor for performance
2019-05-16 14:05:57 -07:00
Asger F
9c1208e751 JS: Add change note 2019-05-16 17:50:10 +01:00
Mark Shannon
8558cb3f2f Python points-to: Update Overview.qll to reflect new object model. 2019-05-16 16:25:48 +01:00
Mark Shannon
2f940d013b Python points-to: Fully document object classes. 2019-05-16 16:18:54 +01:00
Asger F
65cbd47a2d Merge pull request #1314 from xiemaisi/js/fix-hardcoded-pw-fps
JavaScript: Further broaden the whitelist in `PasswordInConfigurationFile`.
2019-05-16 14:42:09 +01:00
Jonas Jensen
947aaa9e4e C++: reachableRecursive refactor for performance
The `reachable` predicate is large and slow to compute. It's part of a
mutual recursion that's non-linear, meaning it has a recursive call on
both sides of an `and`.

This change removes a part of the base case that has no effect on
recursive cases. The removed part is added back after the recursion has
finished.

Before, on Wireshark:

    ControlFlowGraph::Cached::reachable#f .......... 20.8s (executed 9800 times)
    ConstantExprs::successors_adapted#ff ........... 4.2s (executed 615 times)
    ConstantExprs::potentiallyReturningFunction#f .. 3.9s (executed 9799 times)
    ConstantExprs::possiblePredecessor#f ........... 2.9s (executed 788 times)

After, on Wireshark:

    ConstantExprs::reachableRecursive#f ............ 13.2s (executed 9800 times)
    ConstantExprs::successors_adapted#ff ........... 4.2s (executed 615 times)
    ConstantExprs::potentiallyReturningFunction#f .. 4.3s (executed 9799 times)
    ConstantExprs::possiblePredecessor#f ........... 2.6s (executed 788 times)

I've verified that this change doesn't change what's computed by
checking that the output of the following query is unchanged:

    import cpp
    import semmle.code.cpp.controlflow.internal.ConstantExprs

    select
      strictcount(ControlFlowNode n | reachable(n)) as reachable,
      strictcount(ControlFlowNode n1, ControlFlowNode n2 | n2 = n1.getASuccessor()) as edges,
      strictcount(FunctionCall c | aborting(c)) as abortingCall,
      strictcount(Function f | abortingFunction(f)) as abortingFunction
2019-05-16 13:39:23 +02:00
Calum Grant
c1e627d739 Merge pull request #1312 from hvitved/csharp/variable-preds
C#: Refactor predicates in `Variable` class to be defined by dispatch
2019-05-16 12:35:12 +01:00
Jonas Jensen
db6a807ff6 C++: Move same-stage predicates into cached module
This change only moves code around -- there are no changes to predicate
bodies or signatures.

The predicates that go in `ConstantExprs.Cached` after this change were
already cached in the same stage or, in the case of the `aborting*`
predicates, did not need to be cached. This is a fortunate consequence
of how the mutual recursion between the predicates happens to work, and
it's not going to be the case after the next commit.
2019-05-16 13:34:50 +02:00
Mark Shannon
d6d72dcef4 Python: Account for --respect-init when determining module name. 2019-05-16 11:46:47 +01:00
Mark Shannon
d1a711e459 Merge pull request #1296 from RasmusSemmle/master
Add pythagorean query
2019-05-16 11:02:56 +01:00
Calum Grant
6994ba904b Merge pull request #1309 from hvitved/csharp/get-explicit-arg-nomagic
Add `pragma[nomagic]` to `getExplicitArgument()`
2019-05-16 10:57:00 +01:00
Asger F
b9ade67933 JS: Add change note 2019-05-16 10:56:47 +01:00
Asger F
9293010e4c JS: Fix some FPs in IncorrectSuffixCheck 2019-05-16 10:56:17 +01:00
semmle-qlci
649979de3e Merge pull request #1327 from asger-semmle/express-nomagic
Approved by esben-semmle
2019-05-16 10:43:10 +01:00
Tom Hvitved
02ca09aa43 Data flow: performance improvements 2019-05-16 07:35:10 +02:00
Robert Marsh
14795863e2 Merge pull request #1303 from jbj/hasQualifiedName
C++: Fix `getQualifiedName` performance issues
2019-05-15 12:42:57 -07:00
Asger F
8fe2319a23 JS: Fix lurking cartesian product in Express 2019-05-15 18:07:24 +01:00
Calum Grant
6a198ff7e1 Merge pull request #1306 from hvitved/csharp/dataflow/shared-implementation
C#: Adopt shared data flow implementation
2019-05-15 17:41:46 +01:00
Mark Shannon
d7558e8fe5 Python: Fix CP in pruner and cache to avoid re-evaluation. 2019-05-15 15:26:44 +01:00
Jonas Jensen
d820fc9cd2 C++: Address review comments about the comments 2019-05-15 14:55:26 +02:00
Jonas Jensen
f38253da89 C++: Use isConstexpr instead of workaround
The `addressConstantVariable` predicate was the slowest single predicate
when running the full LGTM suite on Chromium. Fortunately it's only
executed once, but it could be easily made faster by using the new
`Variable.isConstexpr` predicate instead of the slow workaround that was
in its place.
2019-05-15 14:41:05 +02:00
Jonas Jensen
8b012b2cab C++: Remove unneeded import 2019-05-15 14:35:05 +02:00
Tom Hvitved
949b3601d0 C#: Address review comments 2019-05-15 14:10:42 +02:00
Anders Schack-Mulligen
531d30f048 Java: Add SwitchExpr to Nullness::dereference. 2019-05-15 13:20:55 +02:00
Mark Shannon
2b72a50dbf Python points-to: Fix up re extension. 2019-05-15 11:24:40 +01:00
Mark Shannon
bf78c62594 Python points-to: Add objects representing missing modules and their attributes. 2019-05-15 11:24:01 +01:00
Taus
1076c03016 Merge pull request #1323 from markshannon/hotfix-path-fix
Python QL: Use Module.getPath() to implement ModuleObject.getPath()
2019-05-15 11:46:36 +02:00
Asger F
682f2790cd JS: Address comments 2019-05-15 10:09:56 +01:00
Mark Shannon
0035dc2982 Python QL: Use Module.getPath() to implement ModuleObject.getPath() 2019-05-15 10:09:00 +01:00
semmle-qlci
ec10b76d5a Merge pull request #1321 from aschackmull/java/polycalls
Approved by pavgust
2019-05-15 08:52:34 +01:00
Mark Shannon
b10a7cd3a4 Python points-to: Make behviour of instances more consistent. 2019-05-14 15:50:20 +01:00
Anders Schack-Mulligen
3eb3cd345d Java: Update qldoc and add callsImpl convenience wrapper. 2019-05-14 16:31:56 +02:00
Mark Shannon
8f74f918c7 Python points-to: Speed up call-points-to. 2019-05-14 14:49:29 +01:00
Anders Schack-Mulligen
f9e4512f32 Java: Update polyCalls to use virtual dispatch. 2019-05-14 15:36:12 +02:00
Mark Shannon
0afcb11a13 Python points-to: Make sure reachability can skip over if-statements. 2019-05-14 11:52:33 +01:00
Anders Schack-Mulligen
b71acd2ff9 Java: Deprecate RemoteUserInput 2019-05-14 12:33:36 +02:00
Mark Shannon
a5ff527ac2 Python: Remove test due to instability across minor versions. 2019-05-14 10:45:43 +01:00
Asger F
778244878a JS: Normalize whitespace 2019-05-14 10:31:28 +01:00
Anders Schack-Mulligen
14cad57960 Java: Improve joinorder for GuardsLogic::conditionalAssign. 2019-05-14 11:28:18 +02:00
Tom Hvitved
89e60dc9bf C#: Simplify CallContext.qll 2019-05-14 11:24:23 +02:00
Mark Shannon
a8dc2908de Python: Update test results. 2019-05-13 17:32:29 +01:00
Asger F
fd9765b99f JS: Add qhelp 2019-05-13 17:31:12 +01:00
Mark Shannon
1c20336eb9 Python points-to. Fix attribute lookup for type. 2019-05-13 17:24:02 +01:00
Mark Shannon
a03e101e4f Python points-to: Improve performance. 2019-05-13 17:15:01 +01:00
Anders Schack-Mulligen
ebb63c8141 Java: Refactor Guard.controls in terms of dominating edges. 2019-05-13 16:35:30 +02:00
Asger F
0c715f7540 JS: Lower precision to medium 2019-05-13 15:20:40 +01:00
Asger F
aaf503837d JS: Move prototype pollution into real query 2019-05-13 15:20:25 +01:00
Mark Shannon
972ac0fdbd Python: Update test result. 2019-05-13 15:15:27 +01:00
Mark Shannon
5f9a807392 Python points-to: Fix handling of builtin-method objects. 2019-05-13 15:08:58 +01:00
Mark Shannon
33043d6a8a Python: update exptected test results. 2019-05-13 14:35:22 +01:00
Mark Shannon
1f00c3b248 Python points-to: Fix up metaclass determination for Python 2. 2019-05-13 14:34:33 +01:00
Mark Shannon
26044f20c7 Python points-to: Fix up tuple inequality analysis. 2019-05-13 12:59:19 +01:00
Mark Shannon
0491fe1356 Python points-to: Update 'analysis' query test results. 2019-05-13 12:11:19 +01:00
Mark Shannon
2905737a0e Python points-to: Fix analysis of zero-arg super(). 2019-05-13 12:00:38 +01:00
Tom Hvitved
0096024396 Merge pull request #1174 from calumgrant/cs/extractor-diagnostics
C#: Log compiler and extractor diagnostics
2019-05-13 12:53:12 +02:00
Mark Shannon
d74c76510f Python points-to: Don't track non-descriptor class attributes on instances. Update more tests. 2019-05-13 11:46:55 +01:00
Mark Shannon
beebd0e15c Python points-to: Be more specific when describing inheritance analysis failures. 2019-05-13 10:50:20 +01:00
Mark Shannon
7244b9fc6f Python points-to: Update some more expected test results. 2019-05-13 10:49:07 +01:00
Asger F
4db7aa6ed2 JS: Relax type inference to account for overriding 2019-05-13 10:18:19 +01:00
Calum Grant
88b5719103 C#: Add DB upgrade script 2019-05-13 09:18:52 +01:00
Calum Grant
7a3b6575a5 C#: Update expected output following roslyn-3.0.0 update. 2019-05-13 09:18:52 +01:00
calum
7b19402b1f C#: Update DB stats. 2019-05-13 09:18:52 +01:00
calum
39bb3f2d52 C#: Fix elapsed timings and add a test for it. 2019-05-13 09:18:52 +01:00
calum
c67e441003 C#: Implement compilation_referencing_files and update comments for C#. 2019-05-13 09:18:52 +01:00
calum
1a99f4f253 C#: Fix unit tests due to qltest mangling output. 2019-05-13 09:18:52 +01:00
calum
2a484dc4ea C#: Fix alerts and tests. 2019-05-13 09:18:52 +01:00
calum
66b3df7f29 C#: Fix unit tests. 2019-05-13 09:18:52 +01:00
calum
3046cc494a C#: Code tidy. 2019-05-13 09:18:52 +01:00
calum
343cddcbb7 C#: Refactor extractor errors and log extractor errors to the database. 2019-05-13 09:18:52 +01:00
calum
e1158bb5e5 C#: Store compilations, compiler diagnostics and performance in the database. 2019-05-13 09:18:52 +01:00
Jonas Jensen
bb67ac9ad1 Merge pull request #1219 from geoffw0/msfix2
CPP: Fix FormatLiteral.isMicrosoft
2019-05-13 09:24:49 +02:00
Mark Shannon
315fe0ab94 Python points-to: Update an expected file. 2019-05-10 17:00:03 +01:00
Mark Shannon
80f6883304 Python points-to: Update test results. 2019-05-10 16:40:53 +01:00
Mark Shannon
a1bf071f55 Python points-to: Fix getattr() points-to. 2019-05-10 16:36:09 +01:00
Geoffrey White
4cc23cce13 CPP: Document. 2019-05-10 16:26:39 +01:00
Geoffrey White
581266c347 CPP: Alternative fix. 2019-05-10 16:26:38 +01:00
Mark Shannon
8b28105677 Python points-to: update some more test results. 2019-05-10 16:05:37 +01:00
Mark Shannon
76c43b491f Python points-to: Improve handling of attributes. 2019-05-10 16:05:11 +01:00
Mark Shannon
992ee2f150 Python points-to: Fix up some test results. 2019-05-10 16:03:27 +01:00
Mark Shannon
2db0bd9483 Python: Remove obsolete tests. 2019-05-10 13:04:43 +01:00
Mark Shannon
39861597e5 Python points-to: Fix up handiling of metaclasses, new-style and type-heirarchy failure analysis. 2019-05-10 13:02:36 +01:00
Max Schaefer
79e01a2de5 Merge pull request #1305 from aschackmull/java/abstract-flowsources
Java: Introduce an abstract class RemoteFlowSource to ease customization.
2019-05-10 11:42:15 +01:00
Mark Shannon
75feab53db Python QL: Clean up pruning code, renaming and adding comments for clarity. 2019-05-10 10:59:44 +01:00
Max Schaefer
9ec366cf88 JavaScript: Move support for optional catch to ES2019. 2019-05-10 08:27:25 +01:00
Max Schaefer
d93d68d7f5 JavaScript: Add parser support for Unicode newlines in string literals. 2019-05-10 08:16:20 +01:00
Max Schaefer
31f80df7dc JavaScript: Add YAML file types to versions-compilers.csv. 2019-05-10 08:09:46 +01:00
Max Schaefer
86a7fa3abb JavaScript: Make extractor default to ECMA 2019.
Also introduces an enum constant for ECMA 2020 (not used anywhere yet).
2019-05-10 08:09:46 +01:00
Mark Shannon
bbf7ff9a3f Python: do pruning in QL. 2019-05-09 17:58:36 +01:00
Max Schaefer
b478c0ddaa JavaScript: Further broaden the whitelist in PasswordInConfigurationFile. 2019-05-09 17:07:59 +01:00
Mark Shannon
93f0b8f1b7 Python points-to: Fix up support for six.add_metaclass() 2019-05-09 15:15:40 +01:00
Mark Shannon
92d0aef6f4 Rename super_() to superType() for better consistency. 2019-05-09 14:47:12 +01:00
Anders Schack-Mulligen
66813a91ef Java: Postpone deprecation to separate PR. 2019-05-09 13:40:25 +02:00
Tom Hvitved
e3b83d04f5 C#: Refactor predicates in Variable class to be defined by dispatch 2019-05-09 11:53:42 +02:00
semmle-qlci
9653fbd4f7 Merge pull request #1311 from emarteca/unreachableThrows
Approved by xiemaisi
2019-05-09 10:37:41 +01:00
Ellen Arteca
893f62f334 Stylistic issue: replace \"eg\" by \"example\", as requested 2019-05-09 09:30:12 +01:00
Ellen Arteca
a12d12d59a JavaScript: Update UnreachableStmt query so unreachable throws no longer gives an alert 2019-05-08 16:25:54 +01:00
semmle-qlci
13e04f459d Merge pull request #1310 from xiemaisi/js/fix-hardcoded-pw-fps
Approved by asger-semmle
2019-05-08 14:08:36 +01:00
Asger F
27e8ea85f7 JS: Fix bug from sorting lines 2019-05-08 10:42:14 +01:00
Max Schaefer
c16e9a77f3 JavaScript: Fix a few false positives in PasswordInConfigurationFile. 2019-05-08 08:26:05 +01:00
Tom Hvitved
8adbfdaae7 Merge pull request #1275 from calumgrant/cs/roslyn-3.0.0
C#: Update nuget packages
2019-05-08 08:49:45 +02:00
Tom Hvitved
a89505ba32 C#: Simplify DataFlow::Node::getType() 2019-05-07 20:52:38 +02:00
calum
c28fa7ed3f C#: Handle VarPatternSyntax class introduced by Roslyn 3.0.0 2019-05-07 18:01:37 +01:00
calum
8a78c8f124 C#: Update xunit and other dependencies. 2019-05-07 18:01:36 +01:00
calum
d84fcbeedb C#: Fix extractor errors. 2019-05-07 18:01:36 +01:00
calum
b7875aef20 C#: Update nuget packages 2019-05-07 18:01:36 +01:00
Asger F
86885f4ff0 JS: Address comments 2019-05-07 18:00:36 +01:00
Asger F
7c9d20ae81 JS: Implement for TrackedNode to maintain consistency 2019-05-07 17:38:43 +01:00
Max Schaefer
d23c48330c Merge pull request #1307 from asger-semmle/exclude-js-testcases
JS: Exclude test cases from extraction
2019-05-07 16:41:08 +01:00
Asger F
331cc497e6 JS: Exclude test cases from extraction 2019-05-07 14:36:35 +01:00
Tom Hvitved
272545a63c Add pragma[nomagic] to getExplicitArgument() 2019-05-07 15:34:27 +02:00
Asger F
a3cf07af7e JS: Add flow steps through iteration callback 2019-05-07 13:52:31 +01:00
Asger F
e7bf485807 JS: Add another interprocedural flow test case 2019-05-07 10:33:01 +01:00
Asger F
3cbd6d3786 JS: Test case for nested statements 2019-05-07 10:26:30 +01:00
Asger F
f3a4acf0b2 JS: Add async functions to test 2019-05-07 10:11:42 +01:00
Asger F
1f897b4b63 JS: step through Error constructor and accept the potential FP 2019-05-07 10:11:41 +01:00
Asger F
b0090c2fe6 JS: Add test case for flow through new Error() 2019-05-07 10:11:41 +01:00
Asger F
36cefd8fc6 JS: Track taint through exceptions 2019-05-07 10:11:41 +01:00
Tom Hvitved
7b7a1ecea0 C#: Move DelegateDataFlow.qll into internal folder 2019-05-06 14:54:11 +02:00
Tom Hvitved
c6a471e4b6 C#: Adopt shared data flow implementation
- General refactoring to fit with the shared data flow implementation.
- Move CFG splitting logic into `ControlFlowReachability.qll`.
- Replace `isAdditionalFlowStepIntoCall()` with `TaintedParameterNode`.
- Redefine `ReturnNode` to be the actual values that are returned, which should
  yield better path information.
- No longer consider overrides in CIL calls.
2019-05-06 14:54:11 +02:00
Tom Hvitved
a6fa6dfd74 C#: Add shared data flow files 2019-05-06 14:54:11 +02:00
Tom Hvitved
26debb846c C#: Change ImplicitCapturedArgumentNode::toString() 2019-05-06 14:54:11 +02:00
Jonas Jensen
639d715d03 Merge pull request #1226 from hvitved/dataflow/prepare-for-csharp
Generalize data-flow library in preparation for C# adoption
2019-05-06 14:42:46 +02:00
Anders Schack-Mulligen
f367427fb8 Java: Deprecate RemoteUserInput. 2019-05-06 13:43:58 +02:00
Jonas Jensen
b52015a584 C++: QLDoc for QualifiedName.qll 2019-05-06 11:28:56 +02:00
Jonas Jensen
56e88cbac0 C++: Use underlyingElement for QualifiedName calls
Since the types in `QualifiedName.qll` are raw db types, callers need to
use `underlyingElement` and `unresolveElement` as appropriate. This has
no effect right now but will be needed when we switch the AST type
hierarchy to `newtype`s.
2019-05-06 11:24:28 +02:00
Jonas Jensen
662d55fd72 C++: Add tests for qualified names 2019-05-06 10:58:05 +02:00
Jonas Jensen
98657ebea7 C++: Change note for hasGlobalName 2019-05-06 10:14:44 +02:00
Calum Grant
19c7360e19 Merge pull request #1301 from hvitved/csharp/more-dataflow-tests
C#: Add more data flow tests
2019-05-03 16:41:21 +01:00
Anders Schack-Mulligen
10a6362357 Java: Introduce an abstract class RemoteFlowSource to ease customization. 2019-05-03 15:48:22 +02:00
Tom Hvitved
d9bf0a670e Data flow: Address review comments 2019-05-03 15:00:48 +02:00
Max Schaefer
e0e6224987 Merge pull request #1298 from asger-semmle/full-mode-fixes-rc120
TS: Backport full-mode fixes to rc/1.20
2019-05-03 13:57:47 +01:00
Jonas Jensen
b98daae077 C++: Remove deprecated from hasQualifiedName/1
The predicate is still deprecated, but we can't mark it as such until
the queries in our internal repo have migrated away from it.
2019-05-03 13:22:23 +02:00
Geoffrey White
ceda0d5c25 Merge pull request #1300 from jbj/MistypedFunctionArguments-rounding
C++: Use a smaller `double` literal in test
2019-05-03 09:56:42 +01:00
Jonas Jensen
6d954fe53e C++: Deprecate hasQualifiedName/1
This predicate handles templates differently from the other overloads
with the same name, so it's likely to cause confusion.
2019-05-03 10:37:48 +02:00
Jonas Jensen
5e789901df C++: Remove all uses of hasQualifiedName/1 2019-05-03 10:37:48 +02:00
Jonas Jensen
64a87a863c C++: Remove uses of getQualifiedName
This removes all uses of `Declaration.getQualifiedName` that I think can
be removed without changing any behaviour. The following uses in the
LGTM default suite remain:

* `cpp/ql/src/Security/CWE/CWE-121/UnterminatedVarargsCall.ql` (in `select`).
* `cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowDispatch.qll` (needs template args).
* `cpp/ql/src/semmle/code/cpp/security/FunctionWithWrappers.qll` (used for alert messages).
2019-05-03 10:37:48 +02:00
Jonas Jensen
0a2e28858a C++: Rework how qualified names are computed 2019-05-03 10:37:48 +02:00
Jonas Jensen
b51ce87ae8 C++: Autoformat QualifiedName.qll 2019-05-03 10:37:47 +02:00
Jonas Jensen
b97ff1a72f C++: Take QualifiedName.qll from Ian's branch
This imports `QualifiedName.qll` from
2f74a456290b9e0850b7308582e07f5d68de3a36 and makes minimal changes so it
compiles.

Original author: Ian Lynagh <ian@semmle.com>
2019-05-03 10:37:12 +02:00
Tom Hvitved
dfdfae8dd6 C#: Add more data flow tests 2019-05-03 09:41:39 +02:00
Jonas Jensen
93658038bc C++: Use a smaller double literal in test
This number got rounded differently on Linux and Windows, causing the
Windows test to fail.
2019-05-03 09:06:10 +02:00
Jonas Jensen
82a6629799 Merge pull request #1016 from dave-bartolomeo/dave/PreciseDefs
C++: SSA flow through fields and imprecise defs
2019-05-03 08:12:13 +02:00
Tom Hvitved
b6206d7370 Data flow: Introduce ReturnKind 2019-05-02 20:30:50 +02:00
Dave Bartolomeo
7071692373 C++: Clarify comment based on PR feedback 2019-05-02 11:18:10 -07:00
Dave Bartolomeo
34a422c756 C++: Accept test output after value category extractor fix 2019-05-02 11:18:10 -07:00
Dave Bartolomeo
ad966e4bd4 C++: Accept test diffs after imprecise use format change 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
fef58ec1ee C++: Add "~" prefix to inexact uses 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
ff12ed145e C++: Update test expectations after StmtExpr changes 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
95a62beb7a C++: Update test expectations due to better dataflow analysis 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
5dcd314908 C++: Update to conform to new API naming 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
65535449d6 C++: Fix merge conflicts 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
0cde86d3c1 C++: Fix PR feedback 2019-05-02 11:18:09 -07:00
Dave Bartolomeo
9869fd32d0 C++: Add implementation documentation for SSA 2019-05-02 11:18:08 -07:00
Dave Bartolomeo
e0f7344676 C++: Imprecise definitions in SSA 2019-05-02 11:18:08 -07:00
Dave Bartolomeo
9726428bcc C++: More SSA test cases 2019-05-02 11:18:08 -07:00
Dave Bartolomeo
eed0894029 C++: Add operand labels for more operand tags
I kept forgetting which operand on a Chi instruction was which, so I added dump labels. I added labels for the function target of a `Call`, for positional arguments, and for address operands as well.
2019-05-02 11:18:08 -07:00
Dave Bartolomeo
a7f3160684 C++: New SSA tests 2019-05-02 11:18:08 -07:00
Jonas Jensen
e68dda8ce8 Merge pull request #1299 from felicity-semmle/cpp-qldoc/fix-typo
Fix typo in C/C++ QL library docs
2019-05-02 17:10:25 +02:00
ian-semmle
464f66b529 Merge pull request #1287 from nickrolfe/fold
C++: support for fold expressions
2019-05-02 15:39:10 +01:00
Felicity Chapman
46177dd378 Fix typo in C/C++ QL library docs 2019-05-02 13:36:39 +01:00
Asger F
5ed3c50dbe TS: Workaround issue with infer types 2019-05-02 13:28:30 +01:00
Asger F
c7300fa197 TS: Add workaround for 'globalThis' getProperties() crash 2019-05-02 13:28:30 +01:00
Asger F
9934996f9b TS: Fix handling of 'export =' 2019-05-02 13:07:29 +01:00
Nick Rolfe
50c901d6d9 C++: remove pointless predicate 2019-05-02 11:16:21 +01:00
Nick Rolfe
8da2f0b8dc C++: clarify folds only appear in uninstantiated templates 2019-05-02 11:16:21 +01:00
Nick Rolfe
4e39862dd5 C++: update stats for @foldexpr 2019-05-02 11:16:21 +01:00
Nick Rolfe
324e59d5fd C++: change note for new FoldExpr class 2019-05-02 11:16:21 +01:00
Nick Rolfe
74f81c7f46 C++: test for fold expressions 2019-05-02 11:16:21 +01:00
Nick Rolfe
4352a20be0 C++: add support for C++17 fold expressions 2019-05-02 11:16:21 +01:00
Jonas Jensen
3905cf70f4 Merge pull request #1255 from geoffw0/wrongtypeformatmore
CPP: WrongTypeFormatArguments.ql Improvements
2019-05-02 09:17:21 +02:00
Jonas Jensen
dcbf70f616 Merge pull request #1279 from geoffw0/large-parameter
CPP: Tests and changes for LargeParameter.ql
2019-05-02 09:15:57 +02:00
Geoffrey White
d2f386ccb7 CPP: Effect of changes on tests. 2019-05-01 15:56:44 +01:00
Geoffrey White
19e6b238b7 CPP: Add test cases. 2019-05-01 15:43:06 +01:00
Geoffrey White
a5b9df204b CPP: Autoformat. 2019-05-01 13:59:28 +01:00
Jonas Jensen
9d15e67f3c C++: Use variableAccessedAsValue in LargeParameter
Using `variableAccessedAsValue` fixes a FP because we can now
distinguish modifications to the parameter from modifications to data
_reachable from_ the parameter.
2019-05-01 13:58:55 +01:00
Geoffrey White
60494fd6d5 CPP: Subtle test case. 2019-05-01 13:17:11 +01:00
Geoffrey White
2ef3cc30c0 CPP: Fix for functions with no definition. 2019-05-01 13:17:11 +01:00
Geoffrey White
6f2274aa5e CPP: Another test case. 2019-05-01 13:17:10 +01:00
Geoffrey White
32b6e9bd3c CPP: Exclude cases where the parameter is written to. 2019-05-01 13:17:10 +01:00
Geoffrey White
54c766c622 CPP: Add more test cases for LargeParameter.ql. 2019-05-01 13:17:10 +01:00
Geoffrey White
88a0e60a2a CPP: Un-autoformat to ease merge. 2019-05-01 13:16:46 +01:00
Jonas Jensen
490dd0e8c0 Merge pull request #1245 from geoffw0/classesmanyfields
CPP: Fix performance issues in ClassesWithManyFields.ql
2019-05-01 13:58:28 +02:00
Geoffrey White
d4e1bae5d5 Merge pull request #1173 from jbj/alloca-enable
C++: Enable cpp/alloca-in-loop on LGTM
2019-05-01 12:48:59 +01:00
Rasmus Lerchedahl Petersen
b5b2d56bfa Add pythagorean query 2019-05-01 13:16:40 +02:00
Geoffrey White
1ee28fa15b CPP: Add a test cases that uses restrict. 2019-05-01 11:12:07 +01:00
Geoffrey White
a749b5b6d1 CPP: Improve WrongTypeFormatArguments logic when there is more than one possible expected argument type. 2019-05-01 11:12:06 +01:00
Geoffrey White
ac277ad7ad CPP: Fix %I length specifier. 2019-05-01 11:12:06 +01:00
Geoffrey White
98c3e1475e CPP: Add test cases of %I64 and similar. 2019-05-01 11:12:06 +01:00
Geoffrey White
3a0dfbd00f CPP: Normalize test cases between some of the WrongTypeFormatArguments tests. 2019-05-01 11:12:06 +01:00
Geoffrey White
efa3c77db5 CPP: Additional test cases. 2019-05-01 10:58:03 +01:00
Geoffrey White
707c9965af CPP: Autoformat. 2019-05-01 10:36:15 +01:00
Dave Bartolomeo
de5c77c4e2 Update cpp/ql/src/Architecture/Refactoring Opportunities/ClassesWithManyFields.ql
Co-Authored-By: geoffw0 <40627776+geoffw0@users.noreply.github.com>
2019-05-01 10:36:00 +01:00
Geoffrey White
89c26ca394 CPP: Rewrite the VDE grouping in ClassesWithManyField.ql to be more performant (and modern). 2019-05-01 10:35:59 +01:00
Geoffrey White
0cc4b23484 CPP: QLDoc some predicates. 2019-05-01 10:35:57 +01:00
Geoffrey White
ab0505ea65 CPP: Undo autoformat so that things can merge. 2019-05-01 10:35:30 +01:00
Jonas Jensen
1203c7305a Merge pull request #1261 from geoffw0/autoformat
CPP: Autoformat the Critical queries directory
2019-05-01 11:19:21 +02:00
Max Schaefer
0f10bdc173 Merge pull request #1295 from asger-semmle/typescript-full-mode-fixes
Typescript full mode fixes
2019-05-01 09:10:43 +01:00
Geoffrey White
09ce95575a CPP: Fix merge. 2019-05-01 09:08:44 +01:00
Anders Schack-Mulligen
aca186bfb3 Merge pull request #1294 from yh-semmle/java12-ql
Java: add Java 12 support
2019-05-01 09:36:48 +02:00
Jonas Jensen
40aea2f76d C++: Shorten alert message
We don't write the reason for the alert in the alert message.
2019-05-01 08:33:36 +02:00
Jonas Jensen
e38ac9f88a C++: suppress alerts in tightly bounded loops 2019-05-01 08:33:35 +02:00
Jonas Jensen
399b64b9a6 C++: Enable cpp/alloca-in-loop on LGTM
Now that the query has both tests and qhelp, we can use it on LGTM. This
commit also adds a change note.

I renamed the query to reduce confusion from the lower-case unquoted
word "alloca".
2019-05-01 08:33:32 +02:00
Jonas Jensen
54091e87fa Merge pull request #1136 from zlaski-semmle/cpp340a
[CPP-340] Refinements to FutileParams.ql etc.
2019-05-01 08:21:35 +02:00
Ziemowit Laski
17066cfe3e [CPP-340] Adjust annotations in test.c file. 2019-04-30 13:21:36 -07:00
Tom Hvitved
42f2c88516 Merge pull request #1 from rdmarsh2/rdmarsh/dataflow/prepare-for-csharp
C++: Use CallInstruction as DataFlowCall
2019-04-30 20:52:53 +02:00
Asger F
15299aba7d TS: Workaround issue with infer types 2019-04-30 16:07:45 +01:00
yh-semmle
3a988d0312 Java 12: revert addition of deprecated annotations for preview features 2019-04-30 10:59:08 -04:00
yh-semmle
6d59b4e049 Java 12: tweak queries to preserve behavior
This accounts for the changes in af8faee1.
2019-04-30 10:59:08 -04:00
yh-semmle
de47f25141 Java 12: remove deprecated annotation from Stmt::getEnclosingStmt 2019-04-30 10:59:07 -04:00
yh-semmle
3f132f45d9 Java 12: add dbscheme stats for switch expressions 2019-04-30 10:59:07 -04:00
yh-semmle
f22084e18a Java 12: add more QL deprecated annotations 2019-04-30 10:59:06 -04:00
Anders Schack-Mulligen
0a569f6c1a Java: Change TCs of Stmt.getParent to Stmt.getEnclosingStmt. 2019-04-30 10:59:06 -04:00
Anders Schack-Mulligen
6ecf46ce85 Java: Add CFG edges for switch expressions. 2019-04-30 10:59:05 -04:00
Anders Schack-Mulligen
9a367d9293 Java: JumpStmt.getTarget, Stmt.getEnclosingStmt, SwitchExpr.getAResult. 2019-04-30 10:59:05 -04:00
yh-semmle
61324f0bb0 Java 12: enhanced QLDoc for preview features 2019-04-30 10:59:05 -04:00
yh-semmle
d4e013b297 Java 12: deprecate QL constructs for new preview feature (switch exprs) 2019-04-30 10:59:04 -04:00
yh-semmle
38705038a8 Java 12: add QL for switch expressions, etc 2019-04-30 10:59:04 -04:00
yh-semmle
6ac1ee5fad Java 12: add switch expressions to dbscheme 2019-04-30 10:59:04 -04:00
yh-semmle
4ede686283 Java: refactor ConstCase and DefaultCase in preparation for Java 12 2019-04-30 10:59:03 -04:00
Asger F
5c8dd7eedd TS: Add workaround for 'globalThis' getProperties() crash 2019-04-30 12:44:58 +01:00
Asger F
686d72c356 TS: Fix handling of 'export =' 2019-04-30 12:41:59 +01:00
Asger F
11c07a3217 TS: Update to TypeScript 3.4.5 2019-04-30 12:41:59 +01:00
semmle-qlci
3f70d91a11 Merge pull request #1288 from xiemaisi/js/fix-end-node-labels
Approved by asger-semmle
2019-04-30 07:32:29 +01:00
Ziemowit Laski
be77eb7367 [CPP-340] Add new test cases to test.c; this required the .expected
files to be regenerated.
2019-04-29 15:30:28 -07:00
Robert Marsh
514d405630 C++: Use CallInstruction as DataFlowCall 2019-04-29 14:18:09 -07:00
Ziemowit Laski
d14696729b [CPP-340] Fix end-of-line formatting for our change notes.
Bring back entry accidentally deleted during previous merge.
2019-04-29 14:05:58 -07:00
Tom Hvitved
5f6e9121b3 C++: Generalize FunctionCall to Call in data-flow library 2019-04-29 20:42:07 +02:00
Tom Hvitved
29e59e6d1e Address review comments 2019-04-29 20:19:31 +02:00
semmle-qlci
2ede941097 Merge pull request #1291 from jbj/backEdgeSuccessor-perf
Approved by dave-bartolomeo
2019-04-29 18:18:27 +01:00
semmle-qlci
0ffba8b4eb Merge pull request #1289 from jbj/dominanceFrontier-iterated-ir
Approved by dave-bartolomeo
2019-04-29 18:14:20 +01:00
semmle-qlci
d53f5aac13 Merge pull request #1228 from jbj/ir-result-type-docs
Approved by dave-bartolomeo
2019-04-29 18:07:22 +01:00
Ziemowit Laski
a0cfe826ee [CPP-340] Replace whitelist with f.getBlock() test. Fix doc comment. 2019-04-29 09:58:31 -07:00
Mark Shannon
d44ce4f1df Python points-to: Performance improvement. 2019-04-29 17:53:18 +01:00
Mark Shannon
15a7ac3680 Python: update failed inference query to use latest points-to. 2019-04-29 16:59:51 +01:00
Mark Shannon
dfc0a80cc5 Python points-to: Handle old-style classes correctly. 2019-04-29 16:40:46 +01:00
Max Schaefer
7ca5cc22d8 Merge pull request #1257 from asger-semmle/jsdoc
JS: Add common interface between TypeExpr and JSDocTypeExpr
2019-04-29 16:20:17 +01:00
Mark Shannon
3ca4524f7a Python points-to: Improve handling of __call__() a bit. 2019-04-29 15:15:01 +01:00
Jonas Jensen
5fd425ae95 C++: fix IRBlock::backEdgeSuccessor performance
The `IRBlock::backEdgeSuccessor` predicate, in its three copies, had
become slow:

    6:IRBlock::Cached::backEdgeSuccessor#fff ...... 1m1s
    7:IRBlock::Cached::backEdgeSuccessor#2#fff .... 52.3s
    8:IRBlock::Cached::backEdgeSuccessor#3#fff .... 26.4s

The slow part was finding all the nodes involved in cycles in the
`forwardEdgeRaw` graph. This was done with `forwardEdgeRaw+(pred, pred)`,
but that got compiled into a materialization of `forwardEdgeRaw+`, which
is a huge relation with 1,816,752,107 rows on Wireshark:

    (1474s) Starting to evaluate predicate IRBlock::Cached::backEdgeSuccessor#3#fff
    (1501s) Tuple counts:
    0          ~0%     {2} r1 = SELECT #IRBlock::Cached::forwardEdgeRaw#3#ffPlus ON FIELDS #IRBlock::Cached::forwardEdgeRaw#3#ffPlus.<0>=#IRBlock::Cached::forwardEdgeRaw#3#ffPlus.<1>
    0          ~0%     {1} r2 = SCAN r1 OUTPUT FIELDS {r1.<0>}
    0          ~0%     {3} r3 = JOIN r2 WITH IRBlock::Cached::blockSuccessor#6#fff ON r2.<0>=IRBlock::Cached::blockSuccessor#6#fff.<0> OUTPUT FIELDS {r2.<0>,IRBlock::Cached::blockSuccessor#6#fff.<1>,IRBlock::Cached::blockSuccessor#6#fff.<2>}
    12411      ~7%     {3} r4 = IRBlock::Cached::backEdgeSuccessorRaw#3#fff \/ r3
                       return r4
    (1501s)  >>> Relation IRBlock::Cached::backEdgeSuccessor#3#fff: 12411 rows using 0 MB

The problem is the `SELECT`. It's fast to join on a fastTC result once
we know what we're looking for, so this fix materializes the identity
relation on `IRBlock` and joins with that so the fastTC ends up on the
RHS of a join, where it's fast. I had to introduce a helper predicate
because even with `noopt` I couldn't get `pred = pred2` to come _before_
`forwardEdgeRaw+(pred, pred2)`. The predicate now takes less than a
second to evaluate:

    (539s) Starting to evaluate predicate IRBlock::Cached::backEdgeSuccessor#fff
    (539s)  >>> Relation IRBlock::Cached::blockImmediatelyDominates#ff: 574677 rows using 0 MB
    (539s) 	 ... created with 574677 rows and 2 columns.
    (539s) Tuple counts:
    702445     ~1%     {2} r1 = SELECT IRBlock::Cached::blockIdentity#ff ON FIELDS IRBlock::Cached::blockIdentity#ff.<0>=IRBlock::Cached::blockIdentity#ff.<1>
    702445     ~1%     {2} r2 = SCAN r1 OUTPUT FIELDS {r1.<0>,r1.<0>}
    0          ~0%     {1} r3 = JOIN r2 WITH #IRBlock::Cached::forwardEdgeRaw#ffPlus ON r2.<0>=#IRBlock::Cached::forwardEdgeRaw#ffPlus.<0> AND r2.<1>=#IRBlock::Cached::forwardEdgeRaw#ffPlus.<1> OUTPUT FIELDS {r2.<0>}
    0          ~0%     {3} r4 = JOIN r3 WITH IRBlock::Cached::blockSuccessor#2#fff ON r3.<0>=IRBlock::Cached::blockSuccessor#2#fff.<0> OUTPUT FIELDS {r3.<0>,IRBlock::Cached::blockSuccessor#2#fff.<1>,IRBlock::Cached::blockSuccessor#2#fff.<2>}
    20487      ~0%     {3} r5 = IRBlock::Cached::backEdgeSuccessorRaw#fff \/ r4
                       return r5
    (539s)  >>> Relation IRBlock::Cached::backEdgeSuccessor#fff: 20487 rows using 0 MB
2019-04-29 15:44:50 +02:00
Mark Shannon
65a30ab392 Adjust a couple of query tests to work with latest points-to. 2019-04-29 14:28:51 +01:00
Max Schaefer
8a34ea8b71 Merge pull request #1284 from esben-semmle/js/fix-azure-performance
JS: fix azure performance
2019-04-29 13:15:16 +01:00
Mark Shannon
6a5ec51623 Update IsComparisons.qll to account for not tracking attributes in detail. 2019-04-29 12:22:48 +01:00
Mark Shannon
55511430cb Python points-to. Don't let unknown values escape refersTo(). 2019-04-29 12:22:17 +01:00
Jonas Jensen
cd7ba176ab C++: iterated dominance frontier algorithm for IR
Use the iterated dominance frontier algorithm to speed up dominance
frontier calculations. The implementation is copied from d310338c9b.

Before this change, the SSA calculations for unaliased and aliased SSA
used 169.9 seconds in total on these predicates:

    7:Dominance::getDominanceFrontier#2#ff .. 49s
    7:Dominance::blockDominates#2#ff ........ 47.5s
    8:Dominance::getDominanceFrontier#ff .... 44.4s
    8:Dominance::blockDominates#ff .......... 29s

After this change, the above predicates are replaced by two copies of
`getDominanceFrontier`, each of which takes less than a second.
2019-04-29 13:01:37 +02:00
ian-semmle
5fd10b56a2 Merge pull request #1280 from jbj/noTarget-workaround
C++: Work around extractor issue CPP-383
2019-04-29 10:47:06 +01:00
Calum Grant
11c1fc8512 Merge pull request #1281 from felicity-semmle/1.20/SD-3391-csharp-version-ql-support
1.20 release: Update supported versions for C#
2019-04-29 09:27:54 +01:00
Tom Hvitved
58babdd425 Merge pull request #1187 from calumgrant/cs/expression-null
C#: Fix FP in cs/constant-condition
2019-04-29 09:37:30 +02:00
Jonas Jensen
c112a4dd20 Merge pull request #1285 from geoffw0/rnperf
CPP: Improve performance of RedundantNullCheckSimple.ql
2019-04-29 08:41:43 +02:00
semmle-qlci
52d6626547 Merge pull request #1242 from esben-semmle/js/whitelist-trailing-newline-removal
Approved by xiemaisi
2019-04-29 07:35:15 +01:00
Ziemowit Laski
4a760b1561 [CPP-340] Delete ArgumentsToImplicit.ql and associated files.
Reduce MistypedFunctionArguments.ql precision to `medium`.
2019-04-28 13:49:46 -07:00
Asger F
3e7bac465b JS: fix join ordering in SimpleParameter.getJSDocTag 2019-04-26 16:56:04 +01:00
Asger F
db3060d336 JS: Add missing override 2019-04-26 16:56:04 +01:00
Asger F
a17756c3d5 JS: Fix formatting 2019-04-26 16:56:04 +01:00
Asger F
2f98acaf6e JS: upgrade script 2019-04-26 16:56:04 +01:00
Asger F
f99db08542 JS: Update trap files 2019-04-26 16:56:04 +01:00
Asger F
393a9fd7b0 JS: Add change notes 2019-04-26 16:56:04 +01:00
Asger F
9086dfdc6f JS: TypeAnnotation.getType() for backwards compatibility 2019-04-26 16:56:04 +01:00
Asger F
e9fcb670ff JS: Provide source locations for JSDocTypeExpr 2019-04-26 16:56:04 +01:00
Asger F
cf8c327a10 JS: make TypeAnnotation extend Locatable 2019-04-26 16:56:04 +01:00
Max Schaefer
c44f99a204 Update javascript/ql/src/semmle/javascript/Variables.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-04-26 16:56:04 +01:00
Asger F
6eb8c692b1 JS: Add partial backwards compatibility with ASTNode 2019-04-26 16:56:04 +01:00
Asger F
e295c3a224 JS: Add JSDoc test 2019-04-26 16:56:04 +01:00
Asger F
6b2b64cb2e JS: test case with unresolved types in TS 2019-04-26 16:56:04 +01:00
Asger F
c9c9a32a37 JS: hasQualifiedName 2019-04-26 16:56:04 +01:00
Asger F
454fff1398 JS: Implement getAnUnderlyingType(). 2019-04-26 16:56:04 +01:00
Asger F
8458a64642 JS: implement isXXX methods in JSDocTypeExpr classes 2019-04-26 16:56:04 +01:00
Asger F
c92a6b72b5 JS: Update getTypeAnnotation() to return TypeAnnotations 2019-04-26 16:56:04 +01:00
Asger F
be5d90d4e7 JS: Make use of JSDocParamTag 2019-04-26 16:56:04 +01:00
Asger F
967752c6c1 JS: Add TypeAnnotations class 2019-04-26 16:56:04 +01:00
Mark Shannon
abf0347fce Python points-to: Split strings into bytes and unicode. 2019-04-26 16:21:47 +01:00
Mark Shannon
48c0cbe51a Python: improve handling of __all__ 2019-04-26 16:21:47 +01:00
Mark Shannon
3bb61e7410 Python points-to: Improve handling of subscripts and sequence inequalities. 2019-04-26 16:21:47 +01:00
Mark Shannon
674a3da4b8 Python points-to: Importing from 'unknown' gives 'unknown'. 2019-04-26 16:21:47 +01:00
Mark Shannon
5ad731a2a8 Python points-to. Fix handling of six.add_metaclass. 2019-04-26 16:21:47 +01:00
Mark Shannon
f51a2d9ec4 Python points-to: Fix up test-evaluate for ABCs and tests involving type(). 2019-04-26 16:21:47 +01:00
Mark Shannon
8a2fb54c49 Python points-to. Track bitwise or-ing of small integer flags. 2019-04-26 16:21:47 +01:00
Mark Shannon
96eaf815da Python: Fix up state-tracking library. 2019-04-26 16:21:47 +01:00
Mark Shannon
2ea204f7f9 Python points-to: Fix up failedInference predicate. 2019-04-26 16:21:47 +01:00
Mark Shannon
2aa967ae8e Remove redundant tests. 2019-04-26 16:21:47 +01:00
Mark Shannon
4145b19671 Python points-to: update some test results. 2019-04-26 16:21:47 +01:00
Mark Shannon
ddc4ada130 Python points-to: Handle subclassing of ABCs. 2019-04-26 16:21:47 +01:00
Mark Shannon
2d4f64f2e5 Python legacy objects: fix function/method call. 2019-04-26 16:21:47 +01:00
Mark Shannon
989d587617 Python points-to: Fix support for backwards compatible extensions. 2019-04-26 16:21:46 +01:00
Mark Shannon
dffbf698d2 Python points-to: improve performance. 2019-04-26 16:21:46 +01:00
Mark Shannon
cd34e23c4c Python points-to: Bring attribute points-to to effective parity with old points-to. 2019-04-26 16:21:46 +01:00
Mark Shannon
2e6c3c9ee3 Python points-to: Support classes created dynamically as instances of meta-class. 2019-04-26 16:21:46 +01:00
Mark Shannon
06ab671629 Python points-to. Fix descriptor behviour of Python functions. 2019-04-26 16:21:46 +01:00
Mark Shannon
9d40a6cd8c Python points-to: restore getArgumentForCall() API method. 2019-04-26 16:21:46 +01:00
Mark Shannon
90bbfd3b16 Python: Add library tests for django. 2019-04-26 16:21:46 +01:00
Mark Shannon
46b9ef79b4 Python points-to: Fix up neverReturns() and return value of __import__(). 2019-04-26 16:21:46 +01:00
Mark Shannon
62e05187af Python points-to: Add property objects. 2019-04-26 16:21:46 +01:00
Mark Shannon
ec080419ba Python points-to: Assorted tweaks to get nore tests passing. 2019-04-26 16:21:46 +01:00
Mark Shannon
3b42f3cea3 Python points-to/taint-tracking: Fix up flow into __init__ methods. 2019-04-26 16:21:46 +01:00
Mark Shannon
53f859117e Python points-to: Fix attribute lookup for packages. 2019-04-26 16:21:46 +01:00
Mark Shannon
4a03fd03cd Update test to reflect new true positive. 2019-04-26 16:21:46 +01:00
Mark Shannon
e82b2c422e Python: Update test to use new API. 2019-04-26 16:21:46 +01:00
Mark Shannon
a442695ad0 Python points-to: Improve handling of len(), sequences and comparisons. 2019-04-26 16:21:46 +01:00
Mark Shannon
e21a863db9 Python points-to: Update sanity check. 2019-04-26 16:21:46 +01:00
Mark Shannon
03159bb31c Python points-to: Track 'unknown' value through simple iteration. 2019-04-26 16:21:46 +01:00
Mark Shannon
9af7071131 Python points-to: track return values from builtin methods. 2019-04-26 16:21:46 +01:00
Mark Shannon
b8fb3e3e61 Python points-to: Distinguish between class attribute access and lookup. Fixes handling of classmethods. 2019-04-26 16:21:46 +01:00
Mark Shannon
55eac7d555 Python points-to: Fix up handling of recursive 'from ... import *'. 2019-04-26 16:21:46 +01:00
Mark Shannon
0b2421eb23 Python points-to. Tidy up a bit. 2019-04-26 16:21:46 +01:00
Mark Shannon
5644072a8d Python points-to: make sure builtin tuples are visible. 2019-04-26 16:21:46 +01:00
Mark Shannon
b47c2dd083 Python remove old MRO module and rename MRO2 to MRO. 2019-04-26 16:21:46 +01:00
Mark Shannon
f543adcd38 Python points-to: Fix up matching arguments to parameters. 2019-04-26 16:21:46 +01:00
Mark Shannon
662aedcb13 Python points-to: Fix up module attributes and classmethods. 2019-04-26 16:21:46 +01:00
Mark Shannon
fc2c46fe4a Python: Fix error in update Module to use new points-to API. 2019-04-26 16:21:46 +01:00
Mark Shannon
782311f805 Python: Update taint-tracking to use new points-to API. 2019-04-26 16:21:46 +01:00
Mark Shannon
3c30480845 Python: Extend API a bit. 2019-04-26 16:21:46 +01:00
Mark Shannon
31a95ceeec Python points-to: Use strongly typed version of CfgOrigin. 2019-04-26 16:21:46 +01:00
Mark Shannon
162bf5143b Python points-to: Assorted improvements to performance and better compatibility. 2019-04-26 16:21:46 +01:00
Mark Shannon
ef0a6b6713 Python points-to: Rationalize handling of expressions and conditions. Tweak API to be a bit more backward-compatible. 2019-04-26 16:21:46 +01:00
Mark Shannon
54c27e1d4b Python points-to: Various minor performance tweaks. 2019-04-26 16:21:46 +01:00
Mark Shannon
23ca403728 Python points-to: Understand callable and hasattr. 2019-04-26 16:21:46 +01:00
Mark Shannon
8af6cb6644 Python points-to: Use objects, not booleans when doing evaluation of tests. 2019-04-26 16:21:46 +01:00
Mark Shannon
610a35c187 Python points-to: Improve backwards compatibility for comparisons. 2019-04-26 16:21:45 +01:00
Mark Shannon
f7edbcc6d9 Python points-to: Clean up interface, and deprecate old interface. 2019-04-26 16:21:45 +01:00
Mark Shannon
d3762ac5a1 Rename 'points_to' to 'pointsTo'. 2019-04-26 16:21:45 +01:00
Mark Shannon
931100c772 Python points-to: Add float objects for better backwards compatibility. 2019-04-26 16:21:45 +01:00
Mark Shannon
e9f58ba3a7 Python: refactor ConstantObjects. 2019-04-26 16:21:45 +01:00
Mark Shannon
0b0a6337f3 Python points-to: Support descriptor protocols, particularly functions. 2019-04-26 16:21:45 +01:00
Mark Shannon
dbf228d005 Python points-to: Better handling of *args, **kwargs and procedures. 2019-04-26 16:21:45 +01:00
Mark Shannon
f5c32421f4 Python points-to: Handle list, dict and float literals as instances. 2019-04-26 16:21:45 +01:00
Mark Shannon
48297e299e Python points-to: Improve handling of 'type' object. 2019-04-26 16:21:45 +01:00
Mark Shannon
85a9016c8c Python points-to: make 'self' instances distinct from other instances. 2019-04-26 16:21:45 +01:00
Mark Shannon
12853ccf30 Python points-to: Add support for tuples. 2019-04-26 16:21:45 +01:00
Mark Shannon
dd83149cc3 Python points-to: Port old API classes to use new points-to. 2019-04-26 16:21:45 +01:00
Mark Shannon
aa30745492 Python points-to: Further types and flow. 2019-04-26 16:21:45 +01:00
Mark Shannon
e3ed8c6abf Python points-to: Simplify handling of booleans and comparisons. 2019-04-26 16:21:45 +01:00
Mark Shannon
84c9866c50 Python points-to: Add generic instances and handle returns for builtin functions. Move attribute lookup handling to objects. 2019-04-26 16:21:45 +01:00
Mark Shannon
ce9d0f1a06 Python points-to: Add support for some more ESSA definitions. 2019-04-26 16:21:45 +01:00
Mark Shannon
ec151e9b02 Python points-to: Convert two pairs of predicates to methods on booleans. 2019-04-26 16:21:45 +01:00
Mark Shannon
39b9723054 Python: Add support for bound-methods. 2019-04-26 16:21:45 +01:00
Mark Shannon
bf692f4aad Python: Add better class support, including inheritance. 2019-04-26 16:21:45 +01:00
Mark Shannon
5a46df2132 Python: Add ADTs for ints and strings. Add some global data-flow. 2019-04-26 16:21:45 +01:00
Mark Shannon
051683fadf Python: Break-up internal object modules. 2019-04-26 16:21:45 +01:00
Mark Shannon
c48d63f2ec Python: First draft of ADT based objects and attendant points-to. 2019-04-26 16:21:45 +01:00
Taus
7d2c17f27c Merge pull request #1271 from markshannon/python-fix-fp-http-prefix
Python: Fix false positive in 'Incomplete URL substring sanitization' query
2019-04-26 15:23:04 +02:00
Max Schaefer
e2666a9203 Update javascript/ql/src/semmle/javascript/frameworks/SocketIO.qll
Co-Authored-By: esben-semmle <42067045+esben-semmle@users.noreply.github.com>
2019-04-26 11:58:40 +02:00
Esben Sparre Andreasen
27f88c38ac JS: help the optimizer with NPMPackage/File relations 2019-04-26 11:49:07 +02:00
Jonas Jensen
bdb678a318 Merge pull request #1267 from rdmarsh2/rdmarsh/cpp/def-by-ref-taint
C++: add taint edges to DefinitionByReferenceNode
2019-04-26 08:50:20 +02:00
Robert Marsh
f5c57b77e6 C++: fix whitespace 2019-04-25 16:16:27 -07:00
Mark Shannon
2db06f9881 Merge pull request #1282 from taus-semmle/python-various-dist-compare-fixes
Python: Add missing `override` annotations.
2019-04-25 18:39:01 +01:00
Mark Shannon
28799441af Python: Fix false positive in 'Incomplete URL substring sanitization' query. 2019-04-25 18:11:01 +01:00
Geoffrey White
63b6942d0d CPP: Improve performance of RedundantNullCheckSimple.ql. 2019-04-25 15:56:49 +01:00
Taus Brock-Nannestad
c8cbae37d9 Python: Add missing override annotations. 2019-04-25 16:48:47 +02:00
Felicity Chapman
156c826f86 Update supported versions for C# 2019-04-25 15:36:01 +01:00
Jonas Jensen
48a3385809 C++: Work around extractor issue CPP-383
This fixes `PointlessComparison.ql` on https://github.com/an-tao/drogon.
The QL is a bit obfuscated because it looks for a pattern that's
impossible according to the dbscheme. There is no accompanying test
because we haven't been able to boil this problem down to a simple test
case. If we could, we'd fix it directly in the extractor instead.
2019-04-25 15:05:27 +02:00
semmle-qlci
3231b60e6b Merge pull request #1272 from asger-semmle/access-path-capture
Approved by xiemaisi
2019-04-25 11:32:54 +01:00
Asger F
47ba7d3004 Merge pull request #1278 from xiemaisi/js/symbolic-constants
JavaScript: Generalise `ConstantComparison` sanitisers.
2019-04-25 11:17:22 +01:00
Max Schaefer
a8470a984a JavaScript: Generalise ConstantComparison sanitisers.
In addition to treating comparisons with literals as sanitisers, we now
also treat comparisons with variables that have a single assignment as
sanitisers.

Proving that such a variable is actually a constant is not easy, but for
this use case a simple approximation works fine.
2019-04-25 07:38:31 +01:00
Ziemowit Laski
ac58bdfc58 [CPP-340] For MistypedFunctionArguments.ql, add support for pointers to pointers and pointers to arrays. 2019-04-24 14:54:01 -07:00
semmle-qlci
a504ad4261 Merge pull request #1270 from xiemaisi/odasa/7904
Approved by esben-semmle
2019-04-24 21:50:07 +01:00
semmle-qlci
3fbfb79c5b Merge pull request #1276 from adityasharad/js/node-runtime-env-var
Approved by asger-semmle
2019-04-24 16:55:14 +01:00
Taus
0917936100 Merge pull request #1273 from markshannon/python-fix-odasa-7890
Add test confirming correct handling of zope.interface.Interface in query.
2019-04-24 11:59:35 +02:00
Asger F
a16753c125 JS: Add documentation 2019-04-24 10:12:55 +01:00
Jonas Jensen
1dcfd21a5c Merge pull request #1264 from geoffw0/redundantnullperf
CPP: Add qhelp for RedundantNullCheckSimple.ql.
2019-04-24 10:25:23 +02:00
Aditya Sharad
4121e7245b TS extractor: Allow the Node.js runtime to be configured via environment variables.
`SEMMLE_TYPESCRIPT_NODE_RUNTIME` can be used to provide the path to the Node.js runtime executable.
If this is omitted, the extractor defaults to the current behaviour of looking for `node` on the PATH.

`SEMMLE_TYPESCRIPT_NODE_RUNTIME_EXTRA_ARGS` can be used to provide additional arguments to the
Node.js runtime. These are passed first, before the arguments supplied by the extractor.

These changes are designed to allow TypeScript extraction in controlled customer environments where
we cannot control the PATH, or must use custom Node.js executables with certain arguments set.
2019-04-23 15:04:14 -07:00
Robert Marsh
919f5c616f C++: comment and test for taint flow via memcpy 2019-04-23 11:17:18 -07:00
semmle-qlci
060aa8cb6c Merge pull request #1274 from asger-semmle/ts-export-equals
Approved by xiemaisi
2019-04-23 17:07:52 +01:00
Geoffrey White
6234b26496 CPP: Make some repairs manually. 2019-04-23 14:45:27 +01:00
Geoffrey White
e395f5215f CPP: Autoformat 'Critical'. 2019-04-23 14:45:27 +01:00
Max Schaefer
7faa4fd938 JavaScript: Add test case exposing two bugs in data flow library.
This test case exposes two bugs in our data flow library (fixed by the
two previous commits):

  - the charpreds of `SourcePathNode` and `SinkPathNode` only ensured
    that they were on a path from a source to a sink, not that they
    actually were the source/sink themselves;
  - function summarization would allow for non-level paths; in the
    test case, this meant that one of the summaries for `source`
    represented the path returning from `source` on line 13 and then
    flowing back into the call on line 15, in the process transforming
    the parity of the flow label and hence causing a spurious flow.
2019-04-23 13:16:30 +01:00
Max Schaefer
465be47574 JavaScript: Only follow level flow steps when summarising functions.
It is not only wasteful to consider paths with unmatched calls/returns,
but also wrong; see test case in next commit.
2019-04-23 13:16:30 +01:00
Max Schaefer
455dbccd05 JavaScript: Fix definitions of SourcePathNode and SinkPathNode.
Their charpreds previously only ensured that they were on a path from a
source to a sink, not that they actually were the source and sink,
respectively. See two commits further for a test case.
2019-04-23 13:15:47 +01:00
Asger F
08bc29cddb TS: fix analysis of export= statements 2019-04-23 13:09:40 +01:00
Mark Shannon
6a9bb5c5c9 Add test confirming correct handling of zope.interface.Interface in query. 2019-04-23 12:52:50 +01:00
Esben Sparre Andreasen
f064ba0c55 JS: change notes for newline whitelist in js/incomplete-sanitization 2019-04-23 08:38:26 +02:00
Esben Sparre Andreasen
ac0913c878 JS: add newline removal whitelist for js/incomplete-sanitization 2019-04-23 08:38:23 +02:00
Esben Sparre Andreasen
bdbd00e046 JS: add newline removal tests for js/incomplete-sanitization 2019-04-23 08:37:39 +02:00
Robert Marsh
34f8653979 C++: change note for taint def-by-ref 2019-04-22 10:46:36 -07:00
Robert Marsh
262f724235 C++: add taint edges to DefinitionByReferenceNode 2019-04-22 10:39:02 -07:00
Robert Marsh
45a35a8572 Merge pull request #1265 from rdmarsh2/rdmarsh/cpp/gvn-string-pooling
C++: string pooling in IR value numbering
2019-04-22 09:29:44 -07:00
Ziemowit Laski
36b2c14f88 [CPP-340] Minor formatting tweaks 2019-04-19 11:46:54 -07:00
Robert Marsh
e7ca6c8bd9 C++: test for value number string pooling 2019-04-19 10:50:52 -07:00
Ziemowit Laski
62b030d27f [CPP-340] Add a fourth query, ArgumentsToImplicit.ql, to deal strictly with implicitly declared
functions.  TooManyArguments.ql will now deal with explicitly declared/prototyped functions.
2019-04-18 17:56:41 -07:00
Robert Marsh
3907ef98a3 C++: value number string constants 2019-04-18 16:14:54 -07:00
yh-semmle
04954f77de Merge pull request #1262 from sb-semmle/more-spring-sources
Parameters annotated with Spring's @RequestBody and @PathVariable are remote input sources.
2019-04-18 18:08:44 -04:00
Sebastian Bauersfeld
734fe542ab Update change notes. 2019-04-18 16:37:08 -04:00
Robert Marsh
c6f01265be Merge pull request #1263 from geoffw0/bufferoverflowqueries
CPP: Resolve overlap between OverflowCalculated.ql and NoSpaceForZeroTerminator.ql
2019-04-18 13:21:57 -04:00
Geoffrey White
eaed0004a3 CPP: Add qhelp for RedundantNullCheckSimple.ql. 2019-04-18 12:47:07 +01:00
Asger F
f3c80c738e JS: Unify access paths for captured variables 2019-04-18 11:27:15 +01:00
Asger F
e543097c45 JS: Add test 2019-04-18 11:26:39 +01:00
Geoffrey White
56e0adf152 CPP: Change note. 2019-04-18 10:34:20 +01:00
Geoffrey White
57a4e52b47 CPP: Remove the overlap between these two queries. 2019-04-18 10:33:33 +01:00
Geoffrey White
ca6ba36d87 CPP: Unify and improve the MallocCall classes. 2019-04-18 10:30:18 +01:00
Geoffrey White
1ba8364c3b CPP: Add more test cases. 2019-04-18 10:28:34 +01:00
Geoffrey White
8856442f7f CPP: Add NoSpaceForZeroTerminator to the OverflowCalculated test. 2019-04-18 09:19:44 +01:00
Geoffrey White
12650f85c5 CPP: Rename a test file. 2019-04-18 09:16:55 +01:00
Max Schaefer
76e01f0055 JavaScript: Update TypeTracker to align with TypeBackTracker.
It now also has `step` and `smallstep` predicates. In the usual case,
however, I think I prefer the `SourceNode::track` API, so I left the
recommended style in the qldoc alone (and adjusted the one for
`TypeBackTracker` to match).
2019-04-18 09:08:09 +01:00
Sebastian Bauersfeld
2f200d7517 Parameters annotated with Spring's @RequestBody and @PathVariable are remote input sources. 2019-04-17 18:02:00 -04:00
Geoffrey White
c674f54129 Merge pull request #1259 from xiemaisi/cpp/typo-fix
CPP: Fix two doc comments.
2019-04-17 16:48:23 +01:00
ian-semmle
ff574e56be Merge pull request #1260 from nickrolfe/qltest_verbosity
C++: update expected extractor arguments to match qltest runner changes
2019-04-17 15:56:22 +01:00
Max Schaefer
a61ca489f1 Merge pull request #1258 from asger-semmle/prototype-pollution
JS: prototype pollution query template
2019-04-17 12:58:05 +01:00
Nick Rolfe
bf204ecdf8 C++: update expected extractor arguments to match qltest runner changes 2019-04-17 12:30:04 +01:00
Max Schaefer
599185e125 CPP: Fix two doc comments. 2019-04-17 10:49:38 +01:00
Geoffrey White
f33b24c917 Merge pull request #1239 from jbj/qlformat-1
C++: Autoformat QL code in Architecture and Best Practices
2019-04-17 09:56:29 +01:00
semmle-qlci
f36eafce3f Merge pull request #1246 from xiemaisi/js/hardcoded-password
Approved by asger-semmle
2019-04-17 08:54:09 +01:00
Ziemowit Laski
65130c40ab [CPP-340] Add white list (for false positive suppression) to TooManyArguments.ql 2019-04-16 14:02:34 -07:00
Robert Marsh
09d0548c81 Merge pull request #1237 from geoffw0/commentedoutcode2
CPP: Fix FPs from detecting commented out preprocessor logic
2019-04-16 10:31:42 -07:00
Calum Grant
d8b47c8337 Merge pull request #1225 from hvitved/csharp/cfg/dynamic-accessor-calls
C#: Improve CFG for (potential) dynamic accessor calls
2019-04-16 17:53:12 +01:00
Asger F
48ca4ae0d8 JS: prototype pollution query template 2019-04-16 17:40:41 +01:00
calum
b628060ddd C#: Address review comments. 2019-04-16 17:38:55 +01:00
calum
e16cbe0ca1 C#: Analysis change notes. 2019-04-16 16:45:49 +01:00
calum
b11dce7b8a C#: Fix FP in expressions of the form (a?b:null)??d, where the null has a single successor, but the d is a join node. 2019-04-16 16:44:51 +01:00
calum
3e563f7a11 C#: Add (failing) unit test for cs/constant-condition 2019-04-16 16:44:50 +01:00
Asger F
e88e5cf4d7 Merge pull request #1256 from Semmle/rc/1.20
Merge 1.20 into master
2019-04-16 16:10:36 +01:00
Geoffrey White
2d15163e30 CPP: Test of a comment inside #if 0. 2019-04-16 15:37:21 +01:00
Arthur Baars
4e10e285a2 Merge pull request #1253 from asger-semmle/rc-tscrash
TS: Dont extract redirect SourceFiles
2019-04-16 14:01:25 +02:00
Asger F
fafdd5bbcd TS: Dont extract redirect SourceFiles 2019-04-16 10:17:45 +01:00
semmle-qlci
ff25a3ee5a Merge pull request #1243 from asger-semmle/access-path-refinements
Approved by xiemaisi
2019-04-16 09:57:51 +01:00
Max Schaefer
65e508ae3b Merge pull request #1252 from esben-semmle/mb/1.20-master
Mergeback: rc/1.20 into Semmle/master
2019-04-16 09:27:50 +01:00
semmle-qlci
aeebc3692d Merge pull request #1247 from asger-semmle/tscrash
Approved by xiemaisi
2019-04-16 07:59:02 +01:00
semmle-qlci
97018f7c3a Merge pull request #1248 from asger-semmle/ts-full-default
Approved by xiemaisi
2019-04-16 07:56:50 +01:00
Max Schaefer
7af4baf57f Merge pull request #1220 from esben-semmle/js/another-getAPropertyAttribut-performance-fix
JS: inline CallToObjectDefineProperty::getAPropertyAttribute
2019-04-16 07:55:53 +01:00
Esben Sparre Andreasen
c80ee3df01 Mergeback: rc/1.20 into Semmle/master 2019-04-16 08:46:15 +02:00
Asger F
abbfe2d5ce TS: Dont extract redirect SourceFiles 2019-04-15 18:57:02 +01:00
Max Schaefer
faba019a29 Merge pull request #1229 from esben-semmle/js/whitelist-unwrappind
JS: whitelilist delimiter unwrapping for js/incomplete-sanitization
2019-04-15 12:20:12 +01:00
Max Schaefer
4c9edafef3 Merge pull request #1211 from esben-semmle/js/type-tracking-for-incomplete-hostname-regexp
JS: type tracking for js/incomplete-hostname-regexp
2019-04-15 12:19:46 +01:00
Asger F
b6ea121808 TS: Make full TS extraction the default in AutoBuild 2019-04-15 12:11:05 +01:00
Max Schaefer
1d5bb97121 JavaScript: Refine PasswordInConfigurationFile to avoid FPs.
We now exclude passwords that look like they might be filled in via
templating or shell substitution.
2019-04-15 12:10:21 +01:00
Max Schaefer
ce53a7d575 Merge pull request #1175 from psygnisfive/NullSensitiveContext
[JS] Null Sensitive Context (new library)
2019-04-15 08:50:14 +01:00
Ziemowit Laski
61c91b67aa [CPP-340] Refactor MistypedFunctionArguments.ql further. 2019-04-14 11:31:10 -07:00
Ziemowit Laski
b58f414ede [CPP-340] Add more test case; exclude K&R definitions of functions when looking
up ()-declarations; refactor QL code.
2019-04-12 17:25:33 -07:00
Rebecca Valentine
fb40548be5 fixes semicolon issues 2019-04-12 10:56:31 -07:00
Rebecca Valentine
a66d1c0e09 fixes test errors 2019-04-12 10:39:34 -07:00
Rebecca Valentine
d4f2172bdc void exprs are also ok 2019-04-12 10:39:20 -07:00
Asger F
b8ec7083d4 JS: Update isBarrier test output 2019-04-12 16:35:01 +01:00
Taus
ae6c768db8 Merge pull request #1244 from markshannon/fix-semantic-merge-conflict
Python: Fix semantic merge conflict between #1206 and #1240.
2019-04-12 14:49:24 +02:00
Mark Shannon
d6ba729dce Python: Fix semantic merge conflict between #1206 and #1240. 2019-04-12 12:32:41 +01:00
Asger F
b36075ca46 JS: step through refinements in AccessPaths 2019-04-12 11:12:50 +01:00
Asger F
720555be45 JS: Add test case 2019-04-12 11:11:26 +01:00
Taus
707b73c3d0 Merge pull request #1240 from markshannon/python-avoid-ssa-defns-in-tests
Python: Remove callsite refinement ESSA definition in tests
2019-04-12 12:05:40 +02:00
Taus
607b5fb077 Merge pull request #1206 from markshannon/python-taint-flow-classless
Python taint-tracking: Better flow for "generic" taint.
2019-04-12 11:54:52 +02:00
Jonas Jensen
29aa5f550c C++: Tidy up code so it looks good after qlformat 2019-04-12 10:43:24 +02:00
Esben Sparre Andreasen
2d66069d60 JS: change notes for js/incomplete-hostname-regexp 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
9c65277b53 JS: reformulate js/incomplete-hostname-regexp with type tracking 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
5a7101481c JS: make message for js/incomplete-hostname-regexp more informative 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
d643904faf JS: improve tests for fixup js/incomplete-hostname-regexp 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
cf7d0a7ea5 JS: fixup qhelp 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
74144b0271 JS: make RegExpPatterns::commonTLD more robust 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
9eb039038e JS: update docstring example for TypeBackTracker 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
1f565bd49c JS: Introduce TypeBackTracker::step and TypeBackTracker::smallstep 2019-04-12 08:51:28 +02:00
Esben Sparre Andreasen
fd429ce639 JS: whitelist delimiter unwrapping for js/incomplete-sanitization 2019-04-12 08:38:44 +02:00
Esben Sparre Andreasen
a0ed362310 JS: add test case for js/incomplete-sanitization 2019-04-12 08:37:47 +02:00
ian-semmle
a84a921730 Merge pull request #1241 from nickrolfe/category_changes
C++: change expected test output following extractor frontend upgrade
2019-04-11 23:27:31 +01:00
Nick Rolfe
baf091235c C++: change expected test output following extractor frontend upgrade 2019-04-11 17:45:35 +01:00
Mark Shannon
ca6e03f597 Python: Remove callsite refinement ESSA definition when call in a test defining a pi-node. 2019-04-11 16:08:29 +01:00
semmle-qlci
ccbb7ce04b Merge pull request #1224 from asger-semmle/cheerio
Approved by esben-semmle
2019-04-11 15:21:44 +01:00
semmle-qlci
a1cc2fbed3 Merge pull request #1233 from xiemaisi/js/amd-type-inference
Approved by asger-semmle
2019-04-11 15:20:00 +01:00
Geoffrey White
1e0e3192bb CPP: Restrict to #elif, #else, #endif. 2019-04-11 15:14:21 +01:00
Geoffrey White
2dad62acf4 CPP: Additional test cases. 2019-04-11 15:06:41 +01:00
Jonas Jensen
ac3421f6be Merge pull request #1238 from geoffw0/newtests
CPP: New test cases
2019-04-11 14:43:03 +02:00
Jonas Jensen
6049c2ccfd C++: Autoformat Architecture + Best Practices 2019-04-11 14:27:07 +02:00
Geoffrey White
3ceacff0d4 CPP: Add a test of IncorrectConstructorDelegation.ql. 2019-04-11 12:24:16 +01:00
Geoffrey White
7dd7bf346d CPP: Add a test of placement new in CWE-772 (this case came up recently but has already been fixed). 2019-04-11 12:23:33 +01:00
Jonas Jensen
d3f60998b1 Merge pull request #1236 from dave-bartolomeo/dave/ReinterpretEscapes
C++: Fix false positive in PointlessComparison
2019-04-11 12:51:30 +02:00
Geoffrey White
4a8b4b32d5 CPP: Fix indentation. 2019-04-11 11:38:50 +01:00
Geoffrey White
2c0ccf4a85 CPP: Exclude unusual header files such as config.h. 2019-04-11 11:28:45 +01:00
Geoffrey White
f381768a1e CPP: Create HeaderFile.noTopLevelCode from existing logic. 2019-04-11 11:21:53 +01:00
Geoffrey White
9e6b178d48 CPP: Resolve #endif FPs. 2019-04-11 11:05:53 +01:00
semmle-qlci
ed5fd96603 Merge pull request #1227 from asger-semmle/typescript3.4
Approved by xiemaisi
2019-04-11 10:39:57 +01:00
Geoffrey White
4beb77588a CPP: Add tests based on false positive results. 2019-04-11 10:14:32 +01:00
Dave Bartolomeo
878cdf7cb6 C++: Fix false positive in PointlessComparison
We avoid putting a variable into SSA if its address is ever taken in a way that could allow mutation of the variable via indirection. We currently just look to see if the address is either "pointer to non-const" or "reference to non-const". However, if the address was cast to an integral type (e.g. `uintptr_t n = (uintptr_t)&x;`), we were treating it as unescaped. This change makes the conservative assumption that casting a pointer to an integer may result in the pointed-to value being modified later.

This fixes a customer-reported false positive (#2 from https://discuss.lgtm.com/t/2-false-positives-in-c-for-comparison-is-always-same/1943)
2019-04-11 01:56:22 -07:00
semmle-qlci
9f13b6be18 Merge pull request #1234 from xiemaisi/js/customizations-qll
Approved by esben-semmle
2019-04-11 08:31:28 +01:00
Esben Sparre Andreasen
a6cf9503da Merge pull request #1235 from xiemaisi/js/include-yaml
JavaScript: Teach AutoBuilder to extract YAML files by default.
2019-04-11 09:28:59 +02:00
Max Schaefer
f22cb186e3 JavaScript: Teach AutoBuilder to extract YAML files by default. 2019-04-10 18:47:06 -07:00
Max Schaefer
078151f9d1 JavaScript: Add an (empty) Customizations.qll module.
Somewhat analogous to the `Options.qll` module in C++; see module
comments for further explanation.
2019-04-10 18:26:27 -07:00
semmle-qlci
02fc45d923 Merge pull request #1232 from xiemaisi/js/more-socket-improvements
Approved by asger-semmle
2019-04-10 22:20:00 +01:00
Geoffrey White
c974693b58 CPP: Add a test case for CWE-120. 2019-04-10 18:52:03 +01:00
Ziemowit Laski
d76138f189 [CPP-340] Remove use of getUnderlyingType() predicate as it does
not appear necessary.  Correct comment to refer to
           arguments rather than parameters.
2019-04-10 10:51:22 -07:00
Geoffrey White
7ea6c1bcbe CPP: Add a test of AV Rule 186.ql. 2019-04-10 18:08:10 +01:00
Ziemowit Laski
dc7497835e [CPP-340] Make the query more strict (again). 2019-04-10 09:55:37 -07:00
Max Schaefer
301dab0e40 JavaScript: Improve AMD support in type inference.
Now leverages the recently introduced logic for resolving AMD imports
based on unique matching paths.
2019-04-10 09:47:54 -07:00
Max Schaefer
20312fc3bf JavaScript: Improve socket.io model.
Recognise `io` imports and use type-tracking to better track handlers.
2019-04-10 08:02:40 -07:00
Asger F
bfa6208a58 TS: Fix test output 2019-04-10 15:44:37 +01:00
Asger F
ef7bde472b TS: Fix javadoc 2019-04-10 15:33:39 +01:00
Max Schaefer
6ac72bd469 Update javascript/ql/src/semmle/javascript/TypeScript.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-04-10 15:33:22 +01:00
Asger F
91f4916d07 TS: update supported compiler versions 2019-04-10 14:13:45 +01:00
Asger F
78b00e16d7 TS: change note 2019-04-10 14:11:11 +01:00
Asger F
4b4e7eb5ff TS: update trap test output 2019-04-10 13:17:15 +01:00
Asger F
d28597ffbb TS: DB upgrade script and stats 2019-04-10 13:13:46 +01:00
Esben Sparre Andreasen
b86f43be98 JS: reformulate CallToObjectDefineProperty::getAPropertyAttribute 2019-04-10 14:03:28 +02:00
Asger F
c1c7ebfc48 TS: Support const type assertions 2019-04-10 12:54:42 +01:00
Asger F
d5ae69d40a TS: Support readonly type expressions 2019-04-10 12:26:46 +01:00
Asger F
11f460c6a3 JS: Generalize KeyofTypeExpr to UnaryTypeExpr 2019-04-10 12:21:28 +01:00
Tom Hvitved
813dfc6417 C++: Generalize data-flow library in preparation for C# adoption 2019-04-10 13:05:39 +02:00
Tom Hvitved
18ced249ab Java: Generalize data-flow library in preparation for C# adoption 2019-04-10 13:05:31 +02:00
Asger F
8304ce1e16 TS: Update test output with new toString value 2019-04-10 11:34:27 +01:00
Asger F
65d863f8fb TS: update to TypeScript 3.4 2019-04-10 11:18:23 +01:00
Geoffrey White
5101a5bc3d Merge pull request #1056 from jbj/SimpleRangeAnalysis-use-after-cast
C++: Fix use-after-cast bug in SimpleRangeAnalysis
2019-04-10 11:04:20 +01:00
Jonas Jensen
01fc721497 C++: Fixup test annotation 2019-04-10 09:28:06 +02:00
Robert Marsh
75ab311c3a Merge pull request #1223 from geoffw0/commentedoutcode
CPP: Detect commented out preprocessor logic
2019-04-09 16:16:19 -04:00
Robert Marsh
c9fbbfe7d8 Merge pull request #984 from rdmarsh2/rdmarsh/cpp/ir-stmtexpr
C++: add support for GNU StmtExpr in IR
2019-04-09 12:54:35 -04:00
Tom Hvitved
006692524b C#: Improve CFG for (potential) dynamic accessor calls 2019-04-09 15:26:42 +02:00
Tom Hvitved
fcad129135 C#: Add CFG tests for (potential) dynamic accessor calls 2019-04-09 15:26:36 +02:00
Esben Sparre Andreasen
e70413922b Update javascript/ql/src/semmle/javascript/frameworks/Cheerio.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-04-09 14:25:33 +01:00
Esben Sparre Andreasen
2113e6e4d3 Update javascript/ql/src/semmle/javascript/frameworks/Cheerio.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-04-09 14:25:19 +01:00
Esben Sparre Andreasen
ad119dae21 Update javascript/ql/src/semmle/javascript/frameworks/jQuery.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-04-09 14:25:11 +01:00
Esben Sparre Andreasen
b72c678b2c Update javascript/ql/src/semmle/javascript/frameworks/jQuery.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-04-09 14:25:01 +01:00
Mark Shannon
97a9954e72 Merge pull request #1222 from taus-semmle/python-unify-old-and-new-query-suites
Python: Make old query suites point to new query suites.
2019-04-09 14:04:21 +01:00
Geoffrey White
13ed50f049 CPP: Improve the regexp. 2019-04-09 13:08:31 +01:00
Geoffrey White
d70e7ceafe CPP: Additional test cases. 2019-04-09 13:04:32 +01:00
Jonas Jensen
ca71ac7c36 C++: Accept improved test output 2019-04-09 13:38:52 +02:00
Geoffrey White
ddb1b0ac1c CPP: Declaration -> definition. 2019-04-09 12:35:20 +01:00
Asger F
39bafa354e JS: Add change note 2019-04-09 12:22:20 +01:00
Asger F
bd1d9ed810 JS: Add test 2019-04-09 12:21:54 +01:00
Asger F
0fcdf91d4a JS: Add model of cheerio 2019-04-09 12:21:54 +01:00
Jonas Jensen
fd4967e6f1 C++: Fix SnprintfOverflow issues
Requiring strict inclusion between types turned out to cause false
positives in `SnprintfOverflow`, which relied indirectly on
`RangeAnalysisUtils::linearAccessImpl` to identify acceptable bounds
checks. This query was particularly affected because `snprintf` returns
`int` (signed) but takes `size_t` (unsigned), so conversions are bound
to happen.
2019-04-09 11:05:14 +02:00
Esben Sparre Andreasen
e7adb62288 Merge pull request #1221 from asger-semmle/contextual-typing
TS: Extract contextual type for object/array literals
2019-04-09 10:43:01 +02:00
Esben Sparre Andreasen
9d1f511ca0 JS: fixup missing space 2019-04-09 10:39:26 +02:00
Esben Sparre Andreasen
89596052cf JS: autoformat TypeTracking.qll 2019-04-09 10:39:26 +02:00
Taus
adf8cdcde5 Merge pull request #1203 from markshannon/python-taint-tracking-configuration-2
Python: Use taint tracking configuration for queries.
2019-04-09 10:01:35 +02:00
Tom Hvitved
3f403b8f0d Merge pull request #1208 from felicity-semmle/support/SD-3189-move
Documentation: move support information into a version-neutral location
2019-04-09 10:01:14 +02:00
semmle-qlci
92acd322fc Merge pull request #1218 from esben-semmle/js/whitelist-typeconfusion-lt1-checks
Approved by asger-semmle
2019-04-09 01:11:34 +01:00
Robert Marsh
fd7512c447 C++: accept test change in SignAnalysis 2019-04-08 14:10:37 -04:00
Geoffrey White
5bd5b1b6ce CPP: Change note. 2019-04-08 18:19:30 +01:00
Geoffrey White
48fff334da CPP: Detect commented preprocessor code. 2019-04-08 18:17:23 +01:00
Geoffrey White
4d67bd32dd CPP: Move comments explaining implementation details into the body of 'looksLikeCode'. 2019-04-08 18:14:54 +01:00
Rebecca Valentine
c120cca9d3 better explanation of null sensitive contexts 2019-04-08 10:12:04 -07:00
Geoffrey White
f432f1a03a CPP: Autoformat CommentedOutCode.qll. 2019-04-08 18:00:49 +01:00
Geoffrey White
92241132b5 CPP: Add test cases. 2019-04-08 18:00:34 +01:00
Taus Brock-Nannestad
98e9edc27c Delete unnecessary files. 2019-04-08 18:27:30 +02:00
Taus Brock-Nannestad
e227078953 Add note about backwards compatibility. 2019-04-08 17:55:48 +02:00
Mark Shannon
52b3f77f4f Fix typo. 2019-04-08 15:47:49 +01:00
Asger F
db9fd3f721 TS: update test change 2019-04-08 15:17:40 +01:00
Taus Brock-Nannestad
2e6291270b Python: Make old query suites point to new. 2019-04-08 14:02:34 +02:00
Taus
f5ccd3c228 Merge pull request #1210 from markshannon/python-dataflow-config
Python: Make DataFlow::Configuration act more like other languages
2019-04-08 13:46:35 +02:00
semmle-qlci
f54366bf95 Merge pull request #1214 from asger-semmle/taint-addexpr-phi
Approved by esben-semmle, xiemaisi
2019-04-08 11:55:06 +01:00
Anders Schack-Mulligen
6e7ae8a0a9 Merge pull request #1217 from jbj/mergeback-20190408
Mergeback rc/1.20 to master
2019-04-08 12:44:19 +02:00
Jonas Jensen
93286aabdf C++: Test for FP introduced by relOp changes 2019-04-08 11:19:57 +02:00
Esben Sparre Andreasen
52d86471af JS: whitelist another emptiness check for the type-confusion query 2019-04-08 09:52:27 +02:00
semmle-qlci
662ad4b2ca Merge pull request #1205 from asger-semmle/prefix-sanitizer
Approved by esben-semmle
2019-04-08 08:29:04 +01:00
Jonas Jensen
fedd652de8 Merge remote-tracking branch 'upstream/rc/1.20' into mergeback-20190408 2019-04-08 08:39:44 +02:00
semmle-qlci
0bd4fde34d Merge pull request #1216 from geoffw0/revert-microsoft
Approved by dave-bartolomeo, jbj
2019-04-06 01:02:17 +01:00
Ziemowit Laski
ef54b012e0 [CPP-340] Fixed .expected file to match new query. 2019-04-05 15:43:38 -07:00
Robert Marsh
8087cb5040 C++: add CopyValueInstruction for StmtExpr result 2019-04-05 11:27:19 -07:00
Asger F
50c2921625 TS: Use contextual typing for literals 2019-04-05 18:43:51 +01:00
Asger F
d7bfeeefd0 TS: add test case with nested literals 2019-04-05 18:40:24 +01:00
Rebecca Valentine
40e3a241a1 Revert "Update javascript/ql/src/semmle/javascript/Expr.qll"
This reverts commit 78407f85ee.
2019-04-05 09:47:56 -07:00
Max Schaefer
78407f85ee Update javascript/ql/src/semmle/javascript/Expr.qll
Co-Authored-By: psygnisfive <psygnisfive@users.noreply.github.com>
2019-04-05 09:46:09 -07:00
Max Schaefer
280c334ab8 Update javascript/ql/src/semmle/javascript/Expr.qll
Co-Authored-By: psygnisfive <psygnisfive@users.noreply.github.com>
2019-04-05 09:45:53 -07:00
Geoffrey White
5dce09b179 Revert "CPP: Workaround improvement for File.compiledAsMicrosoft."
This reverts commit c3ec7b55b7.
2019-04-05 17:37:44 +01:00
Geoffrey White
918f7043af Revert "CPP: Add '/' case."
This reverts commit 5e71207a23.
2019-04-05 17:37:39 +01:00
Max Schaefer
cb22192378 Merge pull request #1196 from asger-semmle/shelljs
JS: Add model for shelljs
2019-04-05 16:45:45 +01:00
yh-semmle
3d2ae00788 Merge pull request #1201 from aschackmull/java/intmulttolong-w-range
Java: Use range analysis in IntMultToLong (ODASA-7836).
2019-04-05 11:14:46 -04:00
Asger F
80f413177a Merge branch 'master' into shelljs 2019-04-05 14:44:32 +01:00
Asger F
e55330b820 JS: Fix flow through += 2019-04-05 13:55:48 +01:00
Jonas Jensen
f7dda1b3a4 Merge pull request #1213 from geoffw0/pointerscaling2
CPP: De-duplicate the PointerScaling queries.
2019-04-05 14:42:28 +02:00
Jonas Jensen
19b05c57d7 Merge pull request #1204 from geoffw0/badlock
CPP: Add a test of common mistakes using locking classes.
2019-04-05 14:34:32 +02:00
Geoffrey White
f040755b3b CPP: Remove unnecessary imports. 2019-04-05 11:44:50 +01:00
Geoffrey White
44d68a761d CPP: Move 'baseType' into IncorrectPointerScalingCommon.qll. 2019-04-05 11:43:47 +01:00
Geoffrey White
695df232e3 CPP: Equalize the definitions of 'baseType'. 2019-04-05 11:28:11 +01:00
Geoffrey White
373075e06d CPP: Extend the test. 2019-04-05 11:09:13 +01:00
Geoffrey White
34fbc7b194 CPP: Guard the delete. 2019-04-05 10:00:55 +01:00
semmle-qlci
063dbeeff3 Merge pull request #1198 from esben-semmle/js/more-express-route-handlers
Approved by xiemaisi
2019-04-05 09:47:51 +01:00
Anders Schack-Mulligen
b5681a1260 Java: Add change note. 2019-04-05 10:44:42 +02:00
Anders Schack-Mulligen
dec31a3dd6 Java: Use range analysis in IntMultToLong. 2019-04-05 10:42:23 +02:00
Mark Shannon
df2000ea8e Python: Fix up dataflow configuration to act as expected. Keep undocumented for now. 2019-04-05 09:05:13 +01:00
Max Schaefer
2f84aac7df Merge pull request #1193 from esben-semmle/js/improve-createServer
JS: treat the last argument to https.createServer as a route handler
2019-04-05 08:57:24 +01:00
Tom Hvitved
67ed863c76 Merge pull request #1200 from calumgrant/cs/icryptotransform
C#: Tidy up cs/thread-unsafe-icryptotransform-field-in-class
2019-04-05 09:28:24 +02:00
Jonas Jensen
d619a8c693 Merge pull request #1192 from geoffw0/severity
CPP: Change some query severities
2019-04-05 09:23:27 +02:00
Jonas Jensen
8c17278808 Merge pull request #1191 from geoffw0/microsoft
CPP: Workaround improvement for File.compiledAsMicrosoft.
2019-04-05 09:22:08 +02:00
Jonas Jensen
b555f5025e Merge pull request #1209 from geoffw0/gmtime
CPP: Add variants to PotentiallyDangerousFunction.ql
2019-04-05 09:19:40 +02:00
yh-semmle
6ba57fc639 Merge pull request #1202 from aschackmull/java/slf4j-print-array
Java: Exclude slf4j calls in PrintLnArray as it supports array formatting.
2019-04-04 20:08:20 -04:00
Rebecca Valentine
b7939029bf removes bigint cases 2019-04-04 16:41:52 -07:00
Rebecca Valentine
5b87b85960 fixes comment language 2019-04-04 16:41:14 -07:00
Esben Sparre Andreasen
0ec0aa35be JS: change notes for Express 2019-04-04 21:42:23 +02:00
Esben Sparre Andreasen
60ba74a210 JS: Express cleanup and generalization 2019-04-04 21:42:08 +02:00
Esben Sparre Andreasen
c94ca46366 JS: add more Express tests 2019-04-04 21:42:08 +02:00
Robert Marsh
46f93ff322 C++: update test expectations 2019-04-04 10:55:27 -07:00
Robert Marsh
427b853077 C++: add another test case for IR stmtexpr 2019-04-04 10:55:27 -07:00
Robert Marsh
81dd03848f C++: respond to PR comments 2019-04-04 10:52:08 -07:00
Robert Marsh
f2fbdac31b C++: add support for GNU StmtExpr in IR 2019-04-04 10:51:06 -07:00
Geoffrey White
0a0bcdf939 CPP: Move some code into IncorrectPointerScalingCommon.qll. 2019-04-04 18:08:18 +01:00
Mark Shannon
2ba122373a Merge pull request #1128 from taus-semmle/python-paramiko-unsafe-host-key-validation
Python: Add query for insecure SSH host key policies in Paramiko.
2019-04-04 16:57:13 +01:00
Geoffrey White
7aee334baf CPP: Update the qhelp. 2019-04-04 16:48:14 +01:00
Geoffrey White
e8b7bf9ddf CPP: Change note. 2019-04-04 16:38:42 +01:00
Geoffrey White
a437e6c103 CPP: Extend coverage. 2019-04-04 16:31:02 +01:00
Geoffrey White
a1e503f428 CPP: Add test cases for PotentiallyDangerousFunction. 2019-04-04 16:26:53 +01:00
Felicity Chapman
bec6316c09 Move support information into a version-neutral location 2019-04-04 16:17:09 +01:00
Taus
c5f41c1a5a Merge pull request #1207 from markshannon/python-fix-cwe-ref
Fix CWE tag for Code injection query.
2019-04-04 17:08:51 +02:00
Mark Shannon
c2e814a11a Fix CWE tag for Code injection query. 2019-04-04 15:09:12 +01:00
Mark Shannon
3bcd445a32 Python change 'SimpleHttpResponseTaintSink' to 'HttpResponseTaintSink'. 2019-04-04 14:45:37 +01:00
Asger F
c38b8d81ca JS: review comments 2019-04-04 14:43:11 +01:00
Geoffrey White
5e71207a23 CPP: Add '/' case. 2019-04-04 14:32:22 +01:00
Mark Shannon
e2a3d91a7d Python taint-tracking: If taint has no class allow it flow through both branches of isinstance test. 2019-04-04 14:29:34 +01:00
Asger F
d594e55a61 JS: Remove ShellJS::Instance for simplicity 2019-04-04 11:45:59 +01:00
Asger F
a2b8721898 JS: Add change note 2019-04-04 11:45:59 +01:00
Asger F
43f6b8fa70 JS: Add test 2019-04-04 11:44:56 +01:00
Asger F
3da76cb798 JS: add model of ShellJS 2019-04-04 11:44:56 +01:00
Geoffrey White
cb09d23069 CPP: Add a test of common mistakes using locking and similar classes. 2019-04-04 11:23:06 +01:00
Mark Shannon
8b01bac900 Python: make sure unsafe deserialization query is using correct sources and that pickle is included in sinks. 2019-04-04 10:56:45 +01:00
Mark Shannon
bc19769e6d Python: make sure code injection query is using correct sources. 2019-04-04 10:56:45 +01:00
Mark Shannon
35e82dca68 Python revert .getNode() to .getSink()/.getSource() to keep expected test output the same. 2019-04-04 10:56:45 +01:00
Mark Shannon
f8c43ca40b Python: make sure all django and flask request sources conform to interface. 2019-04-04 10:56:45 +01:00
Mark Shannon
61e6ae7c4a Python: Use new taint-tracking query in unsafe deserialization query. 2019-04-04 10:56:45 +01:00
Mark Shannon
3c1a5bb046 Python: Use new taint-tracking query in code-injection query. 2019-04-04 10:56:44 +01:00
Mark Shannon
64e8be6ed1 Python: Use new taint-tracking query in reflected-xss query. 2019-04-04 10:56:44 +01:00
Mark Shannon
7fc5d690cd Python: Use new taint-tracking query in SQL-injection query. 2019-04-04 10:56:44 +01:00
Anders Schack-Mulligen
15fa4f8b7a Merge pull request #1007 from jbj/dataflow-dispatch-no-ctx
C++: Simplify stubs in DataFlowDispatch.qll
2019-04-04 11:25:50 +02:00
Anders Schack-Mulligen
d144ea2f1c Java: Exclude slf4j calls in PrintLnArray as it supports array formatting. 2019-04-04 11:09:41 +02:00
yh-semmle
b226cb64cd Merge pull request #1189 from aschackmull/java/preconditions
Java: Support precondition calls as guards (ODASA-7796).
2019-04-03 21:36:08 -04:00
Ziemowit Laski
921523e8e7 Merge branch 'cpp340a' of github.com:zlaski-semmle/ql into cpp340a 2019-04-03 17:56:34 -07:00
Ziemowit Laski
970c45e896 Merge branch 'master' into cpp340a 2019-04-03 17:52:46 -07:00
zlaski-semmle
b060fd13a6 Merge branch 'master' into cpp340a 2019-04-03 17:00:33 -07:00
Ziemowit Laski
e4ce8347bc [CPP-340] Simplify MistypedFunctionArguments.ql and reduce its
precision from very-high to high.
2019-04-03 16:19:37 -07:00
Rebecca Valentine
ec2e17f07a adds whitelist and recursive cases, per PR change req 2019-04-03 10:06:02 -07:00
Tom Hvitved
f5d52d0652 Merge pull request #274 from lukecartey/csharp/remove-security-tags
C#: Remove the 'security' tag from some queries
2019-04-03 17:04:25 +02:00
Asger F
3bc7371fd6 JS: be less conservative about incomplete nodes in prefix sanitizers 2019-04-03 15:20:03 +01:00
Jonas Jensen
d0091b28ee Merge pull request #1199 from geoffw0/printfld
CPP: Support %Ld in printf.qll
2019-04-03 15:38:16 +02:00
Taus
b79b53f5e3 Merge pull request #1103 from markshannon/python-encapsulate-builtins
Python: encapsulate extensionals dealing with 'builtin' objects.
2019-04-03 15:20:42 +02:00
Anders Schack-Mulligen
9211927112 Java: Add change note. 2019-04-03 13:17:18 +02:00
calum
42b2f09315 C#: Tidy up query, remove false-positives and add some more test cases. 2019-04-03 12:17:01 +01:00
Geoffrey White
aa21db3ed3 CPP: Change note. 2019-04-03 11:57:38 +01:00
Geoffrey White
d4c931cf11 CPP: Permit %Ld and similar. 2019-04-03 11:46:48 +01:00
Geoffrey White
b3fd7ab757 CPP: Add test cases. 2019-04-03 11:46:30 +01:00
Esben Sparre Andreasen
3c608fe11e Merge branch 'master' into js/improve-createServer 2019-04-03 12:37:33 +02:00
semmle-qlci
1da828fa80 Merge pull request #1195 from esben-semmle/js/firebase-express-requests
Approved by xiemaisi
2019-04-03 11:36:02 +01:00
Anders Schack-Mulligen
5379c6e3c5 Merge pull request #1197 from felicity-semmle/java/update-query-description
Java: Fix typo in query description
2019-04-03 12:09:26 +02:00
Felicity Chapman
ffeb61c698 Fix typo in query description 2019-04-03 10:46:48 +01:00
Jonas Jensen
2140995530 C++: Update QLDoc for new use of getFullyConverted 2019-04-03 10:52:05 +02:00
Jonas Jensen
4b159fd2a5 C++: Fix the suppression for alerts about enums
The suppression mechanism broke when I changed `relOpWithSwap` to take
fully-converted expressions as parameters.
2019-04-03 10:45:39 +02:00
Jonas Jensen
f9c9efeabe Merge pull request #1188 from geoffw0/donotedit
CPP: Consider more files to be generated.
2019-04-03 09:52:28 +02:00
Esben Sparre Andreasen
f23a5a5fee JS: model firebase-functions/https.onRequest 2019-04-03 08:01:45 +02:00
Robert Marsh
fa8b771944 Merge pull request #1186 from jbj/dataflow-defbyref-1.20-fixes
C++: Let data flow past definition by reference
2019-04-02 13:36:37 -07:00
Robert Marsh
65d0412692 Merge pull request #1194 from geoffw0/dead-goto
CPP: Fix false positive from DeadCodeGoto.ql
2019-04-02 10:03:15 -07:00
Jonas Jensen
eae2fe5a16 Merge pull request #1190 from Semmle/rc/1.20
Merge 1.20 into master
2019-04-02 15:29:12 +02:00
Geoffrey White
2e106879b8 CPP: Change note. 2019-04-02 14:25:38 +01:00
Geoffrey White
8979361255 CPP: Exclude functions containing preprocessor logic. 2019-04-02 14:24:37 +01:00
Esben Sparre Andreasen
0b733b4f23 JS: treat the last argument to https.createServer as a route handler 2019-04-02 14:38:31 +02:00
Geoffrey White
5cb30b04cc CPP: Add a test case. 2019-04-02 13:15:40 +01:00
Geoffrey White
1542fdc44b CPP: Change AV Rule 107.ql to a recommendation. 2019-04-02 12:19:33 +01:00
Geoffrey White
96136a1c55 CPP: Change SloppyGlobal.ql to a recommendation. 2019-04-02 12:18:22 +01:00
Geoffrey White
c3ec7b55b7 CPP: Workaround improvement for File.compiledAsMicrosoft. 2019-04-02 11:40:49 +01:00
semmle-qlci
4ec2df6bad Merge pull request #1179 from asger-semmle/js-windoc
Approved by xiemaisi
2019-04-02 11:21:07 +01:00
Jonas Jensen
b7e6f9a43e Merge pull request #1183 from aibaars/fix-query-metadata
Fix queries with inconsistent `@kind` and `select` statements
2019-04-02 12:00:25 +02:00
Jonas Jensen
842aafc888 C++: Fix new UnsafeDaclSecurityDescriptor FP
This query uses data flow for nullness analysis, which is always going
to be a large overapproximation. The overapproximation became too big
for one of the test cases after the recent change to make data flow go
across assignment by reference.

To make this query more conservative, it will now only report that the
`pDacl` argument can be null if there isn't also evidence that it can be
non-null.
2019-04-02 11:31:12 +02:00
Anders Schack-Mulligen
b1e364b56a Java: Support precondition calls as guards. 2019-04-02 10:58:46 +02:00
Geoffrey White
bce6ee5c27 CPP: Consider more files to be generated. 2019-04-02 09:19:55 +01:00
semmle-qlci
02f4695a5b Merge pull request #1152 from esben-semmle/js/koa-improvements
Approved by xiemaisi
2019-04-02 08:51:19 +01:00
Ziemowit Laski
96b8bdfeb5 [CPP-340] Add new queries to analysis-cpp.md; correct id of
TooFewArguments.ql
2019-04-01 19:15:27 -07:00
Ziemowit Laski
03aa86ed4d Merge branch 'master' into cpp340a
So as to get to change-notes/1.21/analysis-cpp.md
2019-04-01 18:51:03 -07:00
Ziemowit Laski
bd139829ea [CPP-340] Delete old 'UnspecifiedFunctions' folders 2019-04-01 18:44:49 -07:00
Ziemowit Laski
3ec988c39b [CPP-340] Rename 'UnspecifiedFunctions' to 'Unspecified Functions'
Make MistypedFunctionArguments.ql more restrictive (allowing
          type matching only in the presence of no-op conversions).
2019-04-01 18:39:46 -07:00
semmle-qlci
54b4e59d12 Merge pull request #1182 from esben-semmle/js/sourcenode-regexp-literals
Approved by xiemaisi
2019-04-01 21:58:58 +01:00
Esben Sparre Andreasen
2622fc64db JS: autoformat 2019-04-01 22:55:17 +02:00
Esben Sparre Andreasen
86a046a28e JS: change notes for Koa improvements 2019-04-01 22:55:17 +02:00
Esben Sparre Andreasen
7fec005806 JS: use DataFlow::SourceNode in three locations in Koa 2019-04-01 22:55:17 +02:00
Esben Sparre Andreasen
919eed6630 JS: add koa tests 2019-04-01 22:55:17 +02:00
Esben Sparre Andreasen
00c8387bb3 JS: model Koa redirects 2019-04-01 22:55:17 +02:00
Esben Sparre Andreasen
298dbe13c4 JS: improve Koa model to account for aliases on the context object 2019-04-01 22:49:00 +02:00
Esben Sparre Andreasen
0e01988622 JS: add koa tests 2019-04-01 22:49:00 +02:00
Rebecca Valentine
2b6869fff3 updates expecteds to reflect changes in the test file 2019-04-01 11:21:21 -07:00
Rebecca Valentine
0d0adada42 fixes tests and adds test results to expecteds 2019-04-01 11:13:04 -07:00
Rebecca Valentine
a16b5d36a8 adds tests 2019-04-01 10:40:51 -07:00
Rebecca Valentine
5bf7efeed3 fixes name and autoformats 2019-04-01 10:39:06 -07:00
Rebecca Valentine
7d183eab0b moves functionality over to Expr method per PR change requests 2019-04-01 10:22:49 -07:00
semmle-qlci
a4de82de06 Merge pull request #1185 from xiemaisi/js/improve-amd-imports
Approved by asger-semmle
2019-04-01 16:30:47 +01:00
Arthur Baars
5eb58f3ba2 C++: fix HubClasses.ql by changing its kind to 'table' 2019-04-01 16:17:23 +02:00
Tom Hvitved
007cee8426 Merge pull request #1184 from calumgrant/cs/static-cryptotransform
C#: Remove static SHA1CryptoServiceProvider
2019-04-01 16:03:53 +02:00
semmle-qlci
a7d9a50dcf Merge pull request #1176 from xiemaisi/js/fix-socket-io-type-tracking
Approved by asger-semmle
2019-04-01 13:57:13 +01:00
Jonas Jensen
71659594c8 C++: Let data flow past definition by reference
This commit changes how data flow works in the following code.

    MyType x = source();
    defineByReference(&x);
    sink(x);

The question here is whether there should be flow from `source` to
`sink`. Such flow is desirable if `defineByReference` doesn't write to
all of `x`, but it's undesirable if `defineByReference` is a typical
init function in `C` that writes to every field or if
`defineByReference` is `memcpy` or `memset` on the full range.

Before 1.20.0, there would be flow from `source` to `sink` in case `x`
happened to be modeled with `BlockVar` but not in case `x` happened to
be modelled with SSA. The choice of modelling depends on an analysis of
how `x` is used elsewhere in the function, and it's supposed to be an
internal implementation detail that there are two ways to model
variables. In 1.20.0, I changed the `BlockVar` behavior so it worked the
same as SSA, never allowing that flow. It turns out that this change
broke a customer's query.

This commit reverts `BlockVar` to its old behavior of letting flow
propagate past the `defineByReference` call and then regains consistency
by changing all variables that are ever defined by reference to be
modelled with `BlockVar` instead of SSA. This means we now get too much
flow in certain cases, but that appears to be better overall than
getting too little flow. See also the discussion in CPP-336.
2019-04-01 14:13:47 +02:00
calum
932961bf19 C#: Remove static SHA1CryptoServiceProvider 2019-04-01 10:46:39 +01:00
Arthur Baars
4b95fbbb39 C++ Fix select statements of AV 3 and 81 2019-04-01 11:20:12 +02:00
Arthur Baars
ba7fdddafb Change @kind to 'table' for test and sanity checks queries that don't select problems 2019-04-01 11:20:12 +02:00
Esben Sparre Andreasen
6908c54df6 JS: change notes 2019-04-01 09:25:07 +02:00
Esben Sparre Andreasen
364ba1b4ac JS: use RegExpLiteral as a SourceNode 2019-04-01 09:19:25 +02:00
Esben Sparre Andreasen
7923c9d77c JS: add tests for missing flow of regular expressions 2019-04-01 09:19:25 +02:00
Esben Sparre Andreasen
42d3012f81 JS: let RegExpLiteral be a DataFlow::SourceNode 2019-04-01 09:19:25 +02:00
Jonas Jensen
04a48e9034 Merge remote-tracking branch 'upstream/master' into SimpleRangeAnalysis-use-after-cast 2019-04-01 09:10:57 +02:00
Jonas Jensen
76caad0fb4 Merge pull request #1119 from geoffw0/wprintf2
CPP: Better handling of %s/%c/%S/%C in Printf/FormattingFunction.qll
2019-04-01 08:47:20 +02:00
Ziemowit Laski
8a653b9adc [CPP-340] Fix TooFewArguments.c to actually provide a ()-prototype. 2019-03-29 20:34:49 -07:00
Ziemowit Laski
59a54df149 [CPP-340] cpp/too-many-arguments should remain as cpp/futile-params. 2019-03-29 20:30:40 -07:00
Ziemowit Laski
2ea9f81c7f [CPP-340] Refer to C coding standard, not C++. 2019-03-29 20:27:25 -07:00
Ziemowit Laski
cb5bbd2197 [CPP-340] When warning about mismatched parameters, follow what C
compilers do.  Various integral and floating-point types
          are treated as mutually implicitly convertible.  Remaining
          warnings deal with misuse of pointer and array types.
2019-03-29 20:19:45 -07:00
semmle-qlci
ed0ef36427 Merge pull request #1035 from asger-semmle/firebase
Approved by xiemaisi
2019-03-29 13:44:02 +00:00
Asger F
4c99c01c1a JS: review comments 2019-03-29 13:42:22 +00:00
Max Schaefer
e4c4f7a5ae Update javascript/ql/src/semmle/javascript/DOM.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-03-29 13:42:00 +00:00
Max Schaefer
10479eaf4d Update javascript/ql/src/semmle/javascript/DOM.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-03-29 13:40:59 +00:00
Max Schaefer
a0b06c267c Update javascript/ql/src/semmle/javascript/DOM.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-03-29 13:40:46 +00:00
Max Schaefer
62c895de3e JavaScript: Introduce Type(Back)Tracker::continue predicate. 2019-03-29 11:45:18 +00:00
Geoffrey White
a6e0296c0c CPP: Be slash/case insensitive. 2019-03-29 11:19:20 +00:00
Geoffrey White
c8caca3305 CPP: Add test cases for %ls, %hs. 2019-03-29 11:19:20 +00:00
Geoffrey White
f5a7d7a035 CPP: Correct a few comments. 2019-03-29 11:19:19 +00:00
Geoffrey White
d22c93f101 CPP: Change note. 2019-03-29 11:19:19 +00:00
Geoffrey White
66e87fc34c CPP: Detect Microsoft compilations even more reliably. 2019-03-29 11:18:32 +00:00
Geoffrey White
5911699c55 CPP: Clean up some remaining old 'isWideCharDefault' logic that has caused confusion. 2019-03-29 11:18:31 +00:00
Geoffrey White
eef050dd47 CPP: Improve deduction of %S types in FormattingFunction.qll. 2019-03-29 11:18:31 +00:00
Geoffrey White
4a25c37ecc CPP: Detect Microsoft compilations somewhat more reliably. 2019-03-29 11:18:31 +00:00
Geoffrey White
975a0bbf0d CPP: Handle %s/%c/%S/%C correctly on non-MS platforms. 2019-03-29 11:18:31 +00:00
Geoffrey White
648cdbab6c CPP: Add FormattingFunction.getFormatCharType() and test. 2019-03-29 11:18:31 +00:00
Geoffrey White
162c9981bd CPP: Add some test cases. 2019-03-29 11:18:31 +00:00
Asger F
e90a889f76 JS: Refactor DOM libs to use DataFlow more 2019-03-29 11:15:30 +00:00
Max Schaefer
8bb91bf001 JavaScript: Autoformat. 2019-03-29 08:30:05 +00:00
Max Schaefer
41a3ad3f82 JavaScript: Tweak some regexes in Files.qll.
It seems preferable to use the same regex everywhere, even if it's overly general for a few cases.
2019-03-29 08:30:05 +00:00
Max Schaefer
f5279b2a1d JavaScript: Resolve AMD imports based on absolute paths if there is only a single candidate. 2019-03-29 08:30:05 +00:00
Max Schaefer
b29b3dff4d JavaScript: Use proper camel-case for AMD-related class names. 2019-03-29 08:14:07 +00:00
Jonas Jensen
752ca94402 Merge pull request #854 from geoffw0/taintedmalloc
CPP: Improve TaintedAllocationSize.ql
2019-03-29 09:13:18 +01:00
Jonas Jensen
68a19d7d3e Merge branch 'master' into taintedmalloc 2019-03-29 09:12:38 +01:00
Max Schaefer
d541bd58fb JavaScript: Unify (most) overrides of getAnImportedModule. 2019-03-29 08:11:29 +00:00
Max Schaefer
6a78e37d93 JavaScript: Make AMD dependencies Imports. 2019-03-29 08:11:29 +00:00
Jonas Jensen
fcf04abb84 Merge pull request #1120 from jcreedcmu/jcreed/nan
C++: Teach range analysis to pay attention to NaNs.
2019-03-29 07:51:27 +01:00
Jason Reed
e52bbe7784 C++: Add change note. 2019-03-28 20:47:03 -04:00
Jason Reed
d03b5bca31 C++: Fix non-private imports. 2019-03-28 20:39:29 -04:00
Jason Reed
9c0be34fd4 C++: Remove accidental redundancy. 2019-03-28 20:39:29 -04:00
Jason Reed
23ee7ee928 C++: Teach range analysis to pay attention to NaNs. 2019-03-28 20:39:29 -04:00
Jonas Jensen
886e52468d Merge pull request #1177 from geoffw0/qhelp
CPP: Add a reference about include optimization for AV Rule 35
2019-03-28 20:44:39 +01:00
Geoffrey White
f358e61719 CPP: Add a reference about include optimization to the qhelp for AV Rule 35. 2019-03-28 16:37:50 +00:00
Geoffrey White
a7e349c2a2 CPP: Add change note. 2019-03-28 15:50:37 +00:00
Geoffrey White
faa23a53be CPP: Update expected for changes elsewhere. 2019-03-28 15:49:36 +00:00
Geoffrey White
e7c02027f5 CPP: Fix 'BAD'. 2019-03-28 15:49:36 +00:00
Geoffrey White
743b17af50 CPP: Autoformat. 2019-03-28 15:49:36 +00:00
Geoffrey White
0b85966b31 CPP: Fix dubious [old] taint library results involving strlen. 2019-03-28 15:49:36 +00:00
Geoffrey White
8c75e730e4 CPP: Widen TaintedAllocationSize.ql. 2019-03-28 15:49:36 +00:00
Geoffrey White
dab1bba25c CPP: Add a test of TaintedAllocationSize. 2019-03-28 15:49:36 +00:00
Asger F
4908902f47 JS: Update to use TypeTracker::end() 2019-03-28 15:26:55 +00:00
Asger F
365db0ff1f JS: track document and dom values using type tracking 2019-03-28 15:24:00 +00:00
semmle-qlci
225c22cca0 Merge pull request #1171 from hvitved/csharp/attributes-named-args
Approved by calumgrant
2019-03-28 12:06:13 +00:00
Calum Grant
8012dacd69 Merge pull request #1104 from hvitved/csharp/dispatch/performance
C#: Dispatch library performance tweaks
2019-03-28 11:57:19 +00:00
semmle-qlci
35ea746045 Merge pull request #1172 from asger-semmle/hostname-prefix-sanitizer
Approved by xiemaisi
2019-03-28 11:55:10 +00:00
Max Schaefer
c097031c7e JavaScript: Fix uses of TypeTracker with custom flow steps.
These steps need to check that the type hasn't been tracked into a property.
2019-03-28 10:33:04 +00:00
Asger F
6478d9383c JS: drive-by typo fix 2019-03-28 10:28:44 +00:00
Asger F
5dba78ba1a JS: add change note 2019-03-28 10:28:30 +00:00
Max Schaefer
b2faac30c9 JavaScript: Add a few missing doc comments. 2019-03-28 10:12:08 +00:00
Rebecca Valentine
e4c5fd4f61 autoformats 2019-03-27 17:12:10 -07:00
Rebecca Valentine
a049d9a4c6 moves lib to right place 2019-03-27 16:58:33 -07:00
Rebecca Valentine
2d3c522efc cleans up naming conventions 2019-03-27 16:57:35 -07:00
Rebecca Valentine
336eb9dcf3 adds initial qll 2019-03-27 16:31:49 -07:00
Asger F
99dc2435af JS: update test 2019-03-27 15:03:04 +00:00
Taus
eb5927a197 Merge branch 'master' into python-encapsulate-builtins 2019-03-27 15:40:34 +01:00
Asger F
0eb9231cb1 JS: Make use of TypeTracker::end() 2019-03-27 13:25:01 +00:00
Asger F
208bcd438b JS: Make type-tracking predicates private 2019-03-27 13:21:45 +00:00
Asger F
7bfad8c360 JS: trailing whitespace 2019-03-27 13:21:45 +00:00
Asger F
9bbdf84e5d JS: missing qldoc 2019-03-27 13:21:45 +00:00
Asger F
28a776a82b JS: dataflow -> data flow 2019-03-27 13:21:45 +00:00
Asger F
c0b58f6b09 JS: Capitalize Firebase in comments 2019-03-27 13:21:45 +00:00
Asger F
99cc09df8c JS: use TypeBackTracker where appropriate 2019-03-27 13:21:45 +00:00
Asger F
42c0efd549 JS: add test 2019-03-27 13:21:45 +00:00
Asger F
ad592d7cd1 JS: handle .after and .before 2019-03-27 13:21:45 +00:00
Asger F
0401b26b48 JS: handle CloudFunctions 2019-03-27 13:21:45 +00:00
Asger F
49a746b87a JS: handle Reference.transaction() 2019-03-27 13:21:45 +00:00
Asger F
f554f859aa JS: handle 'firebase-admin' package 2019-03-27 13:21:45 +00:00
Asger F
e0c06cb518 JS: handle Query methods 2019-03-27 13:21:45 +00:00
Asger F
06b0851072 JS: Add Firebase model 2019-03-27 13:21:45 +00:00
semmle-qlci
86040575b1 Merge pull request #1161 from esben-semmle/js/classify-mode-html
Approved by xiemaisi
2019-03-27 12:56:04 +00:00
Jonas Jensen
debc441d03 Merge pull request #1158 from geoffw0/moremsalloc
CPP: Add more allocation functions to Alloc.qll
2019-03-27 13:51:39 +01:00
Tom Hvitved
664aa8db47 C#: Address review comment 2019-03-27 13:32:11 +01:00
semmle-qlci
4d4055a87c Merge pull request #1163 from xiemaisi/js/more-type-tracking
Approved by asger-semmle
2019-03-27 12:08:11 +00:00
Asger F
d4c7312d80 JS: more sanitizing prefixes 2019-03-27 11:22:31 +00:00
Asger F
50f2afb622 JS: add test 2019-03-27 11:20:39 +00:00
Geoffrey White
885df8754e Merge pull request #1165 from dave-bartolomeo/dave/CompareFP
C++: Fix FP in PointlessComparison due to preprocessor
2019-03-27 10:54:26 +00:00
Tom Hvitved
7634973bb4 C#: Handle named attribute arguments 2019-03-27 11:10:24 +01:00
Tom Hvitved
12843d2b0e C#: Add tests for named attribute arguments 2019-03-27 10:58:37 +01:00
Jonas Jensen
36ba56c690 C++: Tests for PointlessComparison shortcomings 2019-03-27 10:48:35 +01:00
Jonas Jensen
1ffeebcfea C++: Range analysis: support casts from/to typedef 2019-03-27 10:48:35 +01:00
Jonas Jensen
1c71c74ce5 C++: Tests showing problems with casts of typedefs 2019-03-27 10:48:35 +01:00
Jonas Jensen
10585e719d C++: Support widening casts in range analysis
This makes sure we can conclude from `(int)myShort == 0` that `myShort`
is 0 even though we can no longer conclude from `(short)myInt == 0` that
`myInt` is 0. Without this, we lost a good result in the test for
`InfiniteLoopWithUnsatisfiableExitCondition.ql`.
2019-03-27 10:48:34 +01:00
Jonas Jensen
640f900efd C++: Add missing getFullyConverted for unary +/- 2019-03-27 10:48:34 +01:00
Jonas Jensen
50559d5e63 C++: Accept test output change
The new output looks correct, although I'm not sure if it's correct for
the right reasons.
2019-03-27 10:48:34 +01:00
Jonas Jensen
b827e7a1ea C++: Fix use-after-cast bug in SimpleRangeAnalysis
Like everywhere else in the range analysis, operands to comparison
operators must be considered in their fully-converted form.
2019-03-27 10:48:34 +01:00
Jonas Jensen
ad61b4f55e C++: Add test to demonstrate use-after-cast bugs 2019-03-27 10:48:34 +01:00
semmledocs-ac
fa260872b5 Merge pull request #1081 from rdmarsh2/rdmarsh/cpp/alloca-in-loop
C++: docs for AllocaInLoop
2019-03-27 09:10:24 +00:00
Jonas Jensen
581e765f97 Merge pull request #1168 from geoffw0/format-amp
CPP: %@ in format strings
2019-03-27 09:08:39 +01:00
Robert Marsh
578ed146ed Merge pull request #1115 from dave-bartolomeo/dave/Lambdas
C++: IR construction for lambda expressions
2019-03-26 15:08:34 -07:00
Robert Marsh
30f744a824 C++/Docs: fix whitespace in AllocaInLoop.qhelp 2019-03-26 15:07:28 -07:00
Dave Bartolomeo
127b759bad C++: Move a couple predicates into Exclusions.qll 2019-03-26 14:51:28 -07:00
Dave Bartolomeo
f13fc42a85 C++: Make recursive predicates recursive and non-recursive predicates non-recursive 2019-03-26 14:36:35 -07:00
semmle-qlci
59285be0b8 Merge pull request #1167 from hvitved/csharp/icrypto-qhelp
Approved by aibaars
2019-03-26 18:49:43 +00:00
Taus
046a485dff Merge pull request #1170 from Semmle/rc/1.20
Merge 1.20 into master
2019-03-26 19:28:36 +01:00
Taus
52d8ca09ab Merge pull request #1169 from markshannon/python-speedup-flow-step
Python: Speed up taint-tracking
2019-03-26 16:58:47 +01:00
Mark Shannon
058ae7befc Merge pull request #1142 from taus-semmle/python-use-new-moduleobject-api
Python: Use new `ModuleObject` API more widely.
2019-03-26 15:02:44 +00:00
Mark Shannon
1e1903b6ac Python taint-tracking: Avoid computing many redundant copies of flow step for dicts and sequences. 2019-03-26 14:41:03 +00:00
Geoffrey White
1d0c74daa7 CPP: Fix typo. 2019-03-26 14:34:55 +00:00
Jonas Jensen
c923e4cd36 Merge pull request #1091 from geoffw0/opts
CPP: Speed up AV Rule 35.ql
2019-03-26 15:13:53 +01:00
Tom Hvitved
273e77e800 C#: Fix qhelp for ICryptoTransform queries 2019-03-26 14:38:29 +01:00
Max Schaefer
3e16d16525 JavaScript: Make type tracking-related parameter and predicate names more consistent. 2019-03-26 13:00:09 +00:00
Calum Grant
2229409180 Merge pull request #1088 from hvitved/csharp/no-qname-for-local-scope-vars
C#: No qualified names for local scope variables
2019-03-26 12:58:20 +00:00
Calum Grant
01aa4ecf2f Merge pull request #1075 from hvitved/csharp/get-location-to-string
C#: Simplify dispatch hierarchy for `getLocation()` and `toString()`
2019-03-26 12:56:29 +00:00
Geoffrey White
69f87d8eee CPP: Fix ODASA-3654. 2019-03-26 12:54:44 +00:00
Jonas Jensen
bdd6965d1b Merge branch 'master' into moremsalloc 2019-03-26 13:50:14 +01:00
Tom Hvitved
e01246acc8 C#: Autoformat 2019-03-26 13:38:47 +01:00
Geoffrey White
bd138238b0 CPP: Add a test of ODASA-3654. 2019-03-26 12:37:32 +00:00
Taus
702fc80054 Merge pull request #1166 from Semmle/rc/1.20
Merge rc/1.20 into master
2019-03-26 13:09:40 +01:00
Jonas Jensen
010bb61cbb Merge pull request #1164 from geoffw0/overflowdest-enable
CPP: Re-enable OverflowDestination.ql on the security dashboard.
2019-03-26 10:53:34 +01:00
Max Schaefer
bf04664bd7 Update javascript/ql/src/semmle/javascript/GeneratedCode.qll
Co-Authored-By: esben-semmle <42067045+esben-semmle@users.noreply.github.com>
2019-03-26 10:01:24 +01:00
Taus
23eed3073a Merge pull request #1157 from markshannon/python-taint-tracking-early-exit
Python taint-tracking improvements
2019-03-26 09:28:26 +01:00
Esben Sparre Andreasen
3cd93129a6 JS: classify HTML files with > 20 elements on a line as generated 2019-03-26 08:03:56 +01:00
Dave Bartolomeo
669ac2f4b4 C++: Fix FP in PointlessComparison due to preprocessor
Reported by an LGTM customer here: https://discuss.lgtm.com/t/2-false-positives-in-c-for-comparison-is-always-same/1943.

Even though the comparison is pointless in the preprocessor configuration in effect during extraction, it is not pointless in other preprocessor configurations. Similar to ExprHasNoEffect, we'll now exclude results in functions that contain preprocessor-excluded code. I factored the similar code already used in ExprHasNoEffect in a non-recursive version into Preprocessor.qll, leaving the recursive version in ExprHasNoEffect.ql. I believe the recursive version is too aggressive for PointerlessComparison, which does no interprocedural analysis.
2019-03-25 16:19:18 -07:00
Max Schaefer
c50067b597 JavaScript: Refactor type tracking to avoid computing very large relations. 2019-03-25 20:38:58 +00:00
Max Schaefer
084159dcfd JavaScript: Teach type trackers to track flow through one level of properties. 2019-03-25 20:38:58 +00:00
Max Schaefer
9fbc0eb717 JavaScript: Switch from path summaries to step summaries for type tracking.
This is sufficient since we are not doing summarisation.
2019-03-25 20:37:05 +00:00
Dave Bartolomeo
e25c578011 C++: Use #if 0 instead of comment to exclude broken test case. 2019-03-25 11:10:13 -07:00
Dave Bartolomeo
2e752f48ff C++: Add more Lambda IR test cases
New tests for mixed =/& captures and for captures with initializers
2019-03-25 11:05:53 -07:00
Dave Bartolomeo
8770258714 C++: Add LambdaExpression.getInitializer() 2019-03-25 10:52:57 -07:00
Geoffrey White
193c61c5b5 CPP: Re-enable OverflowDestination.ql on the security dashboard. 2019-03-25 17:40:22 +00:00
Mark Shannon
2f0bb828c8 Python: Tweak wording of qldoc. 2019-03-25 17:35:23 +00:00
Max Schaefer
8e926333a9 JavaScript: Simplify a few newtypes and remove unused predicates. 2019-03-25 16:57:46 +00:00
Max Schaefer
55394df96f JavaScript: Refactor HTTP libraries to use type tracking instead of tracked nodes. 2019-03-25 16:57:46 +00:00
Max Schaefer
74db8b1979 JavaScript: Use type tracking instead of tracked nodes in Express. 2019-03-25 16:57:46 +00:00
Max Schaefer
276f216ef9 JavaScript: Use type tracking to improve modelling of socket.io. 2019-03-25 16:57:46 +00:00
Max Schaefer
4702790696 JavaScript: Refactor AMD/CommonJS path expression analysis to avoid bad magic. 2019-03-25 16:57:46 +00:00
Max Schaefer
0e0fe2545d JavaScript: Refactor Closure::isTopLevelExpr to avoid unhelpful magic. 2019-03-25 16:57:46 +00:00
Max Schaefer
c17f4d7d41 JavaScript: Cache SourceNode::track and SourceNode::backtrack. 2019-03-25 16:57:46 +00:00
Max Schaefer
2b778afdf5 JavaScript: Cache a bunch of flow steps to avoid recomputation. 2019-03-25 16:57:46 +00:00
Jonas Jensen
1be9762463 Merge pull request #1162 from geoffw0/rnr-open
CPP: Fix Resource not released in destructor FP
2019-03-25 17:26:34 +01:00
Geoffrey White
2759861da4 CPP: Change note. 2019-03-25 12:17:05 +00:00
Geoffrey White
9b31b4e364 CPP: Fix false positive. 2019-03-25 11:57:23 +00:00
Max Schaefer
4d1161f236 Merge pull request #1156 from esben-semmle/js/fix-define-property-regression
JS: fix getAPropertyAttribute timeouts
2019-03-25 11:11:58 +00:00
semmle-qlci
d6be42dcc7 Merge pull request #1160 from hvitved/csharp/is-branch
Approved by calumgrant
2019-03-25 10:53:22 +00:00
Esben Sparre Andreasen
4ab3407726 JS: add classification test cases 2019-03-25 10:45:44 +01:00
Geoffrey White
7b88bf7617 CPP: Add a test. 2019-03-25 09:22:18 +00:00
Tom Hvitved
1994f00495 C#: Introduce isBranch() predicate
We already have `isJoin()`, so it makes sense to have `isBranch()` for symmetry.
2019-03-25 09:51:26 +01:00
Ziemowit Laski
29af56d21b [CPP-340] Refine the test query for mismatching args/params by applying
C promotion rules.  The following issues are now flagged:
             (1) passing a larger type than the receiver can accept
                 (e.g., long long -> int)
             (2) passing a type of different signedness than the
                 parameter specified.
2019-03-24 19:42:05 -07:00
Tom Hvitved
1d05bccd87 Merge pull request #952 from calumgrant/cs/non-null-functions
C#: Better call analysis using CIL
2019-03-23 10:47:22 +01:00
Dave Bartolomeo
d20e5bc69c C++: IR construction for lambda expressions
The IR construction code wasn't handling lambda expressions, so I added `TranslatedLambdaExpression`. It's pretty straightforward: it creates a temporary variable, initializes it with an `Uninitialized` instruction, then initializes the individual captured fields with the initializer list supplied in the AST.

When testing the case of a lambda with no captures, I noticed that we weren't handling initialization of empty structs with an initializer list correctly, so I fixed that along the way.

I was getting confused by the bad indentation for wrapped lines in
TranslatedInitialization.qll, so I fixed that up in a separate commit.
2019-03-22 15:17:27 -07:00
Dave Bartolomeo
f0bd1ab7ab C++: Remove overaggressive line breaks in TranslatedInitialization.qll 2019-03-22 15:17:27 -07:00
Geoffrey White
7fd08233c3 CPP: Optimize AV Rule 35's usesMacro. 2019-03-22 14:43:58 +00:00
Calum Grant
eafb6d84e9 Merge pull request #1 from hvitved/cs/non-null-functions
C#: Adjustments to CIL/nullness analyses
2019-03-22 14:41:35 +00:00
Tom Hvitved
6c182564e7 C#: Adjustments to CIL/nullness analyses
- Cache predicates in the same stage using a cached module.
- Introduce `DefUse::defUseVariableUpdate()` and use in `CallableReturns.qll`.
  The updated file `csharp/ql/test/library-tests/cil/dataflow/Nullness.expected`
  demonstrates why this is needed.
- Utilize CIL analysis in `Guards::nonNullValue()`.
- Analyze SSA definitions in `AlwaysNullExpr`, similar to `NonNullExpr`.
2019-03-22 15:11:31 +01:00
Mark Shannon
2edde1fed8 Python taint-tracking. Handle early exit and 'not' correctly for 'falsey' taints. 2019-03-22 11:58:23 +00:00
Esben Sparre Andreasen
335a969946 JS: fix performance in ObjectDefinePropertyAsPropWrite::getRhs 2019-03-22 12:29:34 +01:00
Geoffrey White
a319356b00 CPP: Change note. 2019-03-22 11:09:52 +00:00
Geoffrey White
444259a9ad CPP: Back out support for 'SysAllocString', as PointsTo doesn't support the free(pointer-to-pointer) pattern in 'SysReAllocString' leading to unaccaptable FPs. 2019-03-22 10:59:51 +00:00
Geoffrey White
fbe584f3e1 CPP: Support more MS alloc functions. 2019-03-22 10:59:51 +00:00
Mark Shannon
57368921d2 Python: Fix Builtin.isClass() and use in ClassObject. Also fix a couple of typos. 2019-03-22 10:00:14 +00:00
semmle-qlci
4075f570e2 Merge pull request #1151 from xiemaisi/rc/1.20-merge-master
Approved by asger-semmle, hvitved
2019-03-22 07:34:00 +00:00
Taus
36c7a8430a Merge pull request #1112 from markshannon/python-forward-compatible-points-to-extensions
Python: Allow points-to extensions to specify just the object.
2019-03-21 19:20:44 +01:00
Mark Shannon
8ab4dae2fa Merge pull request #1150 from taus-semmle/python-fix-insecure-default-protocol-fp
Python: Fix false positive for `py/insecure-default-protocol`.
2019-03-21 18:16:05 +00:00
Mark Shannon
d056af323d Merge pull request #1140 from taus-semmle/python-rename-query-suites
Python: Copy query suites from `python2` to `python`.
2019-03-21 17:51:05 +00:00
Jonas Jensen
db8db8669b Merge pull request #1141 from geoffw0/newfreebug
CPP: Fix a bug in NewFree.qll
2019-03-21 17:22:00 +01:00
Geoffrey White
37bd4725ee Merge pull request #1149 from jbj/resource-not-released-in-destructor-Qt
C++: Fix special-casing of Qt library in resource-not-released-in-destructor
2019-03-21 16:13:25 +00:00
Max Schaefer
8c460ae385 Merge remote-tracking branch 'upstream/master' into rc/1.20-merge-master
Conflict in `javascript/extractor/src/com/semmle/js/extractor/Main.java` resolved
in favour of `master`.
2019-03-21 14:46:29 +00:00
semmle-qlci
fb499b02d5 Merge pull request #1138 from asger-semmle/ts-import-namespace-as-type
Approved by xiemaisi
2019-03-21 14:43:48 +00:00
semmle-qlci
313134cb8c Merge pull request #1148 from xiemaisi/js/adm-zip
Approved by esben-semmle
2019-03-21 14:00:30 +00:00
semmle-qlci
395089d35e Merge pull request #1147 from xiemaisi/js/show-char-code
Approved by asger-semmle
2019-03-21 13:59:59 +00:00
Taus Brock-Nannestad
5eb63ae048 Fix false positive and add test. 2019-03-21 14:10:05 +01:00
Taus Brock-Nannestad
9cb35a8ca9 Use correct named argument for ssl.SSLContext. 2019-03-21 14:09:25 +01:00
Jonas Jensen
552842346c C++: Fix special-casing of Qt library
The `Expr.getType` predicate returns a pointer type since that's the
type of the `new`-expression as a whole. To find the class type, we use
`NewExpr.getAllocatedType`.

This commit reduces the number of alerts in a Qt snapshot from 229 to
51, and it removes the two false positives in
https://github.com/Subsurface-divelog/subsurface.
2019-03-21 13:37:18 +01:00
Jonas Jensen
a59a9f6075 C++: Add test cases for Qt's QObject
The Qt library requires client code to call `new` but not `delete`.
2019-03-21 13:31:50 +01:00
Asger F
1a6c95c908 TS: update test expectation 2019-03-21 11:06:04 +00:00
Geoffrey White
867f357b36 CPP: Correct the test. 2019-03-21 10:57:44 +00:00
Calum Grant
f20041d41f Merge pull request #1133 from hvitved/csharp/more-performance-tweaks
C#: More performance tweaks
2019-03-21 10:46:07 +00:00
Max Schaefer
1835028b93 JavaScript: Show character code when reporting unexpected character. 2019-03-21 10:44:49 +00:00
Max Schaefer
4533e1f6fe JavaScript: Add model of adm-zip library for ZipSlip query. 2019-03-21 08:04:06 +00:00
Ziemowit Laski
5a092d0fed [CPP-340] Create three QL queries: (1) mismatched argument types,
(2) too few arguments and (3) too many arguments.
    Create new 'UnderspecifiedFunction' folders for both queries and tests.
2019-03-20 19:42:51 -07:00
Geoffrey White
5a56740ee6 Merge pull request #1124 from jbj/weak-cryptographic-algorithm-perf
C++: Fix performance of BrokenCryptoAlgorithm.ql
2019-03-20 18:01:58 +00:00
Taus Brock-Nannestad
391e111189 Use attr instead of getAttribute. 2019-03-20 17:41:23 +01:00
Taus Brock-Nannestad
f14f7b50ed Python: Use ModuleObject::named more consistently. 2019-03-20 17:41:23 +01:00
Taus Brock-Nannestad
c64372886c Fix typo. 2019-03-20 17:15:41 +01:00
Geoffrey White
2fdd33eecd CPP: Change note. 2019-03-20 15:48:02 +00:00
Geoffrey White
91bef02257 CPP: Add a 1.21 CPP change notes file (couldn't find the templates). 2019-03-20 15:48:00 +00:00
Geoffrey White
faeb326bf8 CPP: Use newer dataflow for the fix. 2019-03-20 15:47:48 +00:00
Geoffrey White
7d8886e30c CPP: Fix over-enthusiastic dataflow in allocExprOrIndirect. 2019-03-20 15:40:02 +00:00
Geoffrey White
ea7e8927fe CPP: Add a test similar to the false positive in arvidn/libtorrent. 2019-03-20 15:35:58 +00:00
Tom Hvitved
414b7243c2 C#: More performance tweaks 2019-03-20 15:43:38 +01:00
Taus Brock-Nannestad
a6708572c0 Python: Copy query suites from python2 to python. 2019-03-20 15:33:54 +01:00
Asger F
5768d85c7b TS: fix trap test output 2019-03-20 12:46:52 +00:00
Geoffrey White
8a693699fc Merge pull request #1139 from jbj/return-stack-allocated-typo
C++: Fix typo in ReturnStackAllocatedMemory.ql
2019-03-20 11:36:12 +00:00
Taus
20e2f9ee4e Remove extraneous period. 2019-03-20 11:48:02 +01:00
Jonas Jensen
401b5648be C++: Fix typo in ReturnStackAllocatedMemory.ql 2019-03-20 11:27:34 +01:00
Asger F
8201e7ea27 TS: update trap test output 2019-03-20 10:23:28 +00:00
Asger F
aaa8bfb874 TS: allow namespace imports as types 2019-03-20 10:09:18 +00:00
Ziemowit Laski
2def0ee9c1 [CPP-340] Re-work QL query; treat undeclared C functions the same way as
()-declared functions.
2019-03-19 16:01:35 -07:00
Ziemowit Laski
5d8b84c22a Refine QL query by requiring that a ()-declaration be present. 2019-03-19 16:00:22 -07:00
Ziemowit Laski
0c350dc504 [CPP-340] Create QL query for function call argument count mismatches.
Update QHELP file, test and test results.
2019-03-19 16:00:02 -07:00
zlaski-semmle
241994d1f8 Merge pull request #1107 from zlaski-semmle/cpp355
Updated query to look for Microsoft-specific '_alloca' and '_malloca'
Merge to Semmle/ql:master.
2019-03-19 13:40:27 -07:00
Ziemowit Laski
09e729ff59 Turns out that '__builtin_alloca' takes 'unsigned long', not 'unsigned long long'; rename some parameters to align with C11 standard. 2019-03-19 13:27:14 -07:00
Ziemowit Laski
11ed4f3312 Change __builtin_alloca declaration to use an unsigned long long parameter. 2019-03-19 13:12:29 -07:00
Ziemowit Laski
ff3430d8d0 Use '// GOOD' and '// BAD' annotations for query diagnostics. 2019-03-19 12:29:38 -07:00
Max Schaefer
b211a54181 Merge pull request #1132 from xiemaisi/mergeback-2019-03-19
Merge rc/1.20 into master
2019-03-19 17:28:52 +00:00
Max Schaefer
23d77f3e6a Merge pull request #1130 from felicity-semmle/1.20/javascript-extractor
1.20: Update JavaScript extraction notes and supported versions
2019-03-19 17:09:05 +00:00
Mark Shannon
29c4e274e1 Merge pull request #1127 from felicity-semmle/1.20/python-change-notes
1.20: finalize python change notes
2019-03-19 16:53:59 +00:00
Calum Grant
fb9c587c86 Merge pull request #1126 from hvitved/csharp/performance-tweaks
C#: Fix a few minor performance regressions
2019-03-19 16:01:49 +00:00
calum
449e65d467 C#: Update expected outputs. 2019-03-19 15:11:19 +00:00
Mark Shannon
9d31d09f08 Python encapsulate extensionals dealing with 'builtin' objects. 2019-03-19 14:45:37 +00:00
Taus Brock-Nannestad
c7c6c83627 Address review comments. 2019-03-19 15:44:11 +01:00
Max Schaefer
6fbf487524 Merge remote-tracking branch 'upstream/rc/1.20' into mergeback-2019-03-19 2019-03-19 14:09:03 +00:00
Taus Brock-Nannestad
129baea835 Add change note for 1.21. 2019-03-19 15:07:50 +01:00
semmle-qlci
17e8b64f59 Merge pull request #1131 from xiemaisi/js/simplify-flow-summary-queries
Approved by asger-semmle
2019-03-19 13:35:06 +00:00
semmle-qlci
6fdba626ad Merge pull request #1121 from jbj/return-stack-allocated-1.20-fixes
Approved by geoffw0
2019-03-19 13:28:55 +00:00
Jonas Jensen
a31794f20c Merge pull request #1129 from geoffw0/unusedstatic
CPP: Add to UnusedStaticVariables tests.
2019-03-19 14:16:30 +01:00
Max Schaefer
77c383aee2 JavaScript: Simplify flow-summary queries.
Previously, `AllConfigurations.qll` would pull in (almost) all taint
tracking configurations, which has started causing OOMEs during
compilation.

I've pruned it down to only the most interesting configurations. Since
flow summaries are experimental at this point and require a bit of manual
configuration anyway, this shouldn't be much of an issue in practice.
2019-03-19 10:58:49 +00:00
Jonas Jensen
111a462d16 C++: Recover some of the good results we lost
My recent changes to suppress FPs in `ReturnStackAllocatedMemory.ql`
caused us to lose all results where there was a `Conversion` at the
initial address escape. We cannot handle conversions in general, but
this commit restores the good results for the trivial types of
conversion that we can handle.
2019-03-19 11:09:58 +01:00
Jonas Jensen
d864df5b7f C++: Tests for new false negatives 2019-03-19 10:30:14 +01:00
yh-semmle
13cd7d0f15 Merge pull request #1122 from felicity-semmle/1.20/SD-3061-java-versions
QL 1.20 docs: Be more explicit about Java versions supported
2019-03-18 18:32:52 -04:00
yh-semmle
23f71714e5 Merge pull request #1117 from felicity-semmle/1.20/java-change-notes
1.20: minor changes to java change notes
2019-03-18 18:30:11 -04:00
Ziemowit Laski
566fdc3f70 Change names of parameters to memcpy(), as per Geoff. 2019-03-18 11:15:43 -07:00
calum
d5a4dcebd6 C#: Fix bug in dataflow library. 2019-03-18 17:59:56 +00:00
calum
d76a9805ae C#: Fix assembly labels when public key token is null. 2019-03-18 17:59:56 +00:00
calum
e1e657c1e8 C#: Address review comments and update tests. 2019-03-18 17:59:56 +00:00
calum
dd64cd2dbe C#: Fix CIL::Method::canReturn() to ignore stubs and only consider the best implementation. 2019-03-18 17:59:56 +00:00
calum
d1ada9594c C#: Implement Type::isRefType() and Type::isValueType() 2019-03-18 17:59:48 +00:00
ian-semmle
3f5c6b0032 Merge pull request #1123 from nickrolfe/tarballs
C++: accept test output from changes to extractor TRAP ordering
2019-03-18 17:31:17 +00:00
Felicity Chapman
06fcd8a150 Reword information on parallel extraction 2019-03-18 17:09:23 +00:00
Geoffrey White
73b7b980c8 CPP: Add to UnusedStaticVariables tests. 2019-03-18 16:43:48 +00:00
Felicity Chapman
5031153ba2 Update JavaScript extraction notes and supported versions 2019-03-18 16:17:20 +00:00
Felicity Chapman
4ab8417734 Fix US spelling 2019-03-18 16:10:03 +00:00
Taus Brock-Nannestad
52278b25d9 Python: Add query for insecure SSH host key policies in Paramiko. 2019-03-18 16:45:54 +01:00
Felicity Chapman
e05387f237 Correct information about build support 2019-03-18 15:44:47 +00:00
Felicity Chapman
e1a3fde52a Remove 'change details' for new query 2019-03-18 15:38:58 +00:00
Felicity Chapman
d07b958bcd Finalize text for 1.20 release 2019-03-18 15:25:46 +00:00
Tom Hvitved
6cd87757f6 C#: Fix a few minor performance regressions 2019-03-18 14:36:41 +01:00
Felicity Chapman
95ead47b21 Organization changes and boiler-plate text deletion 2019-03-18 12:57:40 +00:00
Felicity Chapman
975605bfa9 Merge pull request #1125 from markshannon/python-taint-tracking-change-note
Python: Add change note for new taint-tracking configuration API.
2019-03-18 12:51:08 +00:00
Mark Shannon
33929ab01f Python: Add change note for new taint-tracking configuration API. Needs links to full documentation added. 2019-03-18 12:43:09 +00:00
Jonas Jensen
76ff250593 C++: Don't repeat work in BrokenCryptoAlgorithm.ql
The main source of slowness in `BrokenCryptoAlgorithm.ql` was that the
regexp on function (macro) names was evaluated once per call
(invocation) instead of once per name. Factoring out separate predicates
for the problematic functions (macros) fixes this.

On https://github.com/ericniebler/range-v3, this change reduces the run
time of the two slowest predicates from

    BrokenCryptoAlgorithm::InsecureMacroSpec#class#f .... 35.1s
    BrokenCryptoAlgorithm::InsecureFunctionCall#class#f . 12.8s

to

    BrokenCryptoAlgorithm::getAnInsecureFunction#f . 1.2s
    BrokenCryptoAlgorithm::getAnInsecureMacro#f .... 12ms
2019-03-18 12:01:37 +01:00
Jonas Jensen
f72ff37226 C++: Combine crypto blacklist regexes into one
Instead of `algorithmBlacklistRegex` having 2 * 5 results, it now has
only one result, which is a single regex that represents the union of
the previous 2 * 5 regexes. This means that `BrokenCryptoAlgorithm.ql`
has much less regex matching to do.

On https://github.com/ericniebler/range-v3, this change reduces the run
time of the two slowest predicates from

    BrokenCryptoAlgorithm::InsecureMacroSpec#class#f .... 2m21s
    BrokenCryptoAlgorithm::InsecureFunctionCall#class#f . 54.5s

to

    BrokenCryptoAlgorithm::InsecureMacroSpec#class#f .... 35.1s
    BrokenCryptoAlgorithm::InsecureFunctionCall#class#f . 12.8s
2019-03-18 11:51:50 +01:00
Nick Rolfe
8e9aeffdbc C++: accept test output from changes to extractor TRAP ordering 2019-03-18 10:44:18 +00:00
Felicity Chapman
94f525ff72 Be more explicit about Java versions supported 2019-03-18 10:17:56 +00:00
semmle-qlci
285f8b06bd Merge pull request #1118 from jcreedcmu/jcreed/tarslip
Approved by xiemaisi
2019-03-18 08:18:13 +00:00
Jonas Jensen
6b1cd17009 C++: Fix FPs due to data flow Conversion handling
Since we cannot track data flow from a fully-converted expression but
only the unconverted expression, we should check whether the address
initially escapes into the unconverted expression, not the
fully-converted one.

This fixes most of the false positives observed on lgtm.com.
2019-03-16 20:50:27 +01:00
Jonas Jensen
1a7351ef6e C++: Add tests for three FPs observed on lgtm.com 2019-03-16 20:50:27 +01:00
Jason Reed
4475dd4b9f JavaScript: Add test and fix change note. 2019-03-15 14:40:48 -04:00
Jason Reed
aa9ba9557c JavaScript: Include 'unzipper' library in ZipSlip. 2019-03-15 09:32:39 -04:00
Jason Reed
8124980f58 JavaScript: Add change note and comment. 2019-03-15 09:32:39 -04:00
Jason Reed
a674dbb5cd JavaScript: Update docstrings to reflect generalization. 2019-03-15 09:31:26 -04:00
Jason Reed
6589813ec7 JavaScript: Add tar-stream extraction to ZipSlip query. 2019-03-15 09:31:26 -04:00
Calum Grant
5a3cf2c5bb Merge pull request #1054 from raulgarciamsft/users/raulga/ICryptoTransformLambda
2n part of ICryptoTransform.
2019-03-15 12:55:09 +00:00
Max Schaefer
5441352d41 Merge pull request #1113 from esben-semmle/js/useless-property-assign-setter
JS: improve use of attributes from ~Object.defineProperty~
2019-03-15 12:11:50 +00:00
Mark Shannon
7213b72b9b Python: Allow points-to extensions to specify just the object, and infer the class. Allows points-to extensions to more easily compatible across versions. 2019-03-15 11:09:46 +00:00
Taus
af1c502b11 Merge pull request #1098 from markshannon/python-2-print
Python: Don't report Python 2 print statements as having no effect.
2019-03-15 11:40:32 +01:00
Taus
eec59c2c7d Merge pull request #1092 from markshannon/python-fix-2-tests
Python: Update python-2 specific tests for new parser/tokenizer.
2019-03-15 11:38:34 +01:00
Jonas Jensen
690e2ae514 Merge pull request #1116 from rdmarsh2/rdmarsh/cpp/ir-guards-perf
C++: fix cartesian product in IRGuards.qll
2019-03-15 11:35:15 +01:00
Taus
0b2f44b54b Merge pull request #1052 from markshannon/python-taint-tracking-configuration
Python: Add taint-tracking configuration.
2019-03-15 11:34:59 +01:00
Pavel Avgustinov
7386ca911b Merge pull request #763 from sjvs/patch-1
Make licensing text in README.md more generic
2019-03-15 09:02:08 +00:00
semmle-qlci
cb86687302 Merge pull request #1078 from psygnisfive/UndefinedReturns
Approved by xiemaisi
2019-03-15 08:37:12 +00:00
Felicity Chapman
ee9e083f2a Minor text changes to analysis notes 2019-03-15 08:03:27 +00:00
Robert Marsh
dfb7076fae C++: fix cartesian product in IRGuards.qll 2019-03-14 13:37:35 -07:00
Robin Neatherway
6453b05a41 Merge pull request #1087 from jf205/update-qhelp-style-guide
Docs: mention lgtm in qhelp style guide
2019-03-14 19:28:43 +00:00
Ziemowit Laski
2d5bdc85b0 Add 'restrict' support to the C++ test cases. 2019-03-14 12:12:45 -07:00
Raul Garcia
110c75051c Update .gitignore 2019-03-14 11:04:03 -07:00
Raul Garcia
2521848322 Merging the scenarios. 2019-03-14 10:57:22 -07:00
Rebecca Valentine
f3683794d6 stylistic changes per PR change req. in description
https://github.com/Semmle/ql/pull/1078#pullrequestreview-214401005
2019-03-14 09:49:02 -07:00
semmle-qlci
e648477d14 Merge pull request #1114 from xiemaisi/js/yield-import
Approved by asger-semmle
2019-03-14 16:48:04 +00:00
Calum Grant
0471471d46 Merge pull request #1109 from hvitved/csharp/conditional-bypass
C#: Fix performance regression in `cs/user-controlled-bypass`
2019-03-14 16:19:47 +00:00
Taus
95eb4cf90d Merge pull request #1089 from markshannon/python-fix-redundant-comparison-complex-test
Fix false positive for redundant comparison query
2019-03-14 17:12:44 +01:00
semmle-qlci
d549a0dcb8 Merge pull request #1111 from xiemaisi/js/performance-fiddling
Approved by esben-semmle
2019-03-14 14:56:26 +00:00
Esben Sparre Andreasen
bfc1c6ec8e JS: change notes 2019-03-14 14:53:26 +01:00
semmle-qlci
5d9d23ee71 Merge pull request #1110 from xiemaisi/js/yield-in-non-generator
Approved by asger-semmle
2019-03-14 11:59:43 +00:00
semmle-qlci
7513bcf7ec Merge pull request #1095 from xiemaisi/js/base64
Approved by esben-semmle
2019-03-14 11:58:50 +00:00
semmle-qlci
bd3792a49a Merge pull request #1108 from xiemaisi/js/make-zipslip-visible-by-default
Approved by esben-semmle
2019-03-14 11:58:00 +00:00
Max Schaefer
8e52528219 JavaScript: Refactor reachableFromInput to improve join. 2019-03-14 11:53:46 +00:00
Max Schaefer
993345fb7b JavaScript: Track Electron browser objects locally only. 2019-03-14 11:53:46 +00:00
Esben Sparre Andreasen
bd7eef08e8 JS: introduce CallToObjectDefineProperty::getAPropertyAttribute 2019-03-14 11:59:27 +01:00
Esben Sparre Andreasen
ff5b85067a JS: add tests 2019-03-14 11:55:41 +01:00
Max Schaefer
69c63110c1 JavaScript: Teach Function.isGenerator to check for yield. 2019-03-14 10:48:44 +00:00
Mark Shannon
ab23a157ef Python: Move taint-tracking library to new location and extend configuration to match API of other languages. 2019-03-14 10:22:57 +00:00
Tom Hvitved
84c3073c2a C#: Fix performance regression in cs/user-controlled-bypass 2019-03-14 10:36:50 +01:00
Felicity Chapman
01b8770b7c Merge pull request #1065 from yh-semmle/java-frameworks-notes
Java: update frameworks list for 1.20 release
2019-03-14 09:15:46 +00:00
Max Schaefer
5d35626c58 JavaScript: Rename a test file to avoid case clash. 2019-03-14 08:55:30 +00:00
Max Schaefer
cc8d68082e JavaScript: Show ZipSlip results by default. 2019-03-14 08:50:47 +00:00
semmle-qlci
28efd91bbc Merge pull request #1106 from xiemaisi/js/fix-backtrack-example
Approved by asger-semmle
2019-03-14 08:18:00 +00:00
Ziemowit Laski
586aa0ae41 Updated query to look for Microsoft-specific '_alloca' and '_malloca' entry points. Added sundry positive and negative test cases. 2019-03-13 18:43:24 -07:00
ian-semmle
6a555d0054 Merge pull request #1102 from nickrolfe/declarationEntry
C++: accept test output from extractor changes to template class decls
2019-03-13 22:45:49 +00:00
yh-semmle
d7925ee2ec Java: tweak change note as per review comment 2019-03-13 14:31:13 -04:00
Rebecca Valentine
f9012cb00e improves tests 2019-03-13 10:48:02 -07:00
Rebecca Valentine
64f731c8aa adds clarification in docs 2019-03-13 10:46:39 -07:00
Rebecca Valentine
688e7a9730 improves docs 2019-03-13 10:10:57 -07:00
Calum Grant
a547fbea14 Merge pull request #1073 from hvitved/csharp/get-an-indexer-call
C#: Improve performance and correctness of `IndexerProperty::getAnIndexerCall()`
2019-03-13 17:10:52 +00:00
Rebecca Valentine
7ef33de9d2 add tests to ignore generators and async functions per PR change request in description
https://github.com/Semmle/ql/pull/1078#discussion_r265010018
2019-03-13 10:04:23 -07:00
Nick Rolfe
ac2dbbff13 C++: accept test output from extractor changes to template class decls 2019-03-13 16:38:24 +00:00
Jonas Jensen
028e61b71c Merge pull request #1101 from robertbrignull/merge/rc/1.20
Merge rc/1.20 => master
2019-03-13 16:36:55 +01:00
Max Schaefer
e2cb8c5ceb JavaScript: Fix example in TypeBackTracker qldoc. 2019-03-13 15:20:41 +00:00
Max Schaefer
03a2204c30 JavaScript: Improve support for dynamic imports.
`yield import(...)` previously caused a syntax error, now it is parsed
correctly.

`parseYield` is the only place where the value of `startsExpr` matters,
so this change should not affect anything else.
2019-03-13 14:40:12 +00:00
Tom Hvitved
638af39aa0 C#: Dispatch library performance tweaks
- Restrict `OverridableCallable::getAnOverrider(ValueOrRefType t)` to types `t`
  that are sub types of the callable's declaring type.
- Use explicit recursion in `OverridableCallable::getInherited()`.
2019-03-13 13:59:46 +01:00
Kevin Backhouse
08d852fa94 Merge pull request #1048 from jbj/dataflow-link-targets
C++: Data flow dispatch across link targets
2019-03-13 12:39:59 +00:00
Tom Hvitved
5b491a8564 Merge pull request #1100 from felicity-semmle/1.20/csharp-change-notes
1.20: minor updates to C# change notes
2019-03-13 13:31:23 +01:00
Max Schaefer
bce3cd8d2f Merge pull request #1097 from felicity-semmle/1.20/javascript-change-notes
1.20: minor updates to the javascript change notes
2019-03-13 12:28:31 +00:00
Max Schaefer
8f6cb1cdb9 JavaScript: Add models for many more base64 packages.
No tests; there are too many of these.
2019-03-13 12:27:23 +00:00
Max Schaefer
f76efcb558 JavaScript: Fix modelling of Buffer base64 encoders and decoders. 2019-03-13 12:27:23 +00:00
Mark Shannon
3fbe3c37aa Add change note. 2019-03-13 12:00:42 +00:00
Jonas Jensen
e83dd6708d Merge pull request #1099 from Semmle/pdb_attrs
.gitattributes: PDB files are binary
2019-03-13 11:56:54 +01:00
Robert Brignull
5380e1df68 Merge remote-tracking branch 'upstream/rc/1.20' into merge/rc/1.20 2019-03-13 10:55:30 +00:00
Nick Rolfe
5c4c8eec3b .gitattributes: PDB files are binary 2019-03-13 10:42:28 +00:00
Felicity Chapman
7c4ab6f2ae Text updates for consistency 2019-03-13 10:31:44 +00:00
Felicity Chapman
e46eb36e58 Duplicate information for easier look up 2019-03-13 10:25:41 +00:00
Mark Shannon
e9a45268a8 Python: Don't report Python 2 print statements as having no effect. 2019-03-13 10:08:07 +00:00
Felicity Chapman
a5fbad858b Sort table alphabetically 2019-03-13 09:49:09 +00:00
Jonas Jensen
4c7b4b42a8 Merge pull request #1096 from felicity-semmle/1.20/cpp-change-notes
1.20: minor updates to the cpp change notes
2019-03-13 10:23:49 +01:00
Felicity Chapman
7da36081b2 Minor text updates for consistency 2019-03-13 09:03:29 +00:00
Felicity Chapman
5c29a2641c Sort table alphabetically 2019-03-13 08:51:49 +00:00
Esben Sparre Andreasen
3e8e2ca890 JavaScript: Accept review suggestion.
Co-Authored-By: xiemaisi <max@semmle.com>
2019-03-13 08:47:17 +00:00
Max Schaefer
37f29aafcc JavaScript: Add change note. 2019-03-13 08:21:34 +00:00
semmle-qlci
8ed5d93721 Merge pull request #1090 from hvitved/merge-rc
Approved by calumgrant
2019-03-13 08:21:02 +00:00
Max Schaefer
2dccd39bb7 JavaScript: Fix two comments. 2019-03-13 08:20:58 +00:00
Max Schaefer
28d8011bcf JavaScript: Add models for popular base64 transcoders. 2019-03-13 08:20:58 +00:00
Felicity Chapman
eae6d92dc3 Minor text changes for consistency 2019-03-13 08:06:50 +00:00
james
18ee2866be docs: reword slightly 2019-03-13 07:54:44 +00:00
Felicity Chapman
53d9f0b033 Sort tables into alphabetic order 2019-03-13 07:54:20 +00:00
semmle-qlci
6baf52614e Merge pull request #1074 from xiemaisi/js/socket.io-comm
Approved by esben-semmle
2019-03-13 07:38:12 +00:00
semmle-qlci
5f480af760 Merge pull request #1086 from esben-semmle/js/dead-local-destructuring-defaults
Approved by xiemaisi
2019-03-13 07:37:55 +00:00
Robert Marsh
36db4b4a49 Merge pull request #1093 from dave-bartolomeo/dave/IRFunction
C++: Last minute IR API cleanup
2019-03-12 21:09:34 -07:00
Dave Bartolomeo
b0ad64c3e7 C++: PhiOperand -> PhiInputOperand
Also added `PhiInstruction::getAnInputOperand()`, and renamed `PhiInstruction::getAnOperandDefinitionInstruction()` to `getAnInput()` for consistency with other `Instruction` classes.
2019-03-12 11:57:53 -07:00
Raul Garcia
ad4873a0e7 Merge branch 'users/raulga/ICryptoTransformLambda' of https://github.com/raulgarciamsft/ql into users/raulga/ICryptoTransformLambda 2019-03-12 11:47:45 -07:00
Raul Garcia
af6588eaa9 Replacing tabs for spaces 2019-03-12 11:47:38 -07:00
Rebecca Valentine
64e64c16a8 resolves PR change req mentioned in description
https://github.com/Semmle/ql/pull/1078#discussion_r264557257
2019-03-12 11:29:43 -07:00
Dave Bartolomeo
b5a3edfdae C++: FunctionIR -> IRFunction 2019-03-12 11:28:22 -07:00
Rebecca Valentine
9a7f9aa808 resolves PR change req mentioned in description
2affd2bef6 (r264557539)
2019-03-12 11:23:46 -07:00
Mark Shannon
ccd18b6c67 Python: Update python-2 specific tests for new parser/tokenizer. 2019-03-12 17:53:50 +00:00
Raul Garcia
1fba9ca770 Update .gitignore 2019-03-12 10:14:35 -07:00
Raul Garcia
d4825afc79 Updating expected results (I forgot to update them on my previous push) 2019-03-12 10:14:07 -07:00
Max Schaefer
f540dcb486 JavaScript: Address review comments. 2019-03-12 16:56:10 +00:00
Raul Garcia
e2ca19c803 Merge branch 'users/raulga/ICryptoTransformLambda' of https://github.com/raulgarciamsft/ql into users/raulga/ICryptoTransformLambda 2019-03-12 09:52:51 -07:00
semmle-qlci
4de297c964 Merge pull request #1072 from asger-semmle/prop-write-static-accessor
Approved by esben-semmle
2019-03-12 16:51:54 +00:00
Raul Garcia
5be19d7da4 Separating some reusable code into QLL libraries.
Fixing bugs from code review.
2019-03-12 09:48:15 -07:00
semmle-qlci
669f035444 Merge pull request #1084 from asger-semmle/typescript3.3
Approved by esben-semmle
2019-03-12 16:34:48 +00:00
Tom Hvitved
8db983c2ee Merge branch 'rc/1.19' into merge-rc 2019-03-12 17:34:44 +01:00
calum
e00ada443a C#: Improve nullness and control flow by using CIL for null and throwing callables. 2019-03-12 16:13:29 +00:00
calum
3da8d3e82d C#: Identify CIL methods that are stubs, and exclude them from dataflow. 2019-03-12 16:13:29 +00:00
Geoffrey White
60b121008f Merge pull request #1071 from jbj/dataflow-toString-perf
C++: Make FlowVar::toString not use Expr::toString
2019-03-12 15:52:52 +00:00
Geoffrey White
77c983b99a Merge pull request #1070 from jbj/dataflow-defbyref-join-order
C++: Fix join order in def-by-reference data flow
2019-03-12 15:34:07 +00:00
Jonas Jensen
9758164dd6 Merge pull request #1083 from geoffw0/newdelete-perf2
CPP: Fix NewDelete.qll performance.
2019-03-12 16:08:46 +01:00
Mark Shannon
28c20a3216 Python: Fix false positive for redundant comparison query when a complex comparison is negated. 2019-03-12 15:07:49 +00:00
james
675511e4ce docs: mention lgtm in qhelp style guide 2019-03-12 14:48:27 +00:00
Esben Sparre Andreasen
408ac9878b JS: document limitation of js/useless-assignment-to-local 2019-03-12 15:30:28 +01:00
Tom Hvitved
089ad75a7b C#: Do not extend Element in ExternalArtifact.qll 2019-03-12 15:22:04 +01:00
semmle-qlci
13c6f55a2e Merge pull request #1085 from asger-semmle/extract-symbol
Approved by xiemaisi
2019-03-12 14:07:17 +00:00
semmle-qlci
47e621063b Merge pull request #1076 from asger-semmle/this-param-unused-import
Approved by xiemaisi
2019-03-12 14:04:23 +00:00
Max Schaefer
605f6bc6a6 Merge pull request #1082 from hvitved/merge-rc
Merge rc/1.20 into master
2019-03-12 13:49:12 +00:00
Mark Shannon
7b8ca30c12 Python: Make behaviour of taint-tracking sanitizers and extensions less surprising for the unlikely case of mutliple configurations. 2019-03-12 12:40:02 +00:00
Asger F
f2ec35c334 TS: remove unused import 2019-03-12 11:35:59 +00:00
Geoffrey White
249f350cc8 Fix NewDelete.qll performance. 2019-03-12 11:32:24 +00:00
Asger F
824a50d14e TS: fix extraction of symbols with unusual names 2019-03-12 11:24:16 +00:00
Asger F
0f5e6b2193 TS: update TypeScript compiler version 2019-03-12 09:52:38 +00:00
Asger F
5ef6eefda3 TS: update test 2019-03-12 09:47:06 +00:00
Tom Hvitved
c5450128be Merge branch 'rc/1.20' into merge-rc 2019-03-12 09:14:38 +01:00
Jonas Jensen
c8556bdbfc Merge pull request #1080 from zlaski/cpp80
[CPP-80] Provide kinder, gentler wording for messages
2019-03-12 09:14:19 +01:00
Tom Hvitved
78b4df933b C#: Remove toString() override from Expr class 2019-03-12 09:10:08 +01:00
Tom Hvitved
6d5330b01e C#: Replace getLocation() with hasLocationInfo() in Attributable 2019-03-12 09:09:43 +01:00
Raul Garcia
d733782434 Update .gitignore 2019-03-11 16:26:43 -07:00
Raul Garcia
4ad9163fa8 I fixed the typos, and added support for Parallel.Invoke.
Please let em know if this pattern works, and I can add other mechanisms to start new threads with a shared object.
Please also let me know what other mechanisms would you like me to add, I would like to focus on the most commonly used ones first. Thanks
2019-03-11 16:25:49 -07:00
Ziemowit Laski
75b4a6d6b3 [CPP-80] Provide kinder, gentler wording for messages (ClassesWithManyFields.{ql,qhelp}) 2019-03-11 16:16:05 -07:00
Rebecca Valentine
2affd2bef6 adds library tests 2019-03-11 16:03:48 -07:00
Rebecca Valentine
ea55c1a589 adds getAnUndefinedReturn 2019-03-11 12:41:59 -07:00
Calum Grant
242f8f2b43 Merge pull request #1058 from hvitved/csharp/dataflow/performance
C#: Data flow performance improvements
2019-03-11 18:23:21 +00:00
Asger F
957db8374c JS: Bump extractor version string 2019-03-11 16:53:52 +00:00
Asger F
146909ba13 TS: fix missing this type in method declarations 2019-03-11 16:53:25 +00:00
Asger F
f632379c44 JS: whitelist accessors in DeadStoreOfProperty 2019-03-11 16:38:08 +00:00
Felicity Chapman
35484c0ca9 Merge pull request #1067 from geoffw0/ref
CPP: Add references section to cpp/return-stack-allocated-memory
2019-03-11 16:14:24 +00:00
semmle-qlci
a2b1939319 Merge pull request #1059 from asger-semmle/ts-infinite-expansion
Approved by esben-semmle, xiemaisi
2019-03-11 15:52:53 +00:00
Tom Hvitved
fe3f25864f Merge pull request #1064 from calumgrant/cs/framework-support
C#: Updated framework support list
2019-03-11 16:49:02 +01:00
Tom Hvitved
c6fdcf4648 Merge pull request #1021 from calumgrant/cs/nhibernate
C#: Model NHibernate framework
2019-03-11 16:48:42 +01:00
Max Schaefer
d2c3de6256 JavaScript: Consolidate tests. 2019-03-11 12:47:28 +00:00
Max Schaefer
77e59f1a47 JavaScript: Be more lenient about namespace matching. 2019-03-11 12:42:51 +00:00
Max Schaefer
41d83d5b7d JavaScript: Introduce additional flow steps between sockets. 2019-03-11 12:42:51 +00:00
Max Schaefer
36c9af977b JavaScript: Connect up client and server sockets. 2019-03-11 12:42:51 +00:00
Max Schaefer
dc614ebefe JavaScript: Introduce indices for sent/received items. 2019-03-11 12:42:51 +00:00
Max Schaefer
b47b26ca61 JavaScript: Add basic model of client-side socket.io API. 2019-03-11 12:42:34 +00:00
Max Schaefer
363c11e89d JavaScript: Improve handling of acknowledgment callbacks. 2019-03-11 12:41:19 +00:00
Max Schaefer
37bc36d92e JavaScript: Factor out handling of EventEmitter API. 2019-03-11 12:41:19 +00:00
Max Schaefer
f92f9594ea JavaScript: Add a convenience predicate to get the last parameter of a function. 2019-03-11 12:41:19 +00:00
Max Schaefer
eb07754eee JavaScript: Introduce representation of socket.io servers and namespaces. 2019-03-11 12:41:19 +00:00
Tom Hvitved
94adcc9520 C#: Improve performance and correctness of IndexerProperty::getAnIndexerCall()
Performance has been improved via suitable predicate folding, and correctness
has been improved as the line

```
result = getType().(RefType).getAnIndexer().getAnAccessor().getACall()
```

was missing a `getABaseType*()` (now using the simpler `hasMember()` predicate
instead).
2019-03-11 13:30:20 +01:00
Asger F
16a2177aec JS: update tests 2019-03-11 11:36:46 +00:00
Asger F
d7f0099426 TS: bump extractor version 2019-03-11 11:26:46 +00:00
Asger F
dc6c33dd12 TS: Fix infinite type expansion issue 2019-03-11 11:26:46 +00:00
Jonas Jensen
6122cdb424 C++: Make FlowVar::toString not use Expr::toString
The `FlowVar::toString` predicate is purely a debugging aid, but
unfortunately it has to be `cached` because it's in a `cached` class.
Before this commit, it caused `Expr::toString` to be evaluated in full.
2019-03-11 11:40:49 +01:00
Jonas Jensen
ece122aca3 C++: Fix join order in def-by-reference data flow
The performance was adequate on most projects but degenerated on
https://github.com/Microsoft/Tocino.
2019-03-11 10:57:00 +01:00
Tom Hvitved
10491e6497 C#: More data flow performance tweaks 2019-03-11 10:54:07 +01:00
Asger F
04a6692aed JS: add test case 2019-03-11 09:44:59 +00:00
calum
3fd10ec994 C#: Address review comment. 2019-03-11 09:38:23 +00:00
calum
383e29ce13 C#: Analysis change notes. 2019-03-11 09:38:23 +00:00
calum
d6c315bbdf C#: Model NHibernate framework. 2019-03-11 09:38:22 +00:00
Tom Hvitved
b48576d7b9 C#: Address review comments 2019-03-10 15:45:31 +01:00
Tom Hvitved
8959d528a1 Merge remote-tracking branch 'upstream/rc/1.20' into csharp/dataflow/performance 2019-03-10 15:07:18 +01:00
Geoffrey White
0b21f4d59b CPP: Add an empty references section to the ReturnStackAllocatedMemory qhelp. 2019-03-08 23:21:47 +00:00
Tom Hvitved
548a28ff7d Merge pull request #912 from calumgrant/cs/ef
C#: Model EntityFrameworkCore
2019-03-08 22:13:13 +01:00
Jonas Jensen
a90e4a7bdf Merge pull request #1066 from xiemaisi/fix-qhelp-backticks
Fix qhelp backticks
2019-03-08 19:06:48 +01:00
Max Schaefer
a94f25e8fa C++: Fix erroneous backticks in query help. 2019-03-08 15:28:14 +00:00
Max Schaefer
c74db8bbbc JavaScript: Fix erroneous backticks in query help. 2019-03-08 15:28:03 +00:00
calum
3bdaf7c14e C#: Updated framework support list. 2019-03-08 15:12:50 +00:00
Tom Hvitved
6f44384db9 C#: No qualified name for local scope variables 2019-03-08 15:02:07 +01:00
Mark Shannon
94e4bd8b01 Merge pull request #1063 from taus-semmle/python-fix-compilation-warnings
Python: Fix compilation warnings.
2019-03-08 13:54:31 +00:00
Tom Hvitved
77185f1fa3 Merge pull request #1055 from calumgrant/cs/lazy-type-mention
C#: Fix an InvalidOperationException in csharp.log
2019-03-08 14:17:51 +01:00
Taus
300e3bdfec Merge pull request #1057 from markshannon/python-fix-os-guard
Python: Fix up OsGuard class.
2019-03-08 14:05:22 +01:00
Taus Brock-Nannestad
a74a2060f5 Remove use of deprecated function theEmptyTupleObject. 2019-03-08 14:00:16 +01:00
Taus Brock-Nannestad
116e262c62 Add missing override annotations. 2019-03-08 13:59:52 +01:00
Jonas Jensen
38310e0380 C++: Mention isGLValue in getResultType QLDoc 2019-03-08 11:46:35 +01:00
Taus
984fb3a010 Merge pull request #1043 from markshannon/python-fix-stack-trace-exposure
Python: fix stack trace exposure query.
2019-03-08 11:40:27 +01:00
Jonas Jensen
db104edbd6 Merge pull request #792 from rdmarsh2/rdmarsh/cpp/escape-analysis
C++: Interprocedural escape/alias analysis in IR construction
2019-03-08 07:29:26 +01:00
Robert Marsh
07bc9ca26c C++: fix whitespace 2019-03-07 13:14:58 -08:00
Robert Marsh
8a2a4678d8 C++: accept dataflow test change 2019-03-07 13:14:57 -08:00
Robert Marsh
ef836c39bb C++: respond to PR comments 2019-03-07 13:14:57 -08:00
Robert Marsh
17ad124c9e C++: remove VariableAddress from points_to test 2019-03-07 13:14:56 -08:00
Robert Marsh
7e30ce0c09 C++: add phi node support to escape analysis 2019-03-07 13:14:56 -08:00
Robert Marsh
97c11a5222 C++: points-to for argument-returning calls 2019-03-07 13:14:55 -08:00
Robert Marsh
878502f82e C++: remove duplicate logic 2019-03-07 13:14:52 -08:00
Jonas Jensen
794a8954cd C++: Simplify automaticVariableAddressEscapes
The `automaticVariableAddressEscapes` predicate got join-ordered badly
in its `unaliased_ssa` version. These are the tuple counts on Wireshark,
where one pipeline step is seen to have 716 million tuples:

```
[2019-03-02 11:29:41] (42s) Starting to evaluate predicate AliasAnalysis::automaticVariableAddressEscapes#2#f
[2019-03-02 11:30:06] (67s) Tuple counts:
                      353419    ~0%      {1} r1 = JOIN project#Instruction::VariableAddressInstruction#class#2#ff WITH AliasAnalysis::resultEscapesNonReturn#2#f ON project#Instruction::VariableAddressInstruction#class#2#ff.<0>=AliasAnalysis::resultEscapesNonReturn#2#f.<0> OUTPUT FIELDS {AliasAnalysis::resultEscapesNonReturn#2#f.<0>}
                      353419    ~0%      {2} r2 = JOIN r1 WITH IRConstruction::Cached::getInstructionEnclosingFunctionIR#ff@staged_ext ON r1.<0>=IRConstruction::Cached::getInstructionEnclosingFunctionIR#ff@staged_ext.<0> OUTPUT FIELDS {IRConstruction::Cached::getInstructionEnclosingFunctionIR#ff@staged_ext.<1>,r1.<0>}
                      353419    ~0%      {2} r3 = JOIN r2 WITH FunctionIR::FunctionIR::getFunction_dispred#3#ff ON r2.<0>=FunctionIR::FunctionIR::getFunction_dispred#3#ff.<0> OUTPUT FIELDS {FunctionIR::FunctionIR::getFunction_dispred#3#ff.<1>,r2.<1>}
                      716040298 ~0%      {2} r4 = JOIN r3 WITH IRVariable::IRVariable#class#3#ff_10#join_rhs ON r3.<0>=IRVariable::IRVariable#class#3#ff_10#join_rhs.<0> OUTPUT FIELDS {IRVariable::IRVariable#class#3#ff_10#join_rhs.<1>,r3.<1>}
                      4480139   ~0%      {2} r5 = JOIN r4 WITH IRVariable::IRAutomaticVariable#class#3#ff ON r4.<0>=IRVariable::IRAutomaticVariable#class#3#ff.<0> OUTPUT FIELDS {r4.<1>,r4.<0>}
                      66760     ~91%     {1} r6 = JOIN r5 WITH Instruction::VariableInstruction::getVariable_dispred#2#ff ON r5.<0>=Instruction::VariableInstruction::getVariable_dispred#2#ff.<0> AND r5.<1>=Instruction::VariableInstruction::getVariable_dispred#2#ff.<1> OUTPUT FIELDS {r5.<1>}
                                         return r6
[2019-03-02 11:30:06] (67s)  >>> Relation AliasAnalysis::automaticVariableAddressEscapes#2#f: 35531 rows using 0 MB
```

The predicate contained a cyclic join, which is always hard to optimize.
I couldn't see a reason to join the `FunctionIR`, so I removed that
part. The predicate is now fast, and there are no changes in the tests.
2019-03-07 13:14:51 -08:00
Robert Marsh
a72cd23d1d C++: fix escape test failures 2019-03-07 13:14:51 -08:00
Robert Marsh
09321ee062 C++: refactor escape analysis for performance 2019-03-07 13:14:51 -08:00
Robert Marsh
6f76c13385 C++: fix unused variable warning 2019-03-07 13:14:50 -08:00
Robert Marsh
726f38c802 C++: refactor alias analysis for performance 2019-03-07 13:14:50 -08:00
Robert Marsh
c70bd285de C++: assume arguments to virtual functions escape 2019-03-07 13:14:49 -08:00
Robert Marsh
2c94a8887d C++: test for virtual functions in escape analysis 2019-03-07 13:14:49 -08:00
Robert Marsh
6089172554 C++: escape analysis for this parameters 2019-03-07 13:14:49 -08:00
Robert Marsh
466e110338 C++: add new interprocedural escape analysis 2019-03-07 13:14:48 -08:00
Robert Marsh
bd39698528 C++: test changes for interproc escape analysis 2019-03-07 13:14:48 -08:00
Calum Grant
f6828fa5e5 Merge pull request #1053 from hvitved/csharp/dispatch-tweak
C#: `Dispatch.qll` performance tweaks
2019-03-07 16:21:29 +00:00
semmle-qlci
9dccd9f62c Merge pull request #1050 from asger-semmle/prototype-instance-methods
Approved by xiemaisi
2019-03-07 16:10:29 +00:00
Max Schaefer
b85f44643a Merge pull request #1049 from asger-semmle/js-type-tracking
JS: Add TypeTracking library
2019-03-07 16:09:19 +00:00
calum
fe4cdfdae0 C#: Minimise the test further. 2019-03-07 15:46:36 +00:00
calum
b358f87570 C#: Improve performance. 2019-03-07 14:56:07 +00:00
Mark Shannon
ef1c08e351 Python: Fix up OsGuard class. 2019-03-07 14:21:03 +00:00
calum
6cf2aee2ce C#: Fix failed CIL test. 2019-03-07 12:58:50 +00:00
Asger F
56977b80a0 JS: update comment 2019-03-07 11:35:41 +00:00
Asger F
d4566af271 JS: update test output 2019-03-07 11:27:07 +00:00
Tom Hvitved
397cc56a6f C#: Cache DataFlow::Node::getLocation() 2019-03-07 12:16:12 +01:00
Tom Hvitved
e6f7632d4c C#: Introduce data flow return nodes
Before this change,

```
flowOutOfCallableStep(CallNode call, ReturnNode ret, OutNode out, CallContext cc)
```

would compute all combinations of call sites `call` and returned expressions `ret`
up front.

Now, we instead introduce explicit return nodes, so each callable has exactly
one return node (as well as one for each `out`/`ref` parameter). There is then
local flow from a returned expression to the relevant return node, and
`flowOutOfCallableStep()` computes combinations of call sites and return nodes.

Not only does this result in better performance, it also makes `flowOutOfCallableStep()`
symmetric to `flowIntoCallableStep()`, where each argument is mapped to a parameter,
and not to all reads of that parameter.
2019-03-07 12:16:06 +01:00
Tom Hvitved
e6630cda6b C#: Use explicit recursion in data flow predicate 2019-03-07 12:16:01 +01:00
Tom Hvitved
738d1117f2 C#: Avoid recomputing flowThroughCallableLibraryOutRef() between queries 2019-03-07 12:15:53 +01:00
Tom Hvitved
397ff84898 C#: Cache Ssa::ExplicitDefinition::getADefinition() 2019-03-07 12:15:44 +01:00
calum
173fbc806c C#: Fix extractor to avoid the recursive eval of TypeArgumentList and update test results. 2019-03-07 09:44:18 +00:00
Raul Garcia
492ec9eb59 Update .gitignore 2019-03-06 17:13:25 -08:00
Raul Garcia
2e0c337a94 2n part of ICryptoTransform.
Detecting potential unsafe usage (object shared across multiple threads) on variables captured by Lambda
2019-03-06 17:12:33 -08:00
Robert Marsh
0efb110512 C++: docs for AllocaInLoop 2019-03-06 09:35:17 -08:00
Mark Shannon
7aef32e63f Python: Add basic taint-tracking configuration. Should help avoid cross-talk between flows and brings the interface closer to that of the other languages. 2019-03-06 15:48:03 +00:00
Calum Grant
c087394917 Merge pull request #1030 from hvitved/csharp/structural-comparison
C#: Speedup structural comparison library
2019-03-06 15:47:44 +00:00
Jonas Jensen
57732ee6f9 Merge pull request #1008 from geoffw0/wprintf
CPP: Clean up and fix FormattingFunction, FormatLiteral
2019-03-06 15:08:29 +00:00
calum
3c6ef8dbf7 C#: Refactor additionalJumpStep for performance. 2019-03-06 15:04:39 +00:00
Taus
2f77cde63f Merge pull request #1042 from markshannon/python-ignore-dead-objects
Python: Ignore dead entities from library trap files.
2019-03-06 15:47:56 +01:00
Asger F
f21871d275 JS: relax instantiation requirement for .prototype field 2019-03-06 14:31:37 +00:00
Asger F
96f1d91150 JS: Add a new test 2019-03-06 14:31:37 +00:00
Tom Hvitved
7825642954 C#: Dispatch.qll performance tweaks 2019-03-06 14:54:36 +01:00
Tom Hvitved
d0c442a950 C#: Use explicit recursion in TupleExpr::isReadAccess() 2019-03-06 14:54:25 +01:00
Max Schaefer
48c0949705 Merge pull request #1036 from asger-semmle/hide-implicit-ssa-defs
JS: Omit uninteresting nodes from path explanations
2019-03-06 13:30:11 +00:00
semmle-qlci
420b14b1e7 Merge pull request #1029 from jcreedcmu/jcreed/surgery
Approved by xiemaisi
2019-03-06 13:27:21 +00:00
Asger F
732ddbcbbd JS: Mark API as experimental 2019-03-06 13:04:34 +00:00
Asger F
81476cff0b JS: Expand test case with call/return matching for backtracking 2019-03-06 12:58:52 +00:00
Asger F
3422fa328d JS: Add test 2019-03-06 12:50:59 +00:00
Asger F
e6a1374218 JS: Make separate type for back-tracking types 2019-03-06 12:50:50 +00:00
Calum Grant
4bdcfec674 Merge pull request #990 from hvitved/csharp/cfg/get-a-thrown-exception
C#: Reduce size of `getAThrownException()`
2019-03-06 12:31:00 +00:00
Asger F
0b2c94684d JS: Add TypeTracker library 2019-03-06 11:52:28 +00:00
Geoffrey White
693937367d Merge pull request #1047 from jbj/dataflow-StmtExpr
C++: Data flow through StmtExpr
2019-03-06 10:33:12 +00:00
Geoffrey White
2bac7f1516 CPP: Deprecate old mechanisms FormattingFunction.isWideCharDefault and FormatLiteral.isWideCharDefault. 2019-03-06 10:23:46 +00:00
Geoffrey White
5b8a6c8335 CPP: Remove no longer used FormatLiteral.getEffectiveCharConversionChar. 2019-03-06 10:23:45 +00:00
Geoffrey White
e1447787e3 CPP: Remove dubious case from FormatLiteral.getMaxConvertedLength. 2019-03-06 10:23:45 +00:00
Geoffrey White
1b71accbfe CPP: Fix a bug in FormattingFunction.getDefaultCharType. 2019-03-06 10:23:45 +00:00
Geoffrey White
e59b3c28e4 CPP: Modernize FormatLiteral.getConversionType1b. 2019-03-06 10:23:45 +00:00
Geoffrey White
ac708a569e CPP: Clean up formatting in FormatLiteral.getEffectiveCharConversionChar somewhat. 2019-03-06 10:23:45 +00:00
Geoffrey White
9f9712047c CPP: Add a few more tests of '%c'. 2019-03-06 10:23:45 +00:00
Jason Reed
8829fde86b JS: Add test for zipslip basename sanitization. 2019-03-06 09:46:41 +00:00
Jason Reed
126e207bd0 JS: Add change note. 2019-03-06 09:46:41 +00:00
Jason Reed
0a91d919b0 JS: Allow path.basename sanitization in zipslip. 2019-03-06 09:46:41 +00:00
Jonas Jensen
80b0765618 C++: Make IR DataFlow dispatch use non-IR version
This removes code duplication and ensures that the IR version also gets
the support for flow across link targets.
2019-03-06 10:08:14 +01:00
Jonas Jensen
10ce13d1e9 C++: Tests for cross-target dispatch 2019-03-06 10:08:13 +01:00
Jonas Jensen
14f1ecb456 C++: Data flow dispatch across link targets 2019-03-06 10:08:13 +01:00
Asger F
50a77ea843 JS: update test expectations 2019-03-06 08:41:03 +00:00
Asger F
ee7461380e JS: Omit uninteresting nodes from path explanations 2019-03-06 08:41:03 +00:00
Jonas Jensen
94699175a4 Merge pull request #1046 from xiemaisi/rc/1.20
Merge rc/1.20 into master
2019-03-06 07:49:15 +00:00
Tom Hvitved
440809623b C#: Fix whitespaces 2019-03-06 08:15:46 +01:00
semmle-qlci
69a048d102 Merge pull request #1045 from jbj/import-additional-ir-TaintTracking
Approved by rdmarsh2
2019-03-05 20:52:29 +00:00
Tom Hvitved
0afb85cb91 C#: Address review comments 2019-03-05 19:27:36 +01:00
calum
58fdcd8703 C#: Regression test case demonstrating extractor error. 2019-03-05 18:24:01 +00:00
Asger F
eb08dcfbd0 Merge pull request #1044 from xiemaisi/js/fix-javadoc
JavaScript: Remove a `@link` in Javadoc.
2019-03-05 18:09:10 +01:00
Jonas Jensen
6ef946c2b0 C++: Make IR TaintTracking available on LGTM
Because this new library is not used in a default query, it needs to be
imported here in order to be available in the LGTM query console.
2019-03-05 18:05:27 +01:00
Max Schaefer
832dff54e8 JavaScript: Remove a @link in Javadoc.
Javadoc claims not to be able to resolve this link, while Eclipse manages to do so without any problems, failing an internal PR check.

It's only in a test, though, so I just removed it.
2019-03-05 17:02:44 +00:00
Mark Shannon
38a5fb715a Python: Avoid cross-talk between unrelated sources in py/stack-trace-exposure query. 2019-03-05 16:52:28 +00:00
Calum Grant
926ee7425a Merge pull request #1014 from hvitved/csharp/same-children-modulo-type-params
C#: Speedup `sameChildrenModuloTypeParameters()`
2019-03-05 16:43:33 +00:00
Calum Grant
b17de116f8 Merge pull request #995 from hvitved/csharp/split-guards-performance
C#: Speedup guards predicates
2019-03-05 16:42:39 +00:00
Geoffrey White
d5627fdc9e Merge pull request #1040 from jbj/dominanceFrontier-iterated
C++: Implement dominanceFrontier with recursion
2019-03-05 16:27:53 +00:00
Mark Shannon
32dabcee1e Python: Ignore dead objects from library trap files. 2019-03-05 15:27:45 +00:00
Jonas Jensen
b3d935063f Merge pull request #815 from geoffw0/keyset
CPP: dbscheme annotations
2019-03-05 14:53:46 +00:00
semmle-qlci
dedefe0f9e Merge pull request #1039 from xiemaisi/js/parallel-extraction-env-vars
Approved by asger-semmle
2019-03-05 14:42:01 +00:00
Tom Hvitved
b2ede5e2a1 Revise logic for reducing size of getAThrownException()
When determining which core library a "tried control flow element" is compiled against,
first look at exceptions caught by the surrounding `try` block, then look at assembly
attributes, and finally choose (randomly) the core library with the highest lexicographic
order.
2019-03-05 14:57:46 +01:00
Jonas Jensen
0a57767cc6 C++: Data flow through StmtExpr 2019-03-05 14:36:40 +01:00
Jonas Jensen
a2de057c26 C++: Test for StmtExpr data flow 2019-03-05 14:34:19 +01:00
Jonas Jensen
9d595aa5ea Merge pull request #1033 from geoffw0/newdelete-perf
CPP: NewDelete.qll performance
2019-03-05 12:52:59 +00:00
semmle-qlci
1327b9f552 Merge pull request #1038 from xiemaisi/js/consolidate-tests
Approved by esben-semmle
2019-03-05 11:02:33 +00:00
Jonas Jensen
d310338c9b C++: Implement dominanceFrontier with recursion
This implementation is borrowed from Java's QL library and offers a
great performance improvement. For example, on Wireshark the performance
goes from

    Dominance::bbDominates#ff ....... 40.3s
    SSAUtils::dominanceFrontier#ff .. 30s

to

    SSAUtils::dominanceFrontier#ff .. 418ms (executed 67 times)

The big performance problem before was the need to materialize
`bbDominates`, which is the reflexive-transitive "basic block dominates"
relation. It had 79 million rows on Wireshark.
2019-03-05 11:54:45 +01:00
Geoffrey White
4e1e3131ac CPP: Revert annotation on 'externalData'. 2019-03-05 10:22:33 +00:00
Max Schaefer
b1033b079f JavaScript: Make configuration of parallel extraction consistent with parallel evaluation.
Just like parallel evaluation, the number of extractor threads is now determined by the `LGTM_THREADS` environment variable, and defaults to one.
2019-03-05 10:06:32 +00:00
Geoffrey White
56fe91d774 CPP: cached -> pragma[nomagic]. 2019-03-05 08:59:16 +00:00
Max Schaefer
29f381eb34 JavaScript: Consolidate DOM tests. 2019-03-05 08:24:39 +00:00
Max Schaefer
3ab465edcc JavaScript: Consolidate ReactJS tests. 2019-03-05 08:24:39 +00:00
Max Schaefer
1c97a57888 JavaScript: Consolidate Promises tests. 2019-03-05 08:24:36 +00:00
Max Schaefer
41349c547f JavaScript: Consolidate stmts tests. 2019-03-05 08:14:47 +00:00
Max Schaefer
eb02e8bd36 JavaScript: Consolidate CallGraphs tests. 2019-03-05 08:14:47 +00:00
Max Schaefer
9178da4f61 JavaScript: Consolidate Expr tests. 2019-03-05 08:14:47 +00:00
Max Schaefer
256f3b013b JavaScript: Consolidate tutorial tests. 2019-03-05 08:14:47 +00:00
Max Schaefer
5a242d4849 JavaScript: Consolidate ModuleImportNode tests.
Note that `CustomImport.ql` is still separate since it customises the standard library and would hence influennce other tests.
2019-03-05 08:14:47 +00:00
Max Schaefer
deff97a9e6 JavaScript: Consolidate PropWrite tests. 2019-03-05 08:14:39 +00:00
Max Schaefer
0b5599d009 JavaScript: Consolidate connect, koa, hapi and restify tests. 2019-03-05 08:04:01 +00:00
Max Schaefer
89ad16be4b JavaScript: Consolidate Functions tests. 2019-03-05 08:04:01 +00:00
Max Schaefer
40502c68a5 JavaScript: Consolidate Classes tests. 2019-03-05 08:04:01 +00:00
Max Schaefer
3b89c70da8 JavaScript: Consolidate Modules tests. 2019-03-05 08:04:01 +00:00
Max Schaefer
f3eca887a9 JavaScript: Consolidate JSDoc tests. 2019-03-05 08:04:01 +00:00
Max Schaefer
65ece6e895 JavaScript: Consolidate TypeAnnotations tests. 2019-03-05 08:04:01 +00:00
Max Schaefer
716e741371 JavaScript: Consolidate NodeJSLib tests. 2019-03-05 08:04:01 +00:00
yh-semmle
4908ccc493 Java: update frameworks list for 1.20 release 2019-03-04 20:31:34 -05:00
semmle-qlci
9a2a328243 Merge pull request #1025 from xiemaisi/js/fix-exports-assign
Approved by asger-semmle
2019-03-04 21:25:56 +00:00
Max Schaefer
7f5e2630a1 Merge pull request #1032 from xiemaisi/master-for-merge
Merge master into rc/1.20
2019-03-04 21:23:51 +00:00
Tom Hvitved
1434b10b7a C#: Speedup structural comparison library 2019-03-04 21:23:34 +01:00
semmle-qlci
245b47add7 Merge pull request #1017 from hvitved/csharp/get-label-performance
Approved by calumgrant
2019-03-04 20:22:38 +00:00
Tom Hvitved
8ec0573915 C#: Speedup sameChildrenModuloTypeParameters() 2019-03-04 21:06:13 +01:00
semmle-qlci
08e7499a2f Merge pull request #1011 from hvitved/csharp/implements-performance
Approved by calumgrant
2019-03-04 20:05:04 +00:00
Geoffrey White
eb4efc4745 Merge pull request #1023 from jbj/gets-qualified
C++: Use getQualifiedName() = "gets", not hasName
2019-03-04 18:10:15 +00:00
Kevin Backhouse
8cee18b479 Add assignments to the set of analyzable expressions to simplify overflow detection. 2019-03-04 17:07:11 +00:00
calum
e8bb7f2139 C#: Fix for performance. 2019-03-04 16:54:59 +00:00
Geoffrey White
a9ce2f7a62 CPP: Simplify out some old optimizations (that make little difference now). 2019-03-04 13:13:04 +00:00
Geoffrey White
a3f452b8ae Merge pull request #1024 from jbj/command-line-injection-precision
C++: Set cpp/command-line-injection precision=low
2019-03-04 13:08:38 +00:00
Geoffrey White
df73bb3468 CPP: Fix performance issue. Also has a small positive effect on correctness. 2019-03-04 12:47:55 +00:00
Geoffrey White
f0085ed25a CPP: Additional test cases. 2019-03-04 12:45:05 +00:00
Tom Hvitved
4054dc43e2 C#: Speedup Element::getLabel() 2019-03-04 13:21:10 +01:00
Tom Hvitved
c70a0a646d C#: Add test for getLabel() 2019-03-04 13:21:10 +01:00
Tom Hvitved
6135b5b7eb C#: Updated expected test output 2019-03-04 13:19:00 +01:00
Tom Hvitved
2e1ba7b1f9 C#: Speedup Implements.qll 2019-03-04 13:19:00 +01:00
Mark Shannon
1b35a4eb0f Merge pull request #1026 from taus-semmle/python-unsafe-mktemp-add-missing-kind
Python: Add missing `@kind` for `py/insecure-temporary-file`.
2019-03-04 11:55:45 +00:00
semmle-qlci
f13eb18493 Merge pull request #1018 from xiemaisi/js/consolidate-tests
Approved by esben-semmle
2019-03-04 10:59:51 +00:00
Taus Brock-Nannestad
63893fe52c Python: Add missing @kind for py/insecure-temporary-file. 2019-03-04 11:20:39 +01:00
calum
f7b4985ed1 C#: Fix merge conflict. 2019-03-04 09:54:48 +00:00
calum
741666d561 C#: Address review comment. 2019-03-04 09:54:40 +00:00
calum
d77b60bba8 C#: Add preservesValue to NonLocalJumpNode.getAJumpSuccessor. Allow DataFlow::Configuration::isAdditionalFlowStep to jump between callables. 2019-03-04 09:54:28 +00:00
calum
7343e70151 C#: Fix tests 2019-03-04 09:54:12 +00:00
calum
57ff775c08 C#: Change notes. 2019-03-04 09:54:02 +00:00
calum
74b30d6071 C#: Model EntityFramework 2019-03-04 09:53:49 +00:00
Max Schaefer
3cabc12be3 JavaScript: Teach InvalidExport to never flag module.exports = exports = ... and similar.
This was previously flagged if `exports` wasn't used any further. While it's true that the assignment to `exports` is redundant in this case, the assignment is also flagged by DeadStorOfLocal, so there is no point in InvalidExport flagging it as well.
2019-03-04 09:53:37 +00:00
calum
7010ca8cf3 C#: Fix whitespace in test. 2019-03-04 09:53:37 +00:00
Jonas Jensen
4f9ffb38e6 C++: Set cpp/command-line-injection precision=low
This query is only appropriate for setuid programs. Since such programs
are at most 0.1% of all code we analyse, I would say this query has a
precision of at most 0.1%.
2019-03-04 09:51:33 +01:00
Jonas Jensen
c49c23068a Merge pull request #923 from geoffw0/potentialbufferoverflow
CPP: Deprecate PotentialBufferOverflow.ql
2019-03-04 08:11:27 +00:00
Jonas Jensen
0ed1618824 C++: Use getQualifiedName() = "gets", not hasName
This fixes false positives on
https://lgtm.com/projects/g/brandonpelfrey/Construct caused by a member
function named `gets` -- probably short for "get s".
2019-03-04 09:01:20 +01:00
Robert Marsh
b8f8ed55e6 Merge pull request #1000 from jbj/dataflow-defbyref
C++: Support definition by reference in data flow library
2019-03-01 13:54:37 -08:00
semmle-qlci
4c3ecf0f76 Merge pull request #989 from asger-semmle/class-node-get-this-access
Approved by xiemaisi
2019-03-01 19:40:31 +00:00
Pavel Avgustinov
c26b655956 Merge pull request #1022 from yh-semmle/java/dead-code-override
Java: respect override annotations in `java/unused-parameter`
2019-03-01 19:11:46 +00:00
Geoffrey White
66013272da Merge pull request #894 from jbj/ir-RedundantNullCheckSimple
C++: IR query for redundant null check
2019-03-01 15:34:18 +00:00
Max Schaefer
8e340922cb JavaScript: Simplify some imports. 2019-03-01 14:44:58 +00:00
Nick Rolfe
e6ddf7f48a Merge pull request #1012 from ian-semmle/constexpr
C++: Add Variable.isConstexpr()
2019-03-01 14:42:35 +00:00
Max Schaefer
75c76619d8 JavaScript: Autoformat rearranged tests. 2019-03-01 14:42:01 +00:00
Taus
a30b456e19 Merge pull request #1020 from markshannon/python-taint-tracking-guard
Python: Add taint tracking guard for truthiness.
2019-03-01 15:23:05 +01:00
Ian Lynagh
af397d3546 Changenotes: Fix copy/paste-o. 2019-03-01 13:30:05 +00:00
Mark Shannon
94190e76aa Python: Update py/modification-of-default-value to account for truthiness of default value. 2019-03-01 12:01:39 +00:00
Mark Shannon
ebd9bc3cb5 Python: Improve taint tracking to account for truthiness of the taint kind. 2019-03-01 11:24:07 +00:00
Mark Shannon
8a16164270 Merge pull request #878 from taus-semmle/python-mutable-default-with-flow
Python: Make "Modification of parameter with default" flow-sensitive.
2019-03-01 11:22:21 +00:00
Tom Hvitved
51e5a301cd Merge pull request #956 from raulgarciamsft/users/raulga/ICryptoTransform
Detect usage of ICryptoTransform that would be thread-unsafe
2019-03-01 11:49:27 +01:00
Max Schaefer
83e0f3bc8d Merge pull request #946 from esben-semmle/js/captured-nodes-query-and-type-inference-1
JS: Captured Nodes, type inference + a query
2019-03-01 10:48:52 +00:00
semmle-qlci
6cafe222c4 Merge pull request #1013 from asger-semmle/closure-string-ops
Approved by esben-semmle
2019-03-01 10:31:27 +00:00
Max Schaefer
a6f3305edc Merge pull request #1006 from asger-semmle/express-end
JS: Treat res.end() as alias for res.send() in Express
2019-03-01 10:30:06 +00:00
Taus Brock-Nannestad
64e6974aac Merge branch 'master' into python-mutable-default-with-flow 2019-03-01 11:10:56 +01:00
Taus Brock-Nannestad
91cfc9bd4c Change kind to path-problem. 2019-03-01 11:06:48 +01:00
Max Schaefer
d4d9d61216 JavaScript: Consolidate Express tests.
Instead of having many small independent tests, we now just have a single test that pulls in all the individual tests and runs them together.

Concretely, each `.ql` file has been turned into a `.qll` file with a query predicate corresponding to the original `select` clause and named after the original `.ql` file, plus a prefix `test_`.

The newly added `tests.ql` imports all these `.qll`s.

The individual `.expected` files have been concatenated together into `tests.expected`, each prefixed with the name of the corresponding query predicate. (This is the format that qltest produces for tests with multiple query predicates.)
2019-03-01 09:39:31 +00:00
Max Schaefer
b265ff7cdf JavaScript: Delete stray .expected file. 2019-03-01 09:39:31 +00:00
semmle-qlci
bc8906ba82 Merge pull request #1009 from xiemaisi/js/reformat-extractor
Approved by asger-semmle
2019-03-01 08:20:59 +00:00
Max Schaefer
8dcd8715b9 Merge pull request #889 from jcreedcmu/jcreed/tarslip
JavaScript: Add new query for ZipSlip (CWE-022).
2019-03-01 08:16:35 +00:00
Jason Reed
86bbb5fb18 JS: Add ZipSlip query to security suite 2019-02-28 15:46:34 -05:00
Jason Reed
c1b218a5ff JS: Documentation fixes 2019-02-28 15:46:19 -05:00
Jason Reed
c5e57dacf8 JS: Actually use fileName in examples 2019-02-28 15:46:14 -05:00
Jason Reed
674d2790b4 JS: Address review comments 2019-02-28 15:46:07 -05:00
Jason Reed
caebdd2f68 JS: Fix incorrect sample link 2019-02-28 15:46:00 -05:00
Jason Reed
2fc2a393b7 JS: Address review comments 2019-02-28 15:45:52 -05:00
Jason Reed
09b9a57783 JS: More efficient reasoning through pipe 2019-02-28 15:45:38 -05:00
Jason Reed
b0636dd410 JS: Better local flow through .pipe chaining 2019-02-28 15:45:33 -05:00
Jason Reed
23d37c7167 JS: Unbreak TaintedPath 2019-02-28 15:45:26 -05:00
Jason Reed
32d48ba98b JS: Run auto-formatter 2019-02-28 15:45:20 -05:00
Jason Reed
abd2644af7 JS: Address review comments 2019-02-28 15:45:13 -05:00
Jason Reed
baa4f08259 JS: Add new query for ZipSlip (CWE-022) 2019-02-28 15:45:08 -05:00
Geoffrey White
28304e4fde Merge pull request #1005 from jbj/dataflow-Node-cached
C++: Cache TNode and localFlowStep
2019-02-28 17:43:14 +00:00
Taus
f91e06b5a8 Merge pull request #1002 from markshannon/python-cherrypy
Python: CherryPy support
2019-02-28 18:12:20 +01:00
Asger F
8dfec58428 JS: Update test 2019-02-28 16:49:35 +00:00
Asger F
47b5f34870 JS: shift line numbers in test output 2019-02-28 16:48:47 +00:00
Asger F
2bfb015218 JS: Add closure string ops 2019-02-28 16:47:53 +00:00
Asger F
2dc7f32ca3 JS: add Express to list of updated frameworks 2019-02-28 15:28:42 +00:00
Ian Lynagh
a709a2d0f3 C++: Add Variable.isConstexpr() 2019-02-28 15:26:15 +00:00
Mark Shannon
af2680729f Python: Fix qldoc. 2019-02-28 15:25:43 +00:00
Mark Shannon
faf9b4886d Python: Add change note for CherryPy support. 2019-02-28 15:25:41 +00:00
Mark Shannon
2df718d632 Python: Make bottle response logic consistent with other frameworks. 2019-02-28 15:25:15 +00:00
Mark Shannon
91a1cc9f0b Python: Add cherrypy handler function return values as taint sinks. 2019-02-28 15:25:13 +00:00
Mark Shannon
6c82be8bda Python: CherryPy web framework support -- requests. 2019-02-28 15:24:58 +00:00
Mark Shannon
e933ba28d5 Python: Add basic support for stdlib cookie objects. 2019-02-28 15:24:36 +00:00
Geoffrey White
832a436a49 Revert "C++: Revert doc-related changes to dbscheme"
This reverts commit e81d197ebd.
2019-02-28 14:50:49 +00:00
Geoffrey White
e55dc43111 CPP: Consistency changes suggested by Dave. 2019-02-28 14:50:49 +00:00
Geoffrey White
b1bf1b8f1c CPP: More annotations. 2019-02-28 14:50:49 +00:00
Geoffrey White
dd271f1c93 CPP: Fix type 'diagnosstic'. 2019-02-28 14:50:49 +00:00
Geoffrey White
0c84e06234 CPP: Fix typo. 2019-02-28 14:50:49 +00:00
Geoffrey White
6398298bea CPP: Add keyset annotations to the CPP dbscheme. 2019-02-28 14:50:49 +00:00
Taus
b8b4216352 Merge pull request #979 from markshannon/python-falcon
Python: Add support for falcon web API framework.
2019-02-28 15:47:35 +01:00
Max Schaefer
c4fa29dd0f JavaScript: Autoformat extractor sources using google-java-format.
No special settings; command:

  find javascript/extractor/src -name "*.java" | xargs java -jar /path/to/google-java-format-1.7-all-deps.jar --replace
2019-02-28 14:30:06 +00:00
Asger F
5478e0da62 Merge pull request #998 from xiemaisi/js/autobuild-file-types
JavaScript: Make file types customisable in AutoBuild.
2019-02-28 15:26:35 +01:00
Max Schaefer
2ecabad553 Merge pull request #1004 from asger-semmle/suffix-check-bug
JS: Recognize '+' in suffix check
2019-02-28 14:23:26 +00:00
Jonas Jensen
40f3fecb00 C++: Simplify stubs in DataFlowDispatch.qll
Some of these stubs were quite slow to evaluate. It's possible they
could be optimised, but it seems pointless as long as we don't have
call-context-sensitive virtual dispatch in the C++ library.
2019-02-28 14:38:29 +01:00
Mark Shannon
1444b3976c Python: Add wsgi.environment as a kind of taint, and add suuport for env attribute of falcon request objects. 2019-02-28 13:06:11 +00:00
Asger F
03ef167c56 JS: Treat res.end() as alias for res.send() in Express 2019-02-28 12:37:11 +00:00
semmle-qlci
edba24129d Merge pull request #1003 from xiemaisi/js/fix-test
Approved by esben-semmle
2019-02-28 12:05:44 +00:00
Jonas Jensen
264301be66 C++: Cache TNode and localFlowStep
These two elements weren't cached, which meant that local data flow was
recalculated in every query that used data flow. They are also cached in
the Java version of `DataFlowUtil.qll`.
2019-02-28 11:41:51 +01:00
Asger F
8e8085ea1f JS: add test 2019-02-28 10:09:36 +00:00
Max Schaefer
c8a37297f3 Merge pull request #997 from asger-semmle/closure-promise
JS: model of closure Promises
2019-02-28 10:05:12 +00:00
Taus
a83f33be33 Merge pull request #1001 from markshannon/python-delete-internal-tests
Python delete extractor tests. Duplicates of internal tests.
2019-02-28 11:04:52 +01:00
Max Schaefer
1b5887014b Merge pull request #988 from asger-semmle/spread-taint-step
JS: add taint step through object/array spread operators
2019-02-28 09:58:23 +00:00
Calum Grant
c945b7793c Merge pull request #944 from hvitved/csharp/cfg/accessor-call
C#: Improve CFG for assignments
2019-02-28 09:34:56 +00:00
Jonas Jensen
7afb4898e6 C++: Change note for def-by-ref data flow 2019-02-28 09:39:51 +01:00
Jonas Jensen
8e6daafd7c C++: Add DefinitionByReferenceNode.getParameter
This commits also adds a test that uses `getParameter`. The new tests
demonstrate that support for array-to-pointer decay works, but we get
data flow to the array rather than its contents.
2019-02-28 09:39:51 +01:00
Jonas Jensen
2bc0a8d6fb C++: Remove getVariableAccess from def-by-ref node
This accessor may not be forward-compatible with an IR-based version,
and it's unclear whether it has any use. The `VariableAccess` remains in
the `TDefinitionByReferenceNode` constructor since it's used to
implement `getType`.
2019-02-28 09:38:40 +01:00
Max Schaefer
02dff4e9d9 JavaScript: Update expected test output. 2019-02-28 08:21:06 +00:00
Jonas Jensen
7ff732d962 C++: Use OO dispatch for getType and getFunction 2019-02-28 08:23:24 +01:00
Raul Garcia
9eca21cb5a Update .gitignore 2019-02-27 18:43:51 -08:00
Raul Garcia
e24ca8ec40 Update .gitignore 2019-02-27 18:43:33 -08:00
Raul Garcia
1ae18974d8 Fixing bugs found during Code Review. 2019-02-27 18:41:23 -08:00
semmle-qlci
6602b4dbda Merge pull request #992 from xiemaisi/js/socket.io
Approved by asger-semmle
2019-02-27 18:43:40 +00:00
Tom Hvitved
4cbbe37b1e C#: Updated expected test output 2019-02-27 19:25:14 +01:00
Mark Shannon
9170d85155 Python: Fix falcon sources to only be source if a route is attached. 2019-02-27 16:42:31 +00:00
semmle-qlci
8e485b7972 Merge pull request #996 from xiemaisi/js/first-array-elt-in
Approved by esben-semmle
2019-02-27 16:19:21 +00:00
Mark Shannon
d605dfd542 Python delete extractor tests. Duplicates of internal tests. 2019-02-27 15:35:52 +00:00
Mark Shannon
f7d7b8eef2 Merge pull request #785 from taus-semmle/python-unsafe-use-of-mktemp
Python: Add query for unsafe use of `tempfile.mktemp`.
2019-02-27 15:01:06 +00:00
Jonas Jensen
972d00822c C++: Generalize std::move data flow 2019-02-27 15:53:00 +01:00
Jonas Jensen
80183464d9 C++: Define DefinitionByReferenceNode
This enables data flow through `memcpy` and similar functions modeled in
`semmle.code.cpp.model`.
2019-02-27 15:53:00 +01:00
Asger F
9497199cbd JS: add localFieldStep 2019-02-27 14:20:47 +00:00
Asger F
b6648def19 JS: Add ClassNode.getAReceiverNode 2019-02-27 14:20:47 +00:00
Jonas Jensen
5647a1a658 C++: BlockVar value stops at def by ref (partial) 2019-02-27 15:05:53 +01:00
Geoffrey White
25a5ff5e55 CPP: Similarly update other @deprecated messages. 2019-02-27 13:20:24 +00:00
Geoffrey White
f0356bb83b CPP: Reformat @deprecated message. 2019-02-27 13:18:29 +00:00
Geoffrey White
74f7379ab9 CPP: Change note. 2019-02-27 13:09:10 +00:00
Geoffrey White
3f2e902912 CPP: Remove it from the security dashboard (OverrunWrite.ql is already on there). 2019-02-27 13:09:09 +00:00
Geoffrey White
45315cda90 CPP: Deprecate PotentialBufferOverflow.ql. 2019-02-27 13:09:09 +00:00
Geoffrey White
8a5bc24b36 CPP: Replace PotentialBufferOverflow with OverrunWrite in the test. 2019-02-27 13:09:09 +00:00
Geoffrey White
7194121eae CPP: Expand the test cases covering PotentialBufferOverflow.ql. 2019-02-27 13:09:09 +00:00
Tom Hvitved
996b0efa47 C#: Address review comments 2019-02-27 13:49:15 +01:00
Tom Hvitved
7027cd36c6 C#: Speedup isGuardedByNode() 2019-02-27 13:29:14 +01:00
Tom Hvitved
72384e57e1 C#: Speedup Assertion::strictlyDominates() 2019-02-27 13:29:14 +01:00
Tom Hvitved
baa596ce6c C#: Speedup ControlFlowElement::controlsBlock() 2019-02-27 13:29:14 +01:00
Jonas Jensen
20f3df0d09 C++: Add tests to demo lack dataflow by reference 2019-02-27 13:19:16 +01:00
Max Schaefer
9d77619afc JavaScript: Make file types customisable in AutoBuild.
Every once in a while we encounter projects using some custom file extension for files that we could in principle extract, but since the extractor doesn't know about the extension the files are skipped.

To handle this, the legacy extractor has a `--file-type` option that one can use to specify a file type to use for all files in that particular extraction. So far, `AutoBuild` has nothing of the sort.

This PR proposes to introduce an environment variable `LGTM_INDEX_FILETYPES` to allow a similar customisation. In the fullness of time, this variable would be set through `lgtm.yml` in the usual way, but for now it is undocumented and for internal use only.

Specifically, `LGTM_INDEX_FILETYPES` is a newline-separated list of ".extension:filetype" pairs, specifying that files with the given `.extension` should be extracted as type `filetype`, where
`filetype` is one of `js`, `html`, `json`, `typescript` or `yaml`.

For example, `.jsm:js` causes all `.jsm` files to be extracted as JavaScript.

This can also be used to override default file types: for example, by specifying `.js:typescript` all JavaScript files will be extracted as TypeScript.
2019-02-27 12:02:01 +00:00
Asger F
3d400cc57f JS: basic model of closure Promises 2019-02-27 11:58:51 +00:00
Max Schaefer
2ed37903d8 JavaScript: Include list of relevant environment variables in Javadoc for AutoBuild. 2019-02-27 11:54:59 +00:00
Mark Shannon
9e268d77d0 Python: Add responses to Falcon framework support. 2019-02-27 09:56:18 +00:00
Mark Shannon
6a48420191 Python: Basic support for falcon framework; routing and requests. 2019-02-27 09:55:52 +00:00
semmle-qlci
999e0c8b95 Merge pull request #947 from asger-semmle/string-ops-concat
Approved by xiemaisi
2019-02-27 09:54:46 +00:00
Mark Shannon
742c1d0fa7 Python: Add test skeleton for falcon web framework. 2019-02-27 09:53:20 +00:00
Max Schaefer
37a3085466 Merge pull request #993 from asger-semmle/getacallee
JS: document new behavior of overriding InvokeNode.getACallee()
2019-02-27 09:00:59 +00:00
Max Schaefer
6ecdb0edd5 JavaScript: Allow first expression in array literal to be an in expression. 2019-02-27 08:58:28 +00:00
Max Schaefer
0648d7aa09 JavaScript: Sharpen result type of getAReceivedItem. 2019-02-27 08:51:43 +00:00
semmle-qlci
d857f52c7d Merge pull request #991 from jbj/error-function-returns
Approved by geoffw0
2019-02-27 08:01:39 +00:00
Raul Garcia
fb5f220bb6 Merge branch 'users/raulga/ICryptoTransform' of https://github.com/raulgarciamsft/ql into users/raulga/ICryptoTransform 2019-02-26 16:22:54 -08:00
Raul Garcia
f8ae56a27c Improving documentation 2019-02-26 16:22:39 -08:00
Taus
dcaf0f8ba8 Merge pull request #978 from markshannon/python-turbogears
Python: Add support for turbogears; requests and responses.
2019-02-26 21:46:01 +01:00
Dave Bartolomeo
84c7f195d6 Merge pull request #994 from geoffw0/msalloc
CPP: Add lots more allocation functions to Alloc.qll
2019-02-26 11:59:45 -08:00
Mark Shannon
a480da6ed5 Python: Generalize turbogear response sinks to allow for internally sourced strings. 2019-02-26 18:31:06 +00:00
Calum Grant
5c2804d3ac Merge pull request #968 from hvitved/csharp/dataflow-performance
C#: Improve join orders in `DataFlow` module
2019-02-26 17:34:16 +00:00
Geoffrey White
c637bc5fcc CPP: Change note. 2019-02-26 17:17:16 +00:00
Geoffrey White
e32042d69c CPP: Add support for Microsoft functions in Alloc.qll. 2019-02-26 17:11:37 +00:00
Max Schaefer
cd9ccd4c8d Merge pull request #983 from asger-semmle/closure-global-ref
JS: add closure library in globalObjectRef
2019-02-26 16:55:58 +00:00
Max Schaefer
db5fbe29a3 Merge pull request #941 from esben-semmle/js/vue-support-2
JS: Vue security improvements
2019-02-26 16:49:38 +00:00
Mark Shannon
2995b023fa Python: Fix handling of turbogears' 'expose' decorator. 2019-02-26 16:40:21 +00:00
Asger F
eaf3f52372 JS: document new behavior of overriding InvokeNode.getACallee() 2019-02-26 16:09:19 +00:00
Max Schaefer
cc6ca8bc62 JavaScript: Add change note. 2019-02-26 15:53:29 +00:00
Max Schaefer
739705865b JavaScript: Add basic model of socket.io. 2019-02-26 15:53:29 +00:00
Jonas Jensen
07bd85e9fa C++: Function error doesn't always exit
The configuration in `DefaultOptions.qll` assumed that a call to any
top-level function named `error` would exit the program. This is not
true.

The assumption was probably about `error(3)`, which is a GNU extension.
It only exits if its first argument it not 0. Furthermore, projects such
as openssh may define their own function named `error` with different
behaviour. Because the GNU `error` function is non-standard, it's
perfectly fine to shadow it with a project-specific definition.

This change removes two FPs from `PointlessComparison.qll` on
https://github.com/openssh/openssh-portable.
2019-02-26 16:31:34 +01:00
Taus Brock-Nannestad
e47b391329 Fix interpolation. 2019-02-26 16:27:04 +01:00
Taus Brock-Nannestad
7daaf77183 Make query alert refer to AST nodes rather than CFG nodes. 2019-02-26 15:56:37 +01:00
Tom Hvitved
8abf76b618 C#: Reduce size of getAThrownException()
In the precense of multiple core libraries, `getAThrownException()` would return
multiple copies of the same exception, say `System.OverflowException`, one for each
core library. With this change we try to identify which core library a given control
flow element was compiled against, and only return the corresponding version.
2019-02-26 15:11:45 +01:00
semmle-qlci
86e646beb4 Merge pull request #975 from asger-semmle/global-closure-dataflow
Approved by esben-semmle
2019-02-26 13:57:39 +00:00
Taus Brock-Nannestad
504cb648d1 Change query description. 2019-02-26 13:26:20 +01:00
Taus Brock-Nannestad
8d774cd354 Merge branch 'master' into python-unsafe-use-of-mktemp 2019-02-26 13:23:38 +01:00
Asger F
29d2d620e4 JS: add taint step through object/array spread operators 2019-02-26 11:43:59 +00:00
Taus
9d7877907b Merge pull request #964 from markshannon/python-locations-for-packages
Python: Make sure packages have locations.
2019-02-26 11:55:27 +01:00
Mark Shannon
3854050d57 Python: Update documentation for new web frameworks. 2019-02-26 10:17:29 +00:00
Mark Shannon
7d0943f30d Python: Add tests for turbogears. 2019-02-26 10:15:37 +00:00
Mark Shannon
26c5ebde54 Python: Basic support for TurboGears: requests and responses. 2019-02-26 10:15:36 +00:00
Esben Sparre Andreasen
f9111f68e9 Update javascript/ql/src/semmle/javascript/dataflow/TypeInference.qll
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2019-02-26 11:11:44 +01:00
Asger F
6b9157540b JS: mark globalFlowPred as internal 2019-02-26 09:56:22 +00:00
semmle-qlci
681ff0f39c Merge pull request #977 from asger-semmle/extend-test-version
Approved by xiemaisi
2019-02-26 09:55:41 +00:00
Jonas Jensen
f12dfda28f Merge pull request #985 from rdmarsh2/rdmarsh/ir-call-side-effect
C++: fix PrimaryInstruction for call side effects
2019-02-26 10:36:18 +01:00
semmle-qlci
74a4103857 Merge pull request #976 from asger-semmle/closure-import-deep
Approved by esben-semmle
2019-02-26 09:34:04 +00:00
semmle-qlci
00d490e84d Merge pull request #945 from asger-semmle/extensible-module-import
Approved by xiemaisi
2019-02-26 09:26:28 +00:00
Esben Sparre Andreasen
9511bdf6ae JS: address review comment 2019-02-26 10:07:00 +01:00
Max Schaefer
c2a5350bf2 Merge pull request #982 from asger-semmle/closure-string-lib
JS: model string functions from closure library
2019-02-26 08:26:14 +00:00
Nick Rolfe
53de2d8d3e Merge pull request #830 from ian-semmle/constexpr
C++: Add Function.{isDeclaredConstexpr,isConstexpr}() predicates
2019-02-25 22:11:24 +00:00
Robert Marsh
af490a9b3e C++: fix PrimaryInstruction for call side effects 2019-02-25 11:41:40 -08:00
Asger F
93440014a0 JS: only propagate through first argument of truncate() 2019-02-25 17:11:55 +00:00
Asger F
d45f670646 JS: remove duplicate modelling of urlDecode/urlEncode 2019-02-25 17:04:56 +00:00
Asger F
29de1411b7 JS: remove restriction on truncate calls 2019-02-25 17:00:47 +00:00
Asger F
50e8f83ad5 JS: use globalVarRef/SourceNode instead 2019-02-25 16:54:45 +00:00
Asger F
8354909d46 JS: add closure library in globalObjectRef 2019-02-25 16:45:47 +00:00
Asger F
d70d0e21cc JS: add format function 2019-02-25 16:30:44 +00:00
Asger F
fab0afd755 JS: model string functions from closure library 2019-02-25 16:08:47 +00:00
Max Schaefer
bea75e2d1c Merge pull request #981 from esben-semmle/js/fix-docstring
JS: fix docstring: s/node1/pred + s/node2/succ
2019-02-25 16:04:15 +00:00
Ian Lynagh
ad126b93cf C++: Remove a use of deprecated Function.getFullSignature() 2019-02-25 15:51:39 +00:00
Esben Sparre Andreasen
8e01ccd892 JS: fix docstring: s/node1/pred + s/node2/succ 2019-02-25 16:51:30 +01:00
Mark Shannon
c48ab48dbc Merge pull request #971 from felicity-semmle/ql/SD-3009-add-files
Move support information to QL repository for easier maintenance
2019-02-25 15:36:18 +00:00
semmle-qlci
58cc8d0ecc Merge pull request #936 from xiemaisi/js/revive-electron-support
Approved by esben-semmle
2019-02-25 15:23:20 +00:00
Esben Sparre Andreasen
ab1b1c1431 JS: update docstring 2019-02-25 16:11:35 +01:00
Esben Sparre Andreasen
4dc147d506 JS: rename CapturedSource -> LocalObject (files) 2019-02-25 16:09:07 +01:00
Asger F
050626aca0 JS: remove audit alerts from package.json 2019-02-25 15:04:47 +00:00
Esben Sparre Andreasen
66367987af JS: rename CapturedSource -> LocalObject 2019-02-25 16:04:37 +01:00
Esben Sparre Andreasen
65fb1423b7 JS: format test case (update expected output) 2019-02-25 15:55:44 +01:00
Esben Sparre Andreasen
1150f4c02b JS: add documentation to test case 2019-02-25 15:52:23 +01:00
Esben Sparre Andreasen
0d94fe3f54 JS: analyze assignments in with correctly 2019-02-25 15:32:17 +01:00
Esben Sparre Andreasen
047b69a4c2 JS: address review comments 2019-02-25 15:19:00 +01:00
Esben Sparre Andreasen
46a1c75549 Merge pull request #973 from xiemaisi/js/remove-package-json
JavaScript: Delete an unused `package.json` in a test.
2019-02-25 14:05:22 +01:00
Ian Lynagh
f02a4ce63e C++: Accept test changes following new *constexpr specifiers 2019-02-25 12:48:48 +00:00
Ian Lynagh
133e2d04be C++: Add a changenote for Function.{isDeclaredConstexpr,isConstexpr}() 2019-02-25 12:48:48 +00:00
Ian Lynagh
4bd03d52f1 C++: Add constexpr support for functions 2019-02-25 12:48:48 +00:00
Ian Lynagh
5db38ef14b C++: Add a test for constexpr functions 2019-02-25 12:48:48 +00:00
Asger F
7d14429dce JS: handle deeper access paths in Closure::moduleImport 2019-02-25 12:31:18 +00:00
Asger F
2f6496f6bd JS: add test with undeclared nested access 2019-02-25 12:27:36 +00:00
Jonas Jensen
a9f8a53dac Merge pull request #972 from geoffw0/rtl
CPP: Add support for the Rtl* functions in BufferAccess.ql
2019-02-25 13:07:05 +01:00
semmle-qlci
c31ccbc114 Merge pull request #925 from asger-semmle/closure-reorg
Approved by xiemaisi
2019-02-25 12:02:00 +00:00
Geoffrey White
2ad0ac2c12 Merge pull request #974 from jbj/alloca-delete-precision
C++: Remove @precision of AllocaInLoop.ql
2019-02-25 11:48:56 +00:00
Esben Sparre Andreasen
b0358d7d11 JS: autoformat 2019-02-25 12:44:55 +01:00
Asger F
707886f259 JS: minor qldoc fixes 2019-02-25 11:31:09 +00:00
Asger F
b31d7d1f5f JS: add test case 2019-02-25 11:31:09 +00:00
Asger F
eab034ccfd JS: add ModuleImportNode::Range 2019-02-25 11:31:08 +00:00
Asger F
e9bc728919 JS: fixes in qldoc 2019-02-25 11:26:12 +00:00
Esben Sparre Andreasen
97edfc5524 JS: address review comments 2019-02-25 12:17:56 +01:00
Esben Sparre Andreasen
80a716f3b3 JS: fixup visibility of DataFlow::HtmlAttributeNode 2019-02-25 12:17:56 +01:00
Esben Sparre Andreasen
4ce7ec1661 JS: add XSS vector for Vue's v-html 2019-02-25 12:17:56 +01:00
Esben Sparre Andreasen
4c5e48fbbc JS: introduce DataFlow::HtmlAttributeNode 2019-02-25 12:17:56 +01:00
Esben Sparre Andreasen
da1ffcfd1b JS: introduce Vue Template Element 2019-02-25 12:17:33 +01:00
Esben Sparre Andreasen
9f4f945975 JS: introduce Vue::InstanceHeapStep 2019-02-25 12:17:33 +01:00
Jonas Jensen
2181bca389 C++: Remove @precision of AllocaInLoop.ql
A PR check was failing because this query was enabled on LGTM but had no
qhelp. I'm removing the `@precision` for now to take it off LGTM, and
then we can add it back when it has qhelp, tests, and change note.
2019-02-25 11:45:34 +01:00
Asger F
614ba92fac JS: add ClassContainsTwo.expected 2019-02-25 09:51:40 +00:00
Asger F
86153be64b JS: fix qldoc 2019-02-25 09:51:31 +00:00
semmle-qlci
014d4b9ed0 Merge pull request #934 from asger-semmle/module-import
Approved by xiemaisi
2019-02-25 09:46:52 +00:00
Esben Sparre Andreasen
c34fdda42a Merge pull request #937 from xiemaisi/js/e4x
JavaScript: Add support for E4X.
2019-02-25 10:22:30 +01:00
Max Schaefer
d4dbe3bfb6 JavaScript: Back out parsing of qualified XML identifiers.
Their syntax conflicts with the proposed function-bind operator, which is more important to support.
2019-02-24 21:30:59 +00:00
Max Schaefer
6a90459d6a JavaScript: Add upgrade script. 2019-02-24 21:06:29 +00:00
Max Schaefer
7491b5ea53 JavaScript: Add a comment. 2019-02-24 21:02:12 +00:00
Max Schaefer
f726125b71 JavaScript: Restrict E4X processing instruction disambiguation to the <?xml ...?> case. 2019-02-24 20:56:43 +00:00
Max Schaefer
5a775d9cc7 JavaScript: Add change note. 2019-02-24 20:45:41 +00:00
Max Schaefer
cc216ad250 JavaScript: Buffer recoverable syntax errors during speculative parsing.
Analogous to how we buffer tokens, we need to delay reporting these errors until we have committed to a parse.
2019-02-24 20:45:41 +00:00
Max Schaefer
c7e428eb27 JavaScript: Handle E4X/Flow lexical ambiguity. 2019-02-24 20:45:41 +00:00
Max Schaefer
d6deefed86 JavaScript: Accept CDATA in E4X content. 2019-02-24 20:45:41 +00:00
Max Schaefer
81b86d9a0f JavaScript: Skip XML processing instructions in E4X content. 2019-02-24 20:45:41 +00:00
Max Schaefer
be67d5129a JavaScript: Add QL library support for E4X. 2019-02-24 20:45:41 +00:00
Max Schaefer
5a89024507 JavaScript: Be more lenient about keywords used as identifiers. 2019-02-24 20:45:41 +00:00
Max Schaefer
dbbb961b48 JavaScript: Accept let expressions with an object literal as their body. 2019-02-24 20:45:41 +00:00
Max Schaefer
63ed569724 JavaScript: Recover from missing initializers in const/destructuring declarations. 2019-02-24 20:45:41 +00:00
Max Schaefer
fbf2774bb3 JavaScript: Accept expression-bodied function declarations in experimental mode. 2019-02-24 20:45:41 +00:00
Max Schaefer
a42bec7f44 JavaScript: Accept comments in E4X XML literals (but not in JSX HTML literals). 2019-02-24 20:45:41 +00:00
Max Schaefer
b2366c7a68 JavaScript: Refactor parsing of JSX element content. 2019-02-24 20:45:41 +00:00
Max Schaefer
88be67a4fc JavaScript: Add support for for-each-in comprehensions. 2019-02-24 20:45:41 +00:00
Max Schaefer
d3ae2954ff JavaScript: Add support for parsing postfix generator comprehensions. 2019-02-24 20:45:41 +00:00
Max Schaefer
bb93cef20a JavaScript: Refactor parsing of parenthesised expressions. 2019-02-24 20:45:41 +00:00
Max Schaefer
92c8501e67 JavaScript: Refactor parsing of generator/array comprehensions. 2019-02-24 20:45:41 +00:00
Max Schaefer
f3ea810c21 JavaScript: Add parser support for E4X. 2019-02-24 20:45:41 +00:00
Max Schaefer
1ad4867f2a JavaScript: Make parsing of decorators more restrictive.
As per [the proposal](https://tc39.github.io/proposal-decorators/#sec-new-syntax), decorators can only contain identifiers or parenthesised expressions, optionally followed by property accesses and arguments.
2019-02-24 20:45:41 +00:00
Max Schaefer
0635e1ba02 JavaScript: Update change note.
I've eliminated the clumsily worded "client-side code" and "server-side code" distinction, not least because Electron fits neither of those categories.
2019-02-23 21:46:39 +00:00
Max Schaefer
c6fc4e4764 JavaScript: Address review comments. 2019-02-23 21:43:13 +00:00
Max Schaefer
e7c95bae49 JavaScript: Add flow steps modelling Electron IPC. 2019-02-23 21:43:13 +00:00
Max Schaefer
a4e4957f31 JavaScript: Model webContents property. 2019-02-23 21:43:13 +00:00
Max Schaefer
ff83e600dc JavaScript: Track Electron browser objects inter-procedurally. 2019-02-23 21:43:13 +00:00
Max Schaefer
d59c12e6eb JavaScript: Recognise Electron browser objects based on TypeScript types when available. 2019-02-23 21:43:13 +00:00
Max Schaefer
143bb711f9 JavaScript: Slightly restructure Electron BrowserWindow class hierarchy. 2019-02-23 21:43:13 +00:00
Max Schaefer
20d41b85de JavaScript: Delete an unused package.json in a test.
While this file is part of the project used in the tutorial, it isn't necessary for the queries to work. It also specifies a dependency on a vulnerable version of Express, causing it to be (spuriously) flagged by security scanners.
2019-02-23 13:59:18 +00:00
Max Schaefer
db9ac72e7a Merge pull request #957 from esben-semmle/js/another-autobinder-model
JS: model one more 'autobind' for js/unbound-event-handler-receiver
2019-02-22 20:58:17 +00:00
Max Schaefer
12ed2ca000 Merge pull request #958 from esben-semmle/js/improve-tainted-path
JS: add taint steps for fs.realpath and fs.realpathSync
2019-02-22 20:55:39 +00:00
Dave Bartolomeo
70bccf85fc Merge pull request #970 from jbj/ir-block-count
C++: Use the cached getInstructionCount
2019-02-22 10:19:39 -08:00
Raul Garcia
9bb7816a3c Making changes based on feedback. 2019-02-22 10:10:20 -08:00
Tom Hvitved
116997cf85 Merge pull request #961 from calumgrant/cs/cve-2019-0657
C#: Update cs/use-of-vulnerable-package to detect CVE-2019-0657
2019-02-22 18:01:58 +01:00
Geoffrey White
315133bbb3 CPP: Change note. 2019-02-22 16:07:48 +00:00
Geoffrey White
dc0044288b CPP: Add support for some Rtl* functions in BufferAccess.qll. 2019-02-22 15:54:16 +00:00
Felicity Chapman
e34cf86c47 Move support information to QL repository for easier maintenance 2019-02-22 15:21:16 +00:00
Taus
89216208be Merge pull request #969 from markshannon/python-points-to-speed-up
Python: Refactor three predicates to improve join-order.
2019-02-22 15:27:02 +01:00
Calum Grant
cd721f38b8 Merge pull request #967 from hvitved/csharp/ssa/block-precedes-var
C#: Use explict recursion in `blockPrecedesVar()`
2019-02-22 14:08:26 +00:00
Calum Grant
e93140d136 Merge pull request #959 from hvitved/csharp/dispose-not-called-on-exc-performance
C#: Improve performance of `cs/dispose-not-called-on-throw`
2019-02-22 14:04:48 +00:00
Jonas Jensen
6777c8c13c C++: Use the cached getInstructionCount
The object-oriented `IRBlock` interface was recomputing instruction
counts instead of using the cached count that had already been computed.
2019-02-22 14:55:09 +01:00
Calum Grant
1386af46c1 Merge pull request #960 from hvitved/csharp/cache-get-arg
C#: Cache `Call::getArgumentForParameter()`
2019-02-22 12:39:55 +00:00
Mark Shannon
d46467f526 Python: Update tests to account for packages having locations. 2019-02-22 12:16:34 +00:00
Mark Shannon
a1820fe4c3 Python: Refactor three predicates to improve join-order. 2019-02-22 11:48:39 +00:00
Geoffrey White
8302ac4644 Merge pull request #965 from evverx/alloca-in-a-loop
CPP: add a query for catching alloca in a loop
2019-02-22 11:44:59 +00:00
Taus
69270d0a4e Merge pull request #963 from markshannon/python-sanity-context-sensitive
Python: Make points-to sanity check context sensitive.
2019-02-22 11:50:48 +01:00
Tom Hvitved
74377a28c9 C#: Improve join orders in DataFlow module 2019-02-22 09:31:19 +01:00
Jonas Jensen
21573d31f0 Merge pull request #966 from rdmarsh2/rdmarsh/cpp/ir-taint-tracking
C++: IR-based taint tracking
2019-02-22 09:16:31 +01:00
Robert Marsh
07cbbdaf9a C++: accept test output 2019-02-21 17:18:06 -08:00
Robert Marsh
aa97302671 make loads from tainted addresses tainted 2019-02-21 17:17:49 -08:00
Robert Marsh
9a9ec7bb17 C++: add IR-based taint tracking library 2019-02-21 17:09:09 -08:00
Robert Marsh
173ade1336 C++: add arithmetic/bitwise instruction classes 2019-02-21 17:09:08 -08:00
Jonas Jensen
7649e8758b Merge pull request #846 from geoffw0/returnstack
CPP: Improve  ReturnStackAllocatedMemory.ql
2019-02-21 22:04:53 +01:00
Esben Sparre Andreasen
6c1b29e4b6 JS: add missing flowstep for unused parameter field initializers 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
6766716867 JS: add PropWrite tests for parameter field initializers 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
bdd8691e65 JS: add type inference for the return value of captured method calls 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
c84d898727 JS: change notes for js/unused-property and js/unused-variable 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
8af501d4d5 JS: avoid double reporting dead code with js/unused-variable 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
91dccc3356 JS: add query js/unused-property 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
0cf2eaec5e JS: introduce CapturedSource 2019-02-21 21:44:28 +01:00
Esben Sparre Andreasen
bfbf686d7b JS: fixup changenote for js/unbound-event-handler-receiver 2019-02-21 21:44:28 +01:00
Robert Marsh
a0c12c46e5 Merge pull request #962 from jbj/IRGuards-cached
C++: Reduce the IRGuards to two cached stages
2019-02-21 10:50:19 -08:00
Evgeny Vereshchagin
e9401fca0d CPP: add a query for catching alloca in a loop
Thanks to Sam Lanning (@samlanning) and Robert Marsh for taking the time to help
to make it possible. In fact, it was Robert Marsh who effectively
wrote the query and figured out that __builtin_alloca should be
used to also take functions like strdupa into account. I just
filled out the metadata :-)
2019-02-21 18:09:56 +01:00
Geoffrey White
0ca67880b2 Merge pull request #902 from jbj/test-queries.xml
C++: Add a queries.xml to the test dir
2019-02-21 16:43:01 +00:00
Geoffrey White
c10c65cefe Merge pull request #1 from jbj/returnstack-EscapesTree
C++: Reimplement cpp/return-stack-allocated-memory with EscapesTree and data flow
2019-02-21 16:20:09 +00:00
Tom Hvitved
f02ef51459 C#: Use explict recursion in blockPrecedesVar() 2019-02-21 17:14:23 +01:00
Mark Shannon
1519e1b1f9 Python: Make sanity check context sensitive. 2019-02-21 14:23:24 +00:00
Jonas Jensen
1bc967c1d1 Merge pull request #819 from geoffw0/newdelete
CPP: Improve dataflow in newdelete.qll
2019-02-21 15:09:49 +01:00
Mark Shannon
c1b8f500c7 Python: Make sure packages have locations, so they can be displayed, even if those locations are meaningless. 2019-02-21 12:53:59 +00:00
Taus
ed3a8f0bee Merge pull request #799 from markshannon/python-api-tidy-up
Python API tidy up, part 1
2019-02-21 13:25:17 +01:00
semmle-qlci
e5d6d69ef2 Merge pull request #953 from jf205/doc-links
Approved by esben-semmle, felicity-semmle
2019-02-21 12:01:48 +00:00
calum
15341965e0 C#: Update cs/use-of-vulnerable-package to detect CVE-2019-0657 2019-02-21 11:48:48 +00:00
Geoffrey White
cd13e5877f CPP: Performance improvement. 2019-02-21 11:31:44 +00:00
Felicity Chapman
2358a9f4c7 Merge pull request #954 from jf205/doc-links-2
Update link in readme file
2019-02-21 11:14:11 +00:00
Jonas Jensen
d200bda2ad C++: Reduce the IRGuards to two cached stages
Before this change, all the cached predicates in `IRGuards.qll` were in
separate cached stages, resulting in recomputation of most of the
library for each stage. This change groups the cached predicates in two
cached classes. A better grouping may be possible, but this grouping was
easy to do and seems to solve the problem.

Before this change, the `IRGuards` library accounted for five cached
stages when using the `RangeAnalysis` library. After this change, it
only accounts for one.
2019-02-21 12:03:35 +01:00
Tom Hvitved
f8bb00a81c C#: Cache Call::getArgumentForParameter() 2019-02-21 11:41:40 +01:00
Jonas Jensen
1e0a385d41 C++: Put ReturnStackAllocatedMemory.ql on LGTM 2019-02-21 11:39:05 +01:00
Tom Hvitved
c8eb537591 C#: Improve performance of cs/dispose-not-called-on-throw 2019-02-21 11:20:54 +01:00
Tom Hvitved
c3a62b3656 C#: Always inline ControlFlowElement::[reachableFrom|getAReachableElement]() 2019-02-21 11:20:47 +01:00
Jonas Jensen
b9236d216f C++: Improve ReturnStackAllocatedMemory alert msg 2019-02-21 11:20:25 +01:00
Jonas Jensen
dcf910f20c C++: Use EscapesTree to find pointers to stack
This simplifies the query and is a strict improvement on the tests. I
also found it to be an overall improvement on real projects.
2019-02-21 11:20:25 +01:00
Tom Hvitved
a382a5876f Merge pull request #808 from calumgrant/cs/double-checked-locks
C#: Work on cs/unsafe-double-checked-lock
2019-02-21 11:17:35 +01:00
Jonas Jensen
9f2fdbbc1d C++: More tests for RedundantNullCheckSimple 2019-02-21 10:13:25 +01:00
Jonas Jensen
12084fc904 C++: Add new query to new experimental suite
This suite isn't referenced from anywhere yet, but it'll be included in
a standard ODASA dist because the dist includes all files in the `c` and
`cpp` directories. We can modify the nightly test jobs to include the
experimental suite.
2019-02-21 10:13:25 +01:00
Jonas Jensen
9ac8d60636 C++: IR query for redundant null check
This new query is not written because it's the most interesting query we
could write but because it's an IR-based query whose results are easy to
verify.
2019-02-21 10:13:25 +01:00
Esben Sparre Andreasen
305a249280 JS: add taint steps for fs.realpath and fs.realpathSync 2019-02-21 09:48:35 +01:00
Esben Sparre Andreasen
27cae0c190 JS: model one more 'autobind' for js/unbound-event-handler-receiver 2019-02-21 08:23:54 +01:00
Raul Garcia
143b1e576e Update .gitignore 2019-02-20 17:10:32 -08:00
Raul Garcia
fa73b8488a Update .gitignore 2019-02-20 17:10:19 -08:00
Raul Garcia
7d197692ac Adding a new rule for detecting usage of static objects that implement ICryptoTransform that would be thread-unsafe, and potentially result in incorrect cryptographic results. 2019-02-20 17:07:04 -08:00
yh-semmle
a4beb03e15 Java: respect override annotations in java/unused-parameter 2019-02-20 15:27:35 -05:00
calum
40f3b8b439 C#: Address review comments (documentation). 2019-02-20 18:00:30 +00:00
james
2cf247d739 update link in readme file 2019-02-20 16:59:40 +00:00
james
50ad8a4089 update link in vue.qll 2019-02-20 16:43:56 +00:00
semmle-qlci
f5e419e774 Merge pull request #933 from xiemaisi/js/createContextualFragment
Approved by asger-semmle
2019-02-20 12:42:27 +00:00
Taus
caf0bfe858 Merge pull request #951 from markshannon/python-string-tests
Python: Add a test for handling of corner-case strings.
2019-02-20 12:46:42 +01:00
Mark Shannon
adadd4942b Python: Remove BuiltinFunctionObject module as it is clearer and more concise to use ModuleObject::builtin(). 2019-02-20 11:23:48 +00:00
Mark Shannon
98be27a73e Python: Add 'attr' predicate as a synomnym for 'getAttribute' to help readability. 2019-02-20 11:08:44 +00:00
Geoffrey White
7b0f310856 CPP: Add query IDs to change note. 2019-02-20 10:38:49 +00:00
Mark Shannon
35fa5d8f60 Python move various theXXX() predicates into the appropriate module. 2019-02-20 10:34:08 +00:00
Mark Shannon
76d1fba9f0 Python: Add a test for handling of corner-case strings. 2019-02-20 10:26:40 +00:00
Geoffrey White
bc0387dc9a CPP: Change note. 2019-02-20 10:21:49 +00:00
Geoffrey White
d30bcb6fcf CPP: Widen allocReachedVariable slightly. 2019-02-20 10:19:57 +00:00
Geoffrey White
23ae12a763 CPP: Add test cases. 2019-02-20 10:19:57 +00:00
Geoffrey White
6a17ebbd1b CPP: Add test cases and renumber. 2019-02-20 10:09:57 +00:00
Geoffrey White
4e77f586da CPP: Fix file names. 2019-02-20 10:08:27 +00:00
Jonas Jensen
2dea0b4270 Merge pull request #879 from rdmarsh2/rdmarsh/cpp/ir-guards-edges
C++: Add edge-based predicates to IRGuards
2019-02-19 16:54:52 +01:00
Taus
9e1a5238ac Merge pull request #950 from markshannon/python-fix-a-couple-of-performance-issues
Python: fix a couple of performance issues
2019-02-19 16:15:19 +01:00
Mark Shannon
4e8e4aed3d Python: factor out helper predicate to prevent bad join-order. 2019-02-19 12:40:56 +00:00
Mark Shannon
17681d6de4 Python: factor out helper predicate to prevent bad join-order. 2019-02-19 12:21:41 +00:00
semmle-qlci
9dc624578e Merge pull request #949 from rneatherway/dbscheme-mode
Approved by esben-semmle
2019-02-19 10:01:59 +00:00
Robin Neatherway
88bc1be98f Add simple mode for highlighting QL dbschemes 2019-02-19 09:56:39 +00:00
semmle-qlci
62c0eea572 Merge pull request #939 from yh-semmle/java-frameworks
Approved by pavgust
2019-02-18 17:06:34 +00:00
Jonas Jensen
2550788598 C++: Accept test changes to getRelativePath
After a `queries.xml` was added to the test directory,
`Container.getRelativePath` now considers source files to be relative to
the `cpp/test` directory rather than the directory of the `*.ql*` file.
This caused some benign test output changes, and it also caused an
unwanted alert for `test3.c:14` to appear in
`cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/IntegerOverflowTainted.expected`.
This alert came about because `inSystemMacroExpansion` holds for files
that don't have a relative path, but the pretend system header in
`../system_header` now does have a relative path because it's below the
`cpp/test` directory. The fix is to add another `queries.xml` just for
the directory with the affected test.
2019-02-18 14:41:28 +01:00
Taus
1b25573cc0 Merge pull request #872 from markshannon/python-bottle
Python: Add support for bottle framework.
2019-02-18 12:34:44 +01:00
Jonas Jensen
9dc3b93164 Merge pull request #916 from geoffw0/largeparam
CPP: Update severity/precision of LargeParameter.ql.
2019-02-18 12:23:00 +01:00
calum
b0e2e436a7 C#: Fix documentation. 2019-02-18 09:37:10 +00:00
Tom Hvitved
5ce9b25ec9 C#: Improve CFG for assignments
Write accesses in assignments, such as the access to `x` in `x = 0` are not
evaluated, so they should not have entries in the control flow graph. However,
qualifiers (and indexer arguments) should still be evaluated, for example in

```
x.Foo.Bar = 0;
```

the CFG should be `x --> x.Foo --> 0 --> x.Foo.Bar = 0` (as opposed to
`x --> x.Foo --> x.Foo.Bar --> 0 --> x.Foo.Bar = 0`, prior to this change).

A special case is assignments via acessors (properties, indexers, and event
adders), where we do want to include the access in the control flow graph,
as it represents the accessor call:

```
x.Prop = 0;
```

But instead of `x --> x.set_Prop --> 0 --> x.Prop = 0` the CFG should be
`x --> 0 --> x.set_Prop --> x.Prop = 0`, as the setter is called *after* the
assigned value has been evaluated.

An even more special case is tuple assignments via accessors:

```
(x.Prop1, y.Prop2) = (0, 1);
```

Here the CFG should be
`x --> y --> 0 --> 1 --> x.set_Prop1 --> y.set_Prop2 --> (x.Prop1, y.Prop2) = (0, 1)`.
2019-02-16 19:19:24 +01:00
yh-semmle
ca3aaa8c75 Java: add change note for additional framework support 2019-02-15 20:01:08 -05:00
yh-semmle
64b2d331ae Java: add test for Guice framework support 2019-02-15 20:01:08 -05:00
yh-semmle
b0d9c80ccc Java: add taint steps for Protobuf framework 2019-02-15 20:01:07 -05:00
yh-semmle
fc4aa16905 Java: add remote user input for Apache Thrift framework 2019-02-15 20:01:07 -05:00
yh-semmle
751bbbf583 Java: add remote user input for Struts 2 ActionSupport 2019-02-15 20:01:06 -05:00
yh-semmle
a436369846 Java: add remote user input and taint step for Guice framework 2019-02-15 20:01:06 -05:00
Asger F
e7e29101e4 JS: add StringOps::Concatenation 2019-02-15 16:57:26 +00:00
Asger F
c115451b9d JS: Fix copy-pasta bug 2019-02-15 16:48:42 +00:00
Asger F
ab0ed66266 JS: Add EndsWith::Range 2019-02-15 16:48:15 +00:00
Asger F
2ccfd73be5 JS: Add Includes::Range 2019-02-15 16:42:41 +00:00
Asger F
56e081f7c9 JS: Add StartsWith::Range 2019-02-15 16:38:18 +00:00
Asger F
1aba111a00 JS: Use ::Range pattern for abstract classes 2019-02-15 14:28:07 +00:00
Asger F
c8823fa7cf JS: change charpred of ClosureModule to be AST-based 2019-02-15 14:28:06 +00:00
Asger F
d1607f7c47 JS: remove SourceNode supertype from ClosureNamespaceAccess 2019-02-15 14:28:06 +00:00
Asger F
8801431352 JS: elaborate qldoc for isTopLevelExpr 2019-02-15 14:28:06 +00:00
Asger F
fa34f8f414 JS: replace dataflow -> data flow 2019-02-15 14:28:06 +00:00
Asger F
701e662bc4 JS: rename more predicates for consistency 2019-02-15 14:28:06 +00:00
Asger F
23bd9e62f0 JS: Add ClosureNamespaceAccess 2019-02-15 14:28:06 +00:00
Asger F
939eab2c82 JS: refactor expressions to dataflow nodes 2019-02-15 14:28:06 +00:00
Asger F
8d78731ff0 JS: rename getNamespaceId to getClosureNamespace 2019-02-15 14:28:06 +00:00
Robin Neatherway
5754eb666c Merge pull request #942 from esben-semmle/emacs-1
Emacs syntax highlighting and file-type detection
2019-02-15 14:27:57 +00:00
Asger F
8c96f5f037 JS: tweak global flow for closure modules 2019-02-15 12:05:35 +00:00
Esben Sparre Andreasen
b6f2e60ece emacs: restrict parameterized annotation highlightning 2019-02-15 12:45:36 +01:00
Nick Rolfe
5502627242 Merge pull request #943 from rneatherway/patch-1
Add transient as an annotation
2019-02-15 10:51:05 +00:00
Robin Neatherway
5181bcd0ad Add transient as an annotation 2019-02-15 10:41:17 +00:00
Esben Sparre Andreasen
046c8c963f emacs: generalize parameterized annotation highlightning 2019-02-15 11:35:18 +01:00
Esben Sparre Andreasen
1fd9186428 emacs: initial ql-mode-base.el 2019-02-15 10:00:58 +01:00
Tom Hvitved
096757dadf C#: Add CFG tests for accessor calls 2019-02-14 20:24:04 +01:00
Robert Marsh
26a0f4b100 Merge pull request #938 from dave-bartolomeo/dave/AliasedSSA
C++: Better tracking of SSA memory accesses
2019-02-14 08:10:31 -08:00
Nick Rolfe
6c0dc440ae Merge pull request #940 from aschackmull/cpp/sync-dataflow
CPP/Java: Sync Dataflow
2019-02-14 13:18:35 +00:00
Anders Schack-Mulligen
980a690b8b CPP/Java: Sync Dataflow 2019-02-14 09:59:08 +01:00
Dave Bartolomeo
d8bf3ffe1b C++: Update test expectations 2019-02-13 14:19:57 -08:00
Dave Bartolomeo
b40fd95b8e C++: Better tracking of SSA memory accesses
This change fixes a few key problems with the existing SSA implementations:

For unaliased SSA, we were incorrectly choosing to model a local variable that had accesses that did not cover the entire variable. This has been changed to ensure that all accesses to the variable are at offset zero and have the same type as the variable itself. This was only possible to fix now that every `MemoryOperand` has its own type.

For aliased SSA, we now correctly track the offset and size of each memory access using an interval of bit offsets covered by the access. The offset interval makes the overlap computation more straightforward. Again, this is only possible now that operands have types.
The `getXXXMemoryAccess` predicates are now driven by the `MemoryAccessKind` on the operands and results, instead of by specific opcodes.

This change does fix an existing false negative in the IR dataflow tests.

I added a few simple test cases to the SSA IR tests, covering the various kinds of overlap (MustExcactly, MustTotally, and MayPartially).

I added "PrintSSA.qll", which can dump the SSA memory accesses as part of an IR dump.
2019-02-13 10:44:39 -08:00
Dave Bartolomeo
055485d9eb C++: Work around lack of size for enum type 2019-02-13 10:44:39 -08:00
semmle-qlci
26525fc1b5 Merge pull request #929 from asger-semmle/typescript-no-expansion
Approved by xiemaisi
2019-02-13 18:20:41 +00:00
semmle-qlci
92a6e7e04c Merge pull request #932 from asger-semmle/cookbook-prepare
Approved by xiemaisi
2019-02-13 18:20:09 +00:00
Asger F
dfe3f254de JS: generalize to include default imports 2019-02-13 18:03:57 +00:00
Asger F
d793427630 JS: treat +/- equally in suffix check query 2019-02-13 15:55:19 +00:00
Max Schaefer
5b2df068d3 Merge pull request #921 from asger-semmle/class-node-absval
JS: use type inference to back up function-style classes
2019-02-13 10:12:20 +00:00
Taus
ca6f145b12 Merge pull request #832 from markshannon/python-typesafe-origin
Python: typesafe origin for points-to
2019-02-13 10:55:33 +01:00
semmle-qlci
c422ade739 Merge pull request #927 from xiemaisi/js/ambiguous-id-attr-templates
Approved by esben-semmle
2019-02-13 08:35:41 +00:00
Tom Hvitved
9c287072cf Merge pull request #924 from calumgrant/cs/extractor-string-length
C# extractor: Limit trap strings to 1MB
2019-02-13 09:34:36 +01:00
Tom Hvitved
0cb2c0994a Merge pull request #930 from calumgrant/cs/suppress-alerts
C#: Add some alert suppression comments
2019-02-13 09:34:18 +01:00
semmle-qlci
1d4f894583 Merge pull request #931 from aschackmull/java/autoformat
Approved by esben-semmle, hvitved, yh-semmle
2019-02-13 08:30:25 +00:00
Robert Marsh
f0cf576e3b Merge pull request #935 from dave-bartolomeo/dave/PointerDecay
C++: Handle pointer decay and inferred array sizes
2019-02-12 15:03:21 -08:00
Dave Bartolomeo
aff2ea3316 C++: Handle pointer decay and inferred array sizes
For function parameters that are subject to "pointer decay", the database contains the type as originally declared (e.g. `T[]` instead of `T*`). The IR needs the actual type. Similarly, for variable declared as an array of unknown size, the actual size needs to be inferred from the initializer (e.g. `char a[] = "blah";` needs to have the type `char[5]`).

I've opened a ticket to have the extractor emit the actual type alongside the declared type, but for now, this workaround is enough to unblock progress for typical code.
2019-02-12 12:41:21 -08:00
Robert Marsh
6ab0eaac7d Merge pull request #926 from dave-bartolomeo/dave/MemoryOperand
C++: Rationalize `RegisterOperand` vs. `MemoryOperand`
2019-02-12 12:18:02 -08:00
Dave Bartolomeo
f5121d71bc C++: Fix range analysis for new API 2019-02-12 09:38:11 -08:00
Asger F
d532815efe JS: remove unused predicate 2019-02-12 17:34:21 +00:00
Asger F
be10f24de7 JS: make moduleImport() work for named imports 2019-02-12 17:22:06 +00:00
Max Schaefer
2fce626c3a JavaScript: Add Range.prototype.createContextualFragment as an XSS sink. 2019-02-12 16:32:30 +00:00
Max Schaefer
41eb1ff9d0 JavaScript: Drop precision of AmbiguousIdAttribute to 'high'. 2019-02-12 16:31:29 +00:00
Max Schaefer
25f95d9fb1 JavaScript: Be more conservative about templates in AmbiguousIdAttribute.
Previously, we only excluded attributes where the value of the attribute itself suggests templating happening. Now we exclude all attributes in documents where _any_ attribute value suggests templating.
2019-02-12 16:31:01 +00:00
Mark Shannon
0ea33b7e91 Python: Rename class. 2019-02-12 14:37:50 +00:00
Mark Shannon
e7d2c1e179 Python: Convert ObjectOrCfg back to using extensionals for speed. 2019-02-12 14:37:19 +00:00
Mark Shannon
bcf4df840c Convert ObjectOrCfg to IPA type for stronger type-checking. 2019-02-12 14:37:19 +00:00
Mark Shannon
c767de02e6 Python: Refactor points-to origin code for better encapsulation. 2019-02-12 14:37:19 +00:00
Mark Shannon
b644891e53 Python: Fix up some typos for bottle and add a few more tests. 2019-02-12 14:26:06 +00:00
Mark Shannon
aab0a243dc Python: Add redirects to bottle framework support. 2019-02-12 14:26:06 +00:00
Mark Shannon
d514fc543d Python: Add responses to bottle framework support. 2019-02-12 14:26:06 +00:00
Mark Shannon
8d525e5295 Python: Add support for bottle framework routing and requests. 2019-02-12 14:26:06 +00:00
Anders Schack-Mulligen
15a6044445 Javascript: Autoformat qlls 2019-02-12 14:41:31 +01:00
Taus
9caa9c10bc Merge pull request #928 from markshannon/python-points-to-through-callsites
Python: Points-to should flow through call-sites if not assigned out of scope.
2019-02-12 14:41:12 +01:00
Asger F
3290c174c3 JS: Add DataFlow::Node.getAFunctionValue 2019-02-12 13:38:46 +00:00
Asger F
2fd1ee60a2 JS: add DataFlow::Node.getIntValue() 2019-02-12 13:38:46 +00:00
Asger F
0fd9d157f8 JS: add DataFlow::Node.getStringValue() 2019-02-12 13:38:45 +00:00
Anders Schack-Mulligen
fc9c7ea55a CSharp: Autoformat qls 2019-02-12 14:38:42 +01:00
Anders Schack-Mulligen
bcaaebfe7e CSharp: Autoformat qlls 2019-02-12 14:38:42 +01:00
Anders Schack-Mulligen
1182fca665 Javascript: Autoformat qls 2019-02-12 14:38:42 +01:00
Anders Schack-Mulligen
25469637db Java: Autoformat qls. 2019-02-12 14:38:08 +01:00
Anders Schack-Mulligen
63a4dd09ad Java: Autoformat qlls. 2019-02-12 14:38:08 +01:00
calum
884af9bd7f C#: Fix alert. 2019-02-12 13:34:33 +00:00
semmle-qlci
c133362660 Merge pull request #910 from xiemaisi/js/regexp-taint
Approved by esben-semmle
2019-02-12 13:15:16 +00:00
calum
e18eeb8d2a C#: Address review comments. 2019-02-12 12:56:58 +00:00
calum
1e1784239c C#: Alert suppression comments for lgtm[cs/catch-of-all-exceptions 2019-02-12 12:45:22 +00:00
Asger F
0444fa307d TS: update test expectations 2019-02-12 12:33:09 +00:00
Taus
583358bee3 Merge pull request #911 from markshannon/python-add-special-operation
Python: Add 'special operation' pseudo-expression type
2019-02-12 13:32:20 +01:00
Felicity Chapman
8c5b495c97 Merge pull request #917 from markshannon/python-extractor-change-note
Python: Add change note for unified parser.
2019-02-12 12:24:07 +00:00
Asger F
7a813cfb84 TS: disable type expansion by default 2019-02-12 12:21:11 +00:00
Taus
5b127eb676 Merge pull request #914 from markshannon/python-add-2-3-query-tests
Python: Add 2/3 specific query tests.
2019-02-12 12:54:29 +01:00
Taus
abc71cba4c Merge pull request #913 from markshannon/python-add-3-library-tests
Python add 2/3 specific library tests
2019-02-12 12:54:15 +01:00
calum
33e6b5e55f C#: Fix tests 2019-02-12 10:59:31 +00:00
semmle-qlci
ac3f413b87 Merge pull request #920 from xiemaisi/js/field-as-prop-write
Approved by asger-semmle
2019-02-12 10:48:13 +00:00
Calum Grant
0513828000 Merge pull request #922 from hvitved/csharp/cfg/remove-exception-edges
C#: Remove some impossible CFG exception edges
2019-02-12 10:42:07 +00:00
Calum Grant
e10ea73a07 Merge pull request #901 from hvitved/csharp/conditional-assign-join-order
C#: Improve join order in `conditionalAssign()`
2019-02-12 10:39:49 +00:00
Mark Shannon
220b881096 Python: Points-to should flow through call-sites if not assigned outside of scope. 2019-02-12 09:57:45 +00:00
Mark Shannon
384fa5db3f Python: clarfiy change note. 2019-02-12 09:53:00 +00:00
Calum Grant
b557b7b438 Merge pull request #895 from hvitved/csharp/get-a-thrown-exception
C#: Avoid using `ExceptionClass` in deliberate Cartesian products
2019-02-12 09:49:03 +00:00
Dave Bartolomeo
c224bbd767 C++: Fix Operand.getSize() 2019-02-11 17:48:59 -08:00
calum
b51eb2cb92 C#: Fix tags in documentation. 2019-02-11 17:52:55 +00:00
Dave Bartolomeo
bd46c43067 C++: Add sanity test for missing operand type 2019-02-11 09:47:00 -08:00
Dave Bartolomeo
a54d86423a C++: Add Operand.getType() 2019-02-11 09:47:00 -08:00
Dave Bartolomeo
fa2ef620ac C++: Rationalize RegisterOperand vs. MemoryOperand
This change does some shuffling to make the distinction between memory operands and register operands more clear in the IR API. First, any given type that extends `Operand` is now either always a `MemoryOperand` or always a `RegisterOperand`. This required getting rid of `CopySourceOperand`, which was used for both the `CopyValue` instruction (as a `RegisterOperand`) and for the `Load` instruction (as a `MemoryOperand`). `CopyValue` is now just a `UnaryInstruction`, `Store` has a `StoreValueOperand` (`RegisterOperand`), and all of the instructions that read a value from memory indirectly (`Load`, `ReturnValue`, and `ThrowValue`) all now have a `LoadOperand` (`MemoryOperand`).

There are no diffs in the IR output for this commit, but this change is required for a subsequent commit that will make each `MemoryOperand` have a `Type`, which in turn is needed to fix a critical bug in aliased SSA construction.
2019-02-11 09:47:00 -08:00
calum
8bb1af884a C# extractor: Limit string literals to 1MB. This is made more complicated by the fact that we need to limit the number of bytes to output, rather than the number of characters. 2019-02-11 17:36:23 +00:00
Tom Hvitved
8cb8c967d2 C#: Remove some impossible CFG exception edges 2019-02-11 16:17:01 +01:00
Tom Hvitved
6ff4206d53 C#: Add CFG test 2019-02-11 16:03:25 +01:00
Tom Hvitved
14bdea1cf2 Merge pull request #847 from calumgrant/cs/json.net
C#: Model Json.NET dataflow
2019-02-11 15:48:01 +01:00
Anders Schack-Mulligen
be3191aa6b Merge pull request #871 from nickrolfe/vim
Vim syntax highlighting and file-type detection
2019-02-11 13:10:48 +01:00
Anders Schack-Mulligen
52ad816074 Merge pull request #904 from rneatherway/zipslip-fix
Java: Add a flow step for `Path::toFile` in ZipSlip
2019-02-11 13:08:38 +01:00
Nick Rolfe
7db2f643cc Vim syntax: add missing annotations and annotation arguments 2019-02-11 11:42:53 +00:00
semmle-qlci
10b00254ec Merge pull request #915 from asger-semmle/closure-uri-methods
Approved by xiemaisi
2019-02-11 10:51:07 +00:00
Anders Schack-Mulligen
e4ba5ce608 Merge pull request #787 from hmakholm/pr/fix-useless-parameter
Fix false positives in java/unused parameter
2019-02-11 11:49:21 +01:00
Robin Neatherway
409733838b Java: Add a flow step for Path::toFile in ZipSlip 2019-02-11 10:33:44 +00:00
Taus
fb8d0f5b1f Merge pull request #850 from markshannon/python-improve-import-analysis
Python improve import analysis
2019-02-11 10:28:37 +01:00
Max Schaefer
10ef945b51 JavaScript: Restrict InstanceFieldAsPropWrite to fields with initializers. 2019-02-11 08:17:53 +00:00
Robert Marsh
184e65d8a1 Merge pull request #919 from dave-bartolomeo/dave/SSATests
C++: Split out SSA IR tests
2019-02-08 18:18:01 -08:00
Dave Bartolomeo
bda00bbff2 C++: Split out SSA IR tests
The IR tests were getting kind of unwieldy. We were using "ir.cpp" to contain test cases that covered both IR construction (every language construct imaginable) and SSA construction. We would then build and dump all three flavors of IR. For IR construction tests, examining the SSA dumps when you add a new test case is tedious.

To make this easier to manage, I've split the SSA-specific test cases out into a separate directory. "ir.cpp" should now contain only IR construction test cases, and "ssa.cpp" should contain only SSA construction test cases. We dump just the raw IR for "ir.cpp", and just the two SSA flavors for "ssa.cpp". We still run all three flavors of the IR sanity tests for "ir.cpp", though.

I also removed the "ssa_block_count.ql" test, which wasn't really adding any coverage, because any change to the block count would be reflected in the dump as well.
2019-02-08 15:28:06 -08:00
semmle-qlci
986afa1b1b Merge pull request #909 from xiemaisi/js/improve-incomplete-sanitization-alerts
Approved by esben-semmle
2019-02-08 17:39:36 +00:00
semmle-qlci
232d81a4ed Merge pull request #908 from xiemaisi/js/enable-ms-queries
Approved by esben-semmle
2019-02-08 17:38:27 +00:00
Mark Shannon
ee143ee041 Python: Add change note for unified parser. 2019-02-08 16:44:01 +00:00
Asger F
74a9c4b500 JS: use type inference to back up function-style classes 2019-02-08 16:42:24 +00:00
Mark Shannon
e37bda27d5 Python points-to: Clarify use of '$' variable. 2019-02-08 15:54:51 +00:00
Calum Grant
9319d66c13 Merge pull request #893 from hvitved/csharp/cfg/splitting-performance-tweaks
C#: CFG performance improvements
2019-02-08 15:52:51 +00:00
Geoffrey White
8b2405b267 CPP: Update severity/precision of LargeParameter.ql. 2019-02-08 15:23:57 +00:00
calum
d18bbf6a73 C#: Make query only apply to reftypes, since I believe valuetypes are safe or cannot be fixed trivially using the volatile keyword. 2019-02-08 15:18:29 +00:00
Asger F
f6e0ccfcf0 JS: model URI and XHR methods from closure library 2019-02-08 15:18:27 +00:00
Asger F
fd2e9f1fcb JS: shift line numbers in RequestForgery test 2019-02-08 15:13:33 +00:00
Mark Shannon
52ddd79cab Python: Add 2/3 specific query tests. 2019-02-08 15:13:17 +00:00
calum
b473d2f7a8 C#: Update change notes. Decrease the priority of this query because the volatile keyword is no longer needed on modern .Net runtimes. 2019-02-08 14:59:45 +00:00
calum
7addd41e38 C#: Fixes to double-checked lock. 2019-02-08 14:57:57 +00:00
Mark Shannon
adb4c42aa5 Python: Add 2-only library tests. 2019-02-08 14:49:04 +00:00
Mark Shannon
49307a72b4 Python: Add 3-only library tests. 2019-02-08 14:39:27 +00:00
calum
c9cf183878 C#: Fix merge conflicts. 2019-02-08 14:38:51 +00:00
calum
08d13ea363 C#: Address review comments. 2019-02-08 14:38:51 +00:00
calum
15a2f9dc13 C#: Add change note. 2019-02-08 14:38:51 +00:00
calum
7f7a92d092 C#: Model Json.NET dataflow. 2019-02-08 14:37:54 +00:00
semmle-qlci
937049e060 Merge pull request #891 from xiemaisi/js/simplify-sensitive-actions
Approved by esben-semmle
2019-02-08 14:12:47 +00:00
Taus
90eccbdf76 Merge pull request #836 from markshannon/python-mutating-descriptor
Python: Fix up mutating-descriptor query
2019-02-08 15:10:30 +01:00
Nick Rolfe
01fac31641 Vim syntax: highlight numbers and new keywords 2019-02-08 13:43:15 +00:00
Jonas Jensen
566eafc706 Merge pull request #823 from dave-bartolomeo/dave/IdentityString
C++: Declaration.getIdentityString and Type.getTypeIdentityString
2019-02-08 13:16:02 +01:00
Mark Shannon
465f42eb2f Python: Add 'special operation' pseudo-expression type, for use in semantic stubs file. No use of it as yet. 2019-02-08 11:31:34 +00:00
semmle-qlci
7e298cfbbe Merge pull request #900 from esben-semmle/js/defuse-default
Approved by xiemaisi
2019-02-08 11:28:32 +00:00
semmle-qlci
a48594ad8e Merge pull request #906 from asger-semmle/q-library
Approved by xiemaisi
2019-02-08 11:12:50 +00:00
Asger F
bfe88e9784 JS: make Closure::moduleImport handle member access. 2019-02-08 10:51:07 +00:00
Max Schaefer
6ce77ea1ef JavaScript: Add change note. 2019-02-08 09:57:07 +00:00
Max Schaefer
b314c546e1 JavaScript: Track taint through RegExp.prototype.replace. 2019-02-08 09:57:07 +00:00
Max Schaefer
25d06ad0cf JavaScript: Treat regexp replacements of HTML metacharacters as sanitizers for XSS queries. 2019-02-08 09:57:06 +00:00
Max Schaefer
18c23ecfd4 JavaScript: Introduce shared library for modelling XSS-relevant concepts.
As its first application, this library makes it possible for `StoredXss` to reuse the `Source` classes of `DomBasedXss` and `ReflectedXss` without having to pull in their libraries (which contain their `Configuration` classes, causing `StoredXss` to recompute all flow information for the other two queries).
2019-02-08 09:53:51 +00:00
semmle-qlci
0558b58193 Merge pull request #907 from asger-semmle/reapply-closure-modules
Approved by xiemaisi
2019-02-08 09:23:47 +00:00
Max Schaefer
3e26bc6446 JavaScript: Improve alert location and message for IncompleteSanitization.
We now highlight the `replace` call (instead of the regular expression), and the alert message for the case of missing backslash escapes clarifies that it is talking about failure to escape backslashes in the input, not in the replacement text.
2019-02-08 09:13:40 +00:00
Max Schaefer
aebc5bc6c3 JavaScript: Update qhelp example for CleartextStorage. 2019-02-08 08:43:22 +00:00
Max Schaefer
0be81dacdc JavaScript: Add classification of sensitive expressions.
We now classify sensitive expressions into four categories (secret, id, password, certificate). This allows queries more fine-grained control over what kinds of sensitive data they want to deal with: for clear-text storage, for instance, user ids aren't so much of a problem.
2019-02-08 08:43:22 +00:00
Max Schaefer
6389f32847 JavaScript: Update expected output for ExtractSinkSummaries query. 2019-02-08 08:43:22 +00:00
Max Schaefer
326b93bf84 JavaScript: Clean up classification of sensitive strings. 2019-02-08 08:43:22 +00:00
ian-semmle
f337c9faf4 Merge pull request #888 from dave-bartolomeo/dave/Capture
C++: Update captures test for closure fields extractor fix
2019-02-07 22:54:01 +00:00
Dave Bartolomeo
1e7dcedcdf C++: Fix semantic merge conflict 2019-02-07 14:32:26 -08:00
Dave Bartolomeo
283991d520 C++: Handle ProxyClass in getIdentityString() 2019-02-07 14:26:01 -08:00
Dave Bartolomeo
3414c105c6 C++: Hoist getTemplateArgument() and friends into Declaration 2019-02-07 14:26:01 -08:00
Dave Bartolomeo
1c6b14e505 C++: Remove deprecation of getFullSignature() until we can fix internal tests to use getIdentityString() 2019-02-07 14:26:01 -08:00
Dave Bartolomeo
dbe12e7d02 C++: More PR feedback 2019-02-07 14:26:01 -08:00
Dave Bartolomeo
eb7016620b C++: Fix PR feedback 2019-02-07 14:26:00 -08:00
Dave Bartolomeo
7b54db8ca9 C++: Fix getIdentityString for TemplateParameter 2019-02-07 14:26:00 -08:00
Dave Bartolomeo
5d71d06dbc C++: Fix test expectation 2019-02-07 14:26:00 -08:00
Dave Bartolomeo
bd4ecc3e91 C++: Declaration.getIdentityString and Type.getTypeIdentityString
This PR adds new predicates to `Declaration` and `Type` to get a fully-qualified canonical name for the element, suitable for debugging and dumps. It includes template parameters, cv qualifiers, function parameter and return types, and fully-qualified names for all symbols. These strings are too large to compute in productions queries, so they should be used only for dumps and debugging. Feel free to suggest better names for these predicates.

I've updated PrintAST and PrintIR to use these instead of `Function.getFullSignature()`. The biggest advantage of the new predicates is that they handle lambdas and local classes, which `getQualifiedName` and `getFullSignature` do not. This makes IR and AST dumps much more usable for real-world snapshots.

Along the way, I cleaned up some of our handling of `IntegralType` to use a single table for tracking the signed, unsigned, and canonical versions of each type. The canonical part is new, and was necessary for `getTypeIdentityString` so that `signed int` and `int` both appear as `int`.
2019-02-07 14:26:00 -08:00
Henning Makholm
b8a03464bf Fix false positives in java/unused parameter
Methods that are mentioned in a member reference expression should count
as rootdefs for the unused parameter query. Such methods have to match
the functional interface of the reference expression, so it is to be
expected that they will sometimes have to declare parameters that they
don't actually use.
2019-02-07 21:14:36 +01:00
Tom Hvitved
e663abd5da C#: Avoid using ExceptionClass in deliberate Cartesian products
Using the class `ExceptionClass` in combination with a deliberate Cartesian
product can lead to bad join orders, for example

```
EVALUATE NONRECURSIVE RELATION:
  Completion::TriedControlFlowElement::getAThrownException_dispred#ff(int this, int result) :-
    {1} r1 = JOIN Expr::Expr::getType_dispred#ff_10#join_rhs WITH @integral_type#f ON Expr::Expr::getType_dispred#ff_10#join_rhs.<0>=@integral_type#f.<0> OUTPUT FIELDS {Expr::Expr::getType_dispred#ff_10#join_rhs.<1>}
    {1} r2 = JOIN r1 WITH @un_op#f ON r1.<0>=@un_op#f.<0> OUTPUT FIELDS {r1.<0>}
    {1} r3 = JOIN r2 WITH Stmt::TryStmt::getATriedElement#ff_1#join_rhs ON r2.<0>=Stmt::TryStmt::getATriedElement#ff_1#join_rhs.<0> OUTPUT FIELDS {r2.<0>}
    {2} r4 = JOIN r3 WITH Stmt::ExceptionClass#f CARTESIAN PRODUCT OUTPUT FIELDS {Stmt::ExceptionClass#f.<0>,r3.<0>}
    {2} r5 = JOIN r4 WITH System::SystemOverflowExceptionClass#class#f ON r4.<0>=System::SystemOverflowExceptionClass#class#f.<0> OUTPUT FIELDS {r4.<1>,r4.<0>}
```

where the CP is made with `ExceptionClass` rather than `SystemOverflowExceptionClass`
directly.
2019-02-07 20:42:21 +01:00
Tom Hvitved
e074daee74 C#: Limit number of non-required CFG splits 2019-02-07 20:40:20 +01:00
Tom Hvitved
7d11eb5758 C#: Add CFG test with exponential splitting
This test times out as it would require constructing 2^40 copies of the same node.
2019-02-07 20:40:20 +01:00
Tom Hvitved
ab8ad9f8e6 C#: Improve a few join-orders in CFG splitting library 2019-02-07 20:40:20 +01:00
semmle-qlci
87c5872bc5 Merge pull request #903 from hvitved/csharp/successor-type-qldoc
Approved by calumgrant
2019-02-07 19:38:58 +00:00
Tom Hvitved
0a39e8c34f Merge pull request #905 from calumgrant/cs/trivial-cil-properties
C#: Use CIL analysis when determining trivial properties
2019-02-07 20:38:06 +01:00
Dave Bartolomeo
f460d2c1c3 C++: Fix another test expectation 2019-02-07 09:56:56 -08:00
Dave Bartolomeo
f2a0a86c6d C++: Update captures test for closure fields extractor fix 2019-02-07 09:56:56 -08:00
Robert Marsh
3c638b5966 C++: add edge-based predicates to IRGuards
These predicates currently take a pair of `IRBlock`s - as it stands, at
most one edge can exist from one `IRBlock` to a given other `IRBlock`.
We may need to revisit that assumption and create an `IREdge` IPA type
at some future date
2019-02-07 09:38:54 -08:00
Robert Marsh
b85b7744ef C++: refactor branch instruction handling 2019-02-07 09:36:34 -08:00
Robert Marsh
92ba0919cc Merge pull request #899 from Semmle/rdmarsh/cpp/IRRename-rebased
C++: Rename a few problematic IR APIs
2019-02-07 09:28:59 -08:00
Asger F
9dae08bbcf JS: fix javadoc 2019-02-07 13:53:29 +00:00
Asger F
c2321045f2 TS: fix import of q.d.ts in test case 2019-02-07 12:37:54 +00:00
calum
65b3771f85 C#: Add changenote. 2019-02-07 12:10:18 +00:00
calum
8afbd2d897 C#: Extend TrivialProperty to also include CIL::TrivialProperty 2019-02-07 12:05:42 +00:00
Asger F
6cc30fe732 JS: add stats for new relations 2019-02-07 12:00:53 +00:00
Asger F
e4b230ba60 Revert "Merge pull request #897 from Semmle/revert-817-closure-modules"
This reverts commit 95185345fd, reversing
changes made to b8be66ec48.
2019-02-07 11:58:38 +00:00
Tom Hvitved
ba575db93b C#: Add QL doc to SuccessorType.qll 2019-02-07 12:09:09 +01:00
Calum Grant
383e82a3f3 Merge pull request #886 from hvitved/csharp/cfg/restructure
C#: Split up `ControlFlowGraph.qll` into multiple files
2019-02-07 11:06:19 +00:00
Tom Hvitved
5f027e1761 Merge pull request #860 from calumgrant/cs/library-flow
C#: Refactor LibraryTypeDataFlow
2019-02-07 11:52:05 +01:00
Calum Grant
4274bb136f Merge pull request #892 from hvitved/csharp/get-arg-for-param-bad-magic
C#: Prevent bad magic in `getArgumentForParameter()`
2019-02-07 10:50:21 +00:00
Calum Grant
73d56e1bdb Merge pull request #881 from hvitved/csharp/remove-get-url
C#: Remove `getUrl()` predicate
2019-02-07 10:47:56 +00:00
Esben Sparre Andreasen
5ad83360be JS: move default parameter values to the DefUse graph 2019-02-07 11:41:36 +01:00
Esben Sparre Andreasen
65530c5edf JS: add test for js/useless-comparison-test 2019-02-07 11:41:36 +01:00
Esben Sparre Andreasen
55fd948c24 JS: add test for js/trivial-conditional 2019-02-07 11:41:36 +01:00
Esben Sparre Andreasen
f956e570cb JS: support default destructuring values in the dataflow graph 2019-02-07 11:41:36 +01:00
Esben Sparre Andreasen
687b7f0a7f JS: exclude direct flow from the RHS in a destructuring assignment 2019-02-07 11:41:36 +01:00
Esben Sparre Andreasen
f333419bb4 JS: add defuse+dataflow tests for destructuring and default values 2019-02-07 11:24:46 +01:00
Jonas Jensen
ce31b14f21 C++: Add a queries.xml to the test dir
This makes compilation caching work with `*.ql` files in the test dir
when using `odasa qltest --optimize`.
2019-02-07 11:04:20 +01:00
Max Schaefer
447a1db616 JavaScript: Assign FileAccessToHttp and HttpToFileAccess a precision.
They will now be run on LGTM, but their results won't be displayed by default.
2019-02-07 09:48:05 +00:00
Tom Hvitved
23e63e983c C#: Improve join order in conditionalAssign()
Fixes a bad join-order in `Guards::Internal::conditionalAssign#ffff#antijoin_rhs#1`:

```
[2019-01-25 14:12:03] (377s) Starting to evaluate predicate Guards::Internal::conditionalAssign#ffff#antijoin_rhs#1
[2019-01-25 14:20:41] (895s) Tuple counts:
                      9302551    ~1%     {7} r1 = JOIN ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getAPhiInput_dispred#ff WITH Guards::Internal::conditionalAssign#ffff#shared#1 ON ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getAPhiInput_dispred#ff.<0>=Guards::Internal::conditionalAssign#ffff#shared#1.<0> OUTPUT FIELDS {ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getAPhiInput_dispred#ff.<1>,Guards::Internal::conditionalAssign#ffff#shared#1.<1>,Guards::Internal::conditionalAssign#ffff#shared#1.<2>,Guards::Internal::conditionalAssign#ffff#shared#1.<0>,Guards::Internal::conditionalAssign#ffff#shared#1.<3>,Guards::Internal::conditionalAssign#ffff#shared#1.<4>,Guards::Internal::conditionalAssign#ffff#shared#1.<5>}
                      9302551    ~7%     {8} r2 = JOIN r1 WITH ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getBasicBlock_dispred#ff ON r1.<0>=ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getBasicBlock_dispred#ff.<0> OUTPUT FIELDS {r1.<1>,ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getBasicBlock_dispred#ff.<1>,r1.<2>,r1.<3>,r1.<4>,r1.<5>,r1.<6>,r1.<0>}
                      1223774650 ~0%     {8} r3 = JOIN r2 WITH Guards::Internal::Guard::preControlsDirect_dispred#fff ON r2.<0>=Guards::Internal::Guard::preControlsDirect_dispred#fff.<0> AND r2.<1>=Guards::Internal::Guard::preControlsDirect_dispred#fff.<1> OUTPUT FIELDS {r2.<6>,Guards::Internal::Guard::preControlsDirect_dispred#fff.<2>,r2.<0>,r2.<2>,r2.<3>,r2.<4>,r2.<5>,r2.<7>}
                      80626      ~0%     {7} r4 = JOIN r3 WITH Guards::AbstractValue::getDualValue_dispred#ff ON r3.<0>=Guards::AbstractValue::getDualValue_dispred#ff.<0> AND r3.<1>=Guards::AbstractValue::getDualValue_dispred#ff.<1> OUTPUT FIELDS {r3.<2>,r3.<3>,r3.<4>,r3.<5>,r3.<6>,r3.<0>,r3.<7>}
                      9293564    ~0%     {7} r5 = Guards::Internal::conditionalAssign#ffff#shared#2 AND NOT Guards::Internal::conditionalAssign#ffff#antijoin_rhs(Guards::Internal::conditionalAssign#ffff#shared#2.<0>,Guards::Internal::conditionalAssign#ffff#shared#2.<1>,Guards::Internal::conditionalAssign#ffff#shared#2.<2>,Guards::Internal::conditionalAssign#ffff#shared#2.<3>,Guards::Internal::conditionalAssign#ffff#shared#2.<4>,Guards::Internal::conditionalAssign#ffff#shared#2.<5>,Guards::Internal::conditionalAssign#ffff#shared#2.<6>)
                      9293564    ~1%     {7} r6 = SCAN r5 OUTPUT FIELDS {r5.<6>,r5.<0>,r5.<1>,r5.<2>,r5.<3>,r5.<4>,r5.<5>}
                      9293564    ~2%     {8} r7 = JOIN r6 WITH ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getBasicBlock_dispred#ff ON r6.<0>=ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getBasicBlock_dispred#ff.<0> OUTPUT FIELDS {ControlFlowGraph::ControlFlow::Internal::PreSsa::Definition::getBasicBlock_dispred#ff.<1>,r6.<2>,r6.<1>,r6.<3>,r6.<4>,r6.<5>,r6.<6>,r6.<0>}
                      1940       ~2%     {7} r8 = JOIN r7 WITH ControlFlowGraph::ControlFlow::Internal::PreBasicBlocks::PreBasicBlock::dominates_dispred#ff ON r7.<0>=ControlFlowGraph::ControlFlow::Internal::PreBasicBlocks::PreBasicBlock::dominates_dispred#ff.<0> AND r7.<1>=ControlFlowGraph::ControlFlow::Internal::PreBasicBlocks::PreBasicBlock::dominates_dispred#ff.<1> OUTPUT FIELDS {r7.<2>,r7.<1>,r7.<3>,r7.<4>,r7.<5>,r7.<6>,r7.<7>}
                      82566      ~0%     {7} r9 = r4 \/ r8
                                         return r9
```
2019-02-07 10:35:31 +01:00
Jonas Jensen
47ad280e34 Merge pull request #842 from geoffw0/gets
CPP: Clean up PotentialBufferOverflow.ql, PotentiallyDangerousFunction.ql
2019-02-07 09:27:00 +01:00
semmle-qlci
b4b37b3a7b Merge pull request #880 from esben-semmle/js/better-alert-message-1
Approved by xiemaisi
2019-02-07 08:01:21 +00:00
Max Schaefer
812cba0fe3 Merge pull request #828 from esben-semmle/js/vue-support-1
JS: basic Vue support
2019-02-07 08:00:17 +00:00
Dave Bartolomeo
f6d392089e C++: Replace getAnOperand().(XXXOperand) with getXXXOperand() 2019-02-06 22:44:53 -08:00
Dave Bartolomeo
4c23ad100e C++: Rename a few IR APIs
There are a few IR APIs that we've found to be confusingly named. This PR renames them to be more consistent within the IR and with the AST API:

`Instruction.getFunction` -> `Instruction.getEnclosingFunction`: This was especially confusing when you'd call `FunctionAddressInstruction.getFunction` to get the function whose address was taken, and wound up with the enclosing function instead.

`Instruction.getXXXOperand` -> `Instruction.getXXX`. Now that `Operand` is an exposed type, we want a way to get a specific `Operand` of an `Instruction`, but more often we want to get the definition instruction of that operand. Now, the pattern is that `getXXXOperand` returns the `Operand`, and `getXXX` is equivalent to `getXXXOperand().getDefinitionInstruction()`.

`Operand.getInstruction` -> `Operand.getUseInstruction`: More consistent with the existing `Operand.getDefinitionInstruction` predicate.
2019-02-06 22:43:49 -08:00
Robert Marsh
97c5b8ee44 Merge pull request #882 from jbj/ir-ConstantAnalysis-perf
C++: Speed up IR ConstantAnalysis
2019-02-06 22:29:09 -08:00
Dave Bartolomeo
1f873d0c9c Merge pull request #890 from aeyerstaylor/more-field-overriding
C++: Use more field overriding in IR construction
2019-02-06 17:04:43 -08:00
Max Schaefer
95185345fd Merge pull request #897 from Semmle/revert-817-closure-modules
Revert "JS: Add support for Closure modules"
2019-02-06 18:14:50 +00:00
Asger F
e46e2b2515 Revert "JS: Add support for Closure modules" 2019-02-06 17:30:45 +00:00
calum
ce7e9901cc C#: Address review comments. 2019-02-06 17:15:43 +00:00
semmle-qlci
b8be66ec48 Merge pull request #887 from asger-semmle/jsdoc-accessors
Approved by xiemaisi
2019-02-06 16:30:48 +00:00
semmle-qlci
b13c11017c Merge pull request #885 from asger-semmle/async-waterfall
Approved by xiemaisi
2019-02-06 16:30:17 +00:00
Esben Sparre Andreasen
235625d03a Merge branch 'master' into js/vue-support-1 2019-02-06 16:57:16 +01:00
semmle-qlci
09825f28ed Merge pull request #817 from asger-semmle/closure-modules
Approved by esben-semmle, xiemaisi
2019-02-06 15:51:53 +00:00
Tom Hvitved
8812f26517 C#: Address review comments 2019-02-06 13:17:47 +01:00
Tom Hvitved
c3378c44a1 C#: Prevent bad magic in getArgumentForParameter() 2019-02-06 13:09:56 +01:00
Calum Grant
dd75e5bce3 Merge pull request #877 from hvitved/csharp/matches-handle
C#: Use `matchesHandle()` instead of `getLabel()`
2019-02-06 11:02:09 +00:00
semmle-qlci
a2691b32b5 Merge pull request #851 from xiemaisi/js/post-message-star
Approved by esben-semmle
2019-02-06 09:57:04 +00:00
Asger F
abb7e63697 JS: update GlobalVariableRef.expected 2019-02-06 09:16:30 +00:00
Asger F
44939263e4 JS: update TRAP files 2019-02-06 09:12:16 +00:00
Asger F
c52ed9152f JS: handle .mjs files correctly 2019-02-06 09:12:10 +00:00
Esben Sparre Andreasen
fb19032038 JS: change notes for Vue support 2019-02-06 09:38:00 +01:00
Esben Sparre Andreasen
f15af70c02 JS: use HTML::ScriptElement::getScript in Vue 2019-02-06 09:38:00 +01:00
Esben Sparre Andreasen
5e2b1c026a JS: introduce HTML::ScriptElement::getScript() 2019-02-06 09:38:00 +01:00
Esben Sparre Andreasen
a78dd422b6 JS: add query js/vue/arrow-method-on-vue-instance 2019-02-06 09:38:00 +01:00
Esben Sparre Andreasen
ea175b2a9f JS: introduce Vue XSS sinks 2019-02-06 09:38:00 +01:00
Esben Sparre Andreasen
a6cfee5f26 JS: prevent inlining of three auxiliary Vue methods 2019-02-06 09:37:23 +01:00
Esben Sparre Andreasen
ddf9ca2505 JS: introduce base Vue model 2019-02-06 09:37:23 +01:00
Geoffrey White
2321ae911e CPP: Fix the test by adding PotentiallyDangerousFunction. 2019-02-05 17:58:30 +00:00
Geoffrey White
018450500d CPP: Fix closing tag. 2019-02-05 17:58:30 +00:00
Geoffrey White
c05df6ea4c CPP: Add reference. 2019-02-05 17:58:30 +00:00
Geoffrey White
f73a3a6a24 CPP: Explain the danger of gets a bit more in qhelp. 2019-02-05 17:58:30 +00:00
Geoffrey White
0541950c44 CPP: Clean up PotentialBufferOverflow.ql a bit. 2019-02-05 17:58:30 +00:00
Geoffrey White
2a708d3243 CPP: Change note. 2019-02-05 17:58:30 +00:00
Geoffrey White
c32e1b8000 CPP: Change the @name of PotentialBufferOverflow.ql to be in line with everything else. 2019-02-05 17:58:30 +00:00
Geoffrey White
f7e7737789 CPP: Update qhelp. 2019-02-05 17:58:30 +00:00
Geoffrey White
87a25f0cbe CPP: Update CWE tags. 2019-02-05 17:58:30 +00:00
Geoffrey White
429f53ed74 CPP: Move the 'gets' case. 2019-02-05 17:58:30 +00:00
Geoffrey White
a82832e779 CPP: Add a test that uses 'gets'. 2019-02-05 17:58:30 +00:00
Geoffrey White
bbc8e7886b CPP: Rearrange PotentiallyDangerousFunction.ql. 2019-02-05 17:58:30 +00:00
Asger F
ddd72190cb JS: change note 2019-02-05 16:59:29 +00:00
Asger F
46b996a936 JS: autoformat ¯\_(ツ)_/¯ 2019-02-05 16:52:06 +00:00
Asger F
8924aa3ee0 JS: add test case 2019-02-05 16:51:21 +00:00
Asger F
cad5a064cd JS: recognize a-sync-waterfall package 2019-02-05 16:38:47 +00:00
semmle-qlci
4b81ffab96 Merge pull request #869 from hvitved/csharp/autoformat
Approved by calumgrant
2019-02-05 16:35:10 +00:00
Tom Hvitved
37c55750f7 Merge pull request #873 from calumgrant/cs/format-getresource-strings
C#: Fix FP in cs/format-argument-unused
2019-02-05 17:12:04 +01:00
Taus Brock-Nannestad
b550da2b45 Improve change note. 2019-02-05 16:01:45 +01:00
yh-semmle
3e8f7a740c Merge pull request #838 from aschackmull/java/taint-collections
Java: Add additional taint steps through collections.
2019-02-05 09:59:24 -05:00
Esben Sparre Andreasen
b72441f9c2 JS: use StringOps:: in js/incomplete-url-substring-sanitization 2019-02-05 15:17:55 +01:00
Tom Hvitved
23b9b1eb72 C#: Cache Splits::toString() 2019-02-05 15:01:25 +01:00
Anders Schack-Mulligen
fe7add77d2 Java: Account for the repo move in NonSecurityTestClass. 2019-02-05 14:31:40 +01:00
Tom Hvitved
8c7c582e07 C#: Move successor types into own file 2019-02-05 14:27:09 +01:00
Tom Hvitved
0992e01f91 C#: Move Splitting and Reachability modules into own file 2019-02-05 14:27:09 +01:00
Tom Hvitved
3503e9b57e C#: Move PreSsa module into own file 2019-02-05 14:27:09 +01:00
alexet
59a5bec769 CPP: Use more field overriding 2019-02-05 13:07:41 +00:00
Tom Hvitved
5306d1ea0d C#: Move PreBasicBlocks module into own file 2019-02-05 13:41:50 +01:00
Asger F
51360d8772 JS: add Parameter.getJSDocTag 2019-02-05 11:35:16 +00:00
Tom Hvitved
83fb32828f C#: Move NonReturning module into own file 2019-02-05 11:50:03 +01:00
Tom Hvitved
64539b0263 C#: Move Completion.qll 2019-02-05 11:45:33 +01:00
Tom Hvitved
0211837e24 C#: Remove getUrl() predicate 2019-02-05 11:07:13 +01:00
Jonas Jensen
cad4bac548 C++: Concretize ConstantAnalysis NegateInstruction
This is just to make the QL shorter. It generates the same DIL.
2019-02-05 11:05:47 +01:00
Jonas Jensen
be35c674a7 C++: Factor out getConstantValueToPhi
This speeds up `getConstantValue`, the main predicate in
`ConstantAnalysis`, from 2.4s to 1.6s on comdb2.
2019-02-05 11:05:47 +01:00
Jonas Jensen
283bb2f6d0 C++: Factor out ConstantAnalysis BinaryInstruction
This speeds up comdb2 constant analysis from 6.5s to 4.5s.
2019-02-05 11:05:47 +01:00
Jonas Jensen
d66578eaa8 C++: Add IntegerPartial, use in ConstantAnalysis
This adds `IntegerPartial.qll`, which is similar to
`IntegerConstant.qll` except that it contains partial functions on
integers instead of total functions on optional integers. This speeds up
the constant analysis so it takes 6.5s instead of 10.3s on comdb2.
2019-02-05 11:05:47 +01:00
Tom Hvitved
d829d98165 Merge branch 'master' into csharp/autoformat 2019-02-05 10:37:42 +01:00
semmle-qlci
06ae0c421a Merge pull request #864 from jbj/ir-TIRVariable-shared
Approved by dave-bartolomeo
2019-02-05 07:55:28 +00:00
Dave Bartolomeo
dc209246aa Merge pull request #866 from jbj/ir-TInstruction-normalize
C++: Normalize TInstruction
2019-02-04 12:14:45 -08:00
semmle-qlci
f47a77b442 Merge pull request #875 from hvitved/csharp/accessor-call-revert
Approved by calumgrant
2019-02-04 19:27:38 +00:00
Dave Bartolomeo
aadd5cf202 Merge pull request #863 from jbj/ir-variableLiveOnEntryToBlock-rhs
C++: Speed up variableLiveOnEntryToBlock in IR
2019-02-04 10:47:29 -08:00
Jonas Jensen
3735cb69ce C++: No InstructionTag in SSAConstruction
This does to `SSAConstruction` what the previous commit did to
`IRConstruction`. An instruction in `SSAConstruction` is now defined in
terms of how it was created rather than what it can be queried for.
Effectively, this defines `TInstruction` as `TInstructionTag` was
defined before and then removes `TInstructionTag` from
`SSAConstruction`. This also has the benefit of removing the concept of
an instruction tag from the public predicates on `Instruction`.
2019-02-04 19:43:17 +01:00
Jonas Jensen
8ae3551ec1 C++: Normalize TInstruction in raw IR
This definition was denormalized to the extent that an instruction was
defined in terms of the six main attributes it could be queried for.
This made it possible to do multi-column joins on those six attributes,
but it doesn't appear that this feature was useful in practice. The main
multi-column join that was in use was on the pair of
(`TranslatedElement, InstructionTag`), but the `TranslatedElement` was
not part of the `TInstruction`.

This commit changes `TInstruction` to be defined in terms of what it's
_built from_ (`TranslatedElement, InstructionTag`) instead. This makes
it possible to do multi-column joins on those two components, and then
there are separate predicates (usually with two columns) to query
instruction attributes, replacing the many uncached projections from
`MkInstruction` that were generated before.

An immediate advantage is that an `Expr` with multiple types will no
longer give rise to multiple `Instruction`s, fixing most of the errors
from the sanity query `ambiguousSuccessors`. The code inside
`IRConstruction.qll` becomes simpler and hopefully faster as there is no
longer a translation from `TranslatedElement` to `Locatable` and back
again.
2019-02-04 19:43:17 +01:00
Jonas Jensen
3e03835630 C++: Only create variables in FunctionIRs
The previous commit had the side effect that `IRVariable`s were created
for all `Functions`, including those that did not have IR. This commit
restricts all `TIRVariable` constructors to functions that have IR.
2019-02-04 19:34:16 +01:00
Taus Brock-Nannestad
895b237e3c Python: Make "Modification of parameter with default" flow-sensitive. 2019-02-04 19:05:04 +01:00
Dave Bartolomeo
6d3d9025f7 Merge pull request #867 from jbj/ir-ignoreExprAndDescendants-perf
C++: Replace FastTC with iteration in ignoreExpr
2019-02-04 09:26:32 -08:00
Dave Bartolomeo
7345c921d9 Merge pull request #857 from jbj/ir-getInstruction
C++: Fix TranslatedElement.getInstruction perf
2019-02-04 09:24:00 -08:00
Robert Marsh
411c285aa3 Merge pull request #870 from jbj/ir-shortestDistances
C++: Use shortestDistances HOP for IR BB indexes
2019-02-04 09:19:15 -08:00
Robert Marsh
3a092faebf Merge pull request #865 from p-snft/large-parameter-const-reference
Fix reccomendation for LargeParameter (C++)
2019-02-04 09:18:03 -08:00
Tom Hvitved
13503d068c C#: Use matchesHandle() instead of getLabel() 2019-02-04 16:20:47 +01:00
Asger F
79b9784b08 JS: handle ES2015 modules compiling to Node.js modules 2019-02-04 14:26:24 +00:00
Asger F
5e10e955ee JS: update trivial TRAP changes 2019-02-04 14:25:05 +00:00
Asger F
4b32d8c63f JS: refactor SourceType/Platform 2019-02-04 14:24:39 +00:00
Asger F
ac6b9d1282 JS: add TRAP test with closure modules 2019-02-04 14:24:39 +00:00
Asger F
cac09cf154 JS: Update TRAP output 2019-02-04 14:24:39 +00:00
Asger F
be105b6348 JS: add dbscheme upgrade script 2019-02-04 14:21:34 +00:00
Asger F
8f3b0f584a JS: Extract predicates for ES2015/closure modules 2019-02-04 14:21:34 +00:00
Asger F
51fe31d049 JS: fix FPs in DeadStoreOfLocal 2019-02-04 14:21:34 +00:00
Asger F
6a451a6b53 JS: Fix InvalidExport.ql 2019-02-04 14:21:34 +00:00
Asger F
72fe63074a JS: convert tabs to spaces 2019-02-04 14:21:34 +00:00
Asger F
df88534b36 JS: use PropWrite in exports() predicate 2019-02-04 14:21:34 +00:00
Asger F
c707935841 JS: add Closure::moduleImport and Closure::moduleMember 2019-02-04 14:21:34 +00:00
Asger F
82c0756248 JS: autoformat 2019-02-04 14:21:34 +00:00
Asger F
2ae926462c JS: Move closure code into a module 2019-02-04 14:21:34 +00:00
Asger F
6bcae5e7c2 JS: address comments 2019-02-04 14:21:34 +00:00
Asger F
9fd4e81f20 JS: add change note 2019-02-04 14:21:34 +00:00
Asger F
6a63c3f149 JS: raise precision of global accesses 2019-02-04 14:21:34 +00:00
Asger F
9589ccd40d JS: support imports/exports for closure library code 2019-02-04 14:21:34 +00:00
Asger F
30ba7aedfe JS: split SourceType.MODULE into two 2019-02-04 14:21:34 +00:00
Asger F
f00b16e500 JS: recognize Closure modules files as modules 2019-02-04 14:21:34 +00:00
Tom Hvitved
b4b6fdd12b C#: Revert recent change to AccessorCall
The recent change to `AccessorCall` on dd99525566 resulted
in some bad join-orders, so I have (partly) reverted them. This means that the issues
orignally addressed by that change are now reintroduced, and I plan to instead apply a
fix to the CFG, which--unlike the original fix--should be able to handle multi-property-tuple
assignments.
2019-02-04 15:14:18 +01:00
calum
d79201ec47 C#: Change notes. 2019-02-04 12:53:18 +00:00
calum
7d17724cae C#: The empty string is not considered a format string for this query. 2019-02-04 12:53:12 +00:00
calum
eb0036172e C#: Add test for false-positive. 2019-02-04 12:30:43 +00:00
Jonas Jensen
45a995ba52 C++: Accept test changes from last commit 2019-02-04 13:00:28 +01:00
calum
f8870e78e7 C#: Fix test. 2019-02-04 11:51:04 +00:00
semmle-qlci
e195ac996e Merge pull request #868 from xiemaisi/js/discard-tokens-early
Approved by esben-semmle
2019-02-04 11:32:03 +00:00
Taus
32cc7c7cd9 Merge pull request #858 from markshannon/python-a-few-more-unknowns
Python: Slight improvement to reachability in points-to
2019-02-04 12:14:50 +01:00
Nick Rolfe
fa07364214 Vim syntax highlighting and file-type detection 2019-02-04 10:48:32 +00:00
Jonas Jensen
8368c37781 C++: Use shortestDistances HOP for IR BB indexes
This doesn't make it much faster, but it reduces the debug output
volume. It also simplifies the code.

I've found this change necessary when I compute the full IR on a
Wireshark snapshot in QL4E. Without it, Eclipse runs out of memory
because the console log is too large.
2019-02-04 11:40:11 +01:00
Tom Hvitved
910995af90 C#: Autoformat QL code 2019-02-04 10:32:30 +01:00
Max Schaefer
7be3336aaf JavaScript: Document per-function caches in CFG extractor. 2019-02-04 08:17:21 +00:00
Max Schaefer
6ad45b2451 JavaScript: Temporarily remove unstable test. 2019-02-04 08:10:39 +00:00
Jonas Jensen
60141bf317 C++: ignoreExprAndDescendants QL-796 workaround
The new predicate `isOrphan` gets inlined into
`ignoreExprAndDescendants`, whose performance improves from

    TranslatedElement::ignoreExprAndDescendants#f .. 23.4s (executed 9 times)

to

    TranslatedElement::ignoreExprAndDescendants#f ... 4.3s (executed 9 times)

This dramatic improvement is not only due to eliminating a type check in
the recursive case. Removing the type check from the other base cases
also enabled them to get better join orders.
2019-02-03 16:55:12 +01:00
Jonas Jensen
66e7c26d4e C++: Replace FastTC with iteration in ignoreExpr
Before, `ignoreExprAndDescendants` and its related predicates had this
timing on Wireshark.

    #TranslatedElement::getRealParent#ffPlus#swapped ......... 25.7s
    TranslatedElement::ignoreExprAndDescendants#f ............ 16.9s
    TranslatedElement::getRealParent#ff ...................... 7.2s
    TranslatedElement::ignoreExpr#f .......................... 4.8s
    TranslatedElement::ignoreExpr#f#antijoin_rhs ............. 3.2s
    TranslatedElement::getRealParent#ff_10#higher_order_body . 2.2s

After, it looks like this

    TranslatedElement::ignoreExprAndDescendants#f ............ 23.4s (executed 9 times)
    TranslatedElement::getRealParent#ff ...................... 6.3s
    TranslatedElement::ignoreExpr#f#antijoin_rhs ............. 4.8s
    TranslatedElement::ignoreExpr#f .......................... 3.7s
    TranslatedElement::getRealParent#ff_10#join_rhs .......... 2.5s
    project#TranslatedElement::getRealParent#ff .............. 1.3s
2019-02-03 16:55:12 +01:00
Patrik Schönfeldt
ac249cdbbe Fix reccomendation for LargeParameter (C++)
The previous reccomentation changed the behaviour of the code.
A user following the advice might have broken her/his code:
With call-by-value, the original parameter is not changed.
With a call-by-reference, however, it may be changed. To be sure,
nothing breaks by blindly following the advice, suggest to pass a
const reference.
2019-02-03 15:44:13 +01:00
Jonas Jensen
f8318ef96f C++: Move TIRVariable to its own file
The `SSAConstruction.getNewIRVariable` was very slow on Wireshark. This
was probably because it couldn't join on multiple columns
simultaneously. Instead of improving the join, I observed that the
`TIRVariable` type was the same between all three IR stages except for a
few occurrences of `FunctionIR` that could easily be changed to
`Function`. By sharing `TIRVariable` between all the stages, we avoid
recomputing it and translating it between every stage, turning the slow
`getNewIRVariable` predicate into a no-op.

This change means that later stages of the IR can't introduce new
variables, but that was already the case because
`config/identical-files.json` forced all three `IRVariable.qll` files to
be identical.
2019-02-03 13:36:30 +01:00
Jonas Jensen
3afefce8ef C++: Improve order of parameters in SSA def/use
This changes the order so the parameter that's sometimes projected away
is the last one, making the projection cheap.
2019-02-03 13:34:02 +01:00
Jonas Jensen
4ac22253eb C++: Speed up variableLiveOnEntryToBlock in IR
This predicate computed a local CP between all defs and uses of the same
virtual variable in a basic block. This wasn't a problem in
`unaliased_ssa`, but it became a huge problem in `aliased_ssa`, probably
because many variables can be modelled with a single virtual variable
there.

Before this commit, evaluation of `aliased_ssa`'s
`variableLiveOnEntryToBlock#ff#antijoin_rhs` on Wireshark took 80
_minutes_. After this commit, that predicate and its immediate
dependencies take around 5 _seconds_.
2019-02-03 13:25:18 +01:00
jf205
6243c722c6 Merge pull request #861 from jbj/revert-dbscheme-docs
C++: Revert doc-related changes to dbscheme
2019-02-01 10:59:18 +00:00
Max Schaefer
9bfde9553d Merge pull request #839 from asger-semmle/field-propwrite
JS: add PropWrites cases for instance fields initialization
2019-02-01 10:56:25 +00:00
semmle-qlci
222738072d Merge pull request #840 from esben-semmle/js/propagate-sound-avalue
Approved by xiemaisi
2019-02-01 09:23:43 +00:00
Jonas Jensen
e81d197ebd C++: Revert doc-related changes to dbscheme
These changes to the dbscheme were made in 7cc1442ecb and a98aae0a24
without a corresponding upgrade script in the internal repo.
2019-02-01 10:01:29 +01:00
Jonas Jensen
ee4526687d Merge pull request #859 from rdmarsh2/rdmarsh/cpp/ir-performance-1
C++: use field overrides in TranslatedElement and subclasses
2019-02-01 08:43:20 +01:00
Robert Marsh
e1d289ffb4 Merge pull request #759 from calumgrant/cs/interface-tostring
C#: Remove FPs from cs/call-to-object-tostring
2019-01-31 12:03:49 -08:00
Robert Marsh
f3b4cb4640 Merge pull request #848 from calumgrant/cs/lgtm-suppress-alerts
C#: Suppress cs/catch-of-all-exceptions
2019-01-31 12:03:26 -08:00
calum
5144f89a5b C#: Fix dataflow. 2019-01-31 19:53:46 +00:00
Robert Marsh
5327ca7f77 Merge pull request #812 from jbj/ir-backedge
C++: IR back-edge detection based on TranslatedStmt
2019-01-31 11:28:21 -08:00
Dave Bartolomeo
bbe8e7ebfc C++: fix typo, ThrowExpr -> ReThrowExpr
Co-Authored-By: rdmarsh2 <rdmarsh2@gmail.com>
2019-01-31 10:47:17 -08:00
Dave Bartolomeo
ab1f96fb2c Merge pull request #770 from jbj/cfg-static-init-pr
C++: Add addresses to `Expr.isConstant`
2019-01-31 10:24:48 -08:00
Dave Bartolomeo
b0b2fc80c1 Merge pull request #855 from jbj/ir-getRealParent
C++: Simplify TranslatedElement.getRealParent
2019-01-31 10:15:30 -08:00
Dave Bartolomeo
8896d3bf88 Merge pull request #856 from jbj/ir-getInstructionOperandDefinition
C++: Speed up `getInstructionOperandDefinition`
2019-01-31 10:11:59 -08:00
calum
92eb857dac C#: Add documentation. 2019-01-31 17:46:28 +00:00
calum
4274854f0f C#: Refactor TCallableFlowSinkDelegateArg 2019-01-31 16:03:23 +00:00
Robert Marsh
ffb46638b0 C++: use more field overrides in IR generation 2019-01-31 07:47:21 -08:00
Robert Marsh
fa56981bce C++: use field overrides in TranslatedExpr 2019-01-31 07:47:21 -08:00
calum
713c7a8c20 C#: Refactor TCallableFlowSourceDelegateArg 2019-01-31 15:42:09 +00:00
Mark Shannon
24d678b869 Python: Points-to; let values with no boolean constant value flow through pi-nodes. 2019-01-31 15:15:49 +00:00
Mark Shannon
f190f83406 Python: Give most non-self instance attributes the 'unknown' value; improves reachability analysis. 2019-01-31 15:05:13 +00:00
Jonas Jensen
be2a480394 Merge pull request #843 from geoffw0/strtoul
CPP: Improve ArithmeticTainted.ql
2019-01-31 07:04:17 -08:00
calum
18ff4583ef C#: Refactor TCallableFlowSourceArg to remove callable. 2019-01-31 12:05:26 +00:00
Jonas Jensen
b55573ebe3 C++: Accept test changes in ir_gvn.expected 2019-01-31 10:08:16 +01:00
Max Schaefer
b87abc9602 JavaScript: Extend suspiciousCredentials predicate to recognise authKey and similar. 2019-01-31 09:03:23 +00:00
Max Schaefer
87e62f0bd5 JavaScript: Teach PostMessageStar to reason about partially tainted objects. 2019-01-31 08:59:47 +00:00
Max Schaefer
aeb8cc62b2 JavaScript: Reclassify PostMessageStar as CWE-201. 2019-01-31 08:08:52 +00:00
Jonas Jensen
35d7fb5322 C++: Fix TranslatedElement.getInstruction perf
This relation was almost 40x the size it needed to be on Wireshark
because it lacked a restriction on the `tag` parameter. To implement
that restriction efficiently, I had to split the relation in two to
dictate the join order.

With the fix, `getInstruction` now computes the same as
`getInstructionTranslatedElementAndTag`, so the latter could be
simplified.

I made a corresponding change to `TranslatedElement.getTempVariable` for
the sake of consistency.
2019-01-31 08:45:02 +01:00
Jonas Jensen
947634f66f C++: Speed up getInstructionOperandDefinition
A part of `SSAConstruction.getInstructionOperandDefinition` was more
expensive than it had to be. On a ChakraCore snapshot, this changes the
tuple counts from

    3020569 ~2%       {3} r40 = JOIN OperandTag::TUnmodeledUseOperand#f WITH Instruction::Instruction::getFunction_dispred#ff CARTESIAN PRODUCT OUTPUT FIELDS {Instruction::Instruction::getFunction_dispred#ff.<0>,OperandTag::TUnmodeledUseOperand#f.<0>,Instruction::Instruction::getFunction_dispred#ff.<1>}
    62405   ~0%       {3} r41 = JOIN r40 WITH Instruction::UnmodeledUseInstruction#class#fffffff ON r40.<0>=Instruction::UnmodeledUseInstruction#class#fffffff.<0> OUTPUT FIELDS {r40.<2>,r40.<1>,r40.<0>}
    2868421 ~1%       {3} r42 = JOIN r41 WITH Instruction::Instruction::getFunction_dispred#ff_10#join_rhs ON r41.<0>=Instruction::Instruction::getFunction_dispred#ff_10#join_rhs.<0> OUTPUT FIELDS {Instruction::Instruction::getFunction_dispred#ff_10#join_rhs.<1>,r41.<1>,r41.<2>}
    62405   ~0%       {3} r43 = JOIN r42 WITH Instruction::UnmodeledDefinitionInstruction#class#fffffff ON r42.<0>=Instruction::UnmodeledDefinitionInstruction#class#fffffff.<0> OUTPUT FIELDS {r42.<2>,r42.<1>,r42.<0>}

to

    (0s) Starting to evaluate predicate SSAConstruction::Cached::getUnmodeledUseInstruction#ff
    (0s) Tuple counts:
    62405   ~0%     {2} r1 = JOIN Instruction::UnmodeledUseInstruction#class#fffffff WITH Instruction::Instruction::getFunction_dispred#ff ON Instruction::UnmodeledUseInstruction#class#fffffff.<0>=Instruction::Instruction::getFunction_dispred#ff.<0> OUTPUT FIELDS {Instruction::Instruction::getFunction_dispred#ff.<1>,Instruction::Instruction::getFunction_dispred#ff.<0>}
                                      return r1
    ...
    75716   ~0%       {3} r40 = JOIN OperandTag::TUnmodeledUseOperand#f WITH FunctionIR::FunctionIR::getUnmodeledDefinitionInstruction#ff CARTESIAN PRODUCT OUTPUT FIELDS {FunctionIR::FunctionIR::getUnmodeledDefinitionInstruction#ff.<0>,OperandTag::TUnmodeledUseOperand#f.<0>,FunctionIR::FunctionIR::getUnmodeledDefinitionInstruction#ff.<1>}
    62405   ~0%       {3} r41 = JOIN r40 WITH FunctionIR::FunctionIR::getUnmodeledUseInstruction#ff ON r40.<0>=FunctionIR::FunctionIR::getUnmodeledUseInstruction#ff.<0> OUTPUT FIELDS {FunctionIR::FunctionIR::getUnmodeledUseInstruction#ff.<1>,r40.<1>,r40.<2>}
2019-01-31 08:43:00 +01:00
Jonas Jensen
5b685383c8 C++: Simplify TranslatedElement.getRealParent
Now that we have `Expr.getParentWithConversions`, we can implement
`TranslatedElement.getRealParent` simpler. This implementation also
avoids recursion.
2019-01-31 08:41:29 +01:00
Geoffrey White
642faa6cf0 CPP: Change note. 2019-01-30 18:38:19 +00:00
Geoffrey White
07adf6f201 CPP: Handle array accesses. 2019-01-30 18:36:32 +00:00
Geoffrey White
4685f193f5 CPP: Widen varMaybeStackAllocated. 2019-01-30 18:36:32 +00:00
Geoffrey White
c87036f2fd CPP: Simplify. 2019-01-30 18:36:32 +00:00
Geoffrey White
276738a435 CPP: Auto-format the query. 2019-01-30 18:36:32 +00:00
Geoffrey White
25e11512db CPP: Add a test of ReturnStackAllocatedMemory. 2019-01-30 18:36:31 +00:00
Asger F
720f442ea5 JS: Rename to StaticClassMemberAsPropWrite 2019-01-30 15:49:21 +00:00
semmle-qlci
fc5b9dd55e Merge pull request #837 from asger-semmle/hardcoded-empty-string
Approved by esben-semmle
2019-01-30 13:40:39 +00:00
semmle-qlci
24c8a47bb1 Merge pull request #841 from asger-semmle/private-higher-order-call
Approved by esben-semmle
2019-01-30 13:34:04 +00:00
Max Schaefer
17ce21c481 JavaScript: Remove an unused import in TrapTests.java. 2019-01-30 12:29:20 +00:00
Max Schaefer
5eba486d34 JavaScript: Clear per-function CFG caches after each function. 2019-01-30 12:29:20 +00:00
Esben Sparre Andreasen
cfc53ade69 JS: add more tests for js/incomplete-url-substring-sanitization 2019-01-30 12:57:03 +01:00
Felicity Chapman
54242f4009 Merge pull request #849 from jf205/locations
Update links to QL help topics in GH repo files (SD-2999)
2019-01-30 11:06:22 +00:00
Max Schaefer
769e407c24 JavaScript: Add new query PostMessageStar. 2019-01-30 10:26:43 +00:00
Calum Grant
9b7f4a8ce5 Merge pull request #845 from hvitved/csharp/get-type-non-null
C#: Teach guards library about `object.GetType()`
2019-01-30 10:08:05 +00:00
Calum Grant
722402fc89 Merge pull request #825 from hvitved/csharp/cfg/splitting-performance
C#: Improve performance of CFG split set computation
2019-01-30 10:05:25 +00:00
james
7cc1442ecb Update link text 2019-01-30 09:44:07 +00:00
Mark Shannon
50a75d2b4f Python: Fully module state of module using global variables and '$' pseudo-variable. 2019-01-30 09:34:17 +00:00
Esben Sparre Andreasen
321b3f1ab5 JS: use ports to sharpen js/incomplete-url-substring-sanitization 2019-01-30 10:18:00 +01:00
james
a98aae0a24 update links to lgtm.com/docs 2019-01-30 08:02:03 +00:00
james
81137aa7b4 update links to locations in .ql files 2019-01-30 08:02:02 +00:00
james
9d1a050f35 update links to locations in .qll files 2019-01-30 08:01:49 +00:00
calum
f39daaeeab C#: Suppress cs/catch-of-all-exceptions 2019-01-29 18:22:12 +00:00
calum
d63df71a8a C#: Fix merge conflict. 2019-01-29 18:15:33 +00:00
calum
423513169f C#: Address review comments. Introduce Member::isEffectivelyPublic() because isEffectivelyPrivate and isEffectivelyInternal are almost always used together. 2019-01-29 18:05:29 +00:00
calum
26365c82f7 C#: Update change notes. 2019-01-29 18:04:52 +00:00
calum
931b6b4ee5 C#: Exclude interfaces and abstract classes from cs/call-to-object-tostring 2019-01-29 18:04:26 +00:00
Taus
83e2689645 Merge pull request #844 from markshannon/python-hide-magic-variables-in-test
Python tests: Further hiding of special ESSA variables in tests
2019-01-29 18:51:06 +01:00
Mark Shannon
4c0f123748 Python: switch from '*' to '$' pseudo variable to track module state. 2019-01-29 17:04:08 +00:00
Taus
08fcb984a8 Implement getACall suggestion. 2019-01-29 17:59:45 +01:00
Taus
3d7821c83a Merge pull request #820 from markshannon/python-incomplete-url-sanitize
Python: Two new queries for URL and hostname sanitization (CWE-020).
2019-01-29 17:48:42 +01:00
Taus Brock-Nannestad
edd4468d08 Fix tests by stubbing relevant os functions. 2019-01-29 17:27:14 +01:00
Tom Hvitved
16d3399039 C#: Teach guards library about object.GetType() 2019-01-29 16:40:36 +01:00
Tom Hvitved
87bb4a1d56 C#: Add null guard test involving GetType() 2019-01-29 16:32:13 +01:00
Taus
6f7c96db54 Merge branch 'master' into python-unsafe-use-of-mktemp 2019-01-29 16:12:53 +01:00
Taus Brock-Nannestad
de63f01f67 Update change note. 2019-01-29 16:10:46 +01:00
Taus Brock-Nannestad
9a9d902cfb Add support for os.tempnam and os.tmpnam. 2019-01-29 16:08:32 +01:00
Mark Shannon
9820249c71 Python tests: Further hiding of special ESSA variables in tests, to ease transition from '*' to '$' variable. 2019-01-29 15:06:47 +00:00
Mark Shannon
7fe3c3d516 Merge branch 'master' into python-mutating-descriptor 2019-01-29 14:46:33 +00:00
Taus
9adb19f3a9 Merge branch 'master' into python-incomplete-url-sanitize 2019-01-29 14:17:37 +01:00
Max Schaefer
e9500e8b75 JavaScript: Update trap tests. 2019-01-29 13:01:03 +00:00
Max Schaefer
6013b918fc JavaScript: Extract tokens and comments before AST.
This allows us to discard token/comment information sooner, thereby reducing heap pressure for very large files.
2019-01-29 13:00:17 +00:00
Max Schaefer
aa54d67301 JavaScript: Update trap tests. 2019-01-29 12:59:42 +00:00
Max Schaefer
99a4f34b7a JavaScript: Omit numlines for functions. 2019-01-29 12:59:33 +00:00
Max Schaefer
a480c6ecaa JavaScript: Implement LoC counting for functions in QL. 2019-01-29 12:58:44 +00:00
Max Schaefer
c09c35a737 JavaScript: Update trap tests. 2019-01-29 12:58:41 +00:00
Max Schaefer
d6c3ae2fb4 JavaScript: Fix bug in extraction of next_token. 2019-01-29 12:58:32 +00:00
Max Schaefer
ea429f4fbe JavaScript: Add test case exposing bug in getNextToken. 2019-01-29 12:50:31 +00:00
Jonas Jensen
d776d9f903 Merge pull request #821 from geoffw0/query-tags-case
CPP: Improve ArrayArgSizeMismatch.ql
2019-01-29 03:52:52 -08:00
Asger F
9e87bf37ea JS: make higherOrderCall private 2019-01-29 11:50:46 +00:00
Asger F
60cef60c1d JS: ensure PropWrites exist for all instance members 2019-01-29 10:12:54 +00:00
Esben Sparre Andreasen
5d5900a534 JS: change notes for improved interprocedural type inference 2019-01-29 10:21:36 +01:00
Esben Sparre Andreasen
0d1f4270d6 JS: introduce SsaVarAccessWithNonLocalAnalysis 2019-01-29 10:20:36 +01:00
Esben Sparre Andreasen
2683a9b43a JS: add testss for js/trivial-conditional 2019-01-29 10:19:03 +01:00
Max Schaefer
e2f27014b5 JavaScript: Introduce suspiciousCredentials predicate (from C# library). 2019-01-29 09:14:43 +00:00
Max Schaefer
a8dd97a2c9 JavaScript: Pull reasoning about encode/encrypt-like calls into library. 2019-01-29 09:14:23 +00:00
Max Schaefer
1fe4c44b36 JavaScript: Bring a few doc comments into line with style guide. 2019-01-29 09:13:53 +00:00
semmle-qlci
a5aee9ed0f Merge pull request #833 from esben-semmle/js/sharpen-cond
Approved by xiemaisi
2019-01-29 08:03:06 +00:00
Taus
1d28c63703 Merge pull request #810 from markshannon/python-hide-magic-variables
Python hide magic variables
2019-01-28 23:21:31 +01:00
Taus
0f5b21e392 Merge pull request #807 from markshannon/python-insecure-file-permission
Python: Weak file permissions query.
2019-01-28 23:21:10 +01:00
semmle-qlci
bf64fee4bd Merge pull request #790 from rdmarsh2/rdmarsh/cpp/futile-params
Approved by semmledocs-ac
2019-01-28 22:11:44 +00:00
Robert Marsh
9642a78bde C++: add FutileParams.ql to C++ suite
In theory this query will produce no results on C++ code; in practice, I
suspect the "cpp" suite is often run on code compiled as C, so it is
likely to be worth running anyways.
2019-01-28 09:40:19 -08:00
Geoffrey White
b0805f8e79 CPP: Adjust ArithmeticTainted.ql so that it can work on non-VariableAccesses. 2019-01-28 17:36:56 +00:00
Robert Marsh
54fdf9f29d C++/Docs: respond to doc comments on PR 2019-01-28 09:34:45 -08:00
Geoffrey White
f1dc538796 CPP: Add a test using strtoul in a taint query. 2019-01-28 16:59:02 +00:00
Taus
15643d1bb6 Merge pull request #814 from markshannon/python-fix-tornado-request-path
Python: Fix tornado and twisted request attribute tracking.
2019-01-28 17:38:34 +01:00
Calum Grant
c86e6bd6ff Merge pull request #826 from hvitved/csharp/autobuild/dotnet-install-script-cleanup
C#: Cleanup dotnet install script after installation in autobuilder
2019-01-28 16:33:55 +00:00
Calum Grant
eef1abfa69 Merge pull request #743 from hvitved/csharp/dataflow-splitting
C#: Teach data flow library about CFG splitting
2019-01-28 16:31:24 +00:00
Asger F
5815aa1e8b JS: add test case to PropWrite tests 2019-01-28 15:43:52 +00:00
Asger F
383cadb25b JS: add PropWrite for instance fields with initializer 2019-01-28 15:40:30 +00:00
Asger F
7a4af4af6d JS: add PropWrite instance for parameter fields 2019-01-28 15:40:30 +00:00
Asger F
dacde5da12 JS: restrict ClassMemberAsPropWrite to static members 2019-01-28 15:40:25 +00:00
Taus
c503ec4608 Merge pull request #806 from markshannon/python-points-to-remove-some-negation
Python: Remove some negation from points-to, in preparation for ADT Objects.
2019-01-28 16:25:18 +01:00
Taus
f61e7b66cc Merge pull request #835 from markshannon/python-compare-is-enum
Python: Fix 'comparison using is' query to account for enum members.
2019-01-28 16:22:57 +01:00
Mark Shannon
39705cf733 Python: Clarify predicate a bit. 2019-01-28 14:33:39 +00:00
Mark Shannon
6d553ae2be Python: Check os.open as well as os.chmod for weak file permissions. 2019-01-28 14:26:16 +00:00
Anders Schack-Mulligen
a29f615da0 Java: Add additional taint steps through collections. 2019-01-28 14:34:09 +01:00
Tom Hvitved
86721ff800 C#: Add more documentation to SuccSplits module 2019-01-28 14:12:17 +01:00
Asger F
5d4192ce0a JS: change note 2019-01-28 13:04:28 +00:00
Taus
e891ab7a54 Merge pull request #834 from markshannon/python-move-test-to-internal
Python: Remove AST test (it will be added to the extractor tests).
2019-01-28 14:03:33 +01:00
Asger F
3245142203 JS: Dont flag empty string as hardcoded username 2019-01-28 13:01:52 +00:00
Mark Shannon
4e5d4e265c Add change note. 2019-01-28 13:01:04 +00:00
Mark Shannon
3992346add Python: Fix up mutating-descriptor query to only flag mutation when they occur during descriptor protocol. 2019-01-28 12:57:18 +00:00
Mark Shannon
53fbf51ee8 Python: Fix handling of enum members in python/ql/src/Expressions/IsComparisons.qll. 2019-01-28 12:20:31 +00:00
Mark Shannon
5da209f876 Python: add failing test for comparison using 'is' and enum members. 2019-01-28 12:19:54 +00:00
Mark Shannon
1bec219048 Python: Remove AST test (it will be added to the extractor tests). 2019-01-28 11:41:12 +00:00
Mark Shannon
b841ecbb7c Python: Fix tornado and twisted request attribute tracking; 'path' attribute can be trusted, but 'uri' and 'arguments' cannot. 2019-01-28 11:26:00 +00:00
Jonas Jensen
ccfb1c229a Merge pull request #831 from geoffw0/query-tags-5
CPP: Tweak tags for consistency
2019-01-28 10:55:09 +01:00
Geoffrey White
bf7cdad736 CPP: Change note. 2019-01-28 09:31:06 +00:00
Esben Sparre Andreasen
239fe6e419 fixup! JS: sharpen the js/trivial-conditional whitelist 2019-01-28 10:18:03 +01:00
semmle-qlci
962416ffc2 Merge pull request #805 from asger-semmle/callback-taint-source
Approved by xiemaisi
2019-01-28 08:45:37 +00:00
semmle-qlci
8b029a2d9f Merge pull request #827 from xiemaisi/js/duplicate-toplevel-percent
Approved by esben-semmle
2019-01-28 08:40:23 +00:00
Jonas Jensen
4d441a3bdb Merge pull request #824 from geoffw0/fread
CPP: Add 'fread' to BufferAccess.qll
2019-01-28 09:07:22 +01:00
Jonas Jensen
0dad04bd7e Merge pull request #829 from geoffw0/deprecate-fpv
CPP: Deprecate FunctionPointerVariable and FunctionPointerMemberVariable
2019-01-28 08:47:49 +01:00
semmle-qlci
65b64c7c05 Merge pull request #645 from sb-semmle/configuration-file-library
Approved by yh-semmle
2019-01-26 02:06:16 +00:00
Robert Marsh
9decbd9c9f C++: new irreducible CFG test for range analysis 2019-01-25 13:12:40 -08:00
Esben Sparre Andreasen
ef3b107cc1 JS: sharpen the js/trivial-conditional whitelist 2019-01-25 18:19:45 +01:00
Geoffrey White
1328cb8013 CPP: Tweak tags for consistency across near duplicate queries. 2019-01-25 16:50:05 +00:00
Mark Shannon
3850f87879 Make qhelp for 'Incomplete URL substring sanitization' consistent across languages. 2019-01-25 16:47:23 +00:00
Geoffrey White
98ba308207 CPP: Use memberMayBeVarSize. 2019-01-25 16:40:11 +00:00
Geoffrey White
c527f9c90c CPP: Upgrade precision to high. 2019-01-25 16:38:25 +00:00
Jonas Jensen
c90d4bb24c Merge pull request #822 from geoffw0/query-tags-4
CPP: Query tags 4
2019-01-25 17:08:56 +01:00
semmle-qlci
d8947a71a5 Merge pull request #735 from asger-semmle/string-ops
Approved by xiemaisi
2019-01-25 15:15:19 +00:00
Taus
fc00e0a64a Merge pull request #796 from markshannon/python-import-used-in-doctest
Python: Fix 'unused import' for doctests and typehints.
2019-01-25 16:14:08 +01:00
Asger F
ccbfaa7c9e JS: explain return step more thoroughly 2019-01-25 15:12:24 +00:00
Geoffrey White
7bc734aa50 CPP: Deprecate FunctionPointerVariable and FunctionPointerMemberVariable. 2019-01-25 14:57:37 +00:00
Max Schaefer
254fafc6ce JavaScript: Round down percentage in DuplicateToplevel.ql.
All the other duplication queries already do this.
2019-01-25 22:44:07 +08:00
Max Schaefer
39191ed6f1 JavaScript: Add more statements to test cases for DuplicateToplevel.
Now both `a.js` and `b.js` have ten (non-block) statements, which allows for more interesting tests.
2019-01-25 22:42:51 +08:00
Geoffrey White
704a220a29 CPP: Add query ID to change note. 2019-01-25 14:42:44 +00:00
Geoffrey White
f98abd6bf8 CPP: Add query ID to change note. 2019-01-25 14:41:12 +00:00
Jonas Jensen
ba8bf94d7b C++: Account for chi nodes in back-edge detection 2019-01-25 15:32:19 +01:00
Jonas Jensen
560dbdf984 C++: Test demonstrating chi node back edge bug
This test shows that the back-edge detection does not properly account
for chi nodes in the translation to aliased SSA.
2019-01-25 15:28:53 +01:00
Tom Hvitved
ed8112a538 C#: Cleanup dotnet install script after installation in autobuilder 2019-01-25 15:26:03 +01:00
Tom Hvitved
50522caa6e C#: Improve performance of CFG split set computation
Rewrite the predicate `succSplits()` and the construction of the IPA type `TSplits`.
The two are now mutually dependent, see more in the comment for the module
`SuccSplits`.
2019-01-25 14:35:56 +01:00
Jonas Jensen
9963270d63 C++: Annotate back edges in IR debug output 2019-01-25 14:16:45 +01:00
Geoffrey White
95eea5cc00 CPP: Change note. 2019-01-25 13:08:28 +00:00
Geoffrey White
1a044a0a22 CPP: Add 'fread' to BufferAccess.qll. 2019-01-25 12:58:25 +00:00
Geoffrey White
fd6365838b CPP: Add test cases involving fread. 2019-01-25 12:58:25 +00:00
semmle-qlci
247d615c01 Merge pull request #802 from Semmle/xiemaisi-patch-5-1
Approved by asger-semmle
2019-01-25 12:32:43 +00:00
Mark Shannon
6ddbed7d95 Python: Minor tweaks to qldoc and release note. 2019-01-25 11:34:41 +00:00
Jonas Jensen
62509ffb69 C++: Add a back-edge safeguard
This prevents loops of non-back-edges on ChakraCore (see #811).
2019-01-25 12:12:31 +01:00
Asger F
8294aeea74 JS: fix doc comments 2019-01-25 11:12:07 +00:00
Tom Hvitved
078becc57b C#: Address review comments 2019-01-25 12:06:34 +01:00
Asger F
c48b529846 JS: autoformat 2019-01-25 11:06:31 +00:00
Asger F
3bbe542ef4 JS: fix whitespace 2019-01-25 11:06:17 +00:00
Jonas Jensen
5b2b961a44 C++: Fix comment (edge is not unique) 2019-01-25 11:28:23 +01:00
Jonas Jensen
34659422db C++: Simplify isStrictlyForwardGoto
We had an existing `Location.isBefore` predicate that was just right for
this use case. Performance is great thanks to magic.
2019-01-25 09:59:28 +01:00
Jonas Jensen
6d09a9b324 C++: Enable range analysis for irreducible CFGs
This adds one new test result (`i >= 0` on line 130).
2019-01-25 09:31:07 +01:00
Jonas Jensen
2aca40a021 Merge pull request #736 from geoffw0/macroinv2
CPP: Deprecate MacroInvocationExpr and MacroInvocationStmt
2019-01-25 09:02:02 +01:00
semmle-qlci
281c944432 Merge pull request #774 from jbj/dataflow-asExpr-conversion
Approved by dave-bartolomeo
2019-01-25 08:00:51 +00:00
Max Schaefer
e6672aaf70 Merge pull request #804 from esben-semmle/js/sharpen-unneeded-defensive
JS: better handling of nested expressions in js/unneeded-defensive-code
2019-01-25 11:23:51 +08:00
Sebastian Bauersfeld
f56fb6d774 Address review comments. 2019-01-24 16:09:06 -05:00
Robert Marsh
44d8e6b6e2 C++: respond to PR comments 2019-01-24 10:50:56 -08:00
Geoffrey White
45476f3047 Merge pull request #739 from jbj/strcpy-fixups
C++: Clean up "Use of string copy function in a condition" query
2019-01-24 17:50:40 +00:00
Geoffrey White
c9c7ca9f0c CPP: Tag metric queries. 2019-01-24 17:36:13 +00:00
Geoffrey White
9bf0843776 CPP: Change note. 2019-01-24 15:15:03 +00:00
Geoffrey White
d042890842 CPP: Assign a query precision. 2019-01-24 15:15:03 +00:00
Geoffrey White
02c69a744f CPP: Fix false positive. 2019-01-24 15:15:02 +00:00
Jonas Jensen
a383a1d6c9 C++: Simpler and more general approx. of constexpr 2019-01-24 15:06:54 +01:00
Mark Shannon
88d8cb514c Python: Two new queries for URL and hostname sanitization (CWE-020). 2019-01-24 12:57:14 +00:00
Geoffrey White
e1d31bf117 CPP: Add a test of ArrayArgSizeMismatch.ql. 2019-01-24 11:20:58 +00:00
Geoffrey White
08ae685aa0 CPP: Tag external-data queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
ab89f1307d CPP: Tag defect filter queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
b791ff8c28 CPP: Tag metric filter queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
132b29fa22 CPP: Tag the Architecture queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
9a9b01bbb0 CPP: Add external/powerof10 tags. 2019-01-24 11:15:21 +00:00
Geoffrey White
30c6637415 CPP: Tag the Power of 10 queries. 2019-01-24 11:15:20 +00:00
Jonas Jensen
ea018a2abc Merge pull request #816 from geoffw0/code-tidy-27
CPP: Code tidy / qldoc
2019-01-24 11:35:00 +01:00
Calum Grant
c6d0600e76 Merge pull request #798 from hvitved/csharp/accessor-calls
C#: Redefine `AccessorCall`
2019-01-24 10:21:32 +00:00
Jonas Jensen
61e23bed88 Merge branch 'master' into strcpy-fixups 2019-01-24 10:51:51 +01:00
jf205
0a4f2e8376 Merge pull request #813 from calumgrant/cs/sb-append-chars
C#: Fix FP in cs/call-to-object-tostring
2019-01-24 09:12:55 +00:00
Dave Bartolomeo
63ed0c5f21 Merge pull request #811 from jbj/ir-successor-sanity
C++: IR sanity queries for outgoing edges
2019-01-23 23:11:57 -08:00
semmle-qlci
085d5a6313 Merge pull request #818 from imsolost/master
Approved by esben-semmle
2019-01-24 06:36:43 +00:00
imsolost
e1aa3def25 removed extra parenthesis around argument for set state arrow function 2019-01-23 17:05:32 -08:00
Sebastian Bauersfeld
170acd539c Add tests for ConfigFiles library. 2019-01-23 19:35:20 -05:00
Sebastian Bauersfeld
1727a0cd1f Address review comments. 2019-01-23 18:01:35 -05:00
Robert Marsh
fa02042fda C++: add more tests and rename test functions 2019-01-23 11:42:44 -08:00
Geoffrey White
fc142c71be CPP: QLDoc cleanup. 2019-01-23 17:58:52 +00:00
Geoffrey White
7c6dfc90de CPP: Make some implementation predicates private. 2019-01-23 17:48:32 +00:00
Geoffrey White
64141b2817 CPP: QLDoc cleanup. 2019-01-23 17:48:32 +00:00
calum
c213cd451e C#: Update change notes. 2019-01-23 16:20:09 +00:00
calum
420c943cce C#: Fix FP in cs/call-to-object-tostring 2019-01-23 16:14:25 +00:00
Mark Shannon
4ef3f461a4 Python: Fix typo and use infix casts. 2019-01-23 14:07:50 +00:00
Taus
ffa8b12d48 Merge pull request #782 from markshannon/python-add-more-tests
Python: Add more tests
2019-01-23 14:04:23 +01:00
Mark Shannon
0ea2d56945 Python tests: Move helper predicate into TestUtils.qll 2019-01-23 11:20:04 +00:00
Taus
d735c363e8 Merge pull request #797 from markshannon/python-hide-check-class
Python: Hide 'CheckClass' class
2019-01-23 12:04:01 +01:00
Asger F
bb775e3343 JS: reapply review fixes 2019-01-23 10:42:03 +00:00
Jonas Jensen
bb7369e844 C++: Use new back-edge def. in range analysis
By using this new definition of back edges, the range analysis should
work on code that uses unstructured `goto`s.
2019-01-23 11:40:13 +01:00
Jonas Jensen
b40accee6f C++: sanity checks for back edges 2019-01-23 11:40:12 +01:00
Jonas Jensen
38f7ec7d18 C++: Initial implementation of back-edge detection 2019-01-23 11:40:12 +01:00
Taus
0217451529 Merge pull request #789 from markshannon/python-points-to-extension-enhancement
Python: Internal points-to extension enhancement.
2019-01-23 11:31:36 +01:00
Jonas Jensen
b2e5d235de C++: IR sanity queries for outgoing edges
These queries have no results on our test cases in the repo, but
`ambiguousSuccessors` has results on any large C++ code base, and
`unexplainedLoop` has results on Windows builds of ChakraCore.
2019-01-23 11:07:49 +01:00
Jonas Jensen
eaa5a5fab7 Merge pull request #809 from geoffw0/enclosing
CPP: Small change to 'Resource not released in destructor'
2019-01-23 11:07:21 +01:00
Dave Bartolomeo
bfb8125474 Merge pull request #754 from jbj/copy-assignment-no-effect
C++: Exclude assignment operator in ExprHasNoEffect
2019-01-23 00:46:17 -08:00
Tom Hvitved
338754ffda Merge pull request #800 from calumgrant/cs/winforms
C#: Add sources from System.Windows.Forms controls
2019-01-23 09:07:02 +01:00
Tom Hvitved
779039b8bb C#: Address review comments 2019-01-23 08:56:39 +01:00
yh-semmle
23e94c23e3 Merge pull request #786 from aschackmull/java/double-checked-locking
Java: Fix FP in DoubleCheckedLocking.ql
2019-01-22 17:39:54 -05:00
Mark Shannon
547b3eb973 Python: Fix 'unused import' to no longer give alerts for imported modules used in typehints. 2019-01-22 17:38:09 +00:00
calum
790db3ab67 C#: Address review comments. 2019-01-22 17:29:58 +00:00
Geoffrey White
175ff9644a CPP: Change * to +. 2019-01-22 16:41:57 +00:00
Geoffrey White
fccf30eff5 Merge pull request #803 from jbj/commented-out-code-const
C++: Recognize more function decls as code
2019-01-22 16:40:08 +00:00
Geoffrey White
feeb391737 Merge pull request #769 from jbj/fully-converted-perf
C++: Speed up Expr.getFullyConverted slightly
2019-01-22 14:02:22 +00:00
Mark Shannon
19c43510a3 Python: Make test 2/3 compatible. 2019-01-22 14:01:44 +00:00
Mark Shannon
a3b5769c2c Python: Weak file permissions query. 2019-01-22 11:33:19 +00:00
Mark Shannon
21299493c9 Python tests: Hide special ESSA variables in tests, to ease transition from '*' to '$' variable. 2019-01-22 11:02:36 +00:00
Mark Shannon
28bea69882 Python: ESSA definitions; make '*' special variable into its own class. 2019-01-22 10:51:36 +00:00
Geoffrey White
aba73f4aac Merge pull request #801 from jbj/mergeback-20190121
C++: Merge rc/1.19 and #777
2019-01-22 08:54:26 +00:00
Geoffrey White
fab8e526f3 CPP: Replace call to getEnclosingAccessHolder() with getEnclosingElement(). 2019-01-21 18:30:20 +00:00
Esben Sparre Andreasen
00ef80dfc5 Merge pull request #741 from asger-semmle/this-access-path
JS: support 'this' as the root of an access path
2019-01-21 16:48:34 +01:00
Mark Shannon
61d8319b4e Fix compilation warning in test. 2019-01-21 14:38:12 +00:00
Mark Shannon
5e8ab92cc6 Add test for attribute points-to extension. 2019-01-21 14:38:12 +00:00
Mark Shannon
01a2add73b Python: Internal points-to extension enhancement. Use it handle re module constants. 2019-01-21 14:38:07 +00:00
Mark Shannon
5dd0123f0d Python tests: Remove useless duplicate test. 2019-01-21 14:31:15 +00:00
Anders Schack-Mulligen
50ce961c06 Merge pull request #791 from hmakholm/pr/ODASA-6859
Fix ODASA-6859
2019-01-21 13:23:26 +01:00
Mark Shannon
6bbbb85a73 Python: Remove some negation from points-to, in preparation for ADT Objects. 2019-01-21 11:56:39 +00:00
Asger F
10db0d53a8 JS: copy changes to TrackedNode 2019-01-21 10:49:27 +00:00
Max Schaefer
43f4fe1a7e Update DoubleEscaping.qhelp
Somewhat ironic, considering the object of the query.
2019-01-21 18:48:22 +08:00
Jonas Jensen
7bb9deeb34 C++: Recognize more function decls as code 2019-01-21 11:47:35 +01:00
Asger F
3a6e6f95b9 JS: autoformat 2019-01-21 10:39:35 +00:00
Asger F
77d748aa00 JS: "return" flow through callbacks 2019-01-21 10:39:35 +00:00
Geoffrey White
821a7bfadd Merge pull request #779 from jbj/commented-out-code-braces
C++: Relax commented-out code heuristic for `}`
2019-01-21 09:37:30 +00:00
Jonas Jensen
b30c9bc571 Merge remote-tracking branch 'upstream/source/pr/777/head' into mergeback-20190121 2019-01-21 09:59:04 +01:00
Jonas Jensen
7912c8106b Merge remote-tracking branch 'upstream/rc/1.19' into mergeback-20190121 2019-01-21 09:58:37 +01:00
Jonas Jensen
9561fdaabf Merge pull request #672 from geoffw0/lgtm1605
CPP: Fix function pointer/lambda related false positives in 'Resource not released in destructor'
2019-01-21 09:35:30 +01:00
Jonas Jensen
169bbcdfa0 Merge pull request #682 from geoffw0/suspiciousaddsizeof
CPP: Fix false positive in SuspiciousAddWithSizeof.ql
2019-01-21 09:06:18 +01:00
Esben Sparre Andreasen
9e4613094a JS: sharpen js/unneeded-defensive-code for negations and sequences 2019-01-21 09:00:35 +01:00
semmle-qlci
0432b01e3b Merge pull request #764 from asger-semmle/dataflow-classnode
Approved by esben-semmle, xiemaisi
2019-01-21 06:47:57 +00:00
semmle-qlci
dd84b6063b Merge pull request #794 from xiemaisi/js/parallel-extraction
Approved by asger-semmle, esben-semmle
2019-01-20 00:22:38 +00:00
Mark Shannon
261cd36b8c Merge pull request #781 from kevinbackhouse/HashedButNoHash
Python: fix false positive result.
2019-01-18 21:56:12 +00:00
Kevin Backhouse
9e79e1bc8c Simplify the logic with theTypeErrorType(). 2019-01-18 16:33:48 +00:00
Geoffrey White
bff23f546d CPP: Clearer naming. 2019-01-18 16:21:28 +00:00
calum
63653cd0f7 C#: Analysis change notes. 2019-01-18 15:49:05 +00:00
calum
c9ffb38e4b C#: Add sources and sinks in Winforms. Update some queries with new sources and sinks. 2019-01-18 15:42:44 +00:00
Asger F
4b4daa645f JS: handle accessors separately 2019-01-18 15:42:05 +00:00
Asger F
e18b635314 JS: add getADirectSuperClass() 2019-01-18 15:42:05 +00:00
Asger F
c82690f4c1 JS: address comments 2019-01-18 15:42:05 +00:00
Asger F
cc1204acef JS: remove isAmbient() check 2019-01-18 15:42:05 +00:00
Asger F
1eb0ca4b4a JS: make ClassNode::Range abstract 2019-01-18 15:42:05 +00:00
Geoffrey White
458fddd28e CPP: Use strictconcat. 2019-01-18 15:01:47 +00:00
Taus
bcc65dbad3 Merge pull request #554 from markshannon/python-named-module-utility
Python: named module utility
2019-01-18 16:01:36 +01:00
Asger F
3cb2341e63 JS: split ClassNode into two classes 2019-01-18 14:46:38 +00:00
Asger F
5b7675d972 JS: introduce DataFlow::ClassNode 2019-01-18 14:46:38 +00:00
Taus
8d99186d74 Merge pull request #795 from markshannon/remove-builtin-class-test
Python: Remove fragile and unnecessary test.
2019-01-18 15:17:39 +01:00
Taus
92d2e18bf2 Merge pull request #712 from markshannon/python-fix-odasa-7307
Python: Detect a wider range of generated files.
2019-01-18 14:38:08 +01:00
Tom Hvitved
ceb9ccf811 C#: Add change note 2019-01-18 13:56:27 +01:00
Tom Hvitved
dd99525566 C#: Redefine AccessorCall
The syntactic node assiociated with accessor calls was previously always the
underlying member access. For example, in

```
x.Prop = y.Prop;
```

the implicit call to `x.set_Prop()` was at the syntactic node `x.Prop`, while the
implicit call to `y.get_Prop()` was at the syntactic node `y.Prop`.

However, this breaks the invariant that arguments to calls dominate the call itself,
as the argument `y.Prop` for the implicit `value` parameter in `x.set_Prop()` will
be evaluated after the call (the left-hand side in an assignment is evaluated before
the right-hand side).

The solution is to redefine the access call to `x.set_Prop()` to point to the whole
assignment `x.Prop = y.Prop`, instead of the access `x.Prop`. For reads, we still want
to associate the accessor call with the member access.

A corner case arises when multiple setters are called in a tuple assignment:

```
(x.Prop1, x.Prop2) = (0, 1)
```

In this case, we cannot associate the assignment with both `x.set_Prop1()` and
`x.set_Prop2()`, so we instead revert to using the underlying member accesses as
before.
2019-01-18 13:56:23 +01:00
Mark Shannon
ad2481f498 Python: Hide 'CheckClass' class which is old and should only be used by those queries it is specifically designed for. 2019-01-18 12:31:19 +00:00
Mark Shannon
e82e7791fa Fix typos in change note. 2019-01-18 11:51:11 +00:00
Mark Shannon
c1a549ddff Python. Improve grammar in qldoc comment. 2019-01-18 11:49:59 +00:00
Mark Shannon
9f93bf8d17 Python: Fix 'unused import' to no longer give alerts for imported modules used in doctests. 2019-01-18 11:08:53 +00:00
Anders Schack-Mulligen
2c0e1f943d Java: Extend change note. 2019-01-18 12:08:00 +01:00
Tom Hvitved
2caf724826 C#: Add more tests 2019-01-18 12:07:22 +01:00
Anders Schack-Mulligen
15e18013c8 Java: Fix qhelp. 2019-01-18 11:47:43 +01:00
Anders Schack-Mulligen
d8fe21be7e Java: Update qhelp as per review. 2019-01-18 11:42:34 +01:00
Asger F
cf3dfcae21 JS: recognize A.substr(0, B.length) == B 2019-01-18 10:40:48 +00:00
Asger F
f9951f67fe JS: add simple variants of StringOps::EndsWith 2019-01-18 10:40:48 +00:00
Asger F
b6626995cf JS: bugfix in indexOf-based include test 2019-01-18 10:40:48 +00:00
Asger F
d603824feb JS: add StringOps::StartsWith and StringOps::Includes 2019-01-18 10:40:18 +00:00
Asger F
107ec3b687 JS: add test with self=this variable 2019-01-18 10:39:02 +00:00
Asger F
78bd76048a JS: add test with closures 2019-01-18 10:39:02 +00:00
Asger F
0bb6692c19 JS: add 'this' as possible access path root 2019-01-18 10:39:02 +00:00
Anders Schack-Mulligen
17b4276699 Java: Fix bug in qltest and query for immutable types. 2019-01-18 11:37:38 +01:00
Jonas Jensen
189d82b79a C++: Change exclusion to not be only operator= 2019-01-18 11:19:38 +01:00
Mark Shannon
4398670ecc Merge pull request #775 from taus-semmle/python-dill-pickle-support
Python: dill pickle support.
2019-01-18 10:01:22 +00:00
Max Schaefer
740acc12e8 JavaScript: Add change note. 2019-01-18 09:36:07 +00:00
semmle-qlci
5e712b3ff6 Merge pull request #784 from asger-semmle/dedup-promiseTaintStep
Approved by esben-semmle
2019-01-18 08:52:09 +00:00
Henning Makholm
fda08181c1 fix ODASA-6859 2019-01-18 00:08:36 +01:00
Henning Makholm
26b6581bdb test example for ODASA-6859 2019-01-17 23:30:39 +01:00
Robert Marsh
64ed9305d3 C++: new query for futile arguments to C functions 2019-01-17 10:45:10 -08:00
Dave Bartolomeo
6af8948a3f Merge pull request #783 from jbj/ir-reachable-perf
C++: Speed up getAFeasiblePredecessorBlock
2019-01-17 10:19:07 -08:00
Kevin Backhouse
56efe3adb7 Fix false positive result. 2019-01-17 16:22:48 +00:00
Kevin Backhouse
5fc056beb3 Add regression test for false positive result. 2019-01-17 16:22:19 +00:00
Jonas Jensen
f147b63bb8 Merge pull request #654 from geoffw0/lossyresultcast
CPP: Work on Lossy function result cast query
2019-01-17 17:07:29 +01:00
semmle-qlci
beed51924e Merge pull request #780 from Semmle/xiemaisi-patch-4
Approved by esben-semmle
2019-01-17 16:04:00 +00:00
Anders Schack-Mulligen
944c082a8d Java: Fix FP in DoubleCheckedLocking.ql 2019-01-17 16:38:25 +01:00
Asger F
a8d750f086 JS: update header doc in Promises.qll 2019-01-17 15:26:45 +00:00
Taus Brock-Nannestad
1d15d46b38 Add change note. 2019-01-17 14:47:21 +01:00
Taus Brock-Nannestad
ad429f5ae1 Add tests. 2019-01-17 14:45:25 +01:00
Taus Brock-Nannestad
7c3dc929ac Add query and qhelp. 2019-01-17 14:45:25 +01:00
Asger F
e9c4f13a31 JS: Remove trailing whitespace again 2019-01-17 13:10:15 +00:00
Asger F
7a344c8546 JS: Add resolved promise taint test case 2019-01-17 13:08:55 +00:00
Asger F
b6fdbdcf84 JS: deduplicate promiseTaintStep 2019-01-17 13:04:16 +00:00
Asger F
882b337c15 JS: Move ResolvedPromiseDefinition into StandardLibrary.qll 2019-01-17 13:02:03 +00:00
Asger F
fc27b26bd5 JS: Remove duplicate PromiseFlowStep 2019-01-17 12:56:40 +00:00
Asger F
66901dc7b8 JS: remove duplicate ES2015PromiseDefinition 2019-01-17 12:55:38 +00:00
Jonas Jensen
6b9aaf63d7 C++: Speed up getAFeasiblePredecessorBlock
This predicate was unbearably slow on a ChakraCore snapshot (and
probably everywhere else):

    ReachableBlock::getAFeasiblePredecessorBlock#2#ff#antijoin_rhs .. 1m6s
    ReachableBlock::getAFeasiblePredecessorBlock#ff#antijoin_rhs .... 31.8s

With this change, the predicate is so fast that it doesn't even show up
in the clause timing report.

It's possible that we only tested this for performance in 1.18, and then
it has regressed in 1.19. Otherwise I can't explain how we've missed
this. I'm using QL for Eclipse 1.20.0.201901070127.
2019-01-17 13:36:20 +01:00
Mark Shannon
801d8cb3a5 Python: Remove fragile and unnecessary test. 2019-01-17 12:31:19 +00:00
Mark Shannon
73095c53b8 Python: Add another AST test. 2019-01-17 11:24:41 +00:00
Jonas Jensen
2478d440c2 C++: Address doc review comments 2019-01-17 12:01:49 +01:00
Calum Grant
f85f05d55f Merge pull request #776 from hvitved/csharp/delegate-ref-assignment
C#: Recognize `ref` assignments through delegate calls
2019-01-17 10:35:26 +00:00
Max Schaefer
8f8068695d JavaScript: Bump extractor version to avoid trap cache. 2019-01-17 09:30:18 +00:00
Max Schaefer
ce65fcedc1 JavaScript: Abort AutoBuild if an exception happens in one of the extractor threads. 2019-01-17 09:29:49 +00:00
Max Schaefer
7765c6d486 JavaScript: Await termination of extractor threadpool. 2019-01-17 09:29:49 +00:00
Max Schaefer
3b5315aa7e JavaScript: Improve logging. 2019-01-17 09:29:49 +00:00
Max Schaefer
a6cb63e9c8 JavaScript: Make number of threads configurable through LGTM_INDEX_THREADS.
If the number of threads specified is one or lower, we fall back onto single-threaded extraction.
2019-01-17 09:29:49 +00:00
Max Schaefer
d625ebf86d JavaScript: Extract JavaScript files after TypeScript files.
This way we only start multi-threaded extraction after the TypeScript parser has already been shut down, reducing the chance of running out of memory.
2019-01-17 09:29:49 +00:00
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
Calum Grant
d4d5c47adb Merge pull request #749 from hvitved/csharp/remove-def-use
C#: Remove `DefUse.qll`
2019-01-15 10:52:39 +00:00
Jonas Jensen
d252a40853 C++: Speed up Expr.getFullyConverted slightly
This change cuts around 15% of the run time off this predicate. It's a
workaround for QL-796.
2019-01-15 11:45:07 +01:00
Nick Rolfe
371c09d4e5 Merge pull request #740 from ian-semmle/inline_ns
C++: Add inline namespace support
2019-01-15 10:00:32 +00:00
Max Schaefer
0877ec845a JavaScript: Add change note. 2019-01-15 09:03:11 +00:00
Max Schaefer
0360df6e05 JavaScript: Improve terminology and comments. 2019-01-15 09:01:39 +00:00
Jonas Jensen
9751a91087 C++: Accept changes to alert message in test 2019-01-14 21:43:57 +01:00
Jonas Jensen
08db4cd959 Merge pull request #744 from geoffw0/format
CPP: Autoformat some untidy files
2019-01-14 21:31:17 +01:00
Jonas Jensen
b966a872f3 Merge pull request #758 from Semmle/gvn-comment
C++: fix wording in GVN qldoc comment
2019-01-14 21:26:43 +01:00
Asger F
19dab71a6c TS: change note 2019-01-14 18:26:09 +00:00
Asger F
a7b0f7e2ce TS: upgrade script, version string, stats 2019-01-14 18:26:09 +00:00
Asger F
3ed9575529 TS: add support for bigints 2019-01-14 18:26:09 +00:00
Asger F
1c6deb65cd TS: update test expectation 2019-01-14 18:15:30 +00:00
Asger F
5fc4147a23 TS: bump TypeScript compiler dependency to 3.2.1 2019-01-14 15:56:50 +00:00
Asger F
f4c89601ff JS: fix typo 2019-01-14 15:34:01 +00:00
Asger F
ad6add383c JS: improve concatenation-sanitizer for property injection 2019-01-14 15:34:01 +00:00
Mark Shannon
05a52bf746 Merge pull request #756 from taus-semmle/python-move-query-suites
Python: Move query suites to public repo.
2019-01-14 15:26:42 +00:00
Bas van Schaik
4aae749d9a Make licensing text in README.md more generic 2019-01-14 14:56:39 +00:00
Tom Hvitved
f90b0fd16f C#: Convert some multi-line comments 2019-01-14 14:08:54 +01:00
Tom Hvitved
b81d2ca8fa C#: Autoformat QLL files 2019-01-14 14:08:54 +01:00
Mark Shannon
c9a929fb23 Python tests: Increase import depth to ensure sre_constants module is imported. 2019-01-14 11:18:36 +00:00
Tom Hvitved
bbc49dce40 Merge pull request #755 from calumgrant/cs/extractor-alerts
C#: Fix some LGTM alerts on the extractor
2019-01-14 10:47:44 +01:00
semmle-qlci
b78fcd39be Merge pull request #745 from hvitved/csharp/query/missed-readonly-modifier
Approved by calumgrant
2019-01-14 08:43:59 +00:00
semmle-qlci
3fe9f92817 Merge pull request #746 from hvitved/csharp/is-valid-explicit-params-type
Approved by calumgrant
2019-01-14 08:43:30 +00:00
semmle-qlci
201f68d751 Merge pull request #757 from hvitved/csharp/autoformat/queries
Approved by calumgrant
2019-01-14 08:42:21 +00:00
semmle-qlci
955bad0618 Merge pull request #640 from asger-semmle/lodash-case
Approved by esben-semmle
2019-01-14 07:59:59 +00:00
semmle-qlci
7bb8edd16d Merge pull request #720 from esben-semmle/js/more-flow-parsing
Approved by xiemaisi
2019-01-14 07:58:28 +00:00
Esben Sparre Andreasen
7f5dd1a4e8 JS: change notes for improved js/unbound-event-handler-receiver 2019-01-14 08:48:15 +01:00
Esben Sparre Andreasen
b35c4b2a9a JS: support FP pattern for js/unbound-event-handler-receiver 2019-01-14 08:47:37 +01:00
semmle-qlci
9c41b214ee Merge pull request #748 from esben-semmle/js/fix/js/useless-assignment-to-property
Approved by xiemaisi
2019-01-13 21:40:35 +00:00
Esben Sparre Andreasen
73af2adde0 JS: change notes for improved support for Flow 2019-01-13 22:10:56 +01:00
Esben Sparre Andreasen
64346e1321 JS: bump extractor version for improved support for Flow 2019-01-13 22:10:56 +01:00
Esben Sparre Andreasen
c26ae26f53 JS: support explicit type arguments for Flow 2019-01-13 22:10:56 +01:00
Esben Sparre Andreasen
45a4026385 JS: support additional export statements for Flow 2019-01-13 22:10:56 +01:00
Esben Sparre Andreasen
c6f9a043ca JS: support additional import statements for Flow 2019-01-13 22:10:56 +01:00
Robert Marsh
eabc674bb3 Merge pull request #747 from jbj/cfg-remove-cfg.ql
C++: Delete library-tests/qlcfg/cfg.ql
2019-01-11 11:57:26 -08:00
Jonas Jensen
ef331ee68c Merge pull request #633 from Semmle/rdmarsh/cpp/range-analysis
C++: New range analysis
2019-01-11 19:32:20 +01:00
Geoffrey White
c8cbc8ea5a Merge pull request #751 from jbj/hides-parameter-crossfile
C++: Improvements to "Declaration hides parameter"
2019-01-11 18:00:50 +00:00
Geoffrey White
a656c692bb Merge pull request #752 from jbj/large-parameter-assignment
C++: Exclude copy assignment in LargeParameter.ql
2019-01-11 17:54:30 +00:00
semmle-qlci
04c15028ab Merge pull request #750 from aschackmull/javascript/autoformat
Approved by xiemaisi
2019-01-11 16:35:38 +00:00
calum
e76eb1641a C#: Address review comment. 2019-01-11 16:13:04 +00:00
Taus
dcdbc00430 Merge pull request #753 from markshannon/python-fix-regex-test-depth
Python tests: Increase import depth to ensure sre_constants module is imported.
2019-01-11 16:46:56 +01:00
Nick Rolfe
e8f4127fe5 C++: fix wording in GVN qldoc comment 2019-01-11 13:56:52 +00:00
Tom Hvitved
36e4b879e9 C#: Remove comment 2019-01-11 14:32:34 +01:00
Anders Schack-Mulligen
db9407bae5 Javascript: Update .expected files. 2019-01-11 14:27:16 +01:00
Jonas Jensen
ca3554dcc6 C++: Incorporate docs review comments 2019-01-11 14:18:15 +01:00
Jonas Jensen
b65e2f8b79 C++: Put QLDoc on two helper predicates 2019-01-11 14:07:22 +01:00
Tom Hvitved
390ebc96ae C#: Autoformat QL files 2019-01-11 13:55:28 +01:00
Taus Brock-Nannestad
b5dc0134a7 Python: Move query suites to public repo. 2019-01-11 13:46:47 +01:00
calum
de4f592bba C#: Add alert suppression comments for cs/similar-file 2019-01-11 12:36:20 +00:00
calum
a44a86bf6f C#: Add alert suppression comments. Rename e to ex in catch clauses for consistency. 2019-01-11 12:32:24 +00:00
Jonas Jensen
6385dd38cf C++: Exclude operator= in ExprHasNoEffect 2019-01-11 13:30:08 +01:00
Jonas Jensen
95e457cb49 C++: Add test with FP in ExprHasNoEffect 2019-01-11 13:18:44 +01:00
Mark Shannon
33a2315ba0 Python tests: Increase import depth to ensure sre_constants module is imported. 2019-01-11 12:15:56 +00:00
calum
fb0cae87a8 C#: Fix some alerts, and fix a potential NullReferenceException. 2019-01-11 12:12:11 +00:00
Jonas Jensen
1cc36dd969 C++: Exclude copy assignment in LargeParameter.ql
The purpose of the copy assignment operator is to copy the object, so we
should not complain that a copy happens when passing the parameter. See
https://en.wikibooks.org/wiki/More_C++_Idioms/Copy-and-swap for details.
2019-01-11 12:00:02 +01:00
Jonas Jensen
4ea3849595 C++: Add failing test case for LargeParameter.ql 2019-01-11 11:53:04 +01:00
semmle-qlci
b0dd3dfeb1 Merge pull request #502 from xiemaisi/js/summaries
Approved by asger-semmle
2019-01-11 10:27:03 +00:00
Jonas Jensen
b38ca944f4 C++: Work around CPP-331
This change suppresses results from "Declaration hides parameter" where
the ParameterDeclarationEntry does not link up to the right
FunctionDeclarationEntry.
2019-01-11 11:26:43 +01:00
Max Schaefer
f9d704bdcf JavaScript: Add example of indirect command injection. 2019-01-11 10:24:41 +00:00
Jonas Jensen
2268f1fee6 C++: Speed up "Declaration hides parameter"
Bad magic ended up in `LocalVariable.getFunction` and effectively
created a Cartesian product. Before this change, the timing looked like
this:

    Variable::LocalVariable::getFunction_dispred#bb ... 50.1s
    #select#cpe#123#fff ............................... 20.6s

After this change, those predicates become much faster:

    Variable::LocalVariable::getFunction_dispred#ff ... 121ms
    DeclarationHidesParameter::localVariableNames#fff . 77ms
    #select#cpe#123#fff ............................... 28ms

Introducing the predicate `localVariableNames` ensures that we can do
the main join on two columns simultaneously, so that's a change we
should keep even if we remove the `pragma[nomagic]` later.
2019-01-11 11:06:18 +01:00
Jonas Jensen
8a435ae321 C++: Autoformat "Declaration hides parameter" 2019-01-11 11:02:52 +01:00
Anders Schack-Mulligen
e58094c732 Javascript: Autoformat. 2019-01-11 11:02:42 +01:00
Max Schaefer
7d2d33840a JavaScript: Track flow through forwarding higher-order calls. 2019-01-11 09:15:58 +00:00
Tom Hvitved
c06fc2af09 C#: Remove DefUse.qll 2019-01-11 09:35:38 +01:00
Max Schaefer
59bac829b1 JavaScript: Refactor flowsIntoHigherOrderCall predicate. 2019-01-11 08:34:09 +00:00
Max Schaefer
edc5117dfd JavaScript: Track flow into (simple) higher-order function calls.
The only case we support for now are functions that invoke one of their arguments, passing another argument as input.
2019-01-11 08:11:15 +00:00
Max Schaefer
414ab8ea8c JavaScript: Refactor argumentPassing. 2019-01-11 07:57:58 +00:00
Esben Sparre Andreasen
9af6a81a58 JS: change note for ODASA-7636 fix 2019-01-11 08:37:01 +01:00
Esben Sparre Andreasen
d0372dd290 JS: reuse a variable 2019-01-11 08:34:17 +01:00
Esben Sparre Andreasen
d3543b74c0 JS: fixup: use the basic block of the actual write (ODASA-7636) 2019-01-11 08:34:17 +01:00
Jonas Jensen
88a251c05a C++: Delete library-tests/qlcfg/cfg.ql
This test was intended to catch regressions in the CFG, but it looks
like it's just catching insignificant extractor changes. The test has
started failing after some recent extractor changes, but I have no way
to pinpoint the failure and understand whether it's a problem or not, so
I think it's better to delete this test.

The remaining tests check whether the QL-based CFG generates the same
graph as the extractor-based CFG. Furthermore, the `successor-tests`
check that the extractor-based CFG works as intended.
2019-01-11 08:24:07 +01:00
Tom Hvitved
0f7dc51e89 C#: Fix performance issue in isValidExplicitParamsType() 2019-01-10 21:19:23 +01:00
Tom Hvitved
2197736128 C#: Speedup cs/missed-readonly-modifier 2019-01-10 20:57:36 +01:00
Robert Marsh
c455db9e59 C++: update test expectations 2019-01-10 11:24:13 -08:00
Geoffrey White
87569d14b9 CPP: QLDoc comments. 2019-01-10 17:38:42 +00:00
Geoffrey White
ba3bc1596b CPP: Manual fixup. 2019-01-10 15:28:13 +00:00
Geoffrey White
c4b01d0816 CPP: Autoformat some other untidy source files. 2019-01-10 15:28:13 +00:00
Geoffrey White
28261d6787 Merge pull request #737 from jbj/cfg-perf
C++: QL CFG performance and tweaks
2019-01-10 14:45:53 +00:00
Geoffrey White
f2e68da322 CPP: Use dataflow to find wrapped rounding functions. 2019-01-10 14:44:11 +00:00
Geoffrey White
207c4d365a CPP: Test wrapped rounding functions more thoroughly. 2019-01-10 14:39:23 +00:00
Geoffrey White
4f002291c5 CPP: Add exception for builtins. 2019-01-10 14:16:57 +00:00
Asger F
2b803693f1 JS: add comment about how to generate isLodashMember 2019-01-10 14:00:20 +00:00
Ian Lynagh
8ce2890824 C++: Add a changenote for Namespace.isInline() 2019-01-10 12:56:16 +00:00
Ian Lynagh
e5b6e61d45 C++: Update stats to include namespace_inline 2019-01-10 11:35:49 +00:00
Geoffrey White
346bc1ac62 CPP: Autoformat some code from Critical. 2019-01-10 10:40:39 +00:00
Geoffrey White
b7febb06af CPP: Autoformat some Power of 10 queries. 2019-01-10 10:40:39 +00:00
semmle-qlci
f474fdd0f9 Merge pull request #731 from xiemaisi/js/performance-fiddling
Approved by asger-semmle, esben-semmle
2019-01-10 10:01:02 +00:00
Jonas Jensen
7ff94e894a C++: Change note for UsingStrcpyAsBoolean.ql 2019-01-10 08:35:54 +01:00
Jonas Jensen
92fbea4e41 C++: UsingStrcpyAsBoolean.ql: use getName
We agreed in the review of the original PR that `getName` is more
appropriate here than `getQualifiedName`. Using `getName` ensures that
we also match the `std::`-prefixed versions of these functions as well
as user-defined versions.
2019-01-10 08:35:54 +01:00
Jonas Jensen
aa0f2f2da3 C++: Support ?: in UsingStrcpyAsBoolean.ql
I removed some unnecessary parentheses for symmetry, causing whitespace
changes.
2019-01-10 08:35:54 +01:00
Jonas Jensen
0f88a4b312 C++: Test ?: support in UsingStrcpyAsBoolean.ql
This test shows that the query only supports the ternary operator in
C++, not C.
2019-01-10 08:35:54 +01:00
Jonas Jensen
4dd36772ef C++: Remove UsingStrcpyAsBoolean.ql duplicates 2019-01-10 08:35:54 +01:00
Jonas Jensen
3a6a515a1d C++: Tabs to spaces and // Bug comments in test
This changes the column numbers in the expected test output.
2019-01-10 08:35:53 +01:00
Jonas Jensen
aafb4abc3d C++: Use more specific predicates than getChild
This commit doesn't change any behavior but just uses the preferred
high-level predicates. The `getChild` predicate inspects the raw
database more or less directly, and the database layout could change in
the future.
2019-01-10 08:35:53 +01:00
Jonas Jensen
657fe0eda3 C++: Tweak docs of UsingStrcpyAsBoolean.ql
This should make the documentation more in line with the documentation
for our other queries. The @name of the query is changed to "Use of
string copy function in a condition".
2019-01-10 08:35:53 +01:00
Jonas Jensen
563f8158d7 C++: Autoformat UsingStrcpyAsBoolean.ql 2019-01-10 08:35:53 +01:00
Jonas Jensen
9219214d64 Merge pull request #695 from raulgarciamsft/users/raulga/c6324
cpp - Using the return value of a strcpy or related string copy function in an if statement
2019-01-10 08:34:17 +01:00
Geoffrey White
7a877bfe14 CPP: Add exception for wrapped whitelisted functions. 2019-01-09 18:30:19 +00:00
Max Schaefer
583734a4e2 JavaScript: Fix semantic merge conflict.
https://github.com/Semmle/ql/pull/698 removed `document.cookie` as a remote flow source, which some of the tests relied on. We now use `location.search` instead.
2019-01-09 16:09:06 +00:00
Taus Brock-Nannestad
41836cdf8c Add descriptions and remove leftovers from old change note. 2019-01-09 16:23:02 +01:00
semmle-qlci
79734603ce Merge pull request #734 from xiemaisi/js/remove-deprecated
Approved by esben-semmle
2019-01-09 15:20:04 +00:00
Geoffrey White
f983391cbf CPP: Add exception for pow. 2019-01-09 15:06:23 +00:00
Geoffrey White
11013b0ec6 CPP: Add a few more test cases. 2019-01-09 14:58:25 +00:00
Ian Lynagh
7a0ed57916 C++: Add namespace_inline 2019-01-09 14:47:27 +00:00
Calum Grant
89becbce9a Merge pull request #726 from hvitved/csharp/cfg/foreach-multi-variables
C#: Fix CFG for `foreach` statements with tuple declarations
2019-01-09 14:47:01 +00:00
Geoffrey White
82e54568a5 CPP: Add qhelp. 2019-01-09 14:03:28 +00:00
Geoffrey White
45cd030a99 CPP: Change note. 2019-01-09 14:03:28 +00:00
Jonas Jensen
9146b8e32e C++: Add example of conditional destruction
The QL CFG and extractor CFG are the same, so the test passes. Neither
of them model that `ref` may or may not be destructed.
2019-01-09 15:02:25 +01:00
Jonas Jensen
8ac826a62a C++: Factor out base case of normalGroupMember
This recursive predicate is made faster by working around a known
optimizer problem (QL-796) that causes the optimizer to insert extra
type checks in recursive case even when they are only needed in the
base case.
2019-01-09 15:02:25 +01:00
Geoffrey White
cbe69f2daf CPP: Fix false positive. 2019-01-09 13:59:24 +00:00
Geoffrey White
e26c709dbf CPP: Add a test for LossyFunctionResultCast.ql. 2019-01-09 13:59:24 +00:00
Geoffrey White
0e092ae88d CPP: Tag LossyFunctionResultCast.ql. Will be run on LGTM. 2019-01-09 13:59:24 +00:00
Jonas Jensen
c74b89119e C++: Reorder parameters to subEdge relations
This improves performance slightly by putting the parameters in the
order in which they'll be needed in `qlCFGSuccessor`.
2019-01-09 14:58:43 +01:00
ian-semmle
b3bcabf7c6 Merge pull request #724 from jbj/cfg-pr
C++: Construct a CFG with QL
2019-01-09 13:12:39 +00:00
Geoffrey White
6088ca5d5b CPP: Update our uses of MacroInvocationExpr. 2019-01-09 12:17:29 +00:00
Geoffrey White
b59c2868cd CPP: Add test cases for the macro logic and other details of ArithmeticUncontrolled.ql. 2019-01-09 12:17:29 +00:00
Geoffrey White
a1caa85172 CPP: Deprecate MacroInvocationExpr. 2019-01-09 11:45:08 +00:00
Geoffrey White
75b1fb36ec CPP: Deprecate MacroInvocationStmt. 2019-01-09 11:45:08 +00:00
Calum Grant
bd9a2d71ba Merge pull request #719 from hvitved/csharp/autoformat/queries
C#: Autoformat QL queries
2019-01-09 10:48:22 +00:00
Max Schaefer
89447846f1 JavaScript: Add change note. 2019-01-09 09:24:22 +00:00
Max Schaefer
97e6c75b94 JavaScript: Remove a few other deprecated predicates and classes. 2019-01-09 09:23:59 +00:00
Max Schaefer
db8e436046 JavaScript: Remove deprecated flow tracking predicates. 2019-01-09 09:23:59 +00:00
Max Schaefer
8a93c6aa65 JavaScript: Remove a few deprecated classes. 2019-01-09 09:23:59 +00:00
Max Schaefer
5d1d94ebf1 JavaScript: Remove deprecated old call graph library. 2019-01-09 09:23:59 +00:00
Max Schaefer
db713fb359 JavaScript: Remove deprecated backward-compatibility layer in security libraries. 2019-01-09 09:23:59 +00:00
Max Schaefer
feb9693fea JavaScript: Remove old data flow library. 2019-01-09 09:23:59 +00:00
Max Schaefer
3d44f0c6e0 JavaScript: Autoformat new libraries. 2019-01-09 09:13:14 +00:00
Max Schaefer
fb53a69880 Revert "JavaScript: Add ImportFromCSV to javascript.qll."
This reverts commit d03f82beb1f7d4634615f527b3d275043eeda1c5.
2019-01-09 09:10:45 +00:00
Max Schaefer
e960bd967f JavaScript: Make configuration IDs explicit in the API. 2019-01-09 09:10:45 +00:00
Max Schaefer
8f1c5db8be JavaScript: Change encoding of member and parameter portals for readability. 2019-01-09 09:10:45 +00:00
Max Schaefer
a7ea7309d4 JavaScript: Fold a predicate to improve performance in the presence of many configurations with many sources/sinks. 2019-01-09 09:10:44 +00:00
Max Schaefer
9a64224344 JavaScript: Cache portal computation. 2019-01-09 09:09:58 +00:00
Max Schaefer
2295353b56 JavaScript: Add ImportFromCSV to javascript.qll. 2019-01-09 09:09:58 +00:00
Max Schaefer
94242b3b94 JavaScript: Exclude step summary query from flow-summaries suite.
In its current form, this query produces way too many results.
2019-01-09 09:09:58 +00:00
Max Schaefer
fae419c5d2 JavaScript: Add guide to using summaries. 2019-01-09 09:09:58 +00:00
Max Schaefer
8e36c60326 JavaScript: Add a few examples that cause cyclic portals. 2019-01-09 09:09:58 +00:00
Max Schaefer
132570940a JavaScript: Add support for annotation comments specifying additional sources and sinks. 2019-01-09 09:09:58 +00:00
Max Schaefer
bdf29d010a JavaScript: Allow summary details to be omitted.
If a summary does not specify a configuration, it is taken to apply to all configurations without custom sanitisers/barriers.

If a source summary does not specify a flow label, `data` is assumed.

If a sink summary does not specify a flow label, both `data` and `taint` are assumed.

Flow step summaries cannot omit flow labels.

Note that the standard extraction queries always provide explicit configurations and flow labels, and hence do not exercise this functionality.
2019-01-09 09:09:58 +00:00
Max Schaefer
7c87c43511 JavaScript: Import flow summaries through external predicates. 2019-01-09 09:09:58 +00:00
Max Schaefer
90ad8e3858 JavaScript: Import flow summaries from CSV data. 2019-01-09 09:09:58 +00:00
Max Schaefer
f4fed3657d JavaScript: Add flow summary extraction queries. 2019-01-09 09:09:58 +00:00
Max Schaefer
6d893d4be7 JavaScript: Allow additional sources, sinks and steps to specify flow labels. 2019-01-09 09:09:57 +00:00
Max Schaefer
98a763ae4b JavaScript: Add QL library for modelling portals between npm packages. 2019-01-09 09:06:55 +00:00
Max Schaefer
7e7899faba JavaScript: Add predicate DataFlow::Node.getTopLevel(). 2019-01-09 09:05:11 +00:00
Max Schaefer
3e56e9eaf9 JavaScript: Add predicate AbstractCallable.getDefinition. 2019-01-09 09:05:09 +00:00
semmle-qlci
688647491e Merge pull request #727 from xiemaisi/js/restructure-sourcenode
Approved by esben-semmle
2019-01-09 08:01:26 +00:00
yh-semmle
b8f53b5c6a Merge pull request #733 from aschackmull/java/remove-old-dataflow
Java: Remove old dataflow library.
2019-01-08 14:59:27 -05:00
yh-semmle
d4f2a07a77 Merge pull request #732 from aschackmull/java/conditional-bypass-precision
Java: Reduce precision of java/user-controlled-bypass.
2019-01-08 14:58:58 -05:00
yh-semmle
b0364e3592 Merge pull request #729 from aschackmull/java/intmulttolong
Java: Restrict attention to integral types in IntMultToLong.
2019-01-08 14:40:22 -05:00
yh-semmle
a09394da1b Merge pull request #730 from aschackmull/java/gcd
Java: Switch to built-in gcd.
2019-01-08 14:38:05 -05:00
Robert Marsh
c39de75d3d C++: change in-predicate comment formatting 2019-01-08 09:34:29 -08:00
Robert Marsh
af8a3f2522 C++: expand a comment 2019-01-08 09:34:28 -08:00
Robert Marsh
0040a2d123 C++: respond to further PR comments 2019-01-08 09:34:28 -08:00
Robert Marsh
8c9c316e1b C++: performance and termination fixes 2019-01-08 09:34:27 -08:00
Robert Marsh
567eee1114 C++: allow phi nodes to self-bound 2019-01-08 09:34:27 -08:00
Robert Marsh
b2cd9a29f2 C++: add test for false comparisons 2019-01-08 09:34:26 -08:00
Robert Marsh
2f8ca8802b C++: switch to using ValueNumbers as bounds
This reduces the number of bounds computed, and will simplify use of the
library. The resulting locations in the tests may be slightly strange,
because the example `Instruction` for a `ValueNumber` is the first
appearing in the IR, regardless of source order, and may not be the most
closely related `Instruction` to the bounded value. I think that's worth
doing for the performance and usability benefits.
2019-01-08 09:34:26 -08:00
Robert Marsh
89148a9ec7 C++: respond to further PR comments 2019-01-08 09:34:26 -08:00
Robert Marsh
ae4ffd9166 C++: respond to PR comments, add some TODOs 2019-01-08 09:34:25 -08:00
Robert Marsh
fe32aea31f C++: fix/add comments 2019-01-08 09:34:25 -08:00
Robert Marsh
ed68f9150a C++: Initial implementation of new range analysis 2019-01-08 09:34:23 -08:00
Robert Marsh
a06a20dbab C++: move SimpleRangeAnalysis tests 2019-01-08 09:34:23 -08:00
Jonas Jensen
1be91b5df5 C++: Use IPA for Pos and Spec
This is cleaner than extending `int` and working with magic numbers.
Performance appears to be unaffected.
2019-01-08 16:23:11 +01:00
Anders Schack-Mulligen
0a9222b772 Java: Add change note. 2019-01-08 15:50:14 +01:00
Anders Schack-Mulligen
51f5198404 Java: Remove old dataflow library. 2019-01-08 13:52:24 +01:00
Asger F
45a5d0ee3a JS: autoformat 2019-01-08 12:30:07 +00:00
Asger F
6816f33a3d JS: Handle case-insensitive lodash imports 2019-01-08 12:29:28 +00:00
Jonas Jensen
dba3351d2c C++: Update comments based on PR feedback 2019-01-08 13:29:03 +01:00
Anders Schack-Mulligen
ab44e5603c Java: Reduce precision of java/user-controlled-bypass. 2019-01-08 13:07:34 +01:00
Anders Schack-Mulligen
06e48ca19f Java: Update test. 2019-01-08 11:57:54 +01:00
Max Schaefer
8951eaead3 JavaScript: Improve caching of getACallee and related predicates. 2019-01-08 09:42:44 +00:00
Max Schaefer
627583fffa JavaScript: Refactor UselessConditional for performance. 2019-01-08 09:40:49 +00:00
Anders Schack-Mulligen
9530eb6cdb Java: Switch to built-in gcd. 2019-01-08 10:07:51 +01:00
Max Schaefer
de429752d1 JavaScript: Restructure implementation of DataFlow::SourceNode.
It now uses a facade pattern similar to `InvokeNode`: the range of the class is defined by an abstract class `DataFlow::SourceNode::Range`, while the actual behaviour is defined by the (no longer abstract) `SourceNode` class itself.

Clients that want to add new source nodes need to extend `DataFlow::SourceNode::Range`, those that want to refine the behaviour of existing source nodes should extend `DataFlow::SourceNode` itself.

While this is technically a breaking API change, I think separating the two aspects in this way is cleaner and makes it easier to use, and improves performance as well.
2019-01-08 08:01:20 +00:00
semmle-qlci
8b8b352439 Merge pull request #715 from xiemaisi/js/autoformat
Approved by asger-semmle
2019-01-07 22:09:05 +00:00
Raul Garcia
18bb6696e0 Fixing conditional only issue.
I changed  to detect any logical operation usage (i.e. !, ==), but I kept usage in a conditional directly as a separate detection condition. I found no false positives on the projects you shared with me previously.
2019-01-07 10:44:11 -08:00
yh-semmle
0b19f41093 Merge pull request #728 from aschackmull/java/qltest-qlpath
Java: Add .qlpath to the test dir.
2019-01-07 11:34:45 -05:00
Taus Brock-Nannestad
f9c6b0eedc Add change note for 1.20 2019-01-07 15:35:19 +01:00
Taus Brock-Nannestad
9ac50186f6 Add a few more insecure versions 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
1af503ab84 Address documentation comments. 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
46973f4305 Support from ssl import PROTOCOL_.... 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
e8a41f719c Add documentation. 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
dfe3fc6d5c Pass pyOpenSSL method as parameter instead of keyword argument. 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
d604f5c9c9 Fix insecure_version_name comments. 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
a893dca06e Add support for ssl.SSLContext. 2019-01-07 15:24:15 +01:00
Taus Brock-Nannestad
0a839f8468 Python: Check for insecure versions of SSL and TLS. 2019-01-07 15:24:15 +01:00
Anders Schack-Mulligen
203c9fb9d8 Java: Restrict attention to integral types in IntMultToLong. 2019-01-07 14:27:52 +01:00
Anders Schack-Mulligen
e0d3be7dbc Java: Add .qlpath to the test dir. 2019-01-07 13:25:20 +01:00
Calum Grant
6f827140d7 Merge pull request #710 from hvitved/csharp/extractor/standalone-runtimes
C#: Improve logic for looking up .NET runtime in standalone mode
2019-01-07 10:22:17 +00:00
Max Schaefer
31bb39a810 JavaScript: Autoformat all QL files. 2019-01-07 10:15:45 +00:00
Raul Garcia
880306c621 Removing duplicated results 2019-01-04 10:45:43 -08:00
Tom Hvitved
6fccfa3b0a C#: Fix CFG for foreach statements with tuple declarations 2019-01-04 18:51:55 +01:00
Tom Hvitved
72b3514970 C#: Add CFG tests for foreach statements with multipe variable declarations 2019-01-04 18:17:48 +01:00
Jonas Jensen
26f32f0d6d C++: Initial version of CFG.qll
This implements calculation of the control-flow graph in QL. The new
code is not enabled yet as we'll need more extractor changes first.

The `SyntheticDestructorCalls.qll` file is a temporary solution that can
be removed when the extractor produces this information directly.
2019-01-04 13:34:36 +01:00
Tom Hvitved
c962f55cd0 C#: Address review comments 2019-01-04 11:32:23 +01:00
Jonas Jensen
a47faa2272 C++: Add ConditionDeclExpr convenience predicates
Also expand the QLDoc.
2019-01-04 10:24:08 +01:00
Jonas Jensen
ca0517b3d6 C++: LocalVariable docs 2019-01-04 10:24:08 +01:00
Jonas Jensen
8f9849b30b C++: Add BuiltInIntAddr class for __INTADDR__ 2019-01-04 10:24:08 +01:00
Raul Garcia
89c045b550 Merge branch 'users/raulga/c6324' of https://github.com/raulgarciamsft/ql into users/raulga/c6324 2019-01-03 10:06:59 -08:00
Raul Garcia
2c1d7bbc41 Switched to DataFlow::localFlow to avoid false positives. 2019-01-03 10:06:49 -08:00
Raul Garcia
e7bc3e6c0d Update UsingStrcpyAsBoolean.cpp 2019-01-02 17:33:28 -08:00
Raul Garcia
28932e85d9 Fixing the code based on PR feedback. 2019-01-02 16:23:19 -08:00
Tom Hvitved
f187e7444c C#: Autoformat follow-up changes 2019-01-02 13:51:30 +01:00
Tom Hvitved
daa45322b1 C#: Autoformat QL queries 2019-01-02 12:59:07 +01:00
Tom Hvitved
412248c77f C#: Address review comments 2019-01-02 10:42:08 +01:00
Mark Shannon
6b5ad0d928 Python: Detect a wider range of generated files. 2018-12-27 15:01:10 +00:00
Tom Hvitved
9f375de716 C#: Improve logic for looking up .NET runtime in standalone mode
Instead of only considering a fixed set of paths for `dotnet` and `mono`,
first attempt to lookup the paths based on the `PATH` environment variable.
This change also fixes a potential `System.IO.DirectoryNotFoundException` exception,
which could be thrown when the `shared/Microsoft.NETCore.App` folder was not
present.
2018-12-20 15:34:15 +01:00
Jonas Jensen
97fc4b0c8e Merge pull request #703 from aeyerstaylor/fix-optimiser-performance
C++: Improve optimiser performance
2018-12-18 12:26:16 +00:00
alexet
d61022ffcc C++: Improve optimiser performance 2018-12-17 16:11:23 +00:00
Raul Garcia
0531602454 Update .gitignore 2018-12-14 15:47:04 -08:00
Raul Garcia
f8ab945b91 Merge branch 'master' into users/raulga/c6324 2018-12-14 15:46:38 -08:00
Raul Garcia
16f2bacf4d cpp - Using the return value of a strcpy or related string copy function in an if statement 2018-12-14 15:42:49 -08:00
Geoffrey White
ca999473b0 CPP: Change note. 2018-12-13 10:17:43 +00:00
Geoffrey White
e443eb8889 CPP: Fix type logic. 2018-12-13 09:49:32 +00:00
Geoffrey White
c904a338f7 CPP: Add test cases. 2018-12-12 23:47:48 +00:00
Geoffrey White
5e39e0ed65 CPP: Change note. 2018-12-12 11:39:20 +00:00
Geoffrey White
2f3a874c7d CPP: Fix false positives when a member variable is released via the target of a function pointer. 2018-12-12 11:38:44 +00:00
Geoffrey White
370387a9ca CPP: Fix false positives when member variable is released via an ExprCall. 2018-12-12 11:38:44 +00:00
Geoffrey White
e408f18766 CPP: Fix false positives when member variable is released via capture inside lambda expression. 2018-12-12 11:38:44 +00:00
Geoffrey White
6efd481118 CPP: Make references to the 'kind' of an alloc/delete consistent (this used to be called the 'release' or 'releaseName'). 2018-12-12 11:38:44 +00:00
Geoffrey White
8e2459a6b7 CPP: Add similar test cases with function pointers. 2018-12-12 11:38:44 +00:00
Geoffrey White
77c1ad47f9 CPP: Add test cases with lambdas. 2018-12-12 11:38:44 +00:00
Sebastian Bauersfeld
6c756c5e6a Rename ConfigLine to ConfigPair. Make ConfigFiles.ql a library, as intended 2018-12-10 14:08:27 -05:00
Sebastian Bauersfeld
3379e71e01 Add ConfigFiles library for working with configuration files. 2018-12-07 15:11:54 -05:00
Mark Shannon
435b309852 Python: Add utility predicate for finding ModuleObject by name. 2018-11-27 17:06:40 +00:00
Luke Cartey
d34eef82b3 C#: Remove the 'security' tag from some queries
These queries are only tenuously security queries, and marking them as
security queries can cause them to have greater prominence than is
merited by the results that they report.
2018-10-03 11:48:27 +01:00
8690 changed files with 598556 additions and 272903 deletions

3
.codeqlmanifest.json Normal file
View File

@@ -0,0 +1,3 @@
{ "provide": [ "*/ql/src/qlpack.yml",
"misc/legacy-support/*/qlpack.yml",
"misc/suite-helpers/qlpack.yml" ] }

1
.gitattributes vendored
View File

@@ -47,3 +47,4 @@
*.jpeg -text
*.gif -text
*.dll -text
*.pdb -text

View File

@@ -0,0 +1,24 @@
---
name: LGTM.com - false positive
about: Tell us about an alert that shouldn't be reported
title: LGTM.com - false positive
labels: false-positive
assignees: ''
---
**Description of the false positive**
<!-- Please explain briefly why you think it shouldn't be included. -->
**URL to the alert on the project page on LGTM.com**
<!--
1. Open the project on LGTM.com.
For example, https://lgtm.com/projects/g/pallets/click/.
2. Switch to the `Alerts` tab. For example, https://lgtm.com/projects/g/pallets/click/alerts/.
3. Scroll to the alert that you would like to report.
4. Click on the right most icon `View this alert within the complete file`.
5. A new browser tab opens. Copy and paste the page URL here.
For example, https://lgtm.com/projects/g/pallets/click/snapshot/719fb7d8322b0767cdd1e5903ba3eb3233ba8dd5/files/click/_winconsole.py#xa08d213ab3289f87:1.
-->

14
.github/ISSUE_TEMPLATE/ql---general.md vendored Normal file
View File

@@ -0,0 +1,14 @@
---
name: General issue
about: Tell us if you think something is wrong or if you have a question
title: General issue
labels: question
assignees: ''
---
**Description of the issue**
<!-- Please explain briefly what is the problem.
If it is about an LGTM project, please include its URL.-->

3
.gitignore vendored
View File

@@ -12,3 +12,6 @@
# Visual studio temporaries, except a file used by QL4VS
.vs/*
!.vs/VSWorkspaceSettings.json
# It's useful (though not required) to be able to unpack codeql in the ql checkout itself
/codeql/

View File

@@ -20,3 +20,8 @@ extraction:
python:
python_setup:
version: 3
javascript:
index:
exclude:
- javascript/ql/test
- javascript/extractor/tests

View File

@@ -2,3 +2,9 @@
/java/ @Semmle/java
/javascript/ @Semmle/js
/cpp/ @Semmle/cpp-analysis
/cpp/**/*.qhelp @hubwriter
/csharp/**/*.qhelp @jf205
/java/**/*.qhelp @felicitymay
/javascript/**/*.qhelp @mchammer01
/python/**/*.qhelp @felicitymay
/docs/language/ @shati-patel @jf205

View File

@@ -14,7 +14,7 @@ Our community strives to:
* Posting, or threatening to post, peoples personally identifying information (“doxing”).
* Insults, especially those using discriminatory terms or slurs.
* Behavior that could be perceived as sexual attention.
* Advocating for or encouraging any of the above behaviors.
* Advocating for or encouraging any of the above behaviors.
* Understand disagreements: Disagreements, both social and technical, are useful learning opportunities. Seek to understand others viewpoints and resolve differences constructively.
This code is not exhaustive or complete. It serves to capture our common understanding of a productive, collaborative environment. We expect the code to be followed in spirit as much as in the letter.

View File

@@ -1,10 +1,50 @@
# Contributing to QL
We welcome contributions to our standard library and standard checks, got an idea for a new check, or how to improve an existing query? Then please go ahead an open a Pull Request!
We welcome contributions to our standard library and standard checks. Got an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request!
Before we accept your pull request, we will require that you have agreed to our Contributor License Agreement, this is not something that you need to do before you submit your pull request, but until you've done so, we will be unable to accept your contribution.
Before we accept your pull request, we require that you have agreed to our Contributor License Agreement, this is not something that you need to do before you submit your pull request, but until you've done so, we will be unable to accept your contribution.
Please read our [QL Style Guide](docs/ql-style-guide.md) for information on how to format QL code in this repository.
## Adding a new query
If you have an idea for a query that you would like to share with other Semmle users, please open a pull request to add it to this repository.
Follow the steps below to help other users understand what your query does, and to ensure that your query is consistent with the other Semmle queries.
1. **Consult the QL documentation for query writers**
There is lots of useful documentation to help you write QL, ranging from information about query file structure to language-specific tutorials. For more information on the documentation available, see [Writing QL queries](https://help.semmle.com/QL/learn-ql/writing-queries/writing-queries.html) on [help.semmle.com](https://help.semmle.com).
2. **Format your QL correctly**
All of Semmle's standard QL queries and libraries are uniformly formatted for clarity and consistency, so we strongly recommend that all QL contributions follow the same formatting guidelines. If you use QL for Eclipse, you can auto-format your query in the [QL editor](https://help.semmle.com/ql-for-eclipse/Content/WebHelp/ql-editor.html). For more information, see the [QL style guide](https://github.com/Semmle/ql/blob/master/docs/ql-style-guide.md).
3. **Make sure your query has the correct metadata**
Query metadata is used by Semmle's analysis to identify your query and make sure the query results are displayed properly.
The most important metadata to include are the `@name`, `@description`, and the `@kind`.
Other metadata properties (`@precision`, `@severity`, and `@tags`) are usually added after the query has been reviewed by Semmle staff.
For more information on writing query metadata, see the [Query metadata style guide](https://github.com/Semmle/ql/blob/master/docs/query-metadata-style-guide.md).
4. **Make sure the `select` statement is compatible with the query type**
The `select` statement of your query must be compatible with the query type (determined by the `@kind` metadata property) for alert or path results to be displayed correctly in LGTM and QL for Eclipse.
For more information on `select` statement format, see [Introduction to query files](https://help.semmle.com/QL/learn-ql/writing-queries/introduction-to-queries.html#select-clause) on help.semmle.com.
5. **Save your query in a `.ql` file in correct language directory in this repository**
There are five language-specific directories in this repository:
* C/C++: `ql/cpp/ql/src`
* C#: `ql/csharp/ql/src`
* Java: `ql/java/ql/src`
* JavaScript: `ql/javascript/ql/src`
* Python: `ql/python/ql/src`
Each language-specific directory contains further subdirectories that group queries based on their `@tags` properties or purpose. Select the appropriate subdirectory for your new query, or create a new one if necessary.
6. **Write a query help file**
Query help files explain the purpose of your query to other users. Write your query help in a `.qhelp` file and save it in the same directory as your new query.
For more information on writing query help, see the [Query help style guide](https://github.com/Semmle/ql/blob/master/docs/query-help-style-guide.md).
## Using your personal data

View File

@@ -4,13 +4,13 @@ This open source repository contains the standard QL libraries and queries that
## How do I learn QL and run queries?
LGTM has [extensive documentation](https://lgtm.com/help/ql/introduction-to-ql) on getting started with writing QL.
You can use the [interactive query console](https://lgtm.com/help/lgtm/using-query-console) or the [QL for Eclipse](https://lgtm.com/help/lgtm/running-queries-ide) plugin to try out your queries on any open-source project that's currently being analyzed.
There is [extensive documentation](https://help.semmle.com/QL/learn-ql/) on getting started with writing QL.
You can use the [interactive query console](https://lgtm.com/help/lgtm/using-query-console) on LGTM.com or the [QL for Eclipse](https://lgtm.com/help/lgtm/running-queries-ide) plugin to try out your queries on any open-source project that's currently being analyzed.
## Contributing
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md) and [QL style guide](docs/ql-style-guide.md).
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md). You can also consult our [style guides](https://github.com/Semmle/ql/tree/master/docs) to learn how to format your QL for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
## License
The LGTM queries are licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).
The QL queries in this repository are licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).

View File

@@ -0,0 +1,61 @@
Frameworks and libraries
########################
The QL libraries and queries in this version have been explicitly checked against the libraries and frameworks listed below.
.. pull-quote::
Tip
If you're interested in other libraries or frameworks, you can extend the analysis to cover them.
For example, by extending the data flow libraries to include data sources and sinks for additional libraries or frameworks.
.. There is currently no built-in support for libraries or frameworks for C/C++.
C# built-in support
================================
* ASP.Net MVC framework
* ASP.NET Web API
* ASP.NET Web Forms
* ASP.NET Core
* ASP.NET Core MVC
* ASP.Net Core Razor
* Razor templates
COBOL built-in support
===================================
* Embedded SQL
* Embedded CICS
Java built-in support
==================================
.. csv-table::
:file: java-frameworks.csv
:header-rows: 1
:class: fullWidthTable
:widths: auto
JavaScript and TypeScript built-in support
=======================================================
.. csv-table::
:file: javascript-typescript-frameworks.csv
:header-rows: 1
:class: fullWidthTable
:widths: auto
Python built-in support
====================================
.. csv-table::
:file: python-frameworks.csv
:header-rows: 1
:class: fullWidthTable
:widths: auto

View File

@@ -0,0 +1,10 @@
Name, Category
Hibernate, Database
iBatis / MyBatis, Database
Java Persistence API (JPA), Database
JDBC, Database
Kryo deserialization, Serialization
SnakeYaml, Serialization
Spring JDBC, Database
Spring MVC, Web application framework
XStream, Serialization
1 Name Category
2 Hibernate Database
3 iBatis / MyBatis Database
4 Java Persistence API (JPA) Database
5 JDBC Database
6 Kryo deserialization Serialization
7 SnakeYaml Serialization
8 Spring JDBC Database
9 Spring MVC Web application framework
10 XStream Serialization

View File

@@ -0,0 +1,22 @@
Name, Category
angularjs, HTML framework
axios, Network communicator
browser, Runtime environment
electron, Runtime environment
express, Server
hapi, Server
jquery, Utility library
koa, Server
lodash, Utility library
mongodb, Database
mssql, Database
mysql, Database
node, Runtime environment
postgres, Database
ramda, Utility library
react, HTML framework
request, Network communicator
sequelize, Database
sqlite3, Database
superagent, Network communicator
underscore, Utility library
1 Name Category
2 angularjs HTML framework
3 axios Network communicator
4 browser Runtime environment
5 electron Runtime environment
6 express Server
7 hapi Server
8 jquery Utility library
9 koa Server
10 lodash Utility library
11 mongodb Database
12 mssql Database
13 mysql Database
14 node Runtime environment
15 postgres Database
16 ramda Utility library
17 react HTML framework
18 request Network communicator
19 sequelize Database
20 sqlite3 Database
21 superagent Network communicator
22 underscore Utility library

View File

@@ -0,0 +1,19 @@
Languages and compilers
#######################
QL and LGTM version |version| support analysis of the following languages compiled by the following compilers.
Note that where there are several versions or dialects of a language, the supported variants are listed.
.. csv-table::
:file: versions-compilers.csv
:header-rows: 1
:widths: auto
:stub-columns: 1
.. container:: footnote-group
.. [1] The best results are achieved with COBOL code that stays close to the ANSI 85 standard.
.. [2] Java 11 refers to the language features used. Builds that execute on Java 6 or higher can be analyzed.
.. [3] JSX and Flow code, YAML, JSON, and HTML files may also be analyzed with JavaScript files.
.. [4] TypeScript analysis is performed by running the JavaScript extractor with TypeScript enabled. This is the default for LGTM.

View File

@@ -0,0 +1,7 @@
Name, Category
Django, Web application framework
Flask, Microframework
Pyramid, Web application framework
Tornado, Web application framework and asynchronous networking library
Twisted, Networking engine
WebOb, WSGI request library
1 Name Category
2 Django Web application framework
3 Flask Microframework
4 Pyramid Web application framework
5 Tornado Web application framework and asynchronous networking library
6 Twisted Networking engine
7 WebOb WSGI request library

View File

@@ -0,0 +1,16 @@
Language,Variants,Compilers,Extensions
C/C++,"C89, C99, C11, C++98, C++03, C++11, C++14, C++17","Clang extensions (up to Clang 6.0)
GNU extensions (up to GCC 7.3),
Microsoft extensions (up to VS 2017)","``.cpp``, ``.c++``, ``.cxx``, ``.hpp``, ``.hh``, ``.h++``, ``.hxx``, ``.c``, ``.cc``, ``.h``"
C#,C# up to 7.2 together with .NET versions up to 4.7.1,"Microsoft Visual Studio up to 2017,
.NET Core up to 2.1","``.sln``, ``.csproj``, ``.cs``, ``.cshtml``, ``.xaml``"
COBOL,ANSI 85 or newer [1]_.,Not applicable,"``.cbl``, ``.CBL``, ``.cpy``, ``.CPY``, ``.copy``, ``.COPY``"
Java,"Java 11 [2]_. or lower","javac (OpenJDK and Oracle JDK)
Eclipse compiler for Java (ECJ) batch compiler",``.java``
JavaScript,ECMAScript 2018 or lower,Not applicable,"``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhm``, ``.xhtml``, ``.vue``, ``.json`` [3]_."
Python,"2.7, 3.5, 3.6, 3.7",Not applicable,``.py``
TypeScript [4]_.,"2.6, 2.7, 2.8, 2.9, 3.0, 3.1",Standard TypeScript compiler,"``.ts``, ``.tsx``"
1 Language Variants Compilers Extensions
2 C/C++ C89, C99, C11, C++98, C++03, C++11, C++14, C++17 Clang extensions (up to Clang 6.0) GNU extensions (up to GCC 7.3), Microsoft extensions (up to VS 2017) ``.cpp``, ``.c++``, ``.cxx``, ``.hpp``, ``.hh``, ``.h++``, ``.hxx``, ``.c``, ``.cc``, ``.h``
3 C# C# up to 7.2 together with .NET versions up to 4.7.1 Microsoft Visual Studio up to 2017, .NET Core up to 2.1 ``.sln``, ``.csproj``, ``.cs``, ``.cshtml``, ``.xaml``
4 COBOL ANSI 85 or newer [1]_. Not applicable ``.cbl``, ``.CBL``, ``.cpy``, ``.CPY``, ``.copy``, ``.COPY``
5 Java Java 11 [2]_. or lower javac (OpenJDK and Oracle JDK) Eclipse compiler for Java (ECJ) batch compiler ``.java``
6 JavaScript ECMAScript 2018 or lower Not applicable ``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhm``, ``.xhtml``, ``.vue``, ``.json`` [3]_.
7 Python 2.7, 3.5, 3.6, 3.7 Not applicable ``.py``
8 TypeScript [4]_. 2.6, 2.7, 2.8, 2.9, 3.0, 3.1 Standard TypeScript compiler ``.ts``, ``.tsx``

View File

@@ -2,19 +2,47 @@
## General improvements
* The logic for identifying auto-generated files via `#line` directives has been improved.
* The logic for identifying auto-generated files via comments and `#line` directives has been improved.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Array argument size mismatch (`cpp/array-arg-size-mismatch`) | reliability | Finds function calls where the size of an array being passed is smaller than the array size of the declared parameter. Newly displayed on LGTM. |
| Lossy function result cast (`cpp/lossy-function-result-cast`) | correctness | Finds function calls whose result type is a floating point type, which are implicitly cast to an integral type. Newly available on LGTM but results not displayed by default. |
| Returning stack-allocated memory (`cpp/return-stack-allocated-memory`) | reliability, external/cwe/cwe-825 | Finds functions that may return a pointer or reference to stack-allocated memory. This query existed already but has been rewritten from scratch to make the error rate low enough for use on LGTM. Results displayed by default. |
| Use of string copy function in a condition (`cpp/string-copy-return-value-as-boolean`) | correctness | This query identifies calls to string copy functions used in conditions, where it's likely that a different function was intended to be called. Results are displayed by default on LGTM. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Suspicious pointer scaling (`cpp/suspicious-pointer-scaling`) | Fewer false positives | False positives involving types that are not uniquely named in the snapshot have been fixed. |
| Array argument size mismatch (`cpp/array-arg-size-mismatch`) | Fewer false positive results | An exception has been added to this query for variable sized arrays. |
| Call to memory access function may overflow buffer (`cpp/overflow-buffer`) | More correct results | This query now recognizes calls to `RtlCopyMemoryNonTemporal` and `RtlSecureZeroMemory`. |
| Call to memory access function may overflow buffer (`cpp/overflow-buffer`) | More correct results | Calls to `fread` are now examined by this query. |
| Lossy function result cast (`cpp/lossy-function-result-cast`) | Fewer false positive results | The whitelist of rounding functions built into this query has been expanded. |
| Memory is never freed (`cpp/memory-never-freed`) | More correct results | Support for more Microsoft-specific memory allocation/de-allocation functions has been added. |
| Memory may not be freed (`cpp/memory-may-not-be-freed`) | More correct results | Support for more Microsoft-specific memory allocation/de-allocation functions has been added. |
| Mismatching new/free or malloc/delete (`cpp/new-free-mismatch`) | More correct results | Data flow through global variables for this query has been improved. |
| 'new[]' array freed with 'delete' (`cpp/new-array-delete-mismatch`) | More correct results | Data flow through global variables for this query has been improved. |
| 'new' object freed with 'delete[]' (`cpp/new-delete-array-mismatch`) | More correct results | Data flow through global variables for this query has been improved. |
| Potential buffer overflow (`cpp/potential-buffer-overflow`) | Deprecated | This query has been deprecated. Use Potentially overrunning write (`cpp/overrunning-write`) and Potentially overrunning write with float to string conversion (`cpp/overrunning-write-with-float`) instead. |
| Resource not released in destructor (`cpp/resource-not-released-in-destructor`) | Fewer false positive results | The query no longer highlights code that releases a resource via a virtual method call, function pointer, or lambda. |
| Returning stack-allocated memory (`cpp/return-stack-allocated-memory`) | More correct results | Many more stack allocated expressions are now recognized. |
| Suspicious add with sizeof (`cpp/suspicious-add-sizeof`) | Fewer false positive results | Pointer arithmetic on `char * const` expressions (and other variations of `char *`) are now correctly excluded from the results. |
| Suspicious pointer scaling (`cpp/suspicious-pointer-scaling`) | Fewer false positive results | False positive results involving types that are not uniquely named in the snapshot have been fixed. |
| Unused static variable (`cpp/unused-static-variable`) | Fewer false positive results | Variables with the attribute `unused` are now excluded from the query. |
| Resource not released in destructor (`cpp/resource-not-released-in-destructor`) | Fewer false positive results | Fix false positives where a resource is released via a virtual method call. |
| Use of inherently dangerous function (`cpp/potential-buffer-overflow`) | Cleaned up | This query no longer catches uses of `gets`, and has been renamed 'Potential buffer overflow'. |
| Use of potentially dangerous function (`cpp/potentially-dangerous-function`) | More correct results | This query now catches uses of `gets`. |
## Changes to QL libraries
* The `semmle.code.cpp.dataflow.DataFlow` library now supports _definition by reference_ via output parameters of known functions.
* Data flows through `memcpy` and `memmove` by default.
* Custom flow into or out of arguments assigned by reference can be modeled with the new class `DataFlow::DefinitionByReferenceNode`.
* The data flow library adds flow through library functions that are modeled in `semmle.code.cpp.models.interfaces.DataFlow`. Queries can add subclasses of `DataFlowFunction` to specify additional flow.
* There is a new `Namespace.isInline()` predicate, which holds if the namespace was declared as `inline namespace`.
* The `Expr.isConstant()` predicate now also holds for _address constant expressions_, which are addresses that will be constant after the program has been linked. These address constants do not have a result for `Expr.getValue()`.
* There are new `Function.isDeclaredConstexpr()` and `Function.isConstexpr()` predicates. They can be used to tell whether a function was declared as `constexpr`, and whether it actually is `constexpr`.
* There is a new `Variable.isConstexpr()` predicate. It can be used to tell whether a variable is `constexpr`.

View File

@@ -1,19 +1,22 @@
# Improvements to C# analysis
## General improvements
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
## Changes to existing queries
| *@name of query (Query ID)* | *Impact on results* | *How/why the query has changed* |
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Off-by-one comparison against container length (cs/index-out-of-bounds) | Fewer false positives | Results have been removed when there are additional guards on the index. |
| Dereferenced variable is always null (cs/dereferenced-value-is-always-null) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. The query is now enabled by default in LGTM. |
| Dereferenced variable may be null (cs/dereferenced-value-may-be-null) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. The query is now enabled by default in LGTM. |
| Clear text storage of sensitive information (`cs/cleartext-storage-of-sensitive-information`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
| Dereferenced variable is always null (`cs/dereferenced-value-is-always-null`) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. Results are now shown by default in LGTM. |
| Dereferenced variable may be null (`cs/dereferenced-value-may-be-null`) | Improved results | The query has been rewritten from scratch, and the analysis is now based on static single assignment (SSA) forms. Results are now shown by default in LGTM. |
| Double-checked lock is not thread-safe (`cs/unsafe-double-checked-lock`) | Fewer false positive and more true positive results | No longer highlights code where the underlying field was not updated in the `lock` statement, or where the field is a `struct`. Results have been added where there are other statements inside the `lock` statement. |
| Exposure of private information (`cs/exposure-of-sensitive-information`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
| Improper control of generation of code (`cs/code-injection`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
| Off-by-one comparison against container length (`cs/index-out-of-bounds`) | Fewer false positive results | No longer reports results when there are additional guards on the index. |
| SQL query built from user-controlled sources (`cs/sql-injection`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
| Uncontrolled format string (`cs/uncontrolled-format-string`) | More results | Now includes data sources for user controls in `System.Windows.Forms`. |
| Unused format argument (`cs/format-argument-unused`) | Fewer false positive results | No longer reports results where the format string is empty. This is often used as a default value and is not an interesting result. |
| Use of default ToString() (`cs/call-to-object-tostring`) | Fewer false positive results | No longer reports results for `char` arrays passed to `StringBuilder.Append()`, which were incorrectly marked as using `ToString`. |
| Use of default ToString() (`cs/call-to-object-tostring`) | Fewer results | No longer reports results when the object is an interface or an abstract class. |
| Using a package with a known vulnerability (`cs/use-of-vulnerable-package`) | More results | This query detects packages vulnerable to CVE-2019-0657. |
## Changes to code extraction
@@ -22,4 +25,14 @@
## Changes to QL libraries
## Changes to the autobuilder
* The class `TrivialProperty` now includes library properties determined to be trivial using CIL analysis. This may increase the number of results for all queries that use data flow.
* Taint-tracking steps have been added for the `Json.NET` package. This will improve results for queries that use taint tracking.
* Support has been added for EntityFrameworkCore, including
- Stored data flow sources
- Sinks for SQL expressions
- Data flow through fields that are mapped to the database
* Support has been added for NHibernate-Core, including
- Stored data flow sources
- Sinks for SQL expressions
- Data flow through fields that are mapped to the database

View File

@@ -1,8 +1,5 @@
# Improvements to Java analysis
## General improvements
## New queries
| **Query** | **Tags** | **Purpose** |
@@ -14,7 +11,22 @@
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Arbitrary file write during archive extraction ("Zip Slip") (`java/zipslip`) | Fewer false positive results | Results involving a sanitization step that converts a destination `Path` to a `File` are no longer reported. |
| Result of multiplication cast to wider type (`java/integer-multiplication-cast-to-long`) | Fewer results | Results involving conversions to `float` or `double` are no longer reported, as they were almost exclusively false positives. |
## Changes to QL libraries
* The deprecated library `semmle.code.java.security.DataFlow` has been removed.
Improved data flow libraries have been available in
`semmle.code.java.dataflow.DataFlow`,
`semmle.code.java.dataflow.TaintTracking`, and
`semmle.code.java.dataflow.FlowSources` since 1.16.
* Taint tracking now includes additional default data-flow steps through
collections, maps, and iterators. This affects all security queries, which
can report more results based on such paths.
* The `FlowSources` and `TaintTracking` libraries are extended to cover additional remote user
input and taint steps from the following frameworks: Guice, Protobuf, Thrift and Struts.
This affects all security queries, which may yield additional results on projects
that use these frameworks.

View File

@@ -2,34 +2,66 @@
## General improvements
* Support for popular libraries has been improved. Consequently, queries may produce better results on code bases that use the following features:
- client-side code, for example [React](https://reactjs.org/)
- cookies and webstorage, for example [js-cookie](https://github.com/js-cookie/js-cookie)
- server-side code, for example [hapi](https://hapijs.com/)
* File classification has been improved to recognize additional generated files, for example files from [HTML Tidy](html-tidy.org).
* Support for many frameworks and libraries has been improved, in particular for:
- [a-sync-waterfall](https://www.npmjs.com/package/a-sync-waterfall)
- [Electron](https://electronjs.org)
- [Express](https://npmjs.org/express)
- [hapi](https://hapijs.com/)
- [js-cookie](https://github.com/js-cookie/js-cookie)
- [React](https://reactjs.org/)
- [socket.io](http://socket.io)
- [Vue](https://vuejs.org/)
* The taint tracking library now recognizes flow through persistent storage, this may give more results for the security queries.
* File classification now recognizes additional generated files, for example, files from [HTML Tidy](html-tidy.org).
* The taint tracking library now recognizes flow through persistent storage, class fields, and callbacks in certain cases. Handling of regular expressions has also been improved. This may give more results for the security queries.
* Type inference for function calls has been improved. This may give additional results for queries that rely on type inference.
* The [Closure-Library](https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide) module system is now supported.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Arbitrary file write during archive extraction ("Zip Slip") (`js/zipslip`) | security, external/cwe/cwe-022 | Identifies extraction routines that allow arbitrary file overwrite vulnerabilities, indicating a possible violation of [CWE-022](https://cwe.mitre.org/data/definitions/22.html). Results are shown on LGTM by default. |
| Arrow method on Vue instance (`js/vue/arrow-method-on-vue-instance`) | reliability, frameworks/vue | Highlights arrow functions that are used as methods on Vue instances. Results are shown on LGTM by default.|
| Cross-window communication with unrestricted target origin (`js/cross-window-information-leak`) | security, external/cwe/201, external/cwe/359 | Highlights code that sends potentially sensitive information to another window without restricting the receiver window's origin, indicating a possible violation of [CWE-201](https://cwe.mitre.org/data/definitions/201.html). Results are shown on LGTM by default. |
| Double escaping or unescaping (`js/double-escaping`) | correctness, security, external/cwe/cwe-116 | Highlights potential double escaping or unescaping of special characters, indicating a possible violation of [CWE-116](https://cwe.mitre.org/data/definitions/116.html). Results are shown on LGTM by default. |
| Incomplete regular expression for hostnames (`js/incomplete-hostname-regexp`) | correctness, security, external/cwe/cwe-020 | Highlights hostname sanitizers that are likely to be incomplete, indicating a violation of [CWE-020](https://cwe.mitre.org/data/definitions/20.html). Results are shown on LGTM by default.|
| Incomplete URL substring sanitization | correctness, security, external/cwe/cwe-020 | Highlights URL sanitizers that are likely to be incomplete, indicating a violation of [CWE-020](https://cwe.mitre.org/data/definitions/20.html). Results shown on LGTM by default. |
| Incorrect suffix check (`js/incorrect-suffix-check`) | correctness, security, external/cwe/cwe-020 | Highlights error-prone suffix checks based on `indexOf`, indicating a potential violation of [CWE-20](https://cwe.mitre.org/data/definitions/20.html). Results are shown on LGTM by default. |
| Loop iteration skipped due to shifting (`js/loop-iteration-skipped-due-to-shifting`) | correctness | Highlights code that removes an element from an array while iterating over it, causing the loop to skip over some elements. Results are shown on LGTM by default. |
| Unused property (`js/unused-property`) | maintainability | Highlights properties that are unused. Results are shown on LGTM by default. |
| Useless comparison test (`js/useless-comparison-test`) | correctness | Highlights code that is unreachable due to a numeric comparison that is always true or always false. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|--------------------------------------------|------------------------------|------------------------------------------------------------------------------|
| Client-side cross-site scripting | More true-positive results, fewer false-positive results. | This rule now recognizes WinJS functions that are vulnerable to HTML injection, and no longer flags certain safe uses of jQuery. |
| Insecure randomness | More results | This rule now flags insecure uses of `crypto.pseudoRandomBytes`. |
| Uncontrolled data used in network request | More results | This rule now recognizes host values that are vulnerable to injection. |
| Unused parameter | Fewer false-positive results | This rule no longer flags parameters with leading underscore. |
| Unused variable, import, function or class | Fewer false-positive results | This rule now flags fewer variables that are implictly used by JSX elements, and no longer flags variables with leading underscore. |
| Uncontrolled data used in path expression | Fewer false-positive results | This rule now recognizes the Express `root` option, which prevents path traversal. |
| Ambiguous HTML id attribute | Fewer false positive results | This query now treats templates more conservatively. Its precision has been revised to 'high'. |
| Assignment to exports variable | Fewer results | This query no longer flags code that is also flagged by the query "Useless assignment to local variable". |
| Client-side cross-site scripting | More true positive and fewer false positive results. | This query now recognizes WinJS functions that are vulnerable to HTML injection. It no longer flags certain safe uses of jQuery, and recognizes custom sanitizers. |
| Hard-coded credentials | Fewer false positive results | This query no longer flags the empty string as a hardcoded username. |
| Insecure randomness | More results | This query now flags insecure uses of `crypto.pseudoRandomBytes`. |
| Reflected cross-site scripting | Fewer false positive results. | This query now recognizes custom sanitizers. |
| Stored cross-site scripting | Fewer false positive results. | This query now recognizes custom sanitizers. |
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | Additional ways that class methods can be bound are now recognized. |
| Uncontrolled data used in network request | More results | This query now recognizes host values that are vulnerable to injection. |
| Uncontrolled data used in path expression | Fewer false positive results | This query now recognizes the Express `root` option, which prevents path traversal. |
| Unneeded defensive code | More true positive and fewer false positive results | This query now recognizes additional defensive code patterns. |
| Unsafe dynamic method access | Fewer false positive results | This query no longer flags concatenated strings as unsafe method names. |
| Unused parameter | Fewer false positive results | This query no longer flags parameters with leading underscore. |
| Unused variable, import, function or class | Fewer false positive results | This query now flags fewer variables that are implictly used by JSX elements. It no longer flags variables with a leading underscore and variables in dead code. |
| Unvalidated dynamic method call | More true positive results | This query now flags concatenated strings as unvalidated method names in more cases. |
| Useless assignment to property. | Fewer false positive results | This query now treats assignments with complex right-hand sides correctly. |
| Useless conditional | Fewer results | Additional defensive coding patterns are now ignored. |
| Useless conditional | More true positive results | This query now flags additional uses of function call values. |
## Changes to QL libraries
* `DataFlow::SourceNode` is no longer an abstract class; to add new source nodes, extend `DataFlow::SourceNode::Range` instead.
* Subclasses of `DataFlow::PropRead` are no longer automatically made source nodes; you now need to additionally define a corresponding subclass of `DataFlow::SourceNode::Range` to achieve this.
* The deprecated libraries `semmle.javascript.DataFlow` and `semmle.javascript.dataflow.CallGraph` have been removed; they are both superseded by `semmle.javascript.dataflow.DataFlow`.
* Overriding `DataFlow::InvokeNode.getACallee()` no longer affects the call graph seen by the interprocedural data flow libraries. To do this, the 1-argument version `getACallee(int imprecision)` can be overridden instead.
* The predicate `DataFlow::returnedPropWrite` was intended for internal use only and is no longer available.

View File

@@ -0,0 +1,51 @@
# Improvements to Python analysis
## General improvements
### Extractor changes
The extractor now parses all Python code from a single unified grammar. This means that almost all Python code will be successfully parsed, even if mutually incompatible Python code is present in the same project. This also means that Python code for any version can be correctly parsed on a worker running any other supported version of Python. For example, Python 3.7 code is parsed correctly, even if the installed version of Python is only 3.5. This will reduce the number of syntax errors found in many projects.
### Regular expression analysis improvements
The Python `re` (regular expressions) module library has a couple of constants called `MULTILINE` and `VERBOSE` which determine the parsing of regular expressions. Python 3.6 changed the implementation of these constants, which resulted in false positive results for some queries. The relevant QL libraries have been updated to support both implementations which will remove false positive results from projects that use Python 3.6 and later versions.
### API improvements
The API has been improved to declutter the global namespace and improve discoverability and readability.
* New predicates `ModuleObject::named(name)` and `ModuleObject.attr(name)` have been added, allowing more readable access to common objects. For example, `(any ModuleObject m | m.getName() = "sys").getAttribute("exit")` can be replaced with `ModuleObject::named("sys").attr("exit")`
* The API for accessing builtin functions has been improved. Predicates of the form `theXXXFunction()`, such as `theLenFunction()`, have been deprecated in favor of `Object::builtin(name)`.
* A configuration based API has been added for writing data flow and taint tracking queries. This is provided as a convenience for query authors who have written data flow or taint tracking queries for other languages, so they can use a similar format of query across multiple languages.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Default version of SSL/TLS may be insecure (`py/insecure-default-protocol`) | security, external/cwe/cwe-327 | Finds instances where an insecure default protocol may be used. Results are shown on LGTM by default. |
| Incomplete regular expression for hostnames (`py/incomplete-hostname-regexp`) | security, external/cwe/cwe-020 | Finds instances where a hostname is incompletely sanitized because a regular expression contains an unescaped character. Results are shown on LGTM by default. |
| Incomplete URL substring sanitization (`py/incomplete-url-substring-sanitization`) | security, external/cwe/cwe-020 | Finds instances where a URL is incompletely sanitized due to insufficient checks. Results are shown on LGTM by default. |
| Insecure temporary file (`py/insecure-temporary-file`) | security, external/cwe/cwe-377 | Finds uses of the insecure and deprecated `tempfile.mktemp`, `os.tempnam`, and `os.tmpnam` functions. Results are shown on LGTM by default. |
| Overly permissive file permissions (`py/overly-permissive-file`) | security, external/cwe/cwe-732 | Finds instances where a file is created with overly permissive permissions. Results are not shown on LGTM by default. |
| Use of insecure SSL/TLS version (`py/insecure-protocol`) | security, external/cwe/cwe-327 | Finds instances where a known insecure protocol has been specified. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Comparison using is when operands support \_\_eq\_\_ (`py/comparison-using-is`) | Fewer false positive results | Results where one of the objects being compared is an enum member are no longer reported. |
| Modification of parameter with default (`py/modification-of-default-value`) | More true positive results | Instances where the mutable default value is mutated inside other functions are now also reported. |
| Mutation of descriptor in \_\_get\_\_ or \_\_set\_\_ method (`py/mutable-descriptor`) | Fewer false positive results | Results where the mutation does not occur when calling one of the `__get__`, `__set__` or `__delete__` methods are no longer reported. |
| Redundant comparison (`py/redundant-comparison`) | Fewer false positive results | Results in chained comparisons are no longer reported. |
| Unused import (`py/unused-import`) | Fewer false positive results | Results where the imported module is used in a `doctest` string are no longer reported. |
| Unused import (`py/unused-import`) | Fewer false positive results | Results where the imported module is used in a type-hint comment are no longer reported. |
## Changes to QL libraries
* Added support for the `dill` pickle library.
* Added support for the `bottle` web framework.
* Added support for the `CherryPy` web framework.
* Added support for the `falcon` web API framework.
* Added support for the `turbogears` web framework.

View File

@@ -2,21 +2,11 @@
# Improvements to JavaScript analysis
> NOTES
>
> Please describe your changes in terms that are suitable for
> customers to read. These notes will have only minor tidying up
> before they are published as part of the release notes.
>
> This file is written for lgtm users and should contain *only*
> notes about changes that affect lgtm enterprise users. Add
> any other customer-facing changes to the `studio-java.md`
> file.
>
## General improvements
## Changes to code extraction
* The extractor now supports [Nullish Coalescing](https://github.com/tc39/proposal-nullish-coalescing) expressions.
* The TypeScript extractor now handles the control-flow of logical operators and destructuring assignments more accurately.
* Parallel extraction of JavaScript files (but not TypeScript files) on LGTM is now supported. If LGTM is configured to evaluate queries using multiple threads, then JavaScript files are also extracted using multiple threads.
* Experimental support for [E4X](https://developer.mozilla.org/en-US/docs/Archive/Web/E4X), a legacy language extension developed by Mozilla, is available.
* Additional [Flow](https://flow.org/) syntax is now supported.
* [Nullish Coalescing](https://github.com/tc39/proposal-nullish-coalescing) expressions are now supported.
* [TypeScript 3.2](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-2.html) is now supported.
* The TypeScript extractor now handles the control flow of logical operators and destructuring assignments more accurately.

View File

@@ -0,0 +1,41 @@
# Improvements to C/C++ analysis
## General improvements
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Call to alloca in a loop (`cpp/alloca-in-loop`) | reliability, correctness, external/cwe/cwe-770 | Finds calls to `alloca` in loops, which can lead to stack overflow if the number of iterations is large. Newly displayed [on LGTM](https://lgtm.com/rules/1508831665988/). |
| Call to function with fewer arguments than declared parameters (`cpp/too-few-arguments`) | correctness, maintainability, security | Finds all cases where the number of arguments is fewer than the number of parameters of the function, provided the function is also properly declared/defined elsewhere. Results are displayed by default [on LGTM](https://lgtm.com/rules/1508860726279/). |
| Call to a function with one or more incompatible arguments (`cpp/mistyped-function-arguments`) | correctness, maintainability | Finds all cases where the types of arguments do not match the types of parameters of the function, provided the function is also properly declared/defined elsewhere. Results are not displayed by default [on LGTM](https://lgtm.com/rules/1508849286093/). |
| Use of dangerous function (`cpp/dangerous-function-overflow`) | reliability, security, external/cwe/cwe-242 | Finds calls to `gets`, which does not guard against buffer overflow. These results were previously detected by the `cpp/potentially-dangerous-function` query. Results for both queries are displayed by default on LGTM. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Buffer not sufficient for string (`cpp/overflow-calculated`) | Fewer results | This query no longer reports results that would be found by the 'No space for zero terminator' (`cpp/no-space-for-terminator`) query. |
| Call to function with extraneous arguments (`cpp/futile-params`) | Improved coverage | Query has been generalized to find all cases where the number of arguments exceeds the number of parameters of the function, provided the function is also properly declared/defined elsewhere. |
| Commented-out code (`cpp/commented-out-code`) | More correct results | Commented-out preprocessor code is now detected by this query. |
| Comparison result is always the same | Fewer false positive results | The range analysis library is now more conservative about floating point values being possibly `NaN`. |
| Constructor with default arguments will be used as a copy constructor (`cpp/constructor-used-as-copy-constructor`) | Lowered severity and precision | The severity and precision of this query have been reduced to "warning" and "low", respectively. This coding pattern is used intentionally and safely in a number of real-world projects. Results are no longer displayed on LGTM unless you choose to display them. |
| Dead code due to goto or break statement (`cpp/dead-code-goto`) | Fewer false positive results | Functions containing preprocessor logic are now excluded from this analysis. |
| Memory is never freed (`cpp/memory-never-freed`) | More correct results | Support added for more Microsoft-specific allocation functions, including `LocalAlloc`, `GlobalAlloc`, `HeapAlloc` and `CoTaskMemAlloc`. |
| Memory may not be freed (`cpp/memory-may-not-be-freed`) | More correct results | Support added for more Microsoft-specific allocation functions, including `LocalAlloc`, `GlobalAlloc`, `HeapAlloc` and `CoTaskMemAlloc`. |
| Mismatching new/free or malloc/delete (`cpp/new-free-mismatch`) | Fewer false positive results | Fixed an issue where functions were being identified as allocation functions inappropriately. This correction also affects `cpp/new-array-delete-mismatch` and `cpp/new-delete-array-mismatch`. |
| No space for zero terminator (`cpp/no-space-for-terminator`) | More correct results | This query now detects calls to `std::malloc`. |
| Overflow in uncontrolled allocation size (`cpp/uncontrolled-allocation-size`) | More correct results | This query has been reworked so that it can find a wider variety of results. |
| Resource not released in destructor (`cpp/resource-not-released-in-destructor`) | Fewer false positive results | Resource allocation and deallocation functions are now determined more accurately. |
| Use of potentially dangerous function | More correct results | Calls to `localtime`, `ctime` and `asctime` are now detected by this query. |
| Wrong type of arguments to formatting function (`cpp/wrong-type-format-argument`) | More correct results and fewer false positive results | This query now understands non-standard uses of `%L`. In addition, it more accurately identifies wide and non-wide string/character format arguments on different platforms. |
| Use of potentially dangerous function (`cpp/potentially-dangerous-function`) | Fewer results | Results relating to the standard library `gets` function have been moved into a new query (`cpp/dangerous-function-overflow`). |
## Changes to QL libraries
- The predicate `Declaration.hasGlobalName` now only holds for declarations that are not nested in a class. For example, it no longer holds for a member function `MyClass::myFunction` or a constructor `MyClass::MyClass`, whereas previously it would classify those two declarations as global names.
- In class `Declaration`, predicates `getQualifiedName/0` and `hasQualifiedName/1` are no longer recommended for finding functions by name. Instead, use `hasGlobalName/1` and the new `hasQualifiedName/2` and `hasQualifiedName/3` predicates. This improves performance and identifies names involving templates and inline namespaces more reliably.
- Additional support for definition by reference has been added to the `semmle.code.cpp.dataflow.TaintTracking` library, including:
- Taint-specific edges for functions modeled in `semmle.code.cpp.models.interfaces.DataFlow`.
- Flow through library functions that are modeled in `semmle.code.cpp.models.interfaces.Taint`. Queries can add subclasses of `TaintFunction` to specify additional flow.
- There is a new `FoldExpr` class, representing C++17 fold expressions.
- The member predicates `DeclarationEntry.getUnspecifiedType`, `Expr.getUnspecifiedType`, and `Variable.getUnspecifiedType` have been added. These should be preferred over the existing `getUnderlyingType` predicates.

View File

@@ -0,0 +1,49 @@
# Improvements to C# analysis
## General improvements
C# analysis now supports the extraction and analysis of many C# 8 features. For details see [Changes to code extraction](#changes-to-code-extraction) and [Changes to QL libraries](#changes-to-ql-libraries) below.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Thread-unsafe capturing of an ICryptoTransform object (`cs/thread-unsafe-icryptotransform-captured-in-lambda`) | concurrency, security, external/cwe/cwe-362 | Highlights instances of classes where a field of type `System.Security.Cryptography.ICryptoTransform` is captured by a lambda, and appears to be used in a thread initialization method. Results are not shown on [LGTM](https://lgtm.com/rules/1508141845995/) by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Constant condition (`cs/constant-condition`) | Fewer false positive results | The query now ignores code where the `null` value is in a conditional expression on the left hand side of a null-coalescing expression. For example, in `(a ? b : null) ?? c`, `null` is not considered to be a constant condition. |
| Thread-unsafe use of a static ICryptoTransform field (`cs/thread-unsafe-icryptotransform-field-in-class`) | Fewer false positive results | The criteria for a result has changed to include nested properties, nested fields, and collections. The format of the alert message has changed to highlight the static field. The query name has been updated. |
| Useless upcast (`cs/useless-upcast`) | Fewer false positive results | The query now ignores code where the upcast is used to disambiguate the target of a constructor call. |
## Changes to code extraction
* The following C# 8 features are now extracted:
- Range expressions
- Recursive patterns
- Using declaration statements
- `static` modifiers on local functions
- Null-coalescing assignment expressions
* The `unmanaged` type parameter constraint is also now extracted.
## Changes to QL libraries
* The class `Attribute` has two new predicates: `getConstructorArgument()` and `getNamedArgument()`. The first predicate returns arguments to the underlying constructor call and the second returns named arguments for initializing fields and properties.
* The class `TypeParameterConstraints` has a new predicate `hasUnmanagedTypeConstraint()`. This shows whether the type parameter has the `unmanaged` constraint.
* The following QL classes have been added to model C# 8 features:
- Class `AssignCoalesceExpr` models null-coalescing assignment, for example `x ??= y`
- Class `IndexExpr` models from-end index expressions, for example `^1`
- Class `PatternExpr` is an `Expr` that appears in a pattern. It has the new subclasses `DiscardPatternExpr`, `LabeledPatternExpr`, `RecursivePatternExpr`, `TypeAccessPatternExpr`, `TypePatternExpr`, and `VariablePatternExpr`.
- Class `PatternMatch` models a pattern being matched. It has the subclasses `Case` and `IsExpr`.
- Class `PositionalPatternExpr` models position patterns, for example `(int x, int y)`
- Class `PropertyPatternExpr` models property patterns, for example `Length: int len`
- Class `RangeExpr` models range expressions, for example `1..^1`
- Class `SwitchCaseExpr` models the arm of a switch expression, for example `(false, false) => true`
- Class `SwitchExpr` models `switch` expressions, for example `(a, b) switch { ... }`
- Classes `IsConstantExpr`, `IsTypeExpr` and `IsPatternExpr` are deprecated in favour of `IsExpr`
- Class `Switch` models both `SwitchExpr` and `SwitchStmt`
- Class `Case` models both `CaseStmt` and `SwitchCaseExpr`
- Class `UsingStmt` models both `UsingBlockStmt` and `UsingDeclStmt`

View File

@@ -0,0 +1,26 @@
# Improvements to Java analysis
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Implicit conversion from array to string (`java/print-array`) | Fewer false positive results | Results in slf4j logging calls are no longer reported as slf4j supports array printing. |
| Result of multiplication cast to wider type (`java/integer-multiplication-cast-to-long`) | Fewer false positive results | Range analysis is now used to exclude results involving multiplication of small values that cannot overflow. |
## Changes to QL libraries
* The `Guards` library has been extended to account for method calls that check
conditions by conditionally throwing an exception. This includes the
`checkArgument` and `checkState` methods in
`com.google.common.base.Preconditions`, the `isTrue` and `validState` methods
in `org.apache.commons.lang3.Validate`, as well as any similar custom
methods. This means that more guards are recognized which improves the precision of a number of queries including `java/index-out-of-bounds`,
`java/dereferenced-value-may-be-null`, and `java/useless-null-check`.
* The default sanitizer in taint tracking has been made more precise. The
sanitizer works by looking for guards that inspect tainted strings. It
previously worked at the level of individual variables. Now it
uses the `Guards` library, such that only guarded variable accesses are
sanitized. This may give additional results for security queries.
* Spring framework support now takes into account additional
annotations that indicate remote user input. This affects all security
queries, which may give additional results.

View File

@@ -0,0 +1,62 @@
# Improvements to JavaScript analysis
## General improvements
* Support for the following frameworks and libraries has been improved:
- [koa](https://github.com/koajs/koa)
- [socket.io](http://socket.io)
- [Node.js](http://nodejs.org)
- [Firebase](https://firebase.google.com/)
- [Express](https://expressjs.com/)
- [shelljs](https://www.npmjs.com/package/shelljs)
- [cheerio](https://www.npmjs.com/package/cheerio)
* The security queries now track data flow through Base64 decoders such as the Node.js `Buffer` class, the DOM function `atob`, and a number of npm packages including [`abab`](https://www.npmjs.com/package/abab), [`atob`](https://www.npmjs.com/package/atob), [`btoa`](https://www.npmjs.com/package/btoa), [`base-64`](https://www.npmjs.com/package/base-64), [`js-base64`](https://www.npmjs.com/package/js-base64), [`Base64.js`](https://www.npmjs.com/package/Base64) and [`base64-js`](https://www.npmjs.com/package/base64-js).
* The security queries now track data flow through exceptions.
* The security queries now treat comparisons with symbolic constants as sanitizers, resulting in fewer false positive results.
* TypeScript 3.5 is now supported.
* On LGTM, TypeScript projects now have static type information extracted by default, resulting in more security results.
Users of the command-line tools must still pass `--typescript-full` to the extractor to enable this.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Missing regular expression anchor (`js/regex/missing-regexp-anchor`) | correctness, security, external/cwe/cwe-20 | Highlights regular expression patterns that may be missing an anchor, indicating a possible violation of [CWE-20](https://cwe.mitre.org/data/definitions/20.html). Results are not shown on LGTM by default. |
| Prototype pollution (`js/prototype-pollution`) | security, external/cwe-250, external/cwe-400 | Highlights code that allows an attacker to modify a built-in prototype object through an unsanitized recursive merge function. Results are not shown on [LGTM](https://lgtm.com/rules/1508857356317/) by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
| Arbitrary file write during zip extraction ("Zip Slip") | More results | This rule now considers more libraries, including tar as well as zip. |
| Client-side URL redirect | More results and fewer false-positive results | This rule now recognizes additional uses of the document URL. It also treats URLs as safe in more cases where the hostname cannot be tampered with. |
| Double escaping or unescaping | More results | This rule now considers the flow of regular expressions literals. |
| Expression has no effect | Fewer false-positive results | This rule now treats uses of `Object.defineProperty` more conservatively. |
| Incomplete regular expression for hostnames | More results | This rule now tracks regular expressions for host names further. |
| Incomplete string escaping or encoding | More results | This rule now considers the flow of regular expressions literals, and it no longer flags the removal of trailing newlines. |
| Incorrect suffix check | Fewer false-positive results | This rule now recognizes valid checks in more cases. |
| Password in configuration file | Fewer false positive results | This query now excludes passwords that are inserted into the configuration file using a templating mechanism or read from environment variables. Results are no longer shown on LGTM by default. |
| Replacement of a substring with itself | More results | This rule now considers the flow of regular expressions literals. |
| Server-side URL redirect | Fewer false-positive results | This rule now treats URLs as safe in more cases where the hostname cannot be tampered with. |
| Tainted path | More results and fewer false-positive results | This rule now analyzes path manipulation code more precisely. |
| Type confusion through parameter tampering | Fewer false-positive results | This rule now recognizes additional emptiness checks. |
| Useless assignment to property | Fewer false-positive results | This rule now ignores reads of additional getters. |
| Unreachable statement | Unreachable throws no longer give an alert | This ignores unreachable throws, as they could be intentional (for example, to placate the TS compiler). |
## Changes to QL libraries
* `RegExpLiteral` is now a `DataFlow::SourceNode`.
* `JSDocTypeExpr` now has source locations and is a subclass of `Locatable` and `TypeAnnotation`.
* The two-parameter versions of predicate `isBarrier` in `DataFlow::Configuration` and of predicate `isSanitizer` in `TaintTracking::Configuration` have been renamed to `isBarrierEdge` and `isSanitizerEdge`, respectively. The old names are maintained for backwards-compatibility in this version, but will be deprecated in the next version and subsequently removed.
* Various predicates named `getTypeAnnotation()` now return `TypeAnnotation` instead of `TypeExpr`.
In rare cases, this may cause compilation errors in existing code. Cast the result to `TypeExpr` if this happens.
* The `getALabel` predicate in `LabeledBarrierGuardNode` and `LabeledSanitizerGuardNode`
has been deprecated and overriding it no longer has any effect.
Instead use the 3-parameter version of `blocks` or `sanitizes`.

View File

@@ -0,0 +1,49 @@
# Improvements to Python analysis
## General improvements
Points-to analysis has been re-implemented to support more language features and provide better reachability analysis.
The new implementation adds the following new features:
* Non-local tracking of bound methods and instances of `super()`
* Superior analysis of conditionals and thus improved reachability analysis.
* Superior modelling of descriptors, for example, classmethods and staticmethods.
* Superior tracking of values through parameters, especially `*` arguments.
A new object API has been provided to complement the new points-to implementation.
A new class `Value` replaces the old `Object` class. The `Value` class has a simpler and more consistent API compared to `Object`.
Some of the functionality of `FunctionObject` and `ClassObject` has been added to `Value` to reduce the number of casts to more specific classes.
For example, the QL to find calls to `os.path.open` has changed from
`ModuleObject::named("os").attr("path").(ModuleObject).attr("join").(FunctionObject).getACall()`
to
`Value::called("os.path.join").getACall()`
The old API is now deprecated, but will be continued to be supported for at least another year.
### Impact on existing queries.
As points-to analysis underpins many queries, and provides the call-graph and reachability analysis required for taint-tracking, the results of many queries may change.
The improved reachability analysis and non-local tracking of bound methods may identify new results.
The increased precision in tracking of values through `*` arguments may remove false positive results.
Overall the number of true positive results should increase and the number false negative results should decline.
We welcome feedback on the new implementation, particularly any surprising changes in results.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------|----------|-------------|
| Accepting unknown SSH host keys when using Paramiko (`py/paramiko-missing-host-key-validation`) | security, external/cwe/cwe-295 | Finds instances where Paramiko is configured to accept unknown host keys. Results are shown [on LGTM](https://lgtm.com/rules/1508297729270/) by default. |
| Pythagorean calculation with sub-optimal numerics (`py/pythagorean`) | accuracy | Finds instances of hypotenuse calculation using `math.sqrt` instead of `math.hypot`. Results are not shown on LGTM by default. |
| Use of 'return' or 'yield' outside a function (`py/return-or-yield-outside-function`) | reliability, correctness | Finds instances where `return`, `yield`, and `yield from` are used outside a function. Results are not shown on LGTM by default. |
## Changes to code extraction
* String literals as expressions within literal string interpolation (f-strings) are now handled correctly.
* The Python extractor now handles invalid input more robustly. In particular, it exits gracefully when:
* A non-existent file or directory is specified using the `--path` option, or as a file name.
* An invalid number is specified for the `--max-procs` option.

View File

@@ -0,0 +1,17 @@
[[ condition: enterprise-only ]]
# Improvements to JavaScript analysis
## Changes to code extraction
* Custom file types can now be specified using the `filetypes` property in the `extraction/javascript/index` section of `lgtm.yml`. The property should be a map from file extensions (including the dot) to file types. Valid file types are `html`, `js`, `json`, `typescript`, `xml` and `yaml`.
* ECMAScript 2019 support is now enabled by default.
* On LGTM, JavaScript extraction for projects that do not contain any JavaScript or TypeScript code will now fail, even if the project contains other file types (such as HTML or YAML) recognized by the JavaScript extractor.
* XML files can now be extracted on LGTM. To enable XML extraction, set the `xml_mode` property in the `extraction/javascript/index` section of your `lgtm.yml` file to `all`. The default value of this property is `disabled`, meaning that XML files will not be extracted. (Note, that the `xml_mode` property does not apply to files that you map to the `xml` file type using the `filetypes` property. LGTM will always extract these files.)
* YAML files are now extracted by default on LGTM. If required, you can specify exclusion filters in your `lgtm.yml` file to override this behavior.
For detailed information about customizing LGTM extraction, see [JavaScript extraction](https://help.semmle.com/lgtm-enterprise/user/help/javascript-extraction.html).

View File

@@ -0,0 +1,42 @@
# Improvements to C/C++ analysis
The following changes in version 1.22 affect C/C++ analysis in all applications.
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Call to alloca in a loop (`cpp/alloca-in-loop`) | Fewer false positive results | The query no longer highlights code where the stack allocation could not be reached multiple times in the loop, typically due to a `break` or `return` statement. |
| Continue statement that does not continue (`cpp/continue-in-false-loop`) | Fewer false positive results | Analysis is now restricted to `do`-`while` loops. This query is now run and displayed by default on LGTM. |
| Expression has no effect (`cpp/useless-expression`) | Fewer false positive results | Calls to functions with the `weak` attribute are no longer considered to be side-effect free, because they could be overridden with a different implementation at link time. |
| No space for zero terminator (`cpp/no-space-for-terminator`) | Fewer false positive results | False positive results for strings that are not null-terminated have been excluded. |
| Non-constant format string (`cpp/non-constant-format`) | Fewer false positive results | The query was rewritten using the taint-tracking library. |
| Sign check of bitwise operation (`cpp/bitwise-sign-check`) | Fewer false positive and more true positive results | The query now understands the direction of each comparison, making it more accurate. |
| Suspicious pointer scaling (`cpp/suspicious-pointer-scaling`) | Lower precision | The precision of this query has been reduced to "medium". This coding pattern is used intentionally and safely in a number of real-world projects. Results are no longer displayed on LGTM unless you choose to display them. |
| Variable used in its own initializer (`cpp/use-in-own-initializer`) | Fewer false positive results | False positive results for constant variables with the same name in different namespaces have been removed. |
## Changes to QL libraries
- The data flow library (`semmle.code.cpp.dataflow.DataFlow`) has had the
following improvements, all of which benefit the taint tracking library
(`semmle.code.cpp.dataflow.TaintTracking`) as well.
- This release includes preliminary support for interprocedural flow through
fields (non-static data members). In some cases, data stored in a field in
one function can now flow to a read of the same field in a different
function.
- The possibility of specifying barrier edges using
`isBarrierEdge`/`isSanitizerEdge` in data-flow and taint-tracking
configurations has been replaced with the option of specifying in- and
out-barriers on nodes by overriding `isBarrierIn`/`isSanitizerIn` and
`isBarrierOut`/`isSanitizerOut`. This should be simpler to use effectively,
as it does not require knowledge about the actual edges used internally by
the library.
- The library now models data flow through `std::swap`.
- Recursion through the `DataFlow` library is now always a compile error. Such recursion has been deprecated since release 1.16 in March 2018. If one `DataFlow::Configuration` needs to depend on the results of another, switch one of them to use one of the `DataFlow2` through `DataFlow4` libraries.
- In the `semmle.code.cpp.dataflow.TaintTracking` library, the second copy of `Configuration` has been renamed from `TaintTracking::Configuration2` to `TaintTracking2::Configuration`, and the old name is now deprecated. Import `semmle.code.cpp.dataflow.TaintTracking2` to access the new name.
- The `semmle.code.cpp.security.TaintTracking` library now considers a pointer difference calculation as blocking taint flow.
- The predicate `Variable.getAnAssignedValue()` now reports assignments to fields resulting from aggregate initialization (` = {...}`).
- The predicate `TypeMention.toString()` has been simplified to always return the string "`type mention`". This may improve performance when using `Element.toString()` or its descendants.
- Fixed the `LocalScopeVariableReachability.qll` library's handling of loops where the entry condition is always true on first entry, and where there is more than one control flow path through the loop condition. This change increases the accuracy of the `LocalScopeVariableReachability.qll` library and queries that depend on it.
- There is a new `Variable.isThreadLocal()` predicate. It can be used to tell whether a variable is `thread_local`.
- C/C++ code examples have been added to QLDoc comments on many more classes in the QL libraries.

View File

@@ -0,0 +1,58 @@
# Improvements to C# analysis
The following changes in version 1.22 affect C# analysis in all applications.
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Constant condition (`cs/constant-condition`) | Fewer false positive results | Results have been removed for default cases (`_`) in switch expressions. |
| Dispose may not be called if an exception is thrown during execution (`cs/dispose-not-called-on-throw`) | Fewer false positive results | Results have been removed where an object is disposed both by a `using` statement and a `Dispose` call. |
| Unchecked return value (`cs/unchecked-return-value`) | Fewer false positive results | Method calls that are expression bodies of `void` callables (for example, the call to `Foo` in `void Bar() => Foo()`) are no longer considered to use the return value. |
## Removal of old queries
The following historic queries are no longer available in the distribution:
* Added lines (`cs/vcs/added-lines-per-file`)
* Churned lines (`cs/vcs/churn-per-file`)
* Defect filter
* Defect from SVN
* Deleted lines (`cs/vcs/deleted-lines-per-file`)
* Files edited in pairs
* Filter: only files recently edited
* Large files currently edited
* Metric from SVN
* Number of authors (version control) (`cs/vcs/authors-per-file`)
* Number of file-level changes (`cs/vcs/commits-per-file`)
* Number of co-committed files (`cs/vcs/co-commits-per-file`)
* Number of file re-commits (`cs/vcs/recommits-per-file`)
* Number of recent file changes (`cs/vcs/recent-commits-per-file`)
* Number of authors
* Number of commits
* Poorly documented files with many authors
* Recent activity
## Changes to code extraction
* The following C# 8 features are now extracted:
- Suppress-nullable-warning expressions, for example `x!`
- Nullable reference types, for example `string?`
## Changes to QL libraries
* The new class `AnnotatedType` models types with type annotations, including nullability information, return kinds (`ref` and `readonly ref`), and parameter kinds (`in`, `out`, and `ref`).
- The new predicate `Assignable.getAnnotatedType()` gets the annotated type of an assignable (such as a variable or a property).
- The new predicates `Callable.getAnnotatedReturnType()` and `DelegateType.getAnnotatedReturnType()` gets the annotated type of the return value.
- The new predicate `ArrayType.getAnnotatedElementType()` gets the annotated type of the array element.
- The new predicate `ConstructedGeneric.getAnnotatedTypeArgument()` gets the annotated type of a type argument.
- The new predicate `TypeParameterConstraints.getAnAnnotatedTypeConstraint()` gets a type constraint with type annotations.
* The new class `SuppressNullableWarningExpr` models suppress-nullable-warning expressions such as `x!`.
* The data-flow and taint-tracking libraries now support flow through fields. All existing configurations will have field-flow enabled by default, but it can be disabled by adding `override int fieldFlowBranchLimit() { result = 0 }` to the configuration class. Field assignments, `this.Foo = x`, object initializers, `new C() { Foo = x }`, and field initializers `int Foo = 0` are supported.
* The possibility of specifying barrier edges using
`isBarrierEdge`/`isSanitizerEdge` in data-flow and taint-tracking
configurations has been replaced with the option of specifying in- and
out-barriers on nodes by overriding `isBarrierIn`/`isSanitizerIn` and
`isBarrierOut`/`isSanitizerOut`. This should be simpler to use effectively,
as it does not require knowledge about the actual edges used internally by
the library.

View File

@@ -0,0 +1,35 @@
# Improvements to Java analysis
The following changes in version 1.22 affect Java analysis in all applications.
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Equals method does not inspect argument type (`java/unchecked-cast-in-equals`) | Fewer false positive and more true positive results | Precision has been improved by doing a bit of inter-procedural analysis and relying less on ad-hoc method names. |
| Uncontrolled data in arithmetic expression (`java/uncontrolled-arithmetic`) | Fewer false positive results | Precision has been improved in several ways, in particular, by better detection of guards along the data-flow path. |
| Uncontrolled data used in path expression (`java/path-injection`) | Fewer false positive results | The query no longer reports results guarded by `!var.contains("..")`. |
| User-controlled data in arithmetic expression (`java/tainted-arithmetic`) | Fewer false positive results | Precision has been improved in several ways, in particular, by better detection of guards along the data-flow path. |
## Changes to QL libraries
* The virtual dispatch library has been updated to give more precise dispatch
targets for `Object.toString()` calls. This affects all security queries and
removes false positive results that arose from paths through impossible `toString()`
calls.
* The library `VCS.qll` and all queries that imported it have been removed.
* The second copy of the interprocedural `TaintTracking` library has been
renamed from `TaintTracking::Configuration2` to
`TaintTracking2::Configuration`, and the old name is now deprecated. Import
`semmle.code.java.dataflow.TaintTracking2` to access the new name.
* The data-flow library now makes it easier to specify barriers/sanitizers
arising from guards by overriding the predicate
`isBarrierGuard`/`isSanitizerGuard` on data-flow and taint-tracking
configurations respectively.
* The possibility of specifying barrier edges using
`isBarrierEdge`/`isSanitizerEdge` in data-flow and taint-tracking
configurations has been replaced with the option of specifying in- and
out-barriers on nodes by overriding `isBarrierIn`/`isSanitizerIn` and
`isBarrierOut`/`isSanitizerOut`. This should be simpler to use effectively,
as it does not require knowledge about the actual edges used internally by
the library.

View File

@@ -0,0 +1,51 @@
# Improvements to JavaScript analysis
## General improvements
* Automatic classification of test files has been improved, in particular `__tests__` and `__mocks__` folders (as used by [Jest](https://jestjs.io)) are now recognized.
* Support for the following frameworks and libraries has been improved:
- [cross-spawn](https://www.npmjs.com/package/cross-spawn)
- [cross-spawn-async](https://www.npmjs.com/package/cross-spawn-async)
- [exec](https://www.npmjs.com/package/exec)
- [execa](https://www.npmjs.com/package/execa)
- [exec-async](https://www.npmjs.com/package/exec-async)
- [express](https://www.npmjs.com/package/express)
- [remote-exec](https://www.npmjs.com/package/remote-exec)
* Support for tracking data flow and taint through getter functions (that is, functions that return a property of one of their arguments) and through the receiver object of method calls has been improved. This may produce more security alerts.
* Taint tracking through object property names has been made more precise, resulting in fewer false positive results.
* Method calls are now resolved in more cases, due to improved class hierarchy analysis. This may produce more security alerts.
* Jump-to-definition now resolves calls to their definition in more cases, and supports jumping from a JSDoc type annotation to its definition.
## New queries
| **Query** | **Tags** | **Purpose** |
|---------------------------------------------------------------------------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Indirect uncontrolled command line (`js/indirect-command-line-injection`) | correctness, security, external/cwe/cwe-078, external/cwe/cwe-088 | Highlights command-line invocations that may indirectly introduce a command-line injection vulnerability elsewhere, indicating a possible violation of [CWE-78](https://cwe.mitre.org/data/definitions/78.html). Results are not shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
| Conflicting HTML element attributes (`js/conflicting-html-attribute`) | No changes to results | Results are no longer shown on LGTM by default. |
| Shift out of range (`js/shift-out-of-range`| Fewer false positive results | This rule now correctly handles BigInt shift operands. |
| Superfluous trailing arguments (`js/superfluous-trailing-arguments`) | Fewer false-positive results. | This rule no longer flags calls to placeholder functions that trivially throw an exception. |
| Undocumented parameter (`js/jsdoc/missing-parameter`) | No changes to results | This rule is now run on LGTM, although its results are still not shown by default. |
| Missing space in string concatenation (`js/missing-space-in-concatenation`) | Fewer false positive results | The rule now requires a word-like part exists in the string concatenation. |
## Changes to QL libraries
- The `getName()` predicate on functions and classes now gets a name that is
inferred from the context if the function or class was not declared with a name.
- The two-argument and three-argument variants of `DataFlow::Configuration::isBarrier` and
`TaintTracking::Configuration::isSanitizer` have been deprecated. Overriding them no
longer has any effect. Use `isBarrierEdge` and `isSanitizerEdge` instead.
- The QLDoc for most AST classes have been expanded with concrete syntax examples.
- Tutorials on how to use [flow labels](https://help.semmle.com/QL/learn-ql/javascript/flow-labels.html)
and [type tracking](https://help.semmle.com/QL/learn-ql/javascript/type-tracking.html) have been published,
as well as a [data flow cheat sheet](https://help.semmle.com/QL/learn-ql/javascript/dataflow-cheat-sheet.html) for quick reference.

View File

@@ -0,0 +1,38 @@
# Improvements to Python analysis
## General improvements
### Points-to
Tracking of "unknown" values from modules that are absent from the database has been improved. Particularly when an "unknown" value is used as a decorator, the decorated function is tracked.
### Loop unrolling
The extractor now unrolls a single iteration of loops that are known to run at least once. This improves analysis in cases like the following
```python
if seq:
for x in seq:
y = x
y # y is defined here
```
### Better API for function parameter annotations
Instances of the `Parameter` and `ParameterDefinition` class now have a `getAnnotation` method that returns the corresponding parameter annotation, if one exists.
### Improvements to the Value API
- The Value API has been extended with classes representing functions, classes, tuples, and other types.
- `Value::forInt(int x)` and `Value::forString(string s)` have been added to make it easier to refer to the `Value` entities for common constants.
### Other improvements
- Short flags for regexes (for example, `re.M` for multiline regexes) are now handled correctly.
- Modules with multiple import roots no longer get multiple names.
- A new `NegativeIntegerLiteral` class has been added as a subtype of `ImmutableLiteral`, so that `-1` is treated as an `ImmutableLiteral`. This means that queries looking for the use of constant integers will automatically handle negative numbers.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------|----------|-------------|
| Arbitrary file write during tarfile extraction (`py/tarslip`) | security, external/cwe/cwe-022 | Finds instances where extracting from a tar archive can result in arbitrary file writes. Results are not shown on LGTM by default. |

View File

@@ -0,0 +1,51 @@
# Improvements to C/C++ analysis
The following changes in version 1.23 affect C/C++ analysis in all applications.
## General improvements
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | reliability, japanese-era | This query is a combination of two old queries that were identical in purpose but separate as an implementation detail. This new query replaces Hard-coded Japanese era start date in call (`cpp/japanese-era/constructor-or-method-with-exact-era-date`) and Hard-coded Japanese era start date in struct (`cpp/japanese-era/struct-with-exact-era-date`). |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Query name (`query id`) | Expected impact | Message. |
| Hard-coded Japanese era start date in call (`cpp/japanese-era/constructor-or-method-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
| Hard-coded Japanese era start date in struct (`cpp/japanese-era/struct-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | More correct results | This query now checks for the beginning date of the Reiwa era (1st May 2019). |
| Sign check of bitwise operation (`cpp/bitwise-sign-check`) | Fewer false positive results | Results involving `>=` or `<=` are no longer reported. |
| Too few arguments to formatting function (`cpp/wrong-number-format-arguments`) | Fewer false positive results | Fixed false positives resulting from mistmatching declarations of a formatting function. |
| Too many arguments to formatting function (`cpp/too-many-format-arguments`) | Fewer false positive results | Fixed false positives resulting from mistmatching declarations of a formatting function. |
| Unclear comparison precedence (`cpp/comparison-precedence`) | Fewer false positive results | False positives involving template classes and functions have been fixed. |
## Changes to QL libraries
* The data-flow library has been extended with a new feature to aid debugging.
Instead of specifying `isSink(Node n) { any() }` on a configuration to
explore the possible flow from a source, it is recommended to use the new
`Configuration::hasPartialFlow` predicate, as this gives a more complete
picture of the partial flow paths from a given source. The feature is
disabled by default and can be enabled for individual configurations by
overriding `int explorationLimit()`.
* The data-flow library now supports flow out of C++ reference parameters.
* The data-flow library now allows flow through the address-of operator (`&`).
* The `DataFlow::DefinitionByReferenceNode` class now considers `f(x)` to be a
definition of `x` when `x` is a variable of pointer type. It no longer
considers deep paths such as `f(&x.myField)` to be definitions of `x`. These
changes are in line with the user expectations we've observed.
* There is now a `DataFlow::localExprFlow` predicate and a
`TaintTracking::localExprTaint` predicate to make it easy to use the most
common case of local data flow and taint: from one `Expr` to another.
* The member predicates of the `FunctionInput` and `FunctionOutput` classes have been renamed for
clarity (e.g. `isOutReturnPointer()` to `isReturnValueDeref()`). The existing member predicates
have been deprecated, and will be removed in a future release. Code that uses the old member
predicates should be updated to use the corresponding new member predicate.
* The control-flow graph is now computed in QL, not in the extractor. This can
lead to regressions (or improvements) in how queries are optimized because
optimization in QL relies on static size estimates, and the control-flow edge
relations will now have different size estimates than before.

View File

@@ -0,0 +1,47 @@
# Improvements to C# analysis
The following changes in version 1.23 affect C# analysis in all applications.
## New queries
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Unsafe year argument for 'DateTime' constructor (`cs/unsafe-year-construction`) | reliability, date-time | Finds incorrect manipulation of `DateTime` values, which could lead to invalid dates. |
| Mishandling the Japanese era start date (`cs/mishandling-japanese-era`) | reliability, date-time | Finds hard-coded Japanese era start dates that could be invalid. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Dereferenced variable may be null (`cs/dereferenced-value-may-be-null`) | Fewer false positive results | More `null` checks are now taken into account, including `null` checks for `dynamic` expressions and `null` checks such as `object alwaysNull = null; if (x != alwaysNull) ...`. |
| Missing Dispose call on local IDisposable (`cs/local-not-disposed`) | Fewer false positive results | The query has been rewritten in order to identify more dispose patterns. For example, a local `IDisposable` that is disposed of by passing through a fluent API is no longer reported. |
## Removal of old queries
## Changes to code extraction
* `nameof` expressions are now extracted correctly when the name is a namespace.
## Changes to QL libraries
* The new class `NamespaceAccess` models accesses to namespaces, for example in `nameof` expressions.
* The data-flow library now makes it easier to specify barriers/sanitizers
arising from guards by overriding the predicate
`isBarrierGuard`/`isSanitizerGuard` on data-flow and taint-tracking
configurations respectively.
* The data-flow library has been extended with a new feature to aid debugging.
Instead of specifying `isSink(Node n) { any() }` on a configuration to
explore the possible flow from a source, it is recommended to use the new
`Configuration::hasPartialFlow` predicate, as this gives a more complete
picture of the partial flow paths from a given source. The feature is
disabled by default and can be enabled for individual configurations by
overriding `int explorationLimit()`.
* `foreach` statements where the body is guaranteed to be executed at least once, such as `foreach (var x in new string[]{ "a", "b", "c" }) { ... }`, are now recognized by all analyses based on the control flow graph (such as SSA, data flow and taint tracking).
* Fixed the control flow graph for `switch` statements where the `default` case was not the last case. This had caused the remaining cases to be unreachable. `SwitchStmt.getCase(int i)` now puts the `default` case last.
* There is now a `DataFlow::localExprFlow` predicate and a
`TaintTracking::localExprTaint` predicate to make it easy to use the most
common case of local data flow and taint: from one `Expr` to another.
## Changes to autobuilder

View File

@@ -0,0 +1,30 @@
# Improvements to Java analysis
The following changes in version 1.23 affect Java analysis in all applications.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Continue statement that does not continue (`java/continue-in-false-loop`) | correctness | Finds `continue` statements in `do { ... } while (false)` loops. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Dereferenced variable may be null (`java/dereferenced-value-may-be-null`) | Fewer false positives | Certain indirect null guards involving two auxiliary variables known to be equal can now be detected. |
| Non-synchronized override of synchronized method (`java/non-sync-override`) | Fewer false positives | Results are now only reported if the immediately overridden method is synchronized. |
| Query built from user-controlled sources (`java/sql-injection`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as SQL expressions sinks. |
| Query built from local-user-controlled sources (`java/sql-injection-local`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as SQL expressions sinks. |
| Query built without neutralizing special characters (`java/concatenated-sql-query`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as SQL expressions sinks. |
| Useless comparison test (`java/constant-comparison`) | Fewer false positives | Additional overflow check patterns are now recognized and no longer reported. |
## Changes to QL libraries
* The data-flow library has been extended with a new feature to aid debugging.
Instead of specifying `isSink(Node n) { any() }` on a configuration to
explore the possible flow from a source, it is recommended to use the new
`Configuration::hasPartialFlow` predicate, as this gives a more complete
picture of the partial flow paths from a given source. The feature is
disabled by default and can be enabled for individual configurations by
overriding `int explorationLimit()`.

View File

@@ -0,0 +1,67 @@
# Improvements to JavaScript analysis
## General improvements
* Suppor for `globalThis` has been added.
* Support for the following frameworks and libraries has been improved:
- [firebase](https://www.npmjs.com/package/firebase)
- [mongodb](https://www.npmjs.com/package/mongodb)
- [mongoose](https://www.npmjs.com/package/mongoose)
- [rate-limiter-flexible](https://www.npmjs.com/package/rate-limiter-flexible)
* The call graph has been improved to resolve method calls in more cases. This may produce more security alerts.
* TypeScript 3.6 features are supported.
## New queries
| **Query** | **Tags** | **Purpose** |
|---------------------------------------------------------------------------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Unused index variable (`js/unused-index-variable`) | correctness | Highlights loops that iterate over an array, but do not use the index variable to access array elements, indicating a possible typo or logic error. Results are shown on LGTM by default. |
| Loop bound injection (`js/loop-bound-injection`) | security, external/cwe/cwe-834 | Highlights loops where a user-controlled object with an arbitrary .length value can trick the server to loop indefinitely. Results are shown on LGTM by default. |
| Suspicious method name (`js/suspicious-method-name-declaration`) | correctness, typescript, methods | Highlights suspiciously named methods where the developer likely meant to write a constructor or function. Results are shown on LGTM by default. |
| Shell command built from environment values (`js/shell-command-injection-from-environment`) | correctness, security, external/cwe/cwe-078, external/cwe/cwe-088 | Highlights shell commands that may change behavior inadvertently depending on the execution environment, indicating a possible violation of [CWE-78](https://cwe.mitre.org/data/definitions/78.html). Results are shown on LGTM by default.|
| Use of returnless function (`js/use-of-returnless-function`) | maintainability, correctness | Highlights calls where the return value is used, but the callee never returns a value. Results are shown on LGTM by default. |
| Useless regular expression character escape (`js/useless-regexp-character-escape`) | correctness, security, external/cwe/cwe-20 | Highlights regular expression strings with useless character escapes, indicating a possible violation of [CWE-20](https://cwe.mitre.org/data/definitions/20.html). Results are shown on LGTM by default. |
| Unreachable method overloads (`js/unreachable-method-overloads`) | correctness, typescript | Highlights method overloads that are impossible to use from client code. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
| Incomplete string escaping or encoding (`js/incomplete-sanitization`) | Fewer false-positive results | This rule now recognizes additional ways delimiters can be stripped away. |
| Client-side cross-site scripting (`js/xss`) | More results, fewer false-positive results | More potential vulnerabilities involving functions that manipulate DOM attributes are now recognized, and more sanitizers are detected. |
| Code injection (`js/code-injection`) | More results | More potential vulnerabilities involving functions that manipulate DOM event handler attributes are now recognized. |
| Hard-coded credentials (`js/hardcoded-credentials`) | Fewer false-positive results | This rule now flags fewer password examples. |
| Illegal invocation (`js/illegal-invocation`) | Fewer false-positive results | This rule now correctly handles methods named `call` and `apply`. |
| Incorrect suffix check (`js/incorrect-suffix-check`) | Fewer false-positive results | The query recognizes valid checks in more cases. |
| Network data written to file (`js/http-to-file-access`) | Fewer false-positive results | This query has been renamed to better match its intended purpose, and now only considers network data untrusted. |
| Password in configuration file (`js/password-in-configuration-file`) | Fewer false-positive results | This rule now flags fewer password examples. |
| Prototype pollution (`js/prototype-pollution`) | More results | The query now highlights vulnerable uses of jQuery and Angular, and the results are shown on LGTM by default. |
| Reflected cross-site scripting (`js/reflected-xss`) | Fewer false-positive results | The query now recognizes more sanitizers. |
| Stored cross-site scripting (`js/stored-xss`) | Fewer false-positive results | The query now recognizes more sanitizers. |
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now treats responses from servers as untrusted. |
## Changes to QL libraries
* `Expr.getDocumentation()` now handles chain assignments.
## Removal of deprecated queries
The following queries (deprecated since 1.17) are no longer available in the distribution:
* Builtin redefined (js/builtin-redefinition)
* Inefficient method definition (js/method-definition-in-constructor)
* Bad parity check (js/incomplete-parity-check)
* Potentially misspelled property or variable name (js/wrong-capitalization)
* Unknown JSDoc tag (js/jsdoc/unknown-tag-type)
* Invalid JSLint directive (js/jslint/invalid-directive)
* Malformed JSLint directive (js/jslint/malformed-directive)
* Use of HTML comments (js/html-comment)
* Multi-line string literal (js/multi-line-string)
* Octal literal (js/octal-literal)
* Reserved word used as variable name (js/use-of-reserved-word)
* Trailing comma in array or object expressions (js/trailing-comma-in-array-or-object)
* Call to parseInt without radix (js/parseint-without-radix)

View File

@@ -0,0 +1,22 @@
# Improvements to Python analysis
## General improvements
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------|----------|-------------|
| Clear-text logging of sensitive information (`py/clear-text-logging-sensitive-data`) | security, external/cwe/cwe-312 | Finds instances where sensitive information is logged without encryption or hashing. Results are shown on LGTM by default. |
| Clear-text storage of sensitive information (`py/clear-text-storage-sensitive-data`) | security, external/cwe/cwe-312 | Finds instances where sensitive information is stored without encryption or hashing. Results are shown on LGTM by default. |
| Binding a socket to all network interfaces (`py/bind-socket-all-network-interfaces`) | security | Finds instances where a socket is bound to all network interfaces. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------|
| Unreachable code | Fewer false positives | Analysis now accounts for uses of `contextlib.suppress` to suppress exceptions. |
| `__iter__` method returns a non-iterator | Better alert message | Alert now highlights which class is expected to be an iterator. |

View File

@@ -0,0 +1,12 @@
[[ condition: enterprise-only ]]
# Improvements to JavaScript analysis
## Changes to code extraction
* Asynchronous generator methods are now parsed correctly and no longer cause a spurious syntax error.
* Recognition of CommonJS modules has improved. As a result, some files that were previously extracted as
global scripts are now extracted as modules.
* Top-level `await` is now supported.
* A bug was fixed in how the TypeScript extractor handles default-exported anonymous classes.
* A bug was fixed in how the TypeScript extractor handles computed instance field names.

View File

@@ -0,0 +1,6 @@
# Files moved to ``docs`` directory
Now that all of the QL documentation is in this repository,
notes on the languages, compilers, and frameworks supported have moved.
They're now stored as part of the Sphinx ``support`` project with the other documentation:
``docs/language/support``.

View File

@@ -1,77 +1,211 @@
{
"DataFlow Java/C++": [
"DataFlow Java/C++/C#": [
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll",
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll",
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll",
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll",
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll",
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplDepr.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll"
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll"
],
"DataFlow Java/C++ Common": [
"DataFlow Java/C++/C# Common": [
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll"
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll"
],
"C++ IR Instruction": [
"TaintTracking::Configuration Java/C++/C#": [
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking4/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking5/TaintTrackingImpl.qll",
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll"
],
"C++ SubBasicBlocks": [
"cpp/ql/src/semmle/code/cpp/controlflow/SubBasicBlocks.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/SubBasicBlocks.qll"
],
"IR Instruction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/Instruction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/Instruction.qll"
],
"C++ IR IRBlock": [
"IR IRBlock": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRBlock.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRBlock.qll"
],
"C++ IR IRVariable": [
"IR IRVariable": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRVariable.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRVariable.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRVariable.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRVariable.qll"
],
"C++ IR FunctionIR": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/FunctionIR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/FunctionIR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/FunctionIR.qll"
"IR IRFunction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRFunction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRFunction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRFunction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRFunction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRFunction.qll"
],
"C++ IR Operand": [
"IR Operand": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Operand.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Operand.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/Operand.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/Operand.qll"
],
"C++ IR IRImpl": [
"IR IRType": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/IRType.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/IRType.qll"
],
"IR Operand Tag": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/OperandTag.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/internal/OperandTag.qll"
],
"IR TIRVariable":[
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TIRVariable.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/internal/TIRVariable.qll"
],
"IR IR": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IR.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IR.qll"
],
"C++ IR IRSanityImpl": [
"IR IRSanity": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRSanity.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRSanity.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRSanity.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRSanity.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRSanity.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRSanity.qll"
],
"C++ IR PrintIRImpl": [
"IR PrintIR": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/PrintIR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/PrintIR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/PrintIR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/PrintIR.qll"
],
"IR IntegerConstant": [
"cpp/ql/src/semmle/code/cpp/ir/internal/IntegerConstant.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/IntegerConstant.qll"
],
"IR IntegerInteval": [
"cpp/ql/src/semmle/code/cpp/ir/internal/IntegerInterval.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/IntegerInterval.qll"
],
"IR IntegerPartial": [
"cpp/ql/src/semmle/code/cpp/ir/internal/IntegerPartial.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/IntegerPartial.qll"
],
"IR Overlap": [
"cpp/ql/src/semmle/code/cpp/ir/internal/Overlap.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/Overlap.qll"
],
"IR EdgeKind": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/EdgeKind.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/EdgeKind.qll"
],
"IR MemoryAccessKind": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/MemoryAccessKind.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/MemoryAccessKind.qll"
],
"IR TempVariableTag": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/TempVariableTag.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/TempVariableTag.qll"
],
"IR Opcode": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/Opcode.qll"
],
"C++ IR InstructionImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/InstructionImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/InstructionImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/InstructionImports.qll"
],
"C++ IR IRImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRImports.qll"
],
"C++ IR IRBlockImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRBlockImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRBlockImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRBlockImports.qll"
],
"C++ IR IRVariableImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRVariableImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRVariableImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRVariableImports.qll"
],
"C++ IR OperandImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/OperandImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/OperandImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/OperandImports.qll"
],
"C++ IR PrintIRImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/PrintIRImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/PrintIRImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintIRImports.qll"
],
"C++ SSA SSAConstructionImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstructionImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstructionImports.qll"
],
"C++ SSA AliasAnalysis": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll"
],
"C++ SSA SSAConstruction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll"
"C++ IR ValueNumberingImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/gvn/internal/ValueNumberingImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/internal/ValueNumberingImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingImports.qll"
],
"C++ IR ValueNumber": [
"IR SSA SimpleSSA": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SimpleSSA.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/SimpleSSA.qll"
],
"IR SSA SSAConstruction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll"
],
"IR SSA PrintSSA": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/PrintSSA.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintSSA.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/PrintSSA.qll"
],
"IR ValueNumber": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/gvn/ValueNumbering.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/gvn/ValueNumbering.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll"
],
"C++ IR ConstantAnalysis": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/constant/ConstantAnalysis.qll",
@@ -98,5 +232,33 @@
"C++ IR PrintDominance": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/reachability/PrintDominance.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/reachability/PrintDominance.qll"
],
"C# IR InstructionImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/InstructionImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/InstructionImports.qll"
],
"C# IR IRImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/IRImports.qll"
],
"C# IR IRBlockImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRBlockImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/IRBlockImports.qll"
],
"C# IR IRVariableImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRVariableImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/IRVariableImports.qll"
],
"C# IR OperandImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/OperandImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/OperandImports.qll"
],
"C# IR PrintIRImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/PrintIRImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/PrintIRImports.qll"
],
"C# IR ValueNumberingImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/gvn/internal/ValueNumberingImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/gvn/internal/ValueNumberingImports.qll"
]
}

View File

@@ -6,8 +6,9 @@
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/IntMultToLong.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Likely Bugs/Conversion/NonzeroValueCastToPointer.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Likely Bugs/Conversion/ImplicitDowncastFromBitfield.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /Correctness/Dangerous Conversions
# Consistent Use
# Consistent Use
+ semmlecode-cpp-queries/Critical/ReturnValueIgnored.ql: /Correctness/Consistent Use
+ semmlecode-cpp-queries/Likely Bugs/InconsistentCheckReturnNull.ql: /Correctness/Consistent Use
+ semmlecode-cpp-queries/Likely Bugs/InconsistentCallOnResult.ql: /Correctness/Consistent Use
@@ -15,6 +16,8 @@
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/AssignWhereCompareMeant.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/CompareWhereAssignMeant.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/ExprHasNoEffect.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooFewArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooManyArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/ShortCircuitBitMask.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/MissingEnumCaseInSwitch.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/FloatComparison.ql: /Correctness/Common Errors

View File

@@ -0,0 +1 @@
+ semmlecode-cpp-queries/Likely Bugs/RedundantNullCheckSimple.ql: /Correctness/Common Errors

View File

@@ -7,8 +7,9 @@
+ semmlecode-cpp-queries/Likely Bugs/Conversion/NonzeroValueCastToPointer.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Likely Bugs/Conversion/ImplicitDowncastFromBitfield.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Likely Bugs/Conversion/CastArrayPointerArithmetic.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql: /Correctness/Dangerous Conversions
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /Correctness/Dangerous Conversions
# Consistent Use
# Consistent Use
+ semmlecode-cpp-queries/Critical/ReturnValueIgnored.ql: /Correctness/Consistent Use
+ semmlecode-cpp-queries/Likely Bugs/InconsistentCheckReturnNull.ql: /Correctness/Consistent Use
+ semmlecode-cpp-queries/Likely Bugs/InconsistentCallOnResult.ql: /Correctness/Consistent Use
@@ -16,6 +17,8 @@
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/AssignWhereCompareMeant.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/CompareWhereAssignMeant.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/ExprHasNoEffect.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooFewArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooManyArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/ShortCircuitBitMask.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/MissingEnumCaseInSwitch.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/FloatComparison.ql: /Correctness/Common Errors

View File

@@ -0,0 +1 @@
+ semmlecode-cpp-queries/Likely Bugs/RedundantNullCheckSimple.ql: /Correctness/Common Errors

View File

@@ -4,7 +4,5 @@
@_namespace com.lgtm/cpp-queries
+ semmlecode-cpp-queries/filters/ClassifyFiles.ql
@_namespace com.lgtm/cpp-queries
+ semmlecode-cpp-queries/filters/ImportAdditionalLibraries.ql
@_namespace com.lgtm/cpp-queries
@import "cpp-alerts-lgtm"

View File

@@ -3,8 +3,8 @@
@name Call to memory access function may overflow buffer (CWE-119)
+ semmlecode-cpp-queries/Critical/OverflowStatic.ql: /CWE/CWE-119
@name Static array access may cause overflow (CWE-119)
# + semmlecode-cpp-queries/Critical/OverflowDestination.ql: /CWE/CWE-119
# ^ disabled due to timeout issue
+ semmlecode-cpp-queries/Critical/OverflowDestination.ql: /CWE/CWE-119
@name Copy function using source size (CWE-119)
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/SuspiciousCallToStrncat.ql: /CWE/CWE-119
@name Potentially unsafe call to strncat (CWE-119)
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/StrncpyFlippedArgs.ql: /CWE/CWE-119

View File

@@ -1,3 +0,0 @@
# CWE-242: Use of Inherently Dangerous Function
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/PotentialBufferOverflow.ql: /CWE/CWE-242
@name Use of inherently dangerous function (CWE-242)

View File

@@ -3,3 +3,5 @@
@name Dangerous use of 'cin' (CWE-676)
+ semmlecode-cpp-queries/Security/CWE/CWE-676/PotentiallyDangerousFunction.ql: /CWE/CWE-676
@name Use of potentially dangerous function (CWE-676)
+ semmlecode-cpp-queries/Security/CWE/CWE-676/DangerousFunctionOverflow.ql: /CWE/CWE-676
@name Use of dangerous function (CWE-676)

View File

@@ -12,7 +12,6 @@
@import "cwe-134"
@import "cwe-170"
@import "cwe-190"
@import "cwe-242"
@import "cwe-253"
@import "cwe-290"
@import "cwe-311"

View File

@@ -0,0 +1 @@
<queries language="cpp"/>

View File

@@ -0,0 +1,16 @@
/**
* @id cpp/examples/addressof
* @name Address of reference variable
* @description Finds address-of expressions (`&`) that take the address
* of a reference variable
* @tags addressof
* reference
*/
import cpp
from AddressOfExpr addr, VariableAccess access
where
access = addr.getOperand() and
access.getTarget().getType() instanceof ReferenceType
select addr

View File

@@ -0,0 +1,17 @@
/**
* @id cpp/examples/arrayaccess
* @name Array access
* @description Finds array access expressions with an index expression
* consisting of a postfix increment (`++`) expression.
* @tags array
* access
* index
* postfix
* increment
*/
import cpp
from ArrayExpr a
where a.getArrayOffset() instanceof PostfixIncrExpr
select a

View File

@@ -0,0 +1,17 @@
/**
* @id cpp/examples/castexpr
* @name Cast expressions
* @description Finds casts from a floating point type to an integer type
* @tags cast
* integer
* float
* type
*/
import cpp
from Cast c
where
c.getExpr().getType() instanceof FloatingPointType and
c.getType() instanceof IntegralType
select c

View File

@@ -0,0 +1,15 @@
/**
* @id cpp/examples/catch-exception
* @name Catch exception
* @description Finds places where we catch exceptions of type `parse_error`
* @tags catch
* try
* exception
*/
import cpp
from CatchBlock catch
// `stripType` converts `const parse_error &` to `parse_error`.
where catch.getParameter().getType().stripType().hasName("parse_error")
select catch

View File

@@ -0,0 +1,16 @@
/**
* @id cpp/examples/constructor-call
* @name Call to constructor
* @description Finds places where we call `new MyClass(...)`
* @tags call
* constructor
* new
*/
import cpp
from NewExpr new, Constructor c
where
c = new.getInitializer().(ConstructorCall).getTarget() and
c.getName() = "MyClass"
select new

View File

@@ -0,0 +1,20 @@
/**
* @id cpp/examples/derives-from-class
* @name Class derives from
* @description Finds classes that derive from `std::exception`
* @tags base
* class
* derive
* inherit
* override
* subtype
* supertype
*/
import cpp
from Class type
where
type.getABaseClass+().hasName("exception") and
type.getNamespace().getName() = "std"
select type

View File

@@ -0,0 +1,14 @@
/**
* @id cpp/examples/emptyblock
* @name Empty blocks
* @description Finds empty block statements
* @tags empty
* block
* statement
*/
import cpp
from Block blk
where blk.getNumStmt() = 0
select blk

View File

@@ -0,0 +1,17 @@
/**
* @id cpp/examples/emptythen
* @name If statements with empty then branch
* @description Finds `if` statements where the `then` branch is
* an empty block statement
* @tags if
* then
* empty
* conditional
* branch
*/
import cpp
from IfStmt i
where i.getThen().(Block).getNumStmt() = 0
select i

View File

@@ -0,0 +1,18 @@
/**
* @id cpp/examples/eq-true
* @name Equality test on boolean
* @description Finds tests like `==true`, `!=true`
* @tags equal
* comparison
* test
* boolean
*/
import cpp
from EqualityOperation eq, Expr trueExpr
where
trueExpr = eq.getAnOperand() and
trueExpr.getType() instanceof BoolType and
trueExpr.getValue().toInt() = 1
select eq

View File

@@ -0,0 +1,17 @@
/**
* @id cpp/examples/field-access
* @name Access of field
* @description Finds reads of `aDate` (defined on class `Order`)
* @tags access
* field
* read
*/
import cpp
from Field f, FieldAccess access
where
f.hasName("aDate") and
f.getDeclaringType().hasName("Order") and
f = access.getTarget()
select access

View File

@@ -0,0 +1,18 @@
/**
* @id cpp/examples/function-call
* @name Call to function
* @description Finds calls to `std::map<...>::find()`
* @tags call
* function
* method
*/
import cpp
from FunctionCall call, Function fcn
where
call.getTarget() = fcn and
fcn.getDeclaringType().getSimpleName() = "map" and
fcn.getDeclaringType().getNamespace().getName() = "std" and
fcn.hasName("find")
select call

View File

@@ -0,0 +1,15 @@
/**
* @id cpp/examples/integer-literal
* @name Integer literal
* @description Finds places where we use the integer literal `2`
* @tags integer
* literal
*/
import cpp
from Literal literal
where
literal.getType() instanceof IntType and
literal.getValue().toInt() = 2
select literal

View File

@@ -0,0 +1,17 @@
/**
* @id cpp/examples/mutualrecursion
* @name Mutual recursion
* @description Finds pairs of functions that call each other
* @tags function
* method
* recursion
*/
import cpp
from Function m, Function n
where
exists(FunctionCall c | c.getEnclosingFunction() = m and c.getTarget() = n) and
exists(FunctionCall c | c.getEnclosingFunction() = n and c.getTarget() = m) and
m != n
select m, n

View File

@@ -0,0 +1,18 @@
/**
* @id cpp/examples/override-method
* @name Override of method
* @description Finds methods that override `std::exception::what()`
* @tags function
* method
* override
*/
import cpp
from MemberFunction override, MemberFunction base
where
base.getName() = "what" and
base.getDeclaringType().getName() = "exception" and
base.getDeclaringType().getNamespace().getName() = "std" and
override.overrides+(base)
select override

View File

@@ -0,0 +1,14 @@
/**
* @id cpp/examples/returnstatement
* @name Return statements
* @description Finds return statements that return `0`
* @tags return
* statement
* literal
*/
import cpp
from ReturnStmt r
where r.getExpr().(Literal).getValue().toInt() = 0
select r

View File

@@ -0,0 +1,13 @@
/**
* @id cpp/examples/singletonblock
* @name Singleton blocks
* @description Finds block statements containing a single statement
* @tags block
* statement
*/
import cpp
from Block b
where b.getNumStmt() = 1
select b

View File

@@ -0,0 +1,17 @@
/**
* @id cpp/examples/switchcase
* @name Switch statement case missing
* @description Finds switch statements with a missing enum constant case
* and no default case
* @tags switch
* case
* enum
*/
import cpp
from EnumSwitch es, EnumConstant ec
where
ec = es.getAMissingCase() and
not es.hasDefaultCase()
select es, ec

View File

@@ -0,0 +1,15 @@
/**
* @id cpp/examples/ternaryconditional
* @name Conditional expressions
* @description Finds conditional expressions of the form `... ? ... : ...`
* where the types of the resulting expressions differ
* @tags conditional
* ternary
* type
*/
import cpp
from ConditionalExpr e
where e.getThen().getType() != e.getElse().getType()
select e

View File

@@ -0,0 +1,15 @@
/**
* @id cpp/examples/throw-exception
* @name Throw exception of type
* @description Finds places where we throw `parse_error` or one of its sub-types
* @tags base
* class
* throw
* exception
*/
import cpp
from ThrowExpr throw
where throw.getType().(Class).getABaseClass*().getName() = "parse_error"
select throw

View File

@@ -0,0 +1,14 @@
/**
* @id cpp/examples/todocomment
* @name TODO comments
* @description Finds comments containing the word "TODO"
* @tags comment
* matches
* TODO
*/
import cpp
from Comment c
where c.getContents().matches("%TODO%")
select c

View File

@@ -0,0 +1,15 @@
/**
* @id cpp/examples/toomanyparams
* @name Functions with many parameters
* @description Finds functions or methods with more than 10 parameters
* @tags function
* method
* parameter
* argument
*/
import cpp
from Function fcn
where fcn.getNumberOfParameters() > 10
select fcn

View File

@@ -0,0 +1,16 @@
/**
* @id cpp/examples/unusedlocalvar
* @name Unused local variable
* @description Finds local variables that are not accessed
* @tags variable
* local
* access
*/
import cpp
from LocalScopeVariable v
where
not v instanceof Parameter and
not exists(v.getAnAccess())
select v

View File

@@ -0,0 +1,18 @@
/**
* @id cpp/examples/unusedmethod
* @name Unused private method
* @description Finds private non-virtual methods that are not accessed
* @tags method
* access
* private
* virtual
*/
import cpp
from MemberFunction fcn
where
fcn.isPrivate() and
not fcn.isVirtual() and
not exists(FunctionCall call | fcn = call.getTarget())
select fcn.getDefinition()

View File

@@ -0,0 +1,13 @@
/**
* @id cpp/examples/unusedparam
* @name Unused parameter
* @description Finds parameters that are not accessed
* @tags parameter
* access
*/
import cpp
from Parameter p
where p.isNamed() and not exists(p.getAnAccess())
select p

View File

@@ -0,0 +1,21 @@
/**
* @id cpp/examples/voidreturntype
* @name Const method without return type
* @description Finds const methods whose return type is `void`
* @tags const
* function
* method
* modifier
* specifier
* return
* type
* void
*/
import cpp
from MemberFunction m
where
m.hasSpecifier("const") and
m.getType() instanceof VoidType
select m

View File

@@ -0,0 +1,13 @@
/**
* @id cpp/examples/volatilevariable
* @name Variable declared volatile
* @description Finds variables with a `volatile` modifier
* @tags variable
* volatile
*/
import cpp
from Variable f
where f.isVolatile()
select f

View File

@@ -16,64 +16,56 @@ class SuppressionComment extends CppStyleComment {
SuppressionComment() {
text = getContents().suffix(2) and
( // match `lgtm[...]` anywhere in the comment
(
// match `lgtm[...]` anywhere in the comment
annotation = text.regexpFind("(?i)\\blgtm\\s*\\[[^\\]]*\\]", _, _)
or
// match `lgtm` at the start of the comment and after semicolon
annotation = text.regexpFind("(?i)(?<=^|;)\\s*lgtm(?!\\B|\\s*\\[)", _, _)
.trim()
annotation = text.regexpFind("(?i)(?<=^|;)\\s*lgtm(?!\\B|\\s*\\[)", _, _).trim()
)
}
/** Gets the text in this comment, excluding the leading //. */
string getText() {
result = text
}
string getText() { result = text }
/** Gets the suppression annotation in this comment. */
string getAnnotation() {
result = annotation
}
string getAnnotation() { result = annotation }
/**
* Holds if this comment applies to the range from column `startcolumn` of line `startline`
* to column `endcolumn` of line `endline` in file `filepath`.
*/
* Holds if this comment applies to the range from column `startcolumn` of line `startline`
* to column `endcolumn` of line `endline` in file `filepath`.
*/
predicate covers(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
this.getLocation().hasLocationInfo(filepath, startline, _, endline, endcolumn) and
startcolumn = 1
}
/** Gets the scope of this suppression. */
SuppressionScope getScope() {
result = this
}
SuppressionScope getScope() { result = this }
}
/**
* The scope of an alert suppression comment.
*/
class SuppressionScope extends ElementBase {
SuppressionScope() {
this instanceof SuppressionComment
}
SuppressionScope() { this instanceof SuppressionComment }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [LGTM locations](https://lgtm.com/help/ql/locations).
*/
predicate hasLocationInfo(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
*/
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.(SuppressionComment).covers(filepath, startline, startcolumn, endline, endcolumn)
}
}
from SuppressionComment c
select c, // suppression comment
c.getText(), // text of suppression comment (excluding delimiters)
c.getAnnotation(), // text of suppression annotation
c.getScope() // scope of suppression
select c, // suppression comment
c.getText(), // text of suppression comment (excluding delimiters)
c.getAnnotation(), // text of suppression annotation
c.getScope() // scope of suppression

View File

@@ -10,11 +10,12 @@
* statistical
* non-attributable
*/
import cpp
predicate functionUsesVariable(Function source, Variable v, File target) {
v.getAnAccess().getEnclosingFunction() = source and
not (v.(LocalScopeVariable).getFunction() = source) and
not v.(LocalScopeVariable).getFunction() = source and
v.getFile() = target
}
@@ -25,15 +26,15 @@ predicate functionUsesFunction(Function source, Function f, File target) {
predicate dependencyCount(Function source, File target, int res) {
res = strictcount(Declaration d |
functionUsesVariable(source, d, target) or
functionUsesFunction(source, d, target)
)
functionUsesVariable(source, d, target) or
functionUsesFunction(source, d, target)
)
}
predicate selfDependencyCountOrZero(Function source, int res) {
exists(File target
| target = source.getFile() and onlyInFile(source, target)
| res = max(int i | dependencyCount(source, target, i) or i = 0))
exists(File target | target = source.getFile() and onlyInFile(source, target) |
res = max(int i | dependencyCount(source, target, i) or i = 0)
)
}
predicate dependsHighlyOn(Function source, File target, int res) {
@@ -41,7 +42,7 @@ predicate dependsHighlyOn(Function source, File target, int res) {
target.fromSource() and
exists(int selfCount |
selfDependencyCountOrZero(source, selfCount) and
res > 2*selfCount and
res > 2 * selfCount and
res > 4
)
}
@@ -52,14 +53,18 @@ predicate onlyInFile(Function f, File file) {
}
from Function f, File other, int selfCount, int depCount, string selfDeps
where dependsHighlyOn(f, other, depCount) and
selfDependencyCountOrZero(f, selfCount) and
not exists(File yetAnother | dependsHighlyOn(f, yetAnother, _) and yetAnother != other) and
not other instanceof HeaderFile and
not f instanceof MemberFunction
and if selfCount = 0 then selfDeps = "0 dependencies"
else if selfCount = 1 then selfDeps = "only 1 dependency"
else selfDeps = "only " + selfCount.toString() + " dependencies"
select f, "Function " + f.getName() + " could be moved to file $@" +
" since it has " + depCount.toString() + " dependencies to that file, but " +
selfDeps + " to its own file.", other, other.getBaseName()
where
dependsHighlyOn(f, other, depCount) and
selfDependencyCountOrZero(f, selfCount) and
not exists(File yetAnother | dependsHighlyOn(f, yetAnother, _) and yetAnother != other) and
not other instanceof HeaderFile and
not f instanceof MemberFunction and
if selfCount = 0
then selfDeps = "0 dependencies"
else
if selfCount = 1
then selfDeps = "only 1 dependency"
else selfDeps = "only " + selfCount.toString() + " dependencies"
select f,
"Function " + f.getName() + " could be moved to file $@" + " since it has " + depCount.toString() +
" dependencies to that file, but " + selfDeps + " to its own file.", other, other.getBaseName()

View File

@@ -7,7 +7,9 @@
* @workingset jhotdraw
* @result succeed 48
* @result_ondemand succeed 48
* @tags maintainability
*/
import cpp
from Class s

View File

@@ -2,15 +2,15 @@
* @name Hub classes
* @description Shows coupling between classes. Large, red, boxes are hub types that depend on many other classes
* and are depended on by many other classes.
* @kind treemap
* @kind table
* @id cpp/architecture/hub-classes
* @treemap.warnOn highValues
* @tags maintainability
*/
import cpp
from Class c
where c.fromSource()
select c as Class,
c.getMetrics().getAfferentCoupling() as AfferentCoupling,
c.getMetrics().getEfferentSourceCoupling() as EfferentCoupling
order by AfferentCoupling desc
select c as Class, c.getMetrics().getAfferentCoupling() as AfferentCoupling,
c.getMetrics().getEfferentSourceCoupling() as EfferentCoupling order by AfferentCoupling desc

View File

@@ -7,7 +7,9 @@
* @workingset jhotdraw
* @result succeed 48
* @result_ondemand succeed 48
* @tags maintainability
*/
import cpp
/** does source class c have inheritance depth d? */
@@ -17,6 +19,5 @@ predicate hasInheritanceDepth(Class c, int d) {
from int depth
where hasInheritanceDepth(_, depth)
select depth as InheritanceDepth,
count(Class c | hasInheritanceDepth(c, depth)) as NumberOfClasses
order by InheritanceDepth
select depth as InheritanceDepth, count(Class c | hasInheritanceDepth(c, depth)) as NumberOfClasses
order by InheritanceDepth

View File

@@ -5,7 +5,9 @@
* @id cpp/architecture/cyclic-namespaces
* @graph.layout hierarchical
* @tags maintainability
* modularity
*/
import cpp
from MetricNamespace a, MetricNamespace b

View File

@@ -3,11 +3,15 @@
* @description Finds classes that belong to no namespace.
* @kind table
* @id cpp/architecture/global-namespace-classes
* @tags maintainability
* modularity
*/
import cpp
from Class c
where c.fromSource()
and c.isTopLevel()
and c.getParentScope() instanceof GlobalNamespace
where
c.fromSource() and
c.isTopLevel() and
c.getParentScope() instanceof GlobalNamespace
select c, "This class is not declared in any namespace"

View File

@@ -4,7 +4,10 @@
* @kind graph
* @id cpp/architecture/namespace-dependencies
* @graph.layout hierarchical
* @tags maintainability
* modularity
*/
import cpp
from MetricNamespace a, MetricNamespace b

View File

@@ -3,32 +3,50 @@
* @description Shows general statistics about the application.
* @kind table
* @id cpp/architecture/general-statistics
* @tags maintainability
*/
import cpp
from string l, string n
where (l = "Number of Namespaces" and
n = count(Namespace p | p.fromSource()).toString())
or (l = "Number of Files" and
n = count(File f | f.fromSource()).toString())
or (l = "Number of Header Files" and
n = count(HeaderFile f | f.fromSource()).toString())
or (l = "Number of C Files" and
n = count(CFile f | f.fromSource()).toString())
or (l = "Number of C++ Files" and
n = count(CppFile f | f.fromSource()).toString())
or (l = "Number of Classes" and
n = count(Class c | c.fromSource() and not c instanceof Struct).toString())
or (l = "Number of Structs" and
n = count(Struct s | s.fromSource()and not s instanceof Union).toString())
or (l = "Number of Unions" and
n = count(Union u | u.fromSource()).toString())
or (l = "Number of Functions" and
n = count(Function f | f.fromSource()).toString())
or (l = "Number of Lines Of Code" and
n = sum(File f, int toSum | (f.fromSource()) and (toSum = f.getMetrics().getNumberOfLinesOfCode()) | toSum).toString())
or (l = "Self-Containedness" and
n = (100 * sum(Class c, int toSum | (c.fromSource()) and (toSum = c.getMetrics().getEfferentSourceCoupling()) | toSum)
/ sum(Class c, int toSum | (c.fromSource()) and (toSum = c.getMetrics().getEfferentCoupling()) | toSum)).toString()
+ "%")
where
l = "Number of Namespaces" and
n = count(Namespace p | p.fromSource()).toString()
or
l = "Number of Files" and
n = count(File f | f.fromSource()).toString()
or
l = "Number of Header Files" and
n = count(HeaderFile f | f.fromSource()).toString()
or
l = "Number of C Files" and
n = count(CFile f | f.fromSource()).toString()
or
l = "Number of C++ Files" and
n = count(CppFile f | f.fromSource()).toString()
or
l = "Number of Classes" and
n = count(Class c | c.fromSource() and not c instanceof Struct).toString()
or
l = "Number of Structs" and
n = count(Struct s | s.fromSource() and not s instanceof Union).toString()
or
l = "Number of Unions" and
n = count(Union u | u.fromSource()).toString()
or
l = "Number of Functions" and
n = count(Function f | f.fromSource()).toString()
or
l = "Number of Lines Of Code" and
n = sum(File f, int toSum |
f.fromSource() and toSum = f.getMetrics().getNumberOfLinesOfCode()
|
toSum
).toString()
or
l = "Self-Containedness" and
n = (
100 * sum(Class c | c.fromSource() | c.getMetrics().getEfferentSourceCoupling()) /
sum(Class c | c.fromSource() | c.getMetrics().getEfferentCoupling())
).toString() + "%"
select l as Title, n as Value

View File

@@ -10,6 +10,7 @@
* statistical
* non-attributable
*/
import cpp
predicate remoteVarAccess(File source, File target, VariableAccess va) {
@@ -48,16 +49,19 @@ predicate highDependencyCount(File source, File target, int res) {
variableDependencyCount(source, target, varCount) and
functionDependencyCount(source, target, funCount) and
res = varCount + funCount and
res > 20)
res > 20
)
}
from File a, File b, int ca, int cb
where highDependencyCount(a, b, ca) and
highDependencyCount(b, a, cb) and
ca >= cb and
a != b and
not a instanceof HeaderFile and
not b instanceof HeaderFile and
b.getShortName().trim().length() > 0
select a, "File is too closely tied to $@ (" + ca.toString() + " dependencies one way and " + cb.toString() + " the other).",
b, b.getBaseName()
where
highDependencyCount(a, b, ca) and
highDependencyCount(b, a, cb) and
ca >= cb and
a != b and
not a instanceof HeaderFile and
not b instanceof HeaderFile and
b.getShortName().trim().length() > 0
select a,
"File is too closely tied to $@ (" + ca.toString() + " dependencies one way and " + cb.toString() +
" the other).", b, b.getBaseName()

View File

@@ -11,10 +11,12 @@
* statistical
* non-attributable
*/
import cpp
from Class t, int n
where t.fromSource() and
n = t.getMetrics().getEfferentSourceCoupling() and
n > 10
where
t.fromSource() and
n = t.getMetrics().getEfferentSourceCoupling() and
n > 10
select t as Class, "This class has too many dependencies (" + n.toString() + ")"

View File

@@ -6,7 +6,7 @@
<overview>
<p>This rule finds classes with more than 15 instance (i.e., non-<code>static</code>) fields. Library classes
are not shown. Having too many fields in one class is a sign that the class lacks cohesion (i.e. lacks a single purpose).
are not shown. Having too many fields in one class is a sign that the class may lack cohesion (i.e. lack a single purpose).
These classes can be split into smaller, more cohesive classes. Alternatively, the related fields can be grouped
into <code>struct</code>s.</p>

View File

@@ -9,77 +9,143 @@
* statistical
* non-attributable
*/
import cpp
string kindstr(Class c)
{
/**
* Gets a string describing the kind of a `Class`.
*/
string kindstr(Class c) {
exists(int kind | usertypes(unresolveElement(c), _, kind) |
(kind = 1 and result = "Struct") or
(kind = 2 and result = "Class") or
(kind = 6 and result = "Template class")
kind = 1 and result = "Struct"
or
kind = 2 and result = "Class"
or
kind = 6 and result = "Template class"
)
}
predicate vdeInfo(VariableDeclarationEntry vde, Class c, File f, int line)
{
/**
* Holds if the arguments correspond to information about a `VariableDeclarationEntry`.
*/
predicate vdeInfo(VariableDeclarationEntry vde, Class c, File f, int line) {
c = vde.getVariable().getDeclaringType() and
f = vde.getLocation().getFile() and
line = vde.getLocation().getStartLine()
}
predicate previousVde(VariableDeclarationEntry previous, VariableDeclarationEntry vde)
{
exists(Class c, File f, int line | vdeInfo(vde, c, f, line) |
vdeInfo(previous, c, f, line - 3) or
vdeInfo(previous, c, f, line - 2) or
vdeInfo(previous, c, f, line - 1) or
(vdeInfo(previous, c, f, line) and exists(int prevCol, int vdeCol |
prevCol = previous.getLocation().getStartColumn() and vdeCol = vde.getLocation().getStartColumn() |
prevCol < vdeCol or (prevCol = vdeCol and previous.getName() < vde.getName())
))
)
newtype TVariableDeclarationInfo =
TVariableDeclarationLine(Class c, File f, int line) { vdeInfo(_, c, f, line) }
/**
* A line that contains one or more `VariableDeclarationEntry`s (in the same class).
*/
class VariableDeclarationLine extends TVariableDeclarationInfo {
Class c;
File f;
int line;
VariableDeclarationLine() {
vdeInfo(_, c, f, line) and
this = TVariableDeclarationLine(c, f, line)
}
/**
* Gets the class associated with this `VariableDeclarationLine`.
*/
Class getClass() { result = c }
/**
* Gets the line of this `VariableDeclarationLine`.
*/
int getLine() { result = line }
/**
* Gets a `VariableDeclarationEntry` on this line.
*/
VariableDeclarationEntry getAVDE() { vdeInfo(result, c, f, line) }
/**
* Gets the start column of the first `VariableDeclarationEntry` on this line.
*/
int getStartColumn() { result = min(getAVDE().getLocation().getStartColumn()) }
/**
* Gets the end column of the last `VariableDeclarationEntry` on this line.
*/
int getEndColumn() { result = max(getAVDE().getLocation().getEndColumn()) }
/**
* Gets the rank of this `VariableDeclarationLine` in its file and class
* (that is, the first is 0, the second is 1 and so on).
*/
private int getRank() {
line = rank[result](VariableDeclarationLine vdl, int l |
vdl = TVariableDeclarationLine(c, f, l)
|
l
)
}
/**
* Gets the `VariableDeclarationLine` following this one, if any.
*/
VariableDeclarationLine getNext() {
result = TVariableDeclarationLine(c, f, _) and
result.getRank() = getRank() + 1
}
/**
* Gets the `VariableDeclarationLine` following this one, if it is nearby.
*/
VariableDeclarationLine getProximateNext() {
result = getNext() and
result.getLine() <= this.getLine() + 3
}
string toString() { result = "VariableDeclarationLine" }
}
predicate masterVde(VariableDeclarationEntry master, VariableDeclarationEntry vde)
{
(not previousVde(_, vde) and master = vde) or
exists(VariableDeclarationEntry previous | previousVde(previous, vde) and masterVde(master, previous))
}
/**
* A group of `VariableDeclarationEntry`s in the same class that are approximately
* contiguous.
*/
class VariableDeclarationGroup extends VariableDeclarationLine {
VariableDeclarationLine end;
class VariableDeclarationGroup extends ElementBase {
VariableDeclarationGroup() {
this instanceof VariableDeclarationEntry and
not previousVde(_, this)
}
Class getClass() {
vdeInfo(this, result, _, _)
// there is no `VariableDeclarationLine` within three lines previously
not any(VariableDeclarationLine prev).getProximateNext() = this and
// `end` is the last transitively proximate line
end = getProximateNext*() and
not exists(end.getProximateNext())
}
// pragma[noopt] since otherwise the two locationInfo relations get join-ordered
// after each other
pragma[noopt]
predicate hasLocationInfo(string path, int startline, int startcol, int endline, int endcol) {
exists(VariableDeclarationEntry last, Location lstart, Location lend |
masterVde(this, last) and
this instanceof VariableDeclarationGroup and
not previousVde(last, _) and
exists(VariableDeclarationEntry vde | vde=this and vde instanceof VariableDeclarationEntry and vde.getLocation() = lstart) and
last.getLocation() = lend and
lstart.hasLocationInfo(path, startline, startcol, _, _) and
lend.hasLocationInfo(path, _, _, endline, endcol)
)
path = f.getAbsolutePath() and
startline = getLine() and
startcol = getStartColumn() and
endline = end.getLine() and
endcol = end.getEndColumn()
}
string describeGroup() {
if previousVde(this, _) then
result = "group of "
+ strictcount(string name
| exists(VariableDeclarationEntry vde
| masterVde(this, vde) and
name = vde.getName()))
+ " fields here"
else
result = "declaration of " + this.(VariableDeclarationEntry).getVariable().getName()
/**
* Gets the number of uniquely named `VariableDeclarationEntry`s in this group.
*/
int getCount() {
result = count(VariableDeclarationLine l |
l = getProximateNext*()
|
l.getAVDE().getVariable().getName()
)
}
override string toString() {
getCount() = 1 and
result = "declaration of " + getAVDE().getVariable().getName()
or
getCount() > 1 and
result = "group of " + getCount() + " fields here"
}
}
@@ -89,26 +155,32 @@ class ExtClass extends Class {
}
predicate hasLocationInfo(string path, int startline, int startcol, int endline, int endcol) {
if hasOneVariableGroup() then
exists(VariableDeclarationGroup vdg | vdg.getClass() = this | vdg.hasLocationInfo(path, startline, startcol, endline, endcol))
else
getLocation().hasLocationInfo(path, startline, startcol, endline, endcol)
if hasOneVariableGroup()
then
exists(VariableDeclarationGroup vdg | vdg.getClass() = this |
vdg.hasLocationInfo(path, startline, startcol, endline, endcol)
)
else getLocation().hasLocationInfo(path, startline, startcol, endline, endcol)
}
}
from ExtClass c, int n, VariableDeclarationGroup vdg, string suffix
where n = strictcount(string fieldName
| exists(Field f
| f.getDeclaringType() = c and
fieldName = f.getName() and
// IBOutlet's are a way of building GUIs
// automatically out of ObjC properties.
// We don't want to count those for the
// purposes of this query.
not (f.getType().getAnAttribute().hasName("iboutlet")))) and
n > 15 and
not c.isConstructedFrom(_) and
c = vdg.getClass() and
if c.hasOneVariableGroup() then suffix = "" else suffix = " - see $@"
select c, kindstr(c) + " " + c.getName() + " has " + n + " fields, which is too many" + suffix + ".",
vdg, vdg.describeGroup()
where
n = strictcount(string fieldName |
exists(Field f |
f.getDeclaringType() = c and
fieldName = f.getName() and
// IBOutlet's are a way of building GUIs
// automatically out of ObjC properties.
// We don't want to count those for the
// purposes of this query.
not f.getType().getAnAttribute().hasName("iboutlet")
)
) and
n > 15 and
not c.isConstructedFrom(_) and
c = vdg.getClass() and
if c.hasOneVariableGroup() then suffix = "" else suffix = " - see $@"
select c,
kindstr(c) + " " + c.getName() + " has " + n +
" fields; we suggest refactoring to 15 fields or fewer" + suffix + ".", vdg, vdg.toString()

View File

@@ -8,11 +8,13 @@
* statistical
* non-attributable
*/
import cpp
from Function f, int n
where f.fromSource() and
n = f.getMetrics().getNumberOfCalls() and
n > 99 and
not f.isMultiplyDefined()
where
f.fromSource() and
n = f.getMetrics().getNumberOfCalls() and
n > 99 and
not f.isMultiplyDefined()
select f as Function, "This function makes too many calls (" + n.toString() + ")"

View File

@@ -8,9 +8,11 @@
* statistical
* non-attributable
*/
import cpp
from Function f, int complexity
where complexity = f.getMetrics().getCyclomaticComplexity()
and complexity > 250
where
complexity = f.getMetrics().getCyclomaticComplexity() and
complexity > 250
select f, "Function has high cyclomatic complexity: " + complexity.toString()

View File

@@ -9,10 +9,13 @@
* statistical
* non-attributable
*/
import cpp
from Function f
where f.fromSource() and
f.getMetrics().getNumberOfParameters() > 15
select f, "This function has too many parameters ("
+ f.getMetrics().getNumberOfParameters().toString() + ")"
where
f.fromSource() and
f.getMetrics().getNumberOfParameters() > 15
select f,
"This function has too many parameters (" + f.getMetrics().getNumberOfParameters().toString() +
")"

View File

@@ -9,19 +9,27 @@
* readability
* maintainability
*/
import cpp
class ComplexStmt extends Stmt {
ComplexStmt() {
exists(Block body | body = this.(Loop ).getStmt() or
body = this.(SwitchStmt).getStmt()
| strictcount(body.getAStmt+()) > 6)
and not exists (this.getGeneratingMacro())
exists(Block body |
body = this.(Loop).getStmt() or
body = this.(SwitchStmt).getStmt()
|
strictcount(body.getAStmt+()) > 6
) and
not exists(this.getGeneratingMacro())
}
}
from Block b, int n, ComplexStmt complexStmt
where n = strictcount(ComplexStmt s | s = b.getAStmt()) and n > 3
and complexStmt = b.getAStmt()
select b, "Block with too many statements (" + n.toString() + " complex statements in the block). Complex statements at: $@", complexStmt, complexStmt.toString()
where
n = strictcount(ComplexStmt s | s = b.getAStmt()) and
n > 3 and
complexStmt = b.getAStmt()
select b,
"Block with too many statements (" + n.toString() +
" complex statements in the block). Complex statements at: $@", complexStmt,
complexStmt.toString()

View File

@@ -11,23 +11,23 @@
* statistical
* non-attributable
*/
import cpp
predicate logicalOp(string op) {
op = "&&" or op = "||"
}
predicate logicalOp(string op) { op = "&&" or op = "||" }
predicate nontrivialLogicalOperator(Operation e) {
exists(string op |
op = e.getOperator() and
logicalOp(op) and
not (op = e.getParent().(Operation).getOperator())
)
and not e.isInMacroExpansion()
not op = e.getParent().(Operation).getOperator()
) and
not e.isInMacroExpansion()
}
from Expr e, int operators
where not (e.getParent() instanceof Expr)
and operators = count(Operation op | op.getParent*() = e and nontrivialLogicalOperator(op))
and operators > 5
where
not e.getParent() instanceof Expr and
operators = count(Operation op | op.getParent*() = e and nontrivialLogicalOperator(op)) and
operators > 5
select e, "Complex condition: too many logical operations in this expression."

View File

@@ -13,10 +13,11 @@
import cpp
predicate isInCatch(Expr e) {
e.getEnclosingStmt().getParent*() instanceof CatchBlock or // Lexically enclosing catch blocks will cause there to be a current exception,
e.getEnclosingStmt().getParent*() instanceof CatchBlock // Lexically enclosing catch blocks will cause there to be a current exception,
or
exists(Function f | f = e.getEnclosingFunction() |
isInCatch(f.getACallToThisFunction()) or // as will dynamically enclosing catch blocks.
f.getName().toLowerCase().matches("%exception%") // We assume that rethrows are intended when the function is called *exception*.
isInCatch(f.getACallToThisFunction()) or // as will dynamically enclosing catch blocks.
f.getName().toLowerCase().matches("%exception%") // We assume that rethrows are intended when the function is called *exception*.
)
}

View File

@@ -13,5 +13,6 @@
import cpp
from CatchBlock cb, Class caughtType
where caughtType = cb.getParameter().getType().getUnderlyingType().getUnspecifiedType()
select cb, "This should catch a " + caughtType.getName() + " by (const) reference rather than by value."
where caughtType = cb.getParameter().getUnspecifiedType()
select cb,
"This should catch a " + caughtType.getName() + " by (const) reference rather than by value."

View File

@@ -18,31 +18,33 @@ predicate doesRethrow(Function f) {
not e.getEnclosingStmt().getParent*() instanceof CatchBlock
)
or
exists(FunctionCall fc | fc.getEnclosingFunction() = f |
doesRethrow(fc.getTarget())
)
exists(FunctionCall fc | fc.getEnclosingFunction() = f | doesRethrow(fc.getTarget()))
}
predicate deletesException(Expr expr, Parameter exception) {
expr.getEnclosingBlock().getParent*().(CatchBlock).getParameter() = exception and (
expr.getEnclosingBlock().getParent*().(CatchBlock).getParameter() = exception and
(
exists(FunctionCall fc | fc = expr |
// Calling a delete function on the exception will free it (MFC's CException has a Delete function).
(fc.getQualifier() = exception.getAnAccess() and fc.getTarget().getName().toLowerCase().matches("%delete%")) or
fc.getQualifier() = exception.getAnAccess() and
fc.getTarget().getName().toLowerCase().matches("%delete%")
or
// Passing the exception to a function might free it.
(fc.getAnArgument() = exception.getAnAccess()) or
fc.getAnArgument() = exception.getAnAccess()
or
// Calling a function which rethrows the current exception might cause the exception to be freed.
doesRethrow(fc.getTarget())
) or
// Calling operator delete on the exception will free it.
exists(DeleteExpr d | d = expr |
d.getExpr() = exception.getAnAccess()
)
or
// Calling operator delete on the exception will free it.
exists(DeleteExpr d | d = expr | d.getExpr() = exception.getAnAccess())
)
}
from CatchBlock cb
where cb.getParameter().getType().getUnderlyingType() instanceof PointerType
and not exists(Expr e | e.getEnclosingBlock().getParent*() = cb |
deletesException(e, cb.getParameter())
)
where
cb.getParameter().getType().getUnderlyingType() instanceof PointerType and
not exists(Expr e | e.getEnclosingBlock().getParent*() = cb |
deletesException(e, cb.getParameter())
)
select cb, "This catch block does not free the caught exception, thereby leaking memory."

View File

@@ -13,8 +13,9 @@
import cpp
from ThrowExpr throw, NewExpr new, Type t
where new.getParent() = throw
where
new.getParent() = throw and
// Microsoft MFC's CException hierarchy should be thrown (and caught) as pointers
and t = new.getAllocatedType()
and not t.getUnderlyingType().(Class).getABaseClass*().hasName("CException")
t = new.getAllocatedType() and
not t.getUnderlyingType().(Class).getABaseClass*().hasName("CException")
select throw, "This should throw a " + t.toString() + " rather than a pointer to one."

View File

@@ -8,29 +8,38 @@
* @tags maintainability
* readability
*/
import cpp
/* Names of parameters in the implementation of a function.
Notice that we need to exclude parameter names used in prototype
declarations and only include the ones from the actual definition.
We also exclude names from functions that have multiple definitions.
This should not happen in a single application but since we
have a system wide view it is likely to happen for instance for
the main function. */
/**
* Gets the parameter of `f` with name `name`, which has to come from the
* _definition_ of `f` and not a prototype declaration.
* We also exclude names from functions that have multiple definitions.
* This should not happen in a single application but since we
* have a system wide view it is likely to happen for instance for
* the main function.
*/
ParameterDeclarationEntry functionParameterNames(Function f, string name) {
exists(FunctionDeclarationEntry fe |
result.getFunctionDeclarationEntry() = fe
and fe.getFunction() = f
and fe.getLocation() = f.getDefinitionLocation()
and strictcount(f.getDefinitionLocation()) = 1
and result.getName() = name
result.getFunctionDeclarationEntry() = fe and
fe.getFunction() = f and
fe.getLocation() = f.getDefinitionLocation() and
result.getFile() = fe.getFile() and // Work around CPP-331
strictcount(f.getDefinitionLocation()) = 1 and
result.getName() = name
)
}
from Function f, LocalVariable lv, ParameterDeclarationEntry pde
where f = lv.getFunction() and
pde = functionParameterNames(f, lv.getName()) and
not lv.isInMacroExpansion()
select lv, "Local variable '"+ lv.getName() +"' hides a $@.",
pde, "parameter of the same name"
/** Gets a local variable in `f` with name `name`. */
pragma[nomagic]
LocalVariable localVariableNames(Function f, string name) {
name = result.getName() and
f = result.getFunction()
}
from Function f, LocalVariable lv, ParameterDeclarationEntry pde, string name
where
lv = localVariableNames(f, name) and
pde = functionParameterNames(f, name) and
not lv.isInMacroExpansion()
select lv, "Local variable '" + lv.getName() + "' hides a $@.", pde, "parameter of the same name"

Some files were not shown because too many files have changed in this diff Show More