Compare commits

..

3448 Commits

Author SHA1 Message Date
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
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
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
Felicity Chapman
156c826f86 Update supported versions for C# 2019-04-25 15:36:01 +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
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
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
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
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
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
Mark Shannon
df2000ea8e Python: Fix up dataflow configuration to act as expected. Keep undocumented for now. 2019-04-05 09:05:13 +01: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
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
Arthur Baars
5eb58f3ba2 C++: fix HubClasses.ql by changing its kind to 'table' 2019-04-01 16:17:23 +02: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
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
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
1e1903b6ac Python taint-tracking: Avoid computing many redundant copies of flow step for dicts and sequences. 2019-03-26 14:41:03 +00: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
Mark Shannon
2f0bb828c8 Python: Tweak wording of qldoc. 2019-03-25 17:35:23 +00:00
Mark Shannon
2edde1fed8 Python taint-tracking. Handle early exit and 'not' correctly for 'falsey' taints. 2019-03-22 11:58:23 +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
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
Asger F
1a6c95c908 TS: update test expectation 2019-03-21 11:06:04 +00:00
Asger F
5768d85c7b TS: fix trap test output 2019-03-20 12:46:52 +00: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
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
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
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
Felicity Chapman
06fcd8a150 Reword information on parallel extraction 2019-03-18 17:09:23 +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
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
Felicity Chapman
94f525ff72 Be more explicit about Java versions supported 2019-03-18 10:17:56 +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
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
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
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
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
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
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
yh-semmle
d7925ee2ec Java: tweak change note as per review comment 2019-03-13 14:31:13 -04: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
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
Mark Shannon
3fbe3c37aa Add change note. 2019-03-13 12:00:42 +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
semmle-qlci
8ed5d93721 Merge pull request #1090 from hvitved/merge-rc
Approved by calumgrant
2019-03-13 08:21:02 +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
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
Dave Bartolomeo
b5a3edfdae C++: FunctionIR -> IRFunction 2019-03-12 11:28:22 -07:00
Mark Shannon
ccd18b6c67 Python: Update python-2 specific tests for new parser/tokenizer. 2019-03-12 17:53:50 +00: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
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
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
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
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
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
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
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
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
b358f87570 C#: Improve performance. 2019-03-07 14:56:07 +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
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
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
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
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
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
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
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
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
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
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
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
Max Schaefer
aa6b89dc34 Merge pull request #723 from Semmle/qlucie/master
Master-to-next merge
2019-01-07 07:59:54 +00:00
Raul Garcia
880306c621 Removing duplicated results 2019-01-04 10:45:43 -08:00
Pavel Avgustinov
42cf76027a Merge branch 'cs/assembly-labels' of https://github.com/calumgrant/ql into HEAD 2019-01-04 18:23:49 +00: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
calum
651d207d0d C#: Fix assembly labels. 2019-01-04 16:19:43 +00: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
Max Schaefer
b4f400fb23 Merge remote-tracking branch 'upstream/next' into qlucie/master 2019-01-04 10:35:57 +00: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
semmle-qlci
6b27dcabc5 Merge pull request #704 from asger-semmle/ts-binary-exprs
Approved by esben-semmle
2019-01-04 08:37:41 +00:00
Jonas Jensen
79e246f961 Merge pull request #722 from geoffw0/doc-macroinv
CPP: Improve qldoc for MacroAccess and MacroInvocation.
2019-01-04 08:40:37 +01:00
Jonas Jensen
8b06b311a0 Merge pull request #668 from ian-semmle/condexpr
C++: Follow changes in how conditional expressions are represented in the database
2019-01-04 07:20:49 +01:00
Ian Lynagh
187fdf67b0 C++: Rename twoOperand to isTwoOperand 2019-01-03 21:09:49 +00:00
Ian Lynagh
98e8858dc6 C++: Accept test changes 2019-01-03 21:09:49 +00:00
Ian Lynagh
283eb51db8 C++: Update stats after adding expr_cond* tables 2019-01-03 21:09:49 +00:00
Ian Lynagh
dc3d87f2fc C++: Add tables for ConditionalExprs 2019-01-03 21:09:49 +00:00
yh-semmle
0e0ff565d5 Merge pull request #686 from aschackmull/java/rm-metrics-queries-xml
Java: Remove `Metrics/queries.xml`
2019-01-03 13:36:17 -05:00
yh-semmle
2d151f71cf Merge pull request #701 from aschackmull/java/override-annot
Java: Add missing override annotations.
2019-01-03 13:34:27 -05: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
semmle-qlci
c0868bcb9e Merge pull request #708 from hvitved/csharp/ssa-read-splitting
Approved by calumgrant
2019-01-03 17:59:55 +00:00
Tom Hvitved
54520003f8 Merge pull request #590 from calumgrant/cs/metadata-handles2
C#: Extract the metadata handle
2019-01-03 18:49:24 +01:00
semmle-qlci
8174fb51ae Merge pull request #705 from asger-semmle/loop-index-concurrent-modification
Approved by mc-semmle, xiemaisi
2019-01-03 17:06:12 +00:00
semmle-qlci
6b459de95f Merge pull request #717 from xiemaisi/js/fix-incorrect-suffix-check-performance
Approved by asger-semmle
2019-01-03 17:04:10 +00:00
semmle-qlci
6c768263d2 Merge pull request #716 from xiemaisi/js/cosmetics
Approved by esben-semmle
2019-01-03 16:11:50 +00:00
semmle-qlci
9b8bf96a6f Merge pull request #718 from xiemaisi/js/ambiguous-id-attr-alert-loc
Approved by asger-semmle
2019-01-03 16:10:57 +00:00
Geoffrey White
114740c148 Merge pull request #721 from jbj/reachable-factor-base-case
C++: Factor out `reachable` base case
2019-01-03 15:56:10 +00:00
Geoffrey White
787febae6e CPP: Improve qldoc for MacroAccess and MacroInvocation. 2019-01-03 15:16:47 +00:00
Asger F
f24313a215 JS: address doc review 2019-01-03 10:49:36 +00:00
Jonas Jensen
b17fb86961 C++: Factor out reachable base case 2019-01-03 11:20:18 +01: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
Max Schaefer
0a2df6c00d JavaScript: Highlight id attribute (not entire element) in AmbiguousIdAttribute. 2019-01-02 11:44:02 +00:00
Asger F
bc59e65222 JS: update suite file 2019-01-02 11:42:47 +00:00
Asger F
9f22da4557 JS: rename query to "Loop iteration skipped due to shifting" 2019-01-02 11:34:06 +00:00
Asger F
8c3b44a525 JS: address comments 2019-01-02 11:12:52 +00:00
Max Schaefer
a9844b2eda JavaScript: Fix performance regression in IncorrectSuffixCheck. 2019-01-02 10:23:16 +00:00
Tom Hvitved
412248c77f C#: Address review comments 2019-01-02 10:42:08 +01:00
Tom Hvitved
4348de3120 Merge pull request #714 from calumgrant/cs/event-accessors
C#: Fix extraction error when Event accessors are ordinary methods
2019-01-02 10:25:15 +01:00
Tom Hvitved
2427f0ada9 C#: Remove redundant cast 2019-01-02 10:09:24 +01:00
Tom Hvitved
5879e58741 C#: Account for CFG splitting in AssignableDefinition::getAFirstRead() and AssignableRead::getANextRead() 2019-01-02 09:50:13 +01:00
Tom Hvitved
f06a20f666 C#: Add SSA tests with CFG splitting 2019-01-02 09:48:04 +01:00
calum
0fe0544769 C#: Fix extraction error when Event accessors are ordinary methods. 2018-12-31 14:20:47 +00:00
Mark Shannon
6b5ad0d928 Python: Detect a wider range of generated files. 2018-12-27 15:01:10 +00:00
calum
6267946768 C#: Revert breaking change 2018-12-21 14:39:01 +00:00
calumgrant
1b11abfec7 Merge pull request #709 from hvitved/csharp/autoformat/tests
C#: Autoformat QL tests
2018-12-21 11:12:31 +00:00
Tom Hvitved
5478155155 Merge pull request #615 from calumgrant/cs/extractor-caching
C# extractor: Improve performance by changing the caching
2018-12-21 09:36:43 +01:00
Jonas Jensen
d566141273 Merge pull request #694 from dave-bartolomeo/dave/BetterUnreached
C++: Remove infeasible edges to reachable blocks
2018-12-21 07:36:51 +00:00
calum
d73b28efe4 C#: Address review comments.
Add more tests for duplicated entities, and fix some duplicated entities.
    Update the TupleTypes output - some extraneous results gone so it's probably better.
2018-12-20 20:23:12 +00:00
Tom Hvitved
af38a2b9c5 Merge branch 'master' into csharp/autoformat/tests 2018-12-20 20:59:10 +01:00
Dave Bartolomeo
a7cb2d6d7c C++: Ignore Unreached blocks in IR Guards 2018-12-20 11:57:25 -08:00
calumgrant
a6003533a4 Merge pull request #692 from hvitved/csharp/maybe-null-as-expression
C#: Consider `as` expressions as maybe-`null` in `cs/dereferenced-value-may-be-null`
2018-12-20 18:49:33 +00:00
calumgrant
7dd263b413 Merge pull request #689 from hvitved/csharp/remove-get-url
C#: Remove `getUrl()` predicates
2018-12-20 18:49:15 +00:00
calum
f5cfd93d8d C#: Use pattern matching. 2018-12-20 14:38:49 +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
Tom Hvitved
33fcbc958d C#: Consider as expressions as maybe-null in cs/dereferenced-value-may-be-null 2018-12-20 14:54:48 +01:00
Tom Hvitved
ccda1c8d3d C#: Add nullness test using an as expression 2018-12-20 14:54:48 +01:00
Tom Hvitved
c66f67dfac C#: Address review comment 2018-12-20 14:49:56 +01:00
calum
d687dd9deb C#: Address review comments. Replace GetHashValue() with MetadataTokens.GetToken().
C#: Make path IDs consistent.
2018-12-20 13:02:25 +00:00
calumgrant
1710f8db7c Merge pull request #661 from hvitved/csharp/maybe-null-path-query
C#: Make `cs/dereferenced-value-may-be-null` a path query
2018-12-20 12:30:07 +00:00
Tom Hvitved
231465143d C#: Autoformat QL tests 2018-12-20 10:19:59 +01:00
Tom Hvitved
546d750045 C#: Reintroduce getURL()
It turns out that we still need `getURL()` to account for cases where there is no
`getLocation()`. Not having `getURL()` for entities without a `getLocation()` results
in a `file://0:0:0:0` URL, which is not rendered in QL4E, unlike a `""` URL.
2018-12-19 20:47:33 +01:00
Tom Hvitved
b2500a0c26 Merge branch 'master' into csharp/maybe-null-path-query 2018-12-19 20:22:19 +01:00
semmle-qlci
83ccddff7a Merge pull request #707 from hvitved/csharp/bounded-fast-tc
Approved by calumgrant
2018-12-19 19:20:42 +00:00
calum
efe2fb502e C#: Convert libraries to use matchesHandle instead of getLabel. 2018-12-19 15:22:53 +00:00
calum
2acde22f43 C#: Add QL and tests for handles. 2018-12-19 15:22:53 +00:00
calum
0ee209e6a4 C#: Update db stats. 2018-12-19 15:22:53 +00:00
calum
fb8895bdc7 C#: Extract metadata handle information. 2018-12-19 15:22:53 +00:00
Esben Sparre Andreasen
c57f8a6d6e Merge pull request #691 from asger-semmle/sendfile-root
JS: Recognize 'root' option in Express res.sendFile
2018-12-19 16:06:15 +01:00
semmle-qlci
495a1fcf3b Merge pull request #698 from asger-semmle/remove-cookie-as-source
Approved by esben-semmle
2018-12-19 15:05:44 +00:00
semmle-qlci
b11b714152 Merge pull request #696 from esben-semmle/js/host-request-forgery
Approved by asger-semmle
2018-12-19 15:04:08 +00:00
Tom Hvitved
10627738d0 C#: Introduce Ssa::Definition::getElement() and AssignableDefinition::getElement() 2018-12-19 14:56:56 +01:00
calumgrant
e15481a622 Merge pull request #702 from hvitved/csharp/remove-deprecated
C#: Remove deprecated predicates
2018-12-19 12:10:49 +00:00
Asger F
ce18aca62b JS: update expected output 2018-12-19 11:30:46 +00:00
Asger F
60ae3e58b8 JS: update change note 2018-12-19 11:26:37 +00:00
Asger F
78334af354 JS: remove cookie source; rely on persistent flow steps instead 2018-12-19 11:23:51 +00:00
calum
6a54a6d3e5 C#: Fix changed unit tests. 2018-12-19 11:03:05 +00:00
Asger F
9440aab3d0 TS: add change note 2018-12-19 10:42:02 +00:00
calum
93ce34ad58 C#: Add a new object->entity cache. 2018-12-19 10:40:07 +00:00
calum
88734f1f8a C#: Fix label conflicts.
C#: Remove unnecessary code from Property.
2018-12-19 10:40:07 +00:00
calum
a7cdf528dd C#: Improve performance by mapping directly from entities to labels. 2018-12-19 10:40:06 +00:00
Asger F
a91599e7fd TS: bump extractor version string 2018-12-19 10:37:27 +00:00
Tom Hvitved
e5cbac5c13 C#: Replace a use of boundedFastTC with fastTC 2018-12-19 11:37:22 +01:00
Asger F
f9da1dc03e JS: add change note 2018-12-19 10:25:49 +00:00
Asger F
0e40717358 JS: recognize res.sendfile root option 2018-12-19 10:25:15 +00:00
Asger F
f84301e476 JS: add tests with res.sendFile root option 2018-12-19 10:25:15 +00:00
Asger F
f9d7f8ba11 JS: fix links in qhelp 2018-12-19 10:10:56 +00:00
semmle-qlci
595634126f Merge pull request #706 from asger-semmle/jquery-location-sink
Approved by esben-semmle
2018-12-18 21:14:08 +00:00
Asger F
f57454951b JS: move <ul> outside of <p> element 2018-12-18 14:15:12 +00:00
Asger F
1246de466a JS: add change note 2018-12-18 13:58:03 +00:00
Asger F
7f538e82c0 JS: add test case for non-whitelisted use of location 2018-12-18 13:55:05 +00:00
Asger F
02978c97f1 JS: whitelist $(location) in simple cases 2018-12-18 13:11:42 +00:00
Asger F
c17eca90a1 JS: add test case for $(location) 2018-12-18 13:06:12 +00:00
calumgrant
b051b7546d Merge pull request #638 from hvitved/csharp/split-dominance-performance
C#: Speedup `Assertions::strictlyDominates()` and `ControlFlowElement::controlsBlock()`
2018-12-18 13:05:36 +00: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
ian-semmle
d2d119eb75 Merge pull request #700 from jbj/mergeback-20181217
Mergeback master -> next
2018-12-18 12:18:54 +00:00
Tom Hvitved
edf1df1577 C#: Remove tests for deprecated predicates 2018-12-18 10:43:12 +01:00
semmle-qlci
c37d655fe8 Merge pull request #697 from esben-semmle/js/fix-heuristics-compilation-time
Approved by asger-semmle
2018-12-18 09:07:36 +00:00
semmle-qlci
7fd1d64d97 Merge pull request #699 from esben-semmle/js/add-lastIndexOf
Approved by asger-semmle
2018-12-18 09:07:17 +00:00
Dave Bartolomeo
63a2670fcd C++: Don't have ReachableBlock extends IRBlock 2018-12-17 13:10:53 -08:00
Dave Bartolomeo
fda8605aae C++: One Unreached per function 2018-12-17 11:03:15 -08:00
Asger F
e1c25c81f6 JS: add change note 2018-12-17 16:34:35 +00:00
Asger F
2044f5fe89 TS: reorganize convertBinaryExpression and create AssignmentExpression when appropriate 2018-12-17 16:23:46 +00:00
alexet
d61022ffcc C++: Improve optimiser performance 2018-12-17 16:11:23 +00:00
Asger F
cc0961a988 TS: translate logical operators correctly 2018-12-17 15:41:15 +00:00
Asger F
d595f20cb1 JS: add to correctness-more suite 2018-12-17 15:29:10 +00:00
Tom Hvitved
d9ae5933d4 C#: Remove deprecated predicates 2018-12-17 16:20:41 +01:00
Asger F
280382e91e JS: whitelist if array access at another index is seen 2018-12-17 15:19:26 +00:00
Tom Hvitved
e14259126e Merge pull request #658 from calumgrant/cs/extractor/for-is
C#: Fix extraction bug for variable declarations in for condition
2018-12-17 16:16:00 +01:00
Anders Schack-Mulligen
d3f6362ba2 Java: Add missing override annotations. 2018-12-17 15:40:46 +01:00
Tom Hvitved
e822510d6b C#: Fix typo 2018-12-17 15:33:05 +01:00
calumgrant
6648c8414f Merge pull request #680 from hvitved/csharp/data-flow-performance-tweaks
C#: Minor data flow performance tweaks
2018-12-17 14:25:51 +00:00
calumgrant
dbd0c7e80a Merge pull request #674 from hvitved/csharp/cache-get-label
C#: Cache `NamedElement::getLabel()`
2018-12-17 14:24:01 +00:00
calumgrant
f50d0e373a Merge pull request #642 from hvitved/csharp/extractor/nullness-refactorings
C#: nullness related extractor refactorings
2018-12-17 14:16:51 +00:00
Asger F
5040d3e26c JS: add query for loop index bug 2018-12-17 13:35:44 +00:00
Jonas Jensen
5ac5aa0c2a Merge remote-tracking branch 'upstream/master' into mergeback-20181217 2018-12-17 13:42:45 +01:00
Esben Sparre Andreasen
4a631b42d4 JS: use .lastIndexOf in js/incomplete-url-substring-sanitization 2018-12-17 13:22:31 +01:00
Asger F
7adf1d9958 Merge pull request #631 from esben-semmle/js/bad-url-regexing
JS: add query: js/incomplete-url-regexp
2018-12-17 11:53:22 +00:00
Tom Hvitved
5f269b2d87 Merge branch 'master' into cs/extractor/for-is 2018-12-17 11:14:50 +01:00
Esben Sparre Andreasen
50cba92f5f JS: remove slow test Security/heuristics/AdditionalCommandInjections 2018-12-17 10:58:46 +01:00
Tom Hvitved
ada0115d6a C#: Remove getUrl() predicates
As described on https://lgtm.com/help/ql/locations#providing-location-information,
there is no need to provide a `getUrl()` predicate, when there is a `getLocation()`
predicate. Not only is it redundant, but it can also be slow because of string
construction.
2018-12-17 10:52:24 +01:00
Esben Sparre Andreasen
3cd62234d4 JS: change notes for js/request-forgery improvements 2018-12-17 10:33:39 +01:00
Esben Sparre Andreasen
c6b4e29b93 JS: add "host" as a sink for js/request-forgery 2018-12-17 10:32:30 +01:00
Esben Sparre Andreasen
60fe0176ed JS: add ClientRequest::getHost 2018-12-17 10:32:30 +01:00
Esben Sparre Andreasen
3a5962aa34 JS: minor fixups in ClientRequests.qll 2018-12-17 10:32:30 +01:00
Anders Schack-Mulligen
01f58758f1 Merge pull request #693 from sb-semmle/remove-duplicate-predicate
Remove a duplicated predicate.
2018-12-17 08:47:33 +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
Dave Bartolomeo
56bb9dcde0 C++: Remove infeasible edges to reachable blocks
The existing unreachable IR removal code only retargeted an infeasible edge to an `Unreached` instruction if the successor of the edge was an unreachable block. This is too conservative, because it doesn't remove an infeasible edge that targets a block that is still reachable via other paths. The trivial example of this is `do { } while (false);`, where the back edge is infeasible, but the body block is still reachable from the loop entry.

This change retargets all infeasible edges to `Unreached` instructions, regardless of the reachability of the successor block.
2018-12-14 12:13:22 -08:00
Sebastian Bauersfeld
c35fc82218 Remove a duplicated predicate. 2018-12-14 12:59:49 -05:00
Geoffrey White
b8877f1d5f Merge pull request #690 from jbj/prepareQueries-fix-warnings-2
C++: Delete dead code with warnings in it
2018-12-14 14:23:19 +00:00
Tom Hvitved
91e4f7ad83 C#: Make cs/dereferenced-value-may-be-null a path query 2018-12-14 12:07:16 +00:00
Esben Sparre Andreasen
487b8c52c6 JS: fix <p></p> issue 2018-12-14 13:04:10 +01:00
Tom Hvitved
e2f271bddb C#: Add more guard implication steps 2018-12-14 12:03:32 +00:00
Tom Hvitved
078dc7b6c0 C#: Fix false positives in cs/dereferenced-value-may-be-null 2018-12-14 12:03:32 +00:00
Tom Hvitved
287ce4e683 C#: Add more nullness tests 2018-12-14 12:03:32 +00:00
Max Schaefer
5ccad6ffc2 JavaScript: Minor improvements. 2018-12-14 11:56:59 +00:00
Max Schaefer
3e04f53ed2 Merge pull request #688 from adityasharad/merge/master-next-141218
Merge master into next.
2018-12-14 11:48:00 +00:00
Jonas Jensen
23a2bf1756 C++: Delete dead code with warnings in it 2018-12-14 10:59:41 +00:00
Tom Hvitved
654f2ae290 C#: Address review comment 2018-12-14 10:38:34 +00:00
Aditya Sharad
7bc729a7dc Merge master into next. 2018-12-14 10:16:47 +00:00
Tom Hvitved
56b80ae13a C#: Add getALocation() for namespaces and namespace declarations 2018-12-14 10:16:20 +00:00
Esben Sparre Andreasen
bb3e3a541d JS: address doc review comments 2018-12-14 10:24:30 +01:00
semmle-qlci
936094d0b6 Merge pull request #671 from xiemaisi/js/more-unhelpful-magic
Approved by asger-semmle
2018-12-14 08:44:45 +00:00
Max Schaefer
f9106b3bfe Merge pull request #685 from asger-semmle/useless-conditional-as-value
JS: fix FPs in UselessConditional
2018-12-14 08:44:10 +00:00
semmle-qlci
7f21f145e2 Merge pull request #678 from asger-semmle/function-receiver
Approved by xiemaisi
2018-12-14 08:39:04 +00:00
Tom Hvitved
b11d5c5075 Merge pull request #679 from calumgrant/cs/omitted-array-size
C#: Extract stackalloc initializers
2018-12-14 07:48:46 +01:00
Arthur Baars
18eb60b98e Merge pull request #687 from adityasharad/merge/master-next-131218
Merge master into next.
2018-12-13 19:43:58 +01:00
Aditya Sharad
f71e5ac338 Merge master into next. 2018-12-13 17:57:31 +00:00
Anders Schack-Mulligen
7656936cad Java: Remove Metrics/queries.xml 2018-12-13 17:43:26 +00:00
Asger F
f737830f18 JS: fix typo 2018-12-13 15:56:00 +00:00
Asger F
ae4b55de9a JS: fix FPs in UselessConditional 2018-12-13 15:41:41 +00:00
Geoffrey White
b21e832ee2 Merge pull request #683 from jbj/prepareQueries-fix-warnings
C++: Fix all prepareQueries errors and warnings
2018-12-13 15:30:44 +00:00
calum
9fba643fb0 C#: Address review comments. 2018-12-13 13:53:58 +00:00
Arthur Baars
1158708ea4 Merge pull request #684 from adityasharad/merge/1.19-next-131218
Merge rc/1.19 into next.
2018-12-13 14:14:42 +01:00
Aditya Sharad
ce8ca5979b Merge rc/1.19 into next. 2018-12-13 12:23:59 +00:00
calumgrant
16c065274d Merge pull request #666 from hvitved/csharp/useless-upcast-performance
C#: Improve performance of `cs/useless-upcast`
2018-12-13 12:04:12 +00:00
Jonas Jensen
bee2ddaf26 C++: Fix all prepareQueries errors and warnings
With these changes we can run `odasa prepareQueries --check-only
--fail-on-warnings` on the C++ query directory. Two changes were needed:

1. The `Metrics/queries.xml` file had to be deleted. It existed because
   the built distribution has a different file layout, where `Metrics`
   is moved to the top-level query dir `odasa-cpp-metrics`. Since
   internal PR 28230 this file is created as needed as part of the dist
   build process, so it doesn't need to be checked in with the sources.
2. All uses of the `deprecated` and stubbed-out Objective C classes were
   removed.
2018-12-13 11:13:50 +00:00
Aditya Sharad
fb82811545 Merge pull request #681 from jbj/import-dataflow-clash
C++: Fix name clash in data flow imports
2018-12-13 10:22:32 +00:00
Asger F
cb349348e7 JS: rename getThisParameter to getReceiver 2018-12-13 10:19:44 +00:00
Geoffrey White
ca999473b0 CPP: Change note. 2018-12-13 10:17:43 +00:00
Jonas Jensen
1a0a8c931f C++: Fix name clash in data flow imports
The AST-based data flow libraries and the IR-based ones both define
modules `DataFlow`, `DataFlow2`, etc. This caused
`ImportAdditionalLibraries.ql` to fail in compilation.
2018-12-13 09:53:20 +00:00
Geoffrey White
e443eb8889 CPP: Fix type logic. 2018-12-13 09:49:32 +00:00
Max Schaefer
e194021c3b Merge pull request #629 from esben-semmle/js/persistent-read-taint
JS: add persistent storage taint steps
2018-12-13 08:24:42 +00:00
Max Schaefer
969fe6e4f1 Merge pull request #657 from esben-semmle/js/classify-more-files
JS: classify additional files
2018-12-13 08:20:33 +00:00
Max Schaefer
e8c8360ad1 Merge pull request #659 from esben-semmle/js/more-constant-string-usage
JS: replace StringLiteral with ConstantString in two queries
2018-12-13 08:19:22 +00:00
Max Schaefer
f1dcec8369 Merge pull request #667 from asger-semmle/ts-binding-pattern-with-defaults
TS: fix extraction of binding pattern with default
2018-12-13 08:18:22 +00:00
Max Schaefer
54bb9d185f Merge pull request #632 from asger-semmle/pseudo-random-bytes
JS: add crypto.pseudoRandomBytes as source in InsecureRandomness.ql
2018-12-13 08:14:40 +00:00
Max Schaefer
df42707050 Merge pull request #675 from asger-semmle/window.name
JS: Add window.name as remote flow source
2018-12-13 08:13:15 +00:00
Max Schaefer
3f185364f9 Merge pull request #669 from adityasharad/merge/master-next-111218
Merge master into next.
2018-12-13 07:58:58 +00:00
Geoffrey White
c904a338f7 CPP: Add test cases. 2018-12-12 23:47:48 +00:00
Tom Hvitved
b155a0f5fb C#: Avoid computing CIL strings and non-PDB locations in data flow library
Computing strings and locations for CIL instructions can be quite time consuming.
The CIL `toString()`s are not very helpful in path explanations, and their locations
are only useful when a PDB source file exists. Therefore, produce a simple constant
`toString()`, and restrict locations to those in PDB files.
2018-12-12 21:58:16 +01:00
Tom Hvitved
344466a8c1 C#: Cache DataFlow::Node::getEnclosingCallable() 2018-12-12 21:49:21 +01:00
semmle-qlci
1470f9fb70 Merge pull request #677 from aschackmull/java/change-note-cfg-cast
Approved by felicity-semmle
2018-12-12 18:24:45 +00:00
Aditya Sharad
f92456fcad Merge master into next.
Conflict in `cpp/ql/test/library-tests/sideEffects/functions/sideEffects.expected`,
resolved by accepting test output (combining changes).
2018-12-12 17:26:18 +00:00
Aditya Sharad
41a48078f7 Merge pull request #673 from calumgrant/cs/sync-files
C#: Sync samples and qltest cases
2018-12-12 17:10:00 +00:00
calumgrant
8e546a30b0 Merge pull request #637 from hvitved/csharp/cfg/throwing-callable
C#: Fix a bug in `ThrowingCallable`
2018-12-12 16:58:28 +00:00
calum
2bbd55519b C#: Add tests for C# 7.3 features. 2018-12-12 16:44:55 +00:00
Asger F
635a3cb1ec JS: add FunctionNode.getThisParameter 2018-12-12 16:26:02 +00:00
calum
5596bc8827 C#: Add change note. 2018-12-12 16:16:07 +00:00
Anders Schack-Mulligen
2150af9732 Java: Add change note about CFG cast deprecation. 2018-12-12 15:04:19 +00:00
Anders Schack-Mulligen
12bc1fc656 Merge pull request #581 from jf205/metadata-guide
Query metadata style guide: add to ql/docs
2018-12-12 12:55:20 +00:00
Asger F
a96c53f9b8 JS: restrict when a variable reference is considered a source 2018-12-12 12:28:26 +00:00
Asger F
14621760bb JS: add window.name as DOM-based remote flow source 2018-12-12 12:22:39 +00:00
Tom Hvitved
74167e478a C#: Cache NamedElement::getLabel() 2018-12-12 13:16:28 +01:00
Tom Hvitved
6918dad1db C#: Refactor localFlowStep()
Using the `forceCachingInSameStage()` trick, we can get rid of the non-cached version
of local flow, while still computing it in the same stage.
2018-12-12 13:14:22 +01:00
Tom Hvitved
1366638f06 C#: Fix whitespaces 2018-12-12 13:13:13 +01: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
calum
3037b2b197 C#: Sync the -Good and -Bad files in the qltest to match the sample. 2018-12-12 11:36:00 +00:00
calum
1df1b0c28e C#: Refactor ArrayCreations to allow stackalloc arrays to have initializers (C# 7.3). 2018-12-12 11:05:34 +00:00
Asger F
aa04e9c77f TS: fix extraction of binding pattern with default 2018-12-12 10:36:30 +00:00
Max Schaefer
faaca21996 JavaScript: Avoid more unhelpful magic. 2018-12-12 08:40:21 +00:00
Max Schaefer
4fc27aaa51 Merge branch 'master' into pseudo-random-bytes 2018-12-12 08:19:57 +00:00
semmle-qlci
06dd5f3616 Merge pull request #656 from xiemaisi/js/unused-local-underscore
Approved by esben-semmle
2018-12-12 08:11:37 +00:00
semmle-qlci
9df5d4b0c2 Merge pull request #660 from esben-semmle/js/angularjs-alert-locations
Approved by xiemaisi
2018-12-12 08:05:19 +00:00
Dave Bartolomeo
be5ac2f2ff Merge pull request #648 from dave-bartolomeo/dave/UnreachableIR
C++: Remove unreachable IR
2018-12-11 20:58:49 -08:00
yh-semmle
14488cb62e Merge pull request #652 from aschackmull/java/constant-loop-cond-alert-pos
Java: Change alert location for ConstantLoopCondition.
2018-12-11 21:26:14 -05:00
Dave Bartolomeo
0140cd23d0 C++: Accept correct test output 2018-12-11 17:11:51 -08:00
Dave Bartolomeo
283c1d43c3 C++: Restore previous test expectations 2018-12-11 17:07:25 -08:00
Robert Marsh
59c0e5d39e C++: update test expectations 2018-12-11 15:07:09 -08:00
Esben Sparre Andreasen
fac638ffab JS: improve alert location of js/angular/unused-dependency 2018-12-11 21:47:08 +01:00
Esben Sparre Andreasen
b5bbf990b0 JS: improve alert location of js/angular/repeated-dependency-injection 2018-12-11 21:47:08 +01:00
Esben Sparre Andreasen
5acd1ca26d JS: improve alert location of js/angular/duplicate-dependency 2018-12-11 21:47:08 +01:00
Robert Marsh
98005edd9d Merge pull request #641 from geoffw0/exprnoeffect2
CPP: More tests of isSideEffectFree() / ExprHasNoEffect.ql
2018-12-11 12:17:30 -08:00
Tom Hvitved
7422947e78 C#: Improve performance of cs/useless-upcast 2018-12-11 17:48:04 +01:00
Asger F
a01a9dc5cc JS: add crypto.pseudoRandomBytes as source in InsecureRandomness.ql 2018-12-11 16:06:22 +00:00
Tom Hvitved
9707b34124 Merge pull request #663 from adityasharad/merge/1.19-next-111218
Merge rc/1.19 into next.
2018-12-11 16:06:55 +01:00
Aditya Sharad
ce905e7a0a Merge pull request #597 from dave-bartolomeo/dave/IRDataflow
C++: Initial IR-based dataflow implementation
2018-12-11 15:05:58 +00:00
Tom Hvitved
e80837681f C#: Refactor LINQ logic
Factor `ClauseCall` out into three classes to make it clear when the fields
`operand` and `declaration` can be `null`.
2018-12-11 16:04:25 +01:00
Aditya Sharad
dde42a5723 Merge rc/1.19 into next. 2018-12-11 14:38:58 +00:00
Esben Sparre Andreasen
376ed7a4d2 JS: generalize js/command-line-injection to handle ConstantString 2018-12-11 13:39:15 +01:00
Esben Sparre Andreasen
a1d92bfa50 JS: generalize js/incomplete-sanitization to handle ConstantString 2018-12-11 13:39:15 +01:00
Esben Sparre Andreasen
1bc73ab592 JS: address review comments 2018-12-11 13:03:17 +01:00
calum
f0fb47cde0 C#: Update change notes. 2018-12-11 10:31:45 +00:00
calum
8d072863df C#: Reorder for statements to ensure variables declared in the condition are declared before they are used. 2018-12-11 10:31:45 +00:00
Esben Sparre Andreasen
7cc6f2f4d8 JS: add test case 2018-12-11 10:17:25 +01:00
Esben Sparre Andreasen
36e36a414e JS: change notes for improve file classification 2018-12-11 10:01:54 +01:00
Esben Sparre Andreasen
73aa223b08 JS: handle additional multi-license file patterns 2018-12-11 09:55:38 +01:00
Max Schaefer
4d186e0edc JavaScript: Teach Unused{Variable,Parameter} to ignore variables with leading underscore. 2018-12-11 08:50:50 +00:00
Dave Bartolomeo
8a73bea72f C++: Avoid bad join ordering in getOperandMemoryAccess 2018-12-11 00:47:53 -08:00
Esben Sparre Andreasen
edbef289a7 JS: improve whitespace handling for multi-license file recognition 2018-12-11 09:30:10 +01:00
Esben Sparre Andreasen
e016098f86 JS: support purs classification 2018-12-11 09:17:01 +01:00
Esben Sparre Andreasen
3879e57f18 JS: support <meta name="generator"/> classification 2018-12-11 09:12:39 +01:00
Esben Sparre Andreasen
a295dfd2c5 JS: support AutoRest classification 2018-12-11 08:54:19 +01:00
Dave Bartolomeo
4170d4fadd C++: Handle relational operators in constant analysis 2018-12-10 23:03:02 -08:00
Dave Bartolomeo
5ba51e32f0 C++: Remove aliased_ssa instantiation of IR reachability
We never actually consumed this iteration, since SSA construction only depends on the reachability instantiation of the previous IR layer.
2018-12-10 21:22:55 -08:00
Dave Bartolomeo
a81ba84c0e C++: Update test expectations after unreachable IR removal 2018-12-10 21:22:55 -08:00
Dave Bartolomeo
b2e596fcc2 C++: Improve join order in IR reachability 2018-12-10 21:22:55 -08:00
Dave Bartolomeo
99d33f9623 C++: Remove unreachable IR
This change removes any IR instructions that can be statically proven unreachable. To detect unreachable IR, we first run a simple constant value analysis on the IR. Then, any `ConditionalBranch` with a constant condition has the appropriate edge marked as "infeasible". We define a class `ReachableBlock` as any `IRBlock` with a path from the entry block of the function. SSA construction has been modified to operate only on `ReachableBlock` and `ReachableInstruction`, which ensures that only reachable IR gets translated into SSA form. For any infeasible edge where its predecessor block is reachable, we replace the original target of the branch with an `Unreached` instruction, which lets us preserve the invariant that all `ConditionalBranch` instructions have both a true and a false edge, and allows guard inference to still work.

The changes to `SSAConstruction.qll` are not as scary as they look. They are almost entirely a mechanical replacement of `OldIR::IRBlock` with `OldBlock`, which is just an alias for `ReachableBlock`.

Note that the `constant_func.ql` test can determine that the two new test functions always return 0.

Removing unreachable code helps get rid of some common FPs in IR-based dataflow analysis, especially for constructs like `while(true)`.
2018-12-10 21:22:55 -08:00
Dave Bartolomeo
59fc77f066 C++: Simple constant analysis
This change moves the simple constant analysis that was used by the const_func test into a pyrameterized module for use on any stage of the IR. This will be used to detect unreachable code.
2018-12-10 21:22:54 -08:00
Dave Bartolomeo
6a11ef5c18 C++: Add a couple test cases for unreachable code in IR 2018-12-10 21:22:54 -08:00
Dave Bartolomeo
78e5b3ad63 C++: Add IR dataflow to ImportAdditionalQueries.ql 2018-12-10 15:09:49 -08:00
Dave Bartolomeo
23993710d1 Revert "C++: Avoid creating ExprNodes for Conversions"
This reverts commit df882a9e72.
2018-12-10 15:06:29 -08:00
Esben Sparre Andreasen
09e7124bb1 JS: update change notes for renamed query 2018-12-10 22:22:54 +01:00
Esben Sparre Andreasen
ab519d4abf JS: rename query
"Incomplete URL regular expression" -> "Incomplete regular expression for hostnames".
2018-12-10 22:22:54 +01:00
Esben Sparre Andreasen
7c6e28d917 JS: introduce near-empty RegularExpressions.qll 2018-12-10 22:22:54 +01:00
Esben Sparre Andreasen
994fe1bea5 JS: address non-semantic review comments 2018-12-10 22:21:02 +01:00
Esben Sparre Andreasen
d4e4bc6a0b JS: sharpen js/incomplete-url-regexp by not matching .* or .+ 2018-12-10 22:21:02 +01:00
Esben Sparre Andreasen
c65c7e700e JS: change notes for js/incomplete-url-regexp 2018-12-10 22:21:01 +01:00
Esben Sparre Andreasen
52ca696ff4 JS: add query js/incomplete-url-regexp 2018-12-10 22:20:29 +01:00
Esben Sparre Andreasen
6d6379fc09 JS: address review comments 2018-12-10 22:03:52 +01:00
Sebastian Bauersfeld
6c756c5e6a Rename ConfigLine to ConfigPair. Make ConfigFiles.ql a library, as intended 2018-12-10 14:08:27 -05:00
Dave Bartolomeo
df882a9e72 C++: Avoid creating ExprNodes for Conversions 2018-12-10 10:09:42 -08:00
Aditya Sharad
d94e14d54b Merge pull request #609 from hvitved/csharp/autobuilder/fixes
C#: Autobuilder fixes
2018-12-10 18:07:31 +00:00
Jonas Jensen
a4b3b1e8c8 Merge pull request #653 from geoffw0/ex-ch-notes
CPP: Additional change notes (for 1.20)
2018-12-10 16:59:12 +01:00
Tom Hvitved
1e9fe0046a C#: Address review comments 2018-12-10 15:31:23 +01:00
semmle-qlci
57de628ab8 Merge pull request #650 from xiemaisi/js/nomagic-isDOMProperty
Approved by asger-semmle
2018-12-10 13:52:47 +00:00
Geoffrey White
709fd6382a CPP: Change note for #562. 2018-12-10 13:51:15 +00:00
Geoffrey White
6b7337d766 CPP: Change note for #540. 2018-12-10 13:42:17 +00:00
Jonas Jensen
1f7383498a Merge pull request #644 from geoffw0/pointerscaling
CPP: Fix type confusion in IncorrectPointerscaling.ql
2018-12-10 14:22:10 +01:00
Anders Schack-Mulligen
bfc7fb7c8a Java: Change alert location for ConstantLoopCondition. 2018-12-10 12:37:11 +00:00
Felicity Chapman
882ab7e9ca Merge pull request #636 from jbj/incorrect-not-operator-usage-case
C++: Rename "Incorrect 'not' operator usage"
2018-12-10 11:13:19 +00:00
Felicity Chapman
6ef16bb728 Merge pull request #649 from jf205/qhelp-guide
Query help style guide: editorial review
2018-12-10 10:59:48 +00:00
Max Schaefer
e7df9b8b01 JavaScript: Avoid unhelpful magic. 2018-12-10 10:40:37 +00:00
Aditya Sharad
02b58a8319 Merge pull request #625 from adityasharad/merge/1.19-next-051218
Merge rc/1.19 into next.
2018-12-10 10:05:16 +00:00
james
a0d5049132 update links to query pages 2018-12-10 09:33:58 +00:00
james
4bd922e442 address further comments 2018-12-10 09:18:05 +00:00
james
36fe86f730 address felicity's comments 2018-12-10 09:18:05 +00:00
james
59542fc367 mention of qldoc comment requirements 2018-12-10 09:18:05 +00:00
james
934fd9f3d6 address geoffrey's comments and reword tags 2018-12-10 09:18:05 +00:00
james
2ed648d798 metadat-style-guide: address anders' review 2018-12-10 09:18:05 +00:00
james
09d08a7547 metadata-style-guide: update title 2018-12-10 09:18:04 +00:00
james
9560165921 metadata-style-guide: add style guide 2018-12-10 09:18:04 +00:00
james
41f5d65e0c remove hyphen from title and update some links 2018-12-10 09:13:33 +00:00
semmle-qlci
1ca27e2c18 Merge pull request #647 from xiemaisi/js/fix-msita-perf
Approved by esben-semmle
2018-12-09 21:32:31 +00:00
Nick Rolfe
976aa22fac Merge pull request #646 from ian-semmle/stats
C++: Update stats
2018-12-09 17:59:46 +00:00
yh-semmle
ba4fa0a246 Merge pull request #643 from aschackmull/java/nullguard-isblank
Java: Add org.apache.commons.lang3.StringUtils.isBlank as a nullguard.
2018-12-07 15:31:58 -05:00
Sebastian Bauersfeld
3379e71e01 Add ConfigFiles library for working with configuration files. 2018-12-07 15:11:54 -05:00
Geoffrey White
9857a85817 CPP: Fix similar queries. 2018-12-07 18:43:28 +00:00
Geoffrey White
d3c6d83786 CPP: Change note. 2018-12-07 18:43:27 +00:00
Geoffrey White
0f268cac40 CPP: Fix the issue. 2018-12-07 18:43:27 +00:00
Geoffrey White
02a060fbfa CPP: Add a test. 2018-12-07 18:21:48 +00:00
Ian Lynagh
4f51257e56 C++: Update stats 2018-12-07 16:13:07 +00:00
calumgrant
67d4099e3f Merge pull request #593 from hvitved/csharp/nullness
C#: Rewrite nullness queries
2018-12-07 15:57:27 +00:00
Geoffrey White
91578258f7 Merge pull request #595 from jf205/qhelp-guide
Query help style-guide
2018-12-07 15:38:58 +00:00
Anders Schack-Mulligen
f09eb67af0 Java: Add org.apache.commons.lang3.StringUtils.isBlank as a nullguard. 2018-12-07 16:18:32 +01:00
Tom Hvitved
6411d1c7dd C#: Refactor operator call logic
Refactored to make it clear when `@operator.Symbol as IMethodSymbol` can be `null`.
2018-12-07 15:47:20 +01:00
Tom Hvitved
e05bbb0f10 C#: Fix always-null bug in TRAP writer 2018-12-07 15:46:27 +01:00
Geoffrey White
e7390f3ea5 CPP: Add simple tests of CommaExpr. 2018-12-07 14:29:09 +00:00
semmle-qlci
3b383e3aaf Merge pull request #635 from Semmle/xiemaisi-patch-3
Approved by esben-semmle
2018-12-07 14:02:48 +00:00
Max Schaefer
74e70615ed JavaScript: Fix performance regression in MixedStaticInstanceThisAccess. 2018-12-07 13:17:36 +00:00
Aditya Sharad
fcfab26267 Merge rc/1.19 into next. 2018-12-07 12:31:51 +00:00
Tom Hvitved
664453707a C#: Speedup Assertions::strictlyDominates() and ControlFlowElement::controlsBlock()
Only calculate dominance by explicit recursion for split nodes; all other nodes
can use regular CFG dominance.
2018-12-07 12:03:12 +01:00
Anders Schack-Mulligen
6beb396d93 Merge pull request #634 from yh-semmle/java/field-annotations
Java: account for change to field annotation extraction
2018-12-07 11:29:46 +01:00
Tom Hvitved
2a30dee8df Merge pull request #621 from calumgrant/cs/invalid-key
C#: Fix [INVALID_KEY] error
2018-12-07 11:24:45 +01:00
Tom Hvitved
c887dc89dc C#: Fix a bug in ThrowingCallable
A method such as

```
void M()
{
    throw new Exception();
}
```

was incorrectly not categorized as a `ThrowingCallable`, that is, a callable
that always throws an exception upon invocation.
2018-12-07 10:56:11 +01:00
Geoffrey White
b1e7649d02 CPP: Add functions containing errors to the sideEffects tests. 2018-12-07 09:54:36 +00:00
Tom Hvitved
243af36167 C#: Add more CFG tests with throwing methods 2018-12-07 10:43:45 +01:00
Tom Hvitved
fce805834e C#: Address review comments 2018-12-07 09:40:49 +01:00
Max Schaefer
74e3709de1 JavaScript: Add missing query id in change notes. 2018-12-07 08:25:28 +00:00
Jonas Jensen
00e52df371 C++: Rename "Incorrect 'not' operator usage"
This makes the casing consistent with our other queries.
2018-12-07 09:24:35 +01:00
yh-semmle
bc78219653 Java: account for change to field annotation extraction 2018-12-06 23:06:14 -05:00
yh-semmle
a709783fe5 Merge pull request #622 from ian-semmle/range_for
C++: Follow range for statement test output changes
2018-12-06 23:05:08 -05:00
semmle-qlci
9e73ed71b9 Merge pull request #623 from esben-semmle/js/incomplete-url-sanitization
Approved by mc-semmle
2018-12-06 20:46:37 +00:00
Dave Bartolomeo
ebbd701188 C++: Fix PR feedback 2018-12-06 12:35:43 -08:00
Dave Bartolomeo
84b39bf999 C++: Simplify models for side effects and alias info. 2018-12-06 12:35:33 -08:00
yh-semmle
c2116f0d91 Merge pull request #560 from aschackmull/java/normalize-parentheses
Java: Normalize parentheses.
2018-12-06 12:38:26 -05:00
Esben Sparre Andreasen
4f53411397 JS: recognize HTTP URLs in js/incomplete-url-sanitization 2018-12-06 15:53:20 +01:00
Esben Sparre Andreasen
56fb63adbc JS: change notes for js/incomplete-url-substring-sanitization 2018-12-06 15:53:20 +01:00
Esben Sparre Andreasen
229eea00dc JS: add query js/incomplete-url-substring-sanitization 2018-12-06 15:53:20 +01:00
semmle-qlci
3397533045 Merge pull request #628 from xiemaisi/js/setUnsafeHTML
Approved by esben-semmle
2018-12-06 13:58:52 +00:00
Esben Sparre Andreasen
bf048e7e49 JS: change notes for persistent storage taint step and cookie models 2018-12-06 14:53:22 +01:00
Esben Sparre Andreasen
45b207c21b JS: introduce models of three cookie libraries 2018-12-06 14:53:22 +01:00
Esben Sparre Andreasen
28b4a78430 JS: introduce DOM::PersistentWebStorage 2018-12-06 14:53:22 +01:00
Jonas Jensen
0a496c1d3d Merge pull request #617 from geoffw0/unusedstatic
CPP: Fix false positives in UnusedStaticVariables.ql
2018-12-06 14:09:52 +01:00
Taus
cb93017d98 Merge pull request #606 from markshannon/python-fix-regex-fp
Python: Fix off-by-one error in regex parsing.
2018-12-06 12:59:44 +01:00
Ian Lynagh
8d655c74ae C++: Follow range for statement test output changes 2018-12-06 11:12:46 +00:00
Esben Sparre Andreasen
7fb752784a JS: introduce persistent read/write pairs as a taint step 2018-12-06 10:36:10 +01:00
Max Schaefer
ef347b3870 JavaScript: Teach Xss query about WinJS HTML injection functions. 2018-12-06 09:13:21 +00:00
Felicity Chapman
6a7b528280 1.19: Finalize change notes for JavaScript 2018-12-06 08:44:35 +00:00
semmle-qlci
bc91e0f53b Merge pull request #624 from Semmle/xiemaisi-patch-2
Approved by esben-semmle
2018-12-06 08:04:37 +00:00
Max Schaefer
305b8a6723 Merge pull request #620 from xiemaisi/js/qhelp-for-ms-queries
JavaScript: Add query help for two externally contributed queries.
2018-12-06 08:04:13 +00:00
Max Schaefer
75842fec1c Merge pull request #627 from samlanning/inconsistentStateExample
JS: Fix syntax error in js/react/inconsistent-state-update example
2018-12-06 08:03:32 +00:00
Sam Lanning
2ea148016c JS: Fix syntax error in js/react/inconsistent-state-update example 2018-12-05 16:44:40 -08:00
Dave Bartolomeo
2b80aee557 C++: Use getConvertedResultExpr in IR-based dataflow
This sort of fixes one FP and causes a new FN, but for the wrong reasons. The IR dataflow is tracking the reference itself, rather than the referred-to object. Once we can better model indirections, we can make this work correctly.

This change is still the right thing to do, because it ensures that the dataflow is looking at actual expression being computed by the instruction.
2018-12-05 12:34:44 -08:00
Dave Bartolomeo
e8efb32156 C++: Remove StoreDestinationAsPostUpdateNode 2018-12-05 11:33:48 -08:00
Dave Bartolomeo
65360b23f9 C++: Change model API based on feedback
I've separated the model interface for memory side effects from the model for escaped addresses. It will be fairly common for a given model to extend both interfaces, but they are used for two different purposes.

I've also put each model interface and the non-member predicates that query it into a named module, which seemed cleaner than having predicates named `functionModelReadsMemory()` and `getFunctionModelParameterAliasBehavior()`.
2018-12-05 10:58:46 -08:00
Taus
a8354b98d9 Merge pull request #626 from felicity-semmle/1.19/python-change-notes
Update logging information based on 'extractor-python.md'
2018-12-05 17:42:56 +01:00
Felicity Chapman
c735043772 Update for feedback 2018-12-05 16:36:34 +00:00
Felicity Chapman
9ef50a7876 Update logging information based on 'extractor-python.md' 2018-12-05 16:13:05 +00:00
Nick Rolfe
d577ee8849 Merge pull request #613 from ian-semmle/catch
C++: Test output changes following CatchAny fix
2018-12-05 16:02:43 +00:00
Ian Lynagh
7d8a8de53d C++: Test output changes following CatchAny fix 2018-12-05 15:35:54 +00:00
Max Schaefer
13a9903c21 JavaScript: Remove redundant conjunct in MixedStaticInstanceThisAccess.
Minor cleanup, but might as well go into the release.
2018-12-05 15:11:32 +00:00
Max Schaefer
a1f210df67 JavaScript: Address review comments. 2018-12-05 14:10:06 +00:00
calum
919d7cbf01 C#: Fix [INVALID_KEY] errors. 2018-12-05 13:55:55 +00:00
Geoffrey White
f6a87574f0 CPP: Add query ID to change note. 2018-12-05 13:55:46 +00:00
Max Schaefer
22502e7a10 JavaScript: Add query help for FileAccessToHttp query. 2018-12-05 13:12:52 +00:00
Max Schaefer
92c1e655dd JavaScript: Add query help for HttpToFileAccess query. 2018-12-05 12:58:38 +00:00
Tom Hvitved
733c7b0a8f Merge pull request #616 from felicity-semmle/1.19/c#-finalize-release-notes
1.19: Finalize release notes for C#
2018-12-05 11:17:19 +01:00
Aditya Sharad
7d3e637eb0 Merge pull request #618 from xiemaisi/js/fix-test-output
JavaScript: Fix expected test output.
2018-12-05 10:15:59 +00:00
Max Schaefer
7ee0ba36af JavaScript: Fix expected test output. 2018-12-05 10:14:25 +00:00
Geoffrey White
d0a0d2300e CPP: Change note. 2018-12-05 10:03:21 +00:00
Geoffrey White
d85f4b540c CPP: Fix false positive. 2018-12-05 10:01:54 +00:00
Geoffrey White
e7f19e97cb CPP: Add a test of UnusedStaticVariable.ql. 2018-12-05 10:01:54 +00:00
Anders Schack-Mulligen
697fd96ed7 Merge pull request #614 from felicity-semmle/1.19/java-finalize-change-notes
1.19: Finalize change notes for Java
2018-12-05 10:56:13 +01:00
Felicity Chapman
d3baa8917e Prepare for publication 2018-12-05 09:44:59 +00:00
Jonas Jensen
54d001e562 Merge pull request #612 from felicity-semmle/1.19/c++-finalize-release-notes
1.19: Finalize release notes for C/C++
2018-12-05 09:28:36 +01:00
Max Schaefer
3c00d4be6d Merge pull request #607 from esben-semmle/js/more-react-methods
JS: model additional React component methods
2018-12-05 08:00:16 +00:00
yh-semmle
00779c518c Merge pull request #611 from aschackmull/java/usessl-fp-fix
Java: Fix FP in `UseSSL.ql`.
2018-12-04 19:31:53 -05:00
Esben Sparre Andreasen
d63d838534 JS: add regression test for ODASA-7506 2018-12-04 22:22:46 +01:00
Arthur Baars
d1cc53cd36 Merge pull request #588 from adityasharad/merge/1.19-next-301118
Merge rc/1.19 into next.
2018-12-04 22:16:37 +01:00
Felicity Chapman
f64bfb5caf Remove template text, sort rows 2018-12-04 17:43:19 +00:00
Felicity Chapman
a144fe8a07 Update with missing ids and move one query 2018-12-04 17:40:09 +00:00
Felicity Chapman
d63b5ac1bd Updates for consistency 2018-12-04 17:34:20 +00:00
Taus
08b1431fc5 Merge pull request #600 from markshannon/python-fix-performance-refinement-edge
Python ESSA: Fix performance of PythonSsaSourceVariable.hasRefinementEdge()
2018-12-04 18:07:21 +01:00
Felicity Chapman
a9ad9399f5 Add a couple more missing identifiers 2018-12-04 16:55:00 +00:00
Anders Schack-Mulligen
d3fcfb0957 Java: Fix FP in UseSSL. 2018-12-04 17:44:05 +01:00
Felicity Chapman
0c283c024d Split query changes into LGTM/non-LGTM queries 2018-12-04 16:43:57 +00:00
Felicity Chapman
62dc486190 Add query ids and update descriptions 2018-12-04 16:40:54 +00:00
semmle-qlci
d05b11f00d Merge pull request #587 from asger-semmle/incorrect-suffix-check
Approved by mc-semmle, xiemaisi
2018-12-04 16:18:42 +00:00
Taus
8493518135 Merge pull request #599 from markshannon/python-fix-essa-nonlocal
Python ESSA: Fix definition of ESSA non-local variables.
2018-12-04 17:06:30 +01:00
Taus
3b6c7d6f2e Merge pull request #582 from markshannon/python-faster-points-to-2
Python points-to: Improve performance of subclass test predicates on large DBs
2018-12-04 16:51:21 +01:00
Dave Bartolomeo
e11b4b6c40 C++: Fix IR Dataflow PR feedback 2018-12-04 07:31:13 -08:00
yh-semmle
0ba7633e4d Merge pull request #553 from aschackmull/java/double-checked-locking
Java: Add two double-checked-locking queries.
2018-12-04 10:23:46 -05:00
Taus
5c3ff8aadd Merge pull request #604 from markshannon/python-faster-essa-computation
Python : Speed up ESSA computation
2018-12-04 16:20:49 +01:00
Tom Hvitved
3bb3de23ce C#: Update change note 2018-12-04 16:08:41 +01:00
semmle-qlci
732874b236 Merge pull request #610 from Semmle/xiemaisi-patch-1
Approved by esben-semmle
2018-12-04 14:44:49 +00:00
Max Schaefer
2e45c50067 JavaScript: Correct change note for new query.
"Hard-coded data interpreted as code" is run, but not shown by default.
2018-12-04 14:40:03 +00:00
Geoffrey White
a7f45bb59d Merge pull request #608 from jbj/assignment-this-templates
C++: Fix "Overloaded assignment does not return 'this'" for templates
2018-12-04 14:12:56 +00:00
james
bdda3ae477 fix typo 2018-12-04 14:01:11 +00:00
Tom Hvitved
ad77afef04 C#: Autobuilder fixes
This commit fixes a few issues that were identified during the last dist upgrade,
and which were introduced/revealed on 836daaf07b.

- Expand environment variables that are passed from `lgtm.yml` to the autobuilder,
  for example `solution: $LGTM_SRC/mysolution.sln`.
- Distinguish between when a build rule is applied automatically and when it is applied
  manually via `lgtm.yml`.
- Catch `FileNotFoundException`s when parsing project files and solution files.
2018-12-04 14:03:39 +01:00
Aditya Sharad
3caf4e52a7 Merge rc/1.19 into next. 2018-12-04 12:39:41 +00:00
Jonas Jensen
6239455a91 C++: Remove extra type check in AV Rule 82
These type checks were overlapping with `assignOperatorWithWrongType` is
are no longer needed now that `assignOperatorWithWrongType` is improved.
They were causing FPs and misleading error messages on uninstantiated
templates.
2018-12-04 12:59:21 +01:00
james
26f030045a address anders' feedback 2018-12-04 11:07:17 +00:00
Asger F
7121a18eba JS: address comments 2018-12-04 10:40:43 +00:00
Jonas Jensen
8ac427c387 C++: Add missing getUnspecifiedType in AV Rule 82
Adding this call to `getUnspecifiedType` makes the error message better
in the presence of typedefs and qualifiers on an assignment operator
return type. It's also needed to avoid losing valid results in the
commit that comes after this.
2018-12-04 11:13:11 +01:00
Taus
a23f7a6b0e Merge pull request #592 from markshannon/python-windows-import-root
Python: Fix up computation of import root path
2018-12-04 11:11:59 +01:00
Jonas Jensen
a78ded7551 C++: Demonstrate FP in AV Rule 82
The added test is a reduced version of a FP observed in the wild.
2018-12-04 11:09:35 +01:00
Mark Shannon
8cd497890a Merge pull request #546 from adityasharad/python/vs-workspace-settings
Python: Add QL for VS workspace settings file.
2018-12-04 10:00:09 +00:00
Esben Sparre Andreasen
b418968efb JS: add change note for improved React model 2018-12-04 10:55:24 +01:00
Esben Sparre Andreasen
679db191f5 JS: move shared conjunct up 2018-12-04 10:55:24 +01:00
Esben Sparre Andreasen
a342fa36c6 JS: support React getSnapshotBeforeUpdate 2018-12-04 10:48:35 +01:00
Esben Sparre Andreasen
67b1487384 JS: support React shouldComponentUpdate 2018-12-04 10:48:35 +01:00
Esben Sparre Andreasen
417dac7ad6 JS: support React getDerivedStateFromProps 2018-12-04 10:48:35 +01:00
Esben Sparre Andreasen
9ff3d2ef1f JS: introduce ReactComponent::getStaticMethod 2018-12-04 10:48:35 +01:00
Esben Sparre Andreasen
0d62191d84 JS: add more React tests 2018-12-04 10:48:35 +01:00
Felicity Chapman
da1bf0601f Sort tables alphabetically 2018-12-04 09:28:42 +00:00
Anders Schack-Mulligen
e836fa7512 Java: Update metadata. 2018-12-04 10:12:56 +01:00
ian-semmle
47e15a6f75 Merge pull request #605 from nickrolfe/agg_init
C++: fix expected test output for improved extraction of aggregate initialisers
2018-12-03 23:30:00 +00:00
Mark Shannon
a5b79e92a5 Python: Fix off-by-one error in regex parsing. 2018-12-03 16:50:47 +00:00
semmle-qlci
3d058a2895 Merge pull request #603 from xiemaisi/js/fix-inconsistent-new
Approved by asger-semmle, esben-semmle
2018-12-03 16:48:55 +00:00
Nick Rolfe
a637eb651f C++: fix expected test output for improved extraction of agg. inits. 2018-12-03 16:45:53 +00:00
ian-semmle
a43125c3e0 Merge pull request #591 from nickrolfe/CPP-298
C++: we now process operands for vacuous destructor calls through pointers
2018-12-03 16:42:00 +00:00
Geoffrey White
436ee553a6 Merge pull request #589 from jbj/1.19-change-notes
C++: add missing 1.19 change notes
2018-12-03 15:56:18 +00:00
Mark Shannon
68440f7f77 Python ESSA: Speed up ESSA computation by refactoring ADT to match class hierarchy making it more transparent to the optimizer. 2018-12-03 15:08:56 +00:00
Jonas Jensen
b80cf30cee Merge pull request #562 from geoffw0/cpp-308
CPP: Fix FPs for 'Resource not released in destructor' involving virtual method calls
2018-12-03 15:57:11 +01:00
Tom Hvitved
4739a6334e C#: Fix a bug and generalize guards implication logic 2018-12-03 15:33:00 +01:00
semmle-qlci
b58c263fd0 Merge pull request #602 from esben-semmle/js/additional-route-handlers-from-context
Approved by xiemaisi
2018-12-03 14:31:10 +00:00
Taus
76b1bbc56a Merge pull request #565 from markshannon/python-analysis-queries-qhelp
Python: Delete some misleading qhelp and rename a couple of queries.
2018-12-03 14:42:03 +01:00
Geoffrey White
d8c7537557 CPP: * -> + 2018-12-03 13:11:52 +00:00
Geoffrey White
dfbccc4bcf CPP: Additional test cases. 2018-12-03 13:11:52 +00:00
calumgrant
43d14ce011 Merge pull request #586 from hvitved/csharp/cfg/field-split
C#: Handle multiple-field Boolean CFG splitting
2018-12-03 12:52:43 +00:00
Max Schaefer
8627ddbe4b JavaScript: Adjust alert message. 2018-12-03 12:38:00 +00:00
Nick Rolfe
fc91ff1a69 C++: we now process operands for vacuous destructor calls thru pointers 2018-12-03 12:16:35 +00:00
Jonas Jensen
8f60c09804 C++: Clarify cpp/virtual-destructor changelog 2018-12-03 13:04:24 +01:00
Mark Shannon
d32e6b8501 Python tests: Make sure stdlib can be found. 2018-12-03 11:55:57 +00:00
Asger F
1130d0c6f9 JS: add comment about arrays 2018-12-03 11:23:02 +00:00
Asger F
374f7ab65d JS: address comments 2018-12-03 11:23:02 +00:00
Asger F
c4d7672ea7 JS: fix typo in method name 2018-12-03 11:23:02 +00:00
Asger F
0462eb4b50 JS: add IncorrectSuffixCheck query 2018-12-03 11:23:02 +00:00
Mark Shannon
fb90d2a5a6 Python points-to: Update test results for fixed ESSA computation. 2018-12-03 11:13:18 +00:00
Mark Shannon
08b99944b1 Python ESSA: Fix definition of Essa non-local variables. 2018-12-03 11:12:35 +00:00
Geoffrey White
a3a5829fd0 Merge pull request #598 from jbj/AlwaysTrueUponEntryLoop-perf
C++: data flow AlwaysTrueUponEntryLoop perf fix
2018-12-03 10:59:50 +00:00
Esben Sparre Andreasen
2cc235d61b Merge pull request #556 from xiemaisi/js/invalid-entity-transcoding
JavaScript: Add new query `InvalidEntityTranscoding`.
2018-12-03 10:31:41 +01:00
Esben Sparre Andreasen
104eafec2f JS: cleanup for all HTTP::RouteHandlerCandidates 2018-12-03 10:13:08 +01:00
Max Schaefer
1a3e3baf80 JavaScript: Add change note. 2018-12-03 09:06:48 +00:00
Esben Sparre Andreasen
88c69e2c9c JS: change note for tracked Hapi route handlers 2018-12-03 09:24:55 +01:00
Esben Sparre Andreasen
a3bd072590 JS: add Hapi::RouteHandlerCandidate 2018-12-03 09:22:21 +01:00
Esben Sparre Andreasen
fd489271b7 JS: refactor Hapi::RouteSetup 2018-12-03 09:22:21 +01:00
Dave Bartolomeo
2822d14588 C++: Add missing changes to test_ir.expected 2018-12-02 22:22:34 -08:00
Mark Shannon
8e6c16d59f Python: Fix import root computation for windows and 3.7 2018-12-01 16:53:41 +00:00
Mark Shannon
f11b5ab42f Python ESSA: Fix performance of PythonSsaSourceVariable.hasRefinementEdge() 2018-12-01 16:36:49 +00:00
Jonas Jensen
d14cf34cc6 C++: data flow AlwaysTrueUponEntryLoop perf fix
The predicate `AlwaysTrueUponEntryLoop.getARelevantVariable` was very
sensitive to join ordering, and with the 1.19 QL engine it got an
unfortunate join order that made it explode on certain snapshots. With
this change, it goes from taking minutes to taking less than a second on
a libretro-uae snapshot.
2018-12-01 10:07:08 +01:00
Dave Bartolomeo
7eb47f3f82 C++: A few more IR dataflow tweaks
Made `Node::getType()`, `Node::asParameter()`, and `Node::asUninitialized()` operate directly on the IR. This actually fixed several diffs compared to the AST dataflow, because `getType()` wasn't holding for nodes that weren't `Exprs`.

Made `Uninitialized` a `VariableInstruction`. This makes it consistent with `InitializeParameter`.
2018-11-30 16:53:45 -08:00
Dave Bartolomeo
309b703e47 C++: Models for side-effect-free functions
This commit adds a new model interface that describes the known side effects (or lack thereof) of a library function. Does it read memory, does it write memory, and do any of its parameters escape? Initially, we have models for just two Standard Library functions: `std::move` and `std::forward`, which neither read nor write memory, and do not escape their parameter.

IR construction has been updated to insert the correct side effect instruction (or no side effect instruction) based on the model.
2018-11-30 12:15:23 -08:00
Dave Bartolomeo
af443569d9 C++: Fix handling of accesses to escaped variables in Aliased SSA
This fixes a subtle bug in the construction of aliased SSA. `getResultMemoryAccess` was failing to return a `MemoryAccess` for a store to a variable whose address escaped. This is because no `VirtualIRVariable` was being created for such variables. The code was assuming that any access to such a variable would be via `UnknownMemoryAccess`. The result is that accesses to such variables were not being modeled in SSA at all.

Instead, the way to handle this is to have a `VariableMemoryAccess` even when the variable being accessed has escaped, and to have `VariableMemoryAccess::getVirtualVariable()` return the `UnknownVirtualVariable` for escaped variables. In the future, this will also let us be less conservative about inserting `Chi` nodes, because we'll be able to determine that there's an exact overlap between two accesses to the same escaped variable in some cases.
2018-11-30 12:15:19 -08:00
Dave Bartolomeo
ae8f18c0b5 C++: Treat all Convert instructions as dataflow
The AST dataflow library essentially ignores conversions, which is probably the right behavior. Converting an `int` to a `long` preserves the value, even if the bit pattern might be different. It's arguable whether narrowing conversions should be treated as dataflow, but we'll do so for now. We can revisit that if we see it cause problems.
2018-11-30 12:15:15 -08:00
Dave Bartolomeo
58f7596519 C++: IR-based dataflow 2018-11-30 12:15:11 -08:00
Aditya Sharad
b638961a4f Merge pull request #596 from Semmle/dll-binary
.gitattributes: DLLs are binary
2018-11-30 18:06:13 +00:00
Nick Rolfe
b173752de9 .gitattributes: DLLs are binary 2018-11-30 18:05:02 +00:00
Max Schaefer
52b8a6bb56 Merge branch 'master' into js/invalid-entity-transcoding 2018-11-30 16:49:20 +00:00
Tom Hvitved
d25bd598db C#: Add change note 2018-11-30 17:44:48 +01:00
Tom Hvitved
3b0d1599ad C#: Teach guards library about unique assignments
For example, in

```
void M(object x)
{
    var y = x == null ? 1 : 2;
    if (y == 2)
        x.ToString();
}
```

the guard `y == 2` implies that the guard `x == null` must be false,
as the assignment of `2` to `y` is unique.
2018-11-30 17:43:10 +01:00
Tom Hvitved
ab9aa7d338 C#: Teach guards library about conditional assignments
For example, in

```
void M(object x)
{
    var y = x != null ? "" : null;
    if (y != null)
        x.ToString();
}
```

the guard `y != null` implies that the guard `x != null` must be true.
2018-11-30 17:41:36 +01:00
Tom Hvitved
80144a00c8 C#: Update nullness analyses
Port the SSA-based logic from the Java nullness analyses.
2018-11-30 17:41:31 +01:00
james
bebac21e19 add qhelp style-guide 2018-11-30 16:27:01 +00:00
Aditya Sharad
ec0663e587 Merge pull request #584 from jbj/mergeback-20181130
Mergeback master -> next
2018-11-30 16:15:21 +00:00
Max Schaefer
3351650895 JavaScript: Make InconsistentNew give fewer results. 2018-11-30 16:13:46 +00:00
Tom Hvitved
d2a431e6f3 C#: Add more nullness tests
Port many of the nullness test from Java, as well as add new tests.
2018-11-30 17:02:05 +01:00
Max Schaefer
b17518a5eb JavaScript: Refactor InconsistentNew to improve performance.
All the filtering is now done in `getALikelyCallee`, to which I have also added an additional parameter that improves the join in the `select` clause.

I've also simplified the alert message to no longer use `toString`, which isn't meant for alert messages anyway. (This is an old query.)
2018-11-30 15:40:45 +00:00
Kevin Backhouse
939db5a7cd Merge pull request #583 from jbj/bbStrictlyDominates-nomagic
C++: pragma[nomagic] on bbStrictlyDominates
2018-11-30 15:12:24 +00:00
calumgrant
1c2dd3e7b9 Merge pull request #570 from hvitved/csharp/ssa/split-to-string
C#: Include CFG splits in `Ssa::Definition::toString()`
2018-11-30 15:04:36 +00:00
Max Schaefer
dfcf767090 Merge pull request #440 from asger-semmle/range-analysis
JS: Range analysis for dead code detection
2018-11-30 15:01:34 +00:00
semmle-qlci
dbeb2dfa0e Merge pull request #585 from xiemaisi/js/join-order-fiddling
Approved by esben-semmle
2018-11-30 14:59:53 +00:00
calumgrant
08f5c2b6a6 Merge pull request #567 from hvitved/csharp/guards-splitting
C#: Account for split SSA definitions in guards library
2018-11-30 14:57:57 +00:00
Jonas Jensen
60076cb734 Merge pull request #532 from geoffw0/query-tags-3
CPP: Query Tags 3 (JPL_C queries)
2018-11-30 15:45:01 +01:00
Jonas Jensen
148c79a0e6 C++: Deprecate RecursionPrevention 2018-11-30 15:41:43 +01:00
Jonas Jensen
9532ee5177 C++: Add more detail to change notes for libraries 2018-11-30 14:29:08 +01:00
Jonas Jensen
b793807af5 C++: Complete change notes for Dave's PRs 2018-11-30 13:44:40 +01:00
Mark Shannon
d933152a54 Merge pull request #573 from felicity-semmle/1.19/python-change-notes
Python: finalize change notes for 1.19
2018-11-30 12:30:57 +00:00
Jonas Jensen
9daefa3613 C++: Complete change notes for my own PRs 2018-11-30 13:09:27 +01:00
semmle-qlci
608d84cfa3 Merge pull request #561 from asger-semmle/useless-conditional-change-note
Approved by esben-semmle
2018-11-30 11:37:51 +00:00
Jonas Jensen
4712a8f913 C++: pragma[nomagic] on bbStrictlyPostDominates
This predicate was recently added and is likely to get the same problems
as `bbStrictlyDominates` with magic.
2018-11-30 11:37:18 +01:00
Jonas Jensen
ace8fa88f2 C++: pragma[nomagic] on bbStrictlyDominates
I noticed that queries using the data flow library spent significant
time in `#Dominance::bbIDominates#fbPlus`, which is the body of the
`bbStrictlyDominates` predicate. That predicate took 28 seconds to
compute on Wireshark.

The `b` in the predicate name means that magic was applied, and the
application of magic meant that it could not be evaluated with the
built-in `fastTC` HOP but became an explicit recursion instead. Applying
`pragma[nomagic]` to this predicate means that we will always get it
evaluated with `fastTC`, and that takes less than a second in my test
case.
2018-11-30 11:36:11 +01:00
calumgrant
ca72c8ebfe Merge pull request #579 from hvitved/csharp/guards-loop
C#: Fix bug in guards library when the guarded expression is in a loop
2018-11-30 10:27:21 +00:00
Tom Hvitved
05b9519e9a C#: Handle multiple-field Boolean CFG splitting
The internal pre-SSA library was extended on 3e78c2671f
to include fields/properties that are local-scope-like. The CFG splitting logic
uses ranking of SSA definitions to define an (arbitrary) order of splits, but for
fields/properties the implicit entry definition all have the same line and column.
In effect, such SSA definitions incorrectly get the same rank. Adding the name
of the field/property to the lexicographic ordering resolves the issue.
2018-11-30 10:57:34 +01:00
Geoffrey White
453529e3bf Merge pull request #575 from jbj/UnsafeCreateProcessCall-nullValue
C++: Avoid using nullValue predicate (rc/1.19)
2018-11-30 09:54:17 +00:00
Max Schaefer
10166be535 JavaScript: Add new query DoubleEscaping. 2018-11-30 09:39:00 +00:00
Max Schaefer
3ed40d5da1 Merge branch 'master' into range-analysis 2018-11-30 09:36:40 +00:00
semmle-qlci
1c5322274a Merge pull request #557 from esben-semmle/js/unused-react-variable
Approved by xiemaisi
2018-11-30 09:35:36 +00:00
Max Schaefer
dcad2a3431 JavaScript: Simplify an if condition.
By pulling this out of the condition we can avoid computing its negation for the `else` branch, which could previously lead to quite an enormous pipeline.
2018-11-30 09:32:31 +00:00
Tom Hvitved
610be85c8c C#: Add CFG test for multiple-field Boolean splitting 2018-11-30 10:32:08 +01:00
Jonas Jensen
9babb4366b Merge remote-tracking branch 'upstream/master' into mergeback-20181130 2018-11-30 10:13:33 +01:00
semmle-qlci
adc15cad07 Merge pull request #574 from xiemaisi/js/avoid-materialisation
Approved by esben-semmle
2018-11-30 08:30:14 +00:00
Jonas Jensen
dd3791490a Merge pull request #580 from geoffw0/av-79-perf
CPP: Fix performance issue with AV Rule 79.ql.
2018-11-30 08:39:38 +01:00
Felicity Chapman
586eaef270 Update for feedback 2018-11-29 18:20:34 +00:00
Mark Shannon
9aa59fd419 Fix spelling. 2018-11-29 18:11:57 +00:00
Tom Hvitved
8bd8975795 Merge pull request #568 from calumgrant/cs/index-out-of-bounds
C#: Fix false-positives in cs/index-out-of-bounds
2018-11-29 18:40:05 +01:00
Jonas Jensen
b98452ddb1 Merge pull request #474 from rdmarsh2/rdmarsh/cpp/call-side-effect
C++: Initital aliased SSA with Chi nodes and function side effects
2018-11-29 18:31:29 +01:00
Geoffrey White
4744cece7b Merge pull request #576 from jbj/bbEntryReachesLocally-perf
C++: Fix performance of bbEntryReachesLocally (1.19)
2018-11-29 17:12:47 +00:00
Asger F
f85e30aa6c Merge pull request #571 from xiemaisi/js/numeric-constant-interpreted-as-code
JavaScript: Add new query `HardcodedDataInterpretedAsCode`.
2018-11-29 17:07:48 +00:00
Mark Shannon
931122971d Python points-to: Improve performance by factoring out handling of tuples in class tests. 2018-11-29 16:27:50 +00:00
Taus
1956cd802f Merge pull request #577 from markshannon/python-fix-performance-regression-dependencies
Python: Fix performance regression in dependency analysis
2018-11-29 16:41:58 +01:00
Geoffrey White
e09ce77678 CPP: Fix performance issue with AV Rule 79.ql. 2018-11-29 15:16:01 +00:00
Tom Hvitved
a12a72e90f C#: Fix bug in guards library when the guarded expression is in a loop
Follow-up on 03e69e9945.
2018-11-29 15:53:03 +01:00
Mark Shannon
11ca7b74a3 Merge pull request #572 from geoffw0/deprecate-cpython
CPP: Delete CPython queries
2018-11-29 14:50:06 +00:00
Jonas Jensen
90ad5cfac5 Merge pull request #569 from geoffw0/deprecate-pointsto-debug
CPP: Deprecate the PointsTo debug queries.
2018-11-29 15:28:07 +01:00
Mark Shannon
8414d46a87 Python: Fix accidentally introduced cartesian product. 2018-11-29 14:19:47 +00:00
Jonas Jensen
62d478eab3 C++: Fix performance of bbEntryReachesLocally
This predicate was fast with the queries and engine from 1.18. With the
queries from `master` it got a bad join order in the
`UninitializedLocal.ql` query, which made it take 2m34s on Wireshark.
This commit decomposes `bbEntryReachesLocally` into two predicates that
together take only 4s.
2018-11-29 15:11:32 +01:00
Jonas Jensen
8654ebcbbd C++: Avoid using nullValue predicate
The `nullValue` predicate performs a slow custom data-flow analysis to
find possible null values. It's so slow that it timed out after 1200s on
Wireshark.

In `UnsafeCreateProcessCall.ql`, the values found with `nullValue` were
used as sources in another data-flow analysis. By using the `NullValue`
class as sink instead of `nullValue`, we avoid the slow-down of doing
data flow twice. The `NullValue` class is essentially the base case of
`nullValue`. Confusing names, yes.
2018-11-29 13:33:45 +01:00
calum
6a1ab51d66 C#: Address review comments. 2018-11-29 11:39:10 +00:00
Asger F
d4023fe95a JS: address review 2018-11-29 11:37:38 +00:00
Asger F
b2a82ae598 JS: add 1.20 change note 2018-11-29 11:26:31 +00:00
Max Schaefer
73ce0f17d6 JavaScript: Americanise change note spelling. 2018-11-29 11:23:47 +00:00
Asger F
959776b775 JS: add test case 2018-11-29 11:22:15 +00:00
Asger F
d69e584cc2 JS: fix bug in foldedComparisonEdge 2018-11-29 11:22:15 +00:00
Asger F
8fd3a417c2 JS: address comments 2018-11-29 11:22:15 +00:00
Asger F
2c51f86f1b JS: avoid joining on =0 2018-11-29 11:22:14 +00:00
Asger F
6d7ac885ec JS: add to correctness-more suite 2018-11-29 11:22:14 +00:00
Asger F
477be260f3 JS: rename UselessRangeCheck -> UselessComparisonTest 2018-11-29 11:22:14 +00:00
Asger F
2e65f6b660 JS: address some style comments 2018-11-29 11:22:14 +00:00
Asger F
2870209299 JS: fix links in qhelp file 2018-11-29 11:22:14 +00:00
Asger F
76a69f4ff2 JS: address review comments 2018-11-29 11:22:14 +00:00
Asger F
f3020f776e JS: avoid extending self-edges 2018-11-29 11:22:14 +00:00
Asger F
4a367d3fdb JS: more efficient encoding of unary constraints 2018-11-29 11:22:14 +00:00
Asger F
5283c6cd48 JS: only warn about dead code 2018-11-29 11:22:14 +00:00
Asger F
2d6bf0aff3 JS: improve join ordering in extendedEdge 2018-11-29 11:22:14 +00:00
Asger F
84ea4cf1d1 JS: manually reorder extendedEdge and negativeEdge 2018-11-29 11:22:14 +00:00
Asger F
344bec3865 JS: Add UselessRangeCheck.ql 2018-11-29 11:22:14 +00:00
Asger F
d813635f3e JS: Restrict constraint generation to relevant nodes 2018-11-29 11:22:14 +00:00
Asger F
43df9538bf JS: be conservative in presence of NaN comments 2018-11-29 11:22:14 +00:00
Asger F
feb8a8c4fd JS: restrict bias to 30-bit range to avoid overflow 2018-11-29 11:22:14 +00:00
Asger F
20aa4e1f6d JS: handle sharp inequalities directly 2018-11-29 11:22:14 +00:00
Asger F
9d8d953292 JS: perform widening when adding operands of very different magnitude 2018-11-29 11:22:14 +00:00
Asger F
6c53ad80c7 JS: add constant constraints in range analysis 2018-11-29 11:22:13 +00:00
Asger F
064b1099eb JS: range analysis through phi nodes 2018-11-29 11:22:13 +00:00
Asger F
09ca6652fb JS: Support return value of x++ 2018-11-29 11:22:13 +00:00
Asger F
73cbdee691 JS: Compound assignments and update exprs in range analysis 2018-11-29 11:22:13 +00:00
Asger F
a374540c55 JS: Range analysis library 2018-11-29 11:22:13 +00:00
Max Schaefer
8637eaf100 JavaScript: Address review comments. 2018-11-29 10:48:44 +00:00
Felicity Chapman
f6fe8d5a28 Text updates for consistency and clarity 2018-11-29 10:20:13 +00:00
mc
83d4fb6711 Merge pull request #559 from xiemaisi/js/invalid-dynamic-method-call
JavaScript: Documentation review for new query `UnvalidatedDynamicMethodCall`.
2018-11-29 09:59:53 +00:00
Max Schaefer
5f16406ad7 JavaScript: Add new query HardcodedDataInterpretedAsCode. 2018-11-29 09:52:31 +00:00
Max Schaefer
94a5722c2a JavaScript: Model taint propagation through new Buffer and Buffer.from. 2018-11-29 09:52:31 +00:00
Max Schaefer
4091cf410d JavaScript: Improve detection of require calls. 2018-11-29 09:52:31 +00:00
Jonas Jensen
d991fa84b1 Merge pull request #552 from geoffw0/move-security-tests-add
CPP: Add the Semmle security tests.
2018-11-29 10:49:20 +01:00
Max Schaefer
506236994f JavaScript: Address doc review comments. 2018-11-29 09:49:13 +00:00
Geoffrey White
9d95291124 CPP: Delete the CPython queries and libraries. 2018-11-29 09:29:46 +00:00
Geoffrey White
909ff428ac CPP: Deprecate the CPython queries. 2018-11-29 09:28:29 +00:00
Tom Hvitved
ab7a094439 C#: Include CFG splits in Ssa::Definition::toString()
Just like syntax elements can be split in the control flow graph, so can SSA
definitions. To make this clear, and to make debugging easier, this commit
adds the splits as a prefix in the textual representation of SSA definitions.
2018-11-29 10:00:08 +01:00
semmle-qlci
d64067aaae Merge pull request #558 from xiemaisi/js/sanitise-access-paths
Approved by asger-semmle
2018-11-29 08:27:58 +00:00
Dave Bartolomeo
40864f9ebb C++: Fix GVN test expectation 2018-11-28 14:07:23 -08:00
semmle-qlci
d31c9950f9 Merge pull request #566 from ian-semmle/defuse_test
Approved by dave-bartolomeo
2018-11-28 20:48:14 +00:00
Geoffrey White
d261f1b6d2 CPP: Deprecate the PointsTo tests. 2018-11-28 20:23:33 +00:00
calum
f2d7b6ebe9 C#: Change notes. 2018-11-28 20:21:34 +00:00
Tom Hvitved
3eb163f656 C#: Account for split SSA definitions in guards library
On 03e69e9945, I updated the guards library to account
for control flow graph splitting. However, the logic that relates SSA qualifiers for
the guard and the guarded expression was not updated accordingly.
2018-11-28 20:00:13 +01:00
Tom Hvitved
1a25f0a068 C#: Add test for guard inside a split CFG block 2018-11-28 19:59:05 +01:00
Dave Bartolomeo
d7938362dd C++: Rename Chi IPA types to match classes 2018-11-28 10:33:04 -08:00
Geoffrey White
1232694340 CPP: Add external/jpl tags. 2018-11-28 18:18:28 +00:00
calum
6c6d7e4fff C#: Fix false-positives in cs/index-out-of-bounds. 2018-11-28 17:42:08 +00:00
Taus
595e6fcbf8 Merge pull request #550 from markshannon/python-weak-crypto
Python: Query for use of weak crypto keys.
2018-11-28 18:21:27 +01:00
Mark Shannon
a345727f71 Python fix up tags in qhelp. 2018-11-28 17:14:07 +00:00
Ian Lynagh
6cb6b1c07d C++: Tweak the defuse test
It looks like this is what it was originally intended to do.
2018-11-28 17:11:17 +00:00
Mark Shannon
b3eaa46f14 Python: Use consistent abbreviations in weak-crypto query message. 2018-11-28 16:58:22 +00:00
Mark Shannon
4f0a666a43 Python: Tweak name of new query and add change note. 2018-11-28 16:58:22 +00:00
Mark Shannon
3c4c8cf7d3 Python: Add qhelp for new query. 2018-11-28 16:57:34 +00:00
Mark Shannon
1065ad0ce7 Python: Weak crypto query. 2018-11-28 16:57:34 +00:00
Mark Shannon
2bf98b805d Python: Delete some misleading qhelp and rename a couple of queries. 2018-11-28 16:53:38 +00:00
Taus
c75fa28510 Merge pull request #538 from markshannon/python-jinja2-autoescape
Python: New query to check for use of jinja2 templates without auto-escaping
2018-11-28 17:32:17 +01:00
Mark Shannon
21246dcbf2 Python: clean up change notes and query help. 2018-11-28 15:02:47 +00:00
Geoffrey White
0eb0bf988e CPP: Fix for virtual method calls. 2018-11-28 14:19:24 +00:00
Asger F
8017df1750 JS: add change note for UselessConditional.ql 2018-11-28 14:14:58 +00:00
Esben Sparre Andreasen
f3889e715e JS: simplify isReactImportForJSX to isReactForJSX 2018-11-28 15:06:53 +01:00
Anders Schack-Mulligen
ae44b90456 Java: Normalize parentheses. 2018-11-28 15:01:25 +01:00
Max Schaefer
45574d4eaa JavaScript: Minor change to documentation to facilitate opening another PR. 2018-11-28 13:53:28 +00:00
semmle-qlci
57a976d668 Merge pull request #555 from xiemaisi/js/invalid-dynamic-method-call
Approved by esben-semmle
2018-11-28 13:52:51 +00:00
Anders Schack-Mulligen
e2dd0ea083 Java: Add 2 double-checked-locking queries. 2018-11-28 13:52:34 +01:00
Max Schaefer
fb78e14db1 JavaScript: Add support for sanitising dynamic property accesses.
This generalises our previous handling of sanitisers operating on property accesses to support dynamic property accesses where the property name is an SSA variable by representing them as access paths.
2018-11-28 12:37:53 +00:00
Esben Sparre Andreasen
72092529d1 JS: add change note for js/unused-local-variable 2018-11-28 13:25:26 +01:00
Esben Sparre Andreasen
f3c90114df JS: add empty 1.20 change note 2018-11-28 13:24:26 +01:00
Esben Sparre Andreasen
54e2215db4 JS: support require in isReactImportForJSX 2018-11-28 13:16:55 +01:00
Esben Sparre Andreasen
737a816e6f JS: refactor isReactImportForJSX 2018-11-28 13:16:55 +01:00
Max Schaefer
9c98aaf4bd JavaScript: Refactor a few predicates to avoid materialisations. 2018-11-28 10:51:29 +00:00
Mark Shannon
eefb45c94b Python: jinja2-without-escaping query: Clean up query and account for Template class in tests. 2018-11-28 10:46:44 +00:00
Mark Shannon
dff36e22ff Fix typo. 2018-11-28 10:46:44 +00:00
Mark Shannon
1080525d7d Python: Add missing test stub. 2018-11-28 10:45:48 +00:00
Mark Shannon
2518ac561e Python: Add change note for jinja2-autoescape query. 2018-11-28 10:45:48 +00:00
Mark Shannon
243280dc00 Python: New query to check for use of jinja2 templates without auto-escaping. 2018-11-28 10:45:19 +00:00
Max Schaefer
39f1c7904b JavaScript: Address review comments. 2018-11-28 09:44:58 +00:00
semmle-qlci
e66691a90c Merge pull request #551 from asger-semmle/js-extractor-shebang
Approved by xiemaisi
2018-11-28 08:49:44 +00:00
Max Schaefer
31d23b6295 JavaScript: Sort change notes alphabetically. 2018-11-28 08:16:31 +00:00
Max Schaefer
f9de1d44ca JavaScript: Add change notes. 2018-11-28 08:16:31 +00:00
Max Schaefer
f1c538a97b JavaScript: Restrict RemotePropertyInjection query to avoid double-reporting.
This query now only flags user-controlled property and header writes, method calls are handled by the new unsafe/unvalidated method call queries.
2018-11-28 08:16:31 +00:00
Max Schaefer
2889e07eb8 JavaScript: Add new query UnvalidatedDynamicMethodCall. 2018-11-28 08:16:31 +00:00
Dave Bartolomeo
5d997c7135 C++: Big QLDoc comment for ChiInstruction 2018-11-27 17:09:26 -08:00
Dave Bartolomeo
53cd5e9994 C++: Fix bug introduced by earlier commit 2018-11-27 14:57:58 -08:00
Dave Bartolomeo
7e6e6f00c1 C++: Fix IR for designated array initializers 2018-11-27 14:57:23 -08:00
Dave Bartolomeo
0a20f9ffbf C++: Print field names and element indices for aggregate literals in PrintAST 2018-11-27 13:26:18 -08:00
Dave Bartolomeo
90b79eb5f3 C++: Accept GVN test expectations with Chi nodes 2018-11-27 12:56:23 -08:00
Mark Shannon
31ac33e723 Merge pull request #528 from taus-semmle/python-flask-debug
Python: Implement check for flask debug mode.
2018-11-27 19:42:26 +00:00
Taus Brock-Nannestad
7f94c257a7 Change precision to high. 2018-11-27 19:02:44 +01:00
Taus
2b340b4804 Merge pull request #530 from markshannon/python-no-cert-validation
New query to check for making a request without cert verification.
2018-11-27 19:01:10 +01:00
Geoffrey White
7107cec503 CPP: Add test cases. 2018-11-27 17:20:14 +00:00
Mark Shannon
435b309852 Python: Add utility predicate for finding ModuleObject by name. 2018-11-27 17:06:40 +00:00
Taus Brock-Nannestad
6ebf504d97 Update test results after stub change. 2018-11-27 16:59:19 +01:00
Taus Brock-Nannestad
8d341ab467 Fix stub file. 2018-11-27 16:56:09 +01:00
Arthur Baars
044dcfbf66 Merge pull request #549 from adityasharad/merge/1.19-next-271118
Merge rc/1.19 into next.
2018-11-27 16:54:43 +01:00
Asger F
623a80fe90 TS: declassify files with unrecognized shebang line 2018-11-27 14:59:03 +00:00
Taus Brock-Nannestad
b393d9ad04 Add change note. 2018-11-27 15:21:02 +01:00
Taus Brock-Nannestad
a4da245809 Python: Implement check for flask debug mode. 2018-11-27 15:14:38 +01:00
Tom Hvitved
41edd61e2e Merge pull request #545 from calumgrant/cs/typemention-constraints
C#: Fix for type mentions of type parameter constraints
2018-11-27 14:25:48 +01:00
Aditya Sharad
5d5bfc215e Merge rc/1.19 into next. 2018-11-27 12:04:46 +00:00
Max Schaefer
cf1e7cff3f JavaScript: Move an auxiliary predicate into shared library. 2018-11-27 12:03:25 +00:00
Mark Shannon
698957e2cf Python: Correct case of query name and improve help. 2018-11-27 11:32:40 +00:00
Geoffrey White
a85dfb1c4e Merge pull request #548 from jbj/security-tags-1.19
C++: Update security tag in change note
2018-11-27 11:13:56 +00:00
Jonas Jensen
c8e34bff6c C++: Update security tag in change note
These two queries have the `security` tag in the `.ql` file, but it was
missing in the change note.
2018-11-27 11:03:42 +01:00
Jonas Jensen
c403bb1cad Merge pull request #541 from kevinbackhouse/CppPostDominators
Add post-dominators
2018-11-27 08:23:43 +01:00
Dave Bartolomeo
689002a22e C++: Fix handling of Chi instructions in sign analysis 2018-11-26 16:46:39 -08:00
Robert Marsh
f4ce7b9648 C++: respond to further PR review comments 2018-11-26 16:16:46 -08:00
Robert Marsh
7ef0d5e98d C++: respond to technical nits 2018-11-26 15:47:47 -08:00
Dave Bartolomeo
2b9afe95e8 C++: Accept test output after rebase 2018-11-26 12:08:19 -08:00
Robert Marsh
799eb06eea C++: add AliasedDefinition for aliased SSA 2018-11-26 12:08:19 -08:00
Robert Marsh
3ee033d96e C++: IR sanity fixes for Chi nodes 2018-11-26 12:08:19 -08:00
Robert Marsh
b401cd97f2 C++: use UnmodeledDefinition in UnmodeledUse 2018-11-26 12:08:19 -08:00
Robert Marsh
927f935e62 C++: hook ChiInstructions into the operand graph 2018-11-26 12:08:19 -08:00
Robert Marsh
a33b59103a C++: insert Chi nodes in the IR successor relation
This commit adds Chi nodes to the successor relation and accounts for
them in the CFG, but does not add them to the SSA data graph. Chi nodes
are inserted for partial writes to any VirtualVariable, regardless of
whether the partial write reaches any uses.
2018-11-26 12:08:18 -08:00
Dave Bartolomeo
1fb36ff7e7 C++: Add conservative side effects for function calls 2018-11-26 12:08:18 -08:00
Robert Marsh
f9ed39915f C++: recompute IRBlock membership at each stage
This enables the addition of new instructions in later phases of IR
construction; in particular, aliasing write instructions and inference
instructions.
2018-11-26 12:08:18 -08:00
calumgrant
d1f7eef7eb Merge pull request #537 from hvitved/csharp/guards-splitting
C#: Make guards library work with CFG splitting
2018-11-26 18:19:37 +00:00
Geoffrey White
f034abc275 CPP: Add the Semmle security tests. 2018-11-26 17:52:34 +00:00
Aditya Sharad
7aef8fa945 Merge pull request #547 from pavgust/fix/cwe-497-performance
C++: Refactor CWE-497 for clarity and performance
2018-11-26 17:13:27 +00:00
Mark Shannon
516b29d2c9 Merge pull request #544 from pavgust/fix/python-hotfixes
Pull recent Python fixes to RC branch
2018-11-26 16:18:13 +00:00
Max Schaefer
8e54c7ab6c Merge pull request #503 from asger-semmle/unsafe-global-object-access
JS: add method name injection query
2018-11-26 15:56:20 +00:00
Aditya Sharad
38095e2f96 Python: Add QL for VS workspace settings file. 2018-11-26 15:10:12 +00:00
Max Schaefer
588defd6b6 Merge pull request #519 from esben-semmle/js/nullish-coalescing-extractor-and-ql
JS: nullish coalescing support in extractor and QL
2018-11-26 15:03:23 +00:00
Kevin Backhouse
4877659578 Fix names. 2018-11-26 14:56:35 +00:00
Tom Hvitved
e069041bd5 Merge pull request #431 from calumgrant/cs/extractor/fsharp-core
C#: Fix extraction of method signatures
2018-11-26 15:07:33 +01:00
Jonas Jensen
fcd53ae631 Merge pull request #540 from geoffw0/cpp-296
CPP: Fix false positive from AutoGeneratedFile.qll.
2018-11-26 15:03:21 +01:00
Tom Hvitved
7dc0a8132e Merge pull request #513 from calumgrant/cs/cwe-134
C#: New query cs/uncontrolled-format-string
2018-11-26 14:58:54 +01:00
calum
de36151c4a C#: Add regression test and fix for type mentions of type parameter constraints. 2018-11-26 13:51:02 +00:00
semmle-qlci
03fd5498d9 Merge pull request #542 from xiemaisi/js/move-project-file-back-to-code
Approved by esben-semmle
2018-11-26 11:41:39 +00:00
Max Schaefer
a1772a9ae4 Merge pull request #543 from markshannon/python-backward-compat-default
Python: Add default.qll for backwards compatibility with older queries and libraries.
2018-11-26 11:27:17 +00:00
Mark Shannon
4d8f5e1020 Python: Add default.qll for backwards compatibility with older queries and libraries. 2018-11-26 11:25:28 +00:00
Esben Sparre Andreasen
2d7f09d321 JS(ql): support nullish coalescing operators 2018-11-26 10:31:19 +01:00
Esben Sparre Andreasen
a2a798e59c JS(extractor): support nullish coalescing operators 2018-11-26 09:45:19 +01:00
Max Schaefer
93f4ee8813 JavaScript: Remove Eclipse metadata files for extractor. 2018-11-26 08:24:33 +00:00
Arthur Baars
8d7ace25bf Merge pull request #535 from adityasharad/merge/master-next-231118
Merge master into next.
2018-11-25 20:19:23 +01:00
Kevin Backhouse
bc752e1a98 Add post-dominators. 2018-11-24 18:23:27 +00:00
Geoffrey White
f338a4f0d6 CPP: Fix false positive from AutoGeneratedFile.qll. 2018-11-23 17:34:18 +00:00
Taus
f0fbed76e7 Merge pull request #539 from markshannon/python-path-fix-siblings
Python: Fix parents relation for path queries.
2018-11-23 17:59:04 +01:00
Aditya Sharad
c20b688a3f Merge master into next. 2018-11-23 16:36:31 +00:00
Taus
3cee874ee3 Merge pull request #536 from markshannon/python-more-shell-injection
Python: Some additional sinks for command injection.
2018-11-23 17:12:20 +01:00
yh-semmle
17b063f0b2 Merge pull request #473 from sb-semmle/add-properties-files-to-java-schema
Add properties files to java schema
2018-11-23 11:09:00 -05:00
yh-semmle
f4ec168666 Merge pull request #533 from aschackmull/java/inherit-bugfix-changenote
Java: Add change note for #459.
2018-11-23 10:53:44 -05:00
Mark Shannon
3190b12544 Python: Fix parent relation for path-queries. 2018-11-23 15:04:01 +00:00
Mark Shannon
bfc001cc68 Python: Add change note for requests without cert verification query. 2018-11-23 14:48:19 +00:00
Mark Shannon
6588606739 Python: Account for other 'falsey' values in query. 2018-11-23 14:42:45 +00:00
Mark Shannon
06e5bc8359 Python: Add qhelp for new query. 2018-11-23 14:42:45 +00:00
Mark Shannon
45e864a395 Python: New query to test for requests without validation. 2018-11-23 14:42:45 +00:00
Mark Shannon
f0206a2ff4 Python: Tests for new query: requests called with verify=False. 2018-11-23 14:42:45 +00:00
Mark Shannon
7f5d46b32f Python: Add change note for new sinks. 2018-11-23 14:30:57 +00:00
Mark Shannon
b94493aec3 Python: Add extra sinks for command-injection query. 2018-11-23 14:29:02 +00:00
Taus
ceb316df60 Merge pull request #527 from markshannon/python-security-change-note
Collated python change notes
2018-11-23 15:28:18 +01:00
Pavel Avgustinov
d4b2c01634 Lift out intermediate helper predicate. 2018-11-23 14:22:44 +00:00
Tom Hvitved
03e69e9945 C#: Make guards library work with CFG splitting 2018-11-23 15:20:33 +01:00
Tom Hvitved
228189db5a C#: Add tests for guards inside split CFG blocks 2018-11-23 15:20:27 +01:00
Taus
61f5c2e834 Merge pull request #516 from markshannon/python-path-queries
Python path queries
2018-11-23 15:20:19 +01:00
Anders Schack-Mulligen
d24145831b Java: Add change note for #459. 2018-11-23 14:21:30 +01:00
Aditya Sharad
10dc183495 Merge pull request #512 from hvitved/csharp/autobuilder/dirs-proj
C#: Recognize `.proj` files in autobuilder
2018-11-23 13:18:04 +00:00
Mark Shannon
4f5cfbc336 Correct change for extractor logging levels. 2018-11-23 13:03:16 +00:00
Mark Shannon
95f1935eaa Python change notes: Merge in internal change notes. 2018-11-23 12:55:04 +00:00
semmle-qlci
04c2b23abd Merge pull request #520 from esben-semmle/js/clear-text-logging-taint-kinds
Approved by asger-semmle
2018-11-23 12:40:40 +00:00
Mark Shannon
61bd8682df Python: Improve API and representation of taint tracking nodes. Update queries and tests accordingly. 2018-11-23 12:32:14 +00:00
calum
b67bc7b612 C#: Fix id generation of constructed methods, by avoid id clashes by ensuring that method type parameters are qualified where necessary. Add a qltest. 2018-11-23 12:11:10 +00:00
calum
051dd191ac C#: Change notes. 2018-11-23 12:11:10 +00:00
calum
e00807d66b C#: Fix decoding method type parameters in FSharp.Core. 2018-11-23 12:09:52 +00:00
semmle-qlci
817456ee9f Merge pull request #529 from asger-semmle/js-line-map
Approved by xiemaisi
2018-11-23 12:00:17 +00:00
Anders Schack-Mulligen
a0d8888224 Merge pull request #531 from yh-semmle/java/deprecate-vcs
Java: deprecate queries that use `VCS.qll`
2018-11-23 11:59:17 +01:00
Geoffrey White
0855543ac4 CPP: Tag the JPL_C LOC-4 queries. 2018-11-23 10:31:37 +00:00
Geoffrey White
e6dddd90b7 CPP: Add a test of FunctionPointerConversions.ql. 2018-11-23 10:31:36 +00:00
Geoffrey White
0a27022dd4 Merge pull request #523 from jbj/placement-new-never-freed
C++: Detect non-allocating placement new in cpp/memory-never-freed
2018-11-23 09:40:11 +00:00
Tom Hvitved
1939773684 C#: Address review comments 2018-11-23 09:32:12 +01:00
Tom Hvitved
c3ccdfa7f9 C#: Guard against cyclic inclusions in project files 2018-11-23 09:32:12 +01:00
Tom Hvitved
e4f68ae324 C#: Address review comments 2018-11-23 09:32:12 +01:00
Tom Hvitved
836daaf07b C#: Recognize .proj files in autobuilder
When determining the target of `msbuild` or `dotnet build`, first look for `.proj`
files, then `.sln` files, and finally `.csproj`/`.vcxproj` files. In all three cases,
choose the project/solution file closest to the root.
2018-11-23 09:32:12 +01:00
Tom Hvitved
b95d7e5302 C#: Move autobuilder into separate folder 2018-11-23 09:32:12 +01:00
Jonas Jensen
4ad59235d8 Merge pull request #524 from geoffw0/cpp-299
CPP: Add (partial) dataflow to OverflowStatic.ql
2018-11-23 08:46:07 +01:00
Sebastian Bauersfeld
4eabca6dde Update java schema to accommodate for key-value configuration files. 2018-11-22 19:08:43 -05:00
yh-semmle
1b84fceb3c Java: deprecate queries that use VCS.qll 2018-11-22 16:21:44 -05:00
semmle-qlci
816a94eaa9 Merge pull request #525 from jbj/uninit-badast-mergefix
Approved by geoffw0, ian-semmle
2018-11-22 21:05:54 +00:00
Geoffrey White
5d8e34a55f CPP: Add a test of NonConstFunctionPointer.ql. 2018-11-22 17:48:40 +00:00
Geoffrey White
17560cf92e CPP: Tag the JPL_C LOC-3 queries. 2018-11-22 17:48:35 +00:00
Geoffrey White
9cc39ae875 CPP: Tag the JPL_C LOC-2 queries. 2018-11-22 16:31:08 +00:00
Geoffrey White
a47db56a68 CPP: Tag DuplicateBlock.ql. 2018-11-22 16:31:08 +00:00
Asger F
b5008d8685 TS: only transfer offsets as part of the AST 2018-11-22 16:20:47 +00:00
Geoffrey White
cb609f4be0 CPP: Be conservative where there are multiple flow sources. 2018-11-22 15:50:13 +00:00
Geoffrey White
d57574e92c CPP: localFlowStep* -> localFlow. 2018-11-22 15:50:13 +00:00
Geoffrey White
16be502d61 CPP: Add change note. 2018-11-22 15:50:13 +00:00
Geoffrey White
ea56a5d9ce CPP: Add local dataflow to (one bit of) OverflowStatic.ql. 2018-11-22 15:49:13 +00:00
Geoffrey White
01ba635e1d CPP: Add some test cases involving dataflow. 2018-11-22 15:49:13 +00:00
Geoffrey White
dc224c5c94 Merge pull request #521 from felicity-semmle/cpp/update-qhelp
C++: Update qhelp for consistency
2018-11-22 15:31:34 +00:00
Pavel Avgustinov
b9a3a71406 Merge pull request #518 from jbj/vcs-deprecate-queries
C++: Deprecate queries using VCS.qll
2018-11-22 15:07:19 +00:00
semmle-qlci
472c0429b5 Merge pull request #526 from esben-semmle/js/flow-parsing-improvements
Approved by xiemaisi
2018-11-22 15:02:21 +00:00
Esben Sparre Andreasen
8c7ca38b8d JS(extractor): improve parser support for flowtype syntax 2018-11-22 14:09:09 +01:00
Jonas Jensen
da26b4f856 C++: Accept test changes for IR
This test was failing due to a semantic merge conflict between #509,
which added `UninitializedInstruction`, and #517, which added new test
code that would get `UninitializedInstruction`s in it after merging with #509.
2018-11-22 13:52:33 +01:00
Esben Sparre Andreasen
b780f82869 JS: sharpen js/clear-text-logging (ODASA-7485) 2018-11-22 13:38:43 +01:00
calum
36d9520f87 C#: Address doc comments. 2018-11-22 11:52:00 +00:00
calum
6b2e339ec5 C#: Address QL review comments. 2018-11-22 11:45:41 +00:00
calum
64de7489fe C#: Analysis change notes. 2018-11-22 11:21:35 +00:00
calum
1bfa4d59e7 C#: Documentation for cs/uncontrolled-format-string 2018-11-22 11:21:35 +00:00
calum
fb09360ad6 C#: New query for cs/uncontrolled-string-format 2018-11-22 11:21:35 +00:00
Mark Shannon
c01db23f58 Python: Fix up expected results of SqlInjection.ql 2018-11-22 11:05:09 +00:00
Mark Shannon
bfb7e17ebf Python: Move library to correct location. 2018-11-22 11:05:09 +00:00
Mark Shannon
f3fedcdf38 Python tests: Move security test stubs to correct location. 2018-11-22 11:05:09 +00:00
Mark Shannon
04e5b8927a Python tests: use a more accurate form os os.path.join() in test lib. 2018-11-22 11:05:09 +00:00
Mark Shannon
88d82017b3 Python: Convert stack-trace-exposure query to path-problem. 2018-11-22 11:05:08 +00:00
Mark Shannon
2a24723cc3 Python: Update test results for path queries. 2018-11-22 11:05:08 +00:00
Mark Shannon
722d89fc75 Upgrade taint-tracking security queries to path-problem queries. 2018-11-22 11:05:01 +00:00
Tom Hvitved
201f64ef8e Merge pull request #367 from calumgrant/cs/path-problems
C#: Update all security queries to path-problems
2018-11-22 12:02:11 +01:00
Mark Shannon
2ac2233e69 Add change note for enhance visibility of security alerts and conversion to path-queries. 2018-11-22 11:01:35 +00:00
Jonas Jensen
75873bb4a6 C++: Detect non-allocating placement new
This adds a `NewOrNewArrayExpr.getPlacementPointer` predicate and uses
it in `Alloc.qll` to detect when a `new`-expression is not an
allocation.

User-defined replacements for `operator new` may not be allocations
either, but the code continues to assume that they are. It's possible
that we want to change this assumption in the future or leave it up to
individual queries to decide on which side to err. It's hard to
statically tell whether `operator new` has been overloaded in a
particular file because it can be overloaded by a definition that is not
in scope but is only linked together with that file.
2018-11-22 11:31:19 +01:00
Felicity Chapman
8cad0b6ef1 Update qhelp for consistency 2018-11-22 10:25:41 +00:00
Asger F
61ef6552c3 JS: handle both data() and taint() source labels 2018-11-22 09:59:31 +00:00
Jonas Jensen
a17debac3e C++: Placement-new tests for MemoryNeverFreed.ql 2018-11-22 10:48:18 +01:00
Jonas Jensen
e062851709 Merge pull request #517 from dave-bartolomeo/dave/IRFilter
C++: Don't generate IR for functions with bad ASTs
2018-11-22 10:02:18 +01:00
Max Schaefer
733acaccfa Merge pull request #506 from esben-semmle/js/optional-chaining-extractor-and-ql
JS: Optional chaining support in extractor and ql
2018-11-22 07:41:51 +00:00
Jonas Jensen
1739cab896 Merge pull request #504 from geoffw0/more-change-notes
CPP: Change notes
2018-11-22 08:30:20 +01:00
Jonas Jensen
220487bb32 C++: Deprecate queries using VCS.qll
One query imported VCS.qll for no reason, so I removed the import
instead of deprecating the query.
2018-11-22 08:21:49 +01:00
Jonas Jensen
70e9d11fd2 Merge pull request #509 from dave-bartolomeo/dave/ConditionDeclExpr
C++: IR support for ConditionDeclExpr
2018-11-22 08:03:14 +01:00
Dave Bartolomeo
beb9c9c054 C++: Sync identical files 2018-11-21 16:51:47 -08:00
Dave Bartolomeo
97fd7b46cc C++: Add tests for filtering bad ASTs 2018-11-21 16:39:08 -08:00
Dave Bartolomeo
7db36b2a22 C++: Skip IR translation for functions with invalid ASTs
An slightly invalid AST can cause IR construction to generate extremely bad IR. This change provides a single place to detect invalid ASTs, and to skip IR construction for the affected functions.
2018-11-21 16:01:19 -08:00
Dave Bartolomeo
03802ed409 C++: Allow filtering of IR creation to speed up dumps
This change provides a mechanism by which a query can tell the IR package to only create IR for certain functions. This is mostly useful for "PrintIR.qll", which uses this feature to avoid the expense of creating IR for functions that aren't going to be printed.
2018-11-21 16:01:12 -08:00
calum
3eae1cd500 C#: Update test outputs. 2018-11-21 17:28:48 +00:00
semmle-qlci
62db19bee7 Merge pull request #492 from geoffw0/offsetuse
Approved by dave-bartolomeo
2018-11-21 17:26:48 +00:00
semmle-qlci
4e72a08b8d Merge pull request #507 from esben-semmle/js/mixed-static-intance-this-access-inheritance
Approved by xiemaisi
2018-11-21 16:07:25 +00:00
semmle-qlci
f5d3274655 Merge pull request #508 from esben-semmle/js/indirect-global-call-with-default-arguments
Approved by xiemaisi
2018-11-21 16:06:46 +00:00
semmle-qlci
746b13a1bc Merge pull request #510 from xiemaisi/js/exclude-minified
Approved by asger-semmle
2018-11-21 16:06:22 +00:00
Jonas Jensen
a4bd586907 Merge pull request #456 from geoffw0/query-tags
CPP: Query tags 1
2018-11-21 16:13:23 +01:00
Geoffrey White
1b69006c20 CPP: Combine two of the Missing return statement change notes. 2018-11-21 15:09:09 +00:00
Taus
24bf2922e0 Merge pull request #515 from markshannon/python-add-metadata
Python tests: Add missing metadata files.
2018-11-21 15:45:32 +01:00
Taus
13d130dad0 Merge pull request #514 from markshannon/python-remove-architect-tests
Python tests: Remove some obsolete tests.
2018-11-21 15:45:21 +01:00
Geoffrey White
cab6f1e87c CPP: Backticks. 2018-11-21 14:39:22 +00:00
Mark Shannon
527c95cd0b Python tests: Add missing metadata files. 2018-11-21 14:39:18 +00:00
Asger F
27c9326e70 JS: address doc review 2018-11-21 14:19:14 +00:00
Mark Shannon
976fed76b9 Python tests: Remove some obsolete tests. 2018-11-21 14:18:46 +00:00
ian-semmle
366934f884 Merge pull request #350 from geoffw0/cpp-205-detail
CPP: Add detail to the CPP-205 test
2018-11-21 13:30:53 +00:00
Jonas Jensen
4e2d40aad8 Merge pull request #484 from geoffw0/limitedscopefile
CPP: Fix Limitedscopefile.ql
2018-11-21 14:30:48 +01:00
Esben Sparre Andreasen
72c4ef4d90 JS: fixup optional chaining on CallWithNonLocalAnalyzedReturnFlow 2018-11-21 14:18:14 +01:00
Geoffrey White
b4846dc995 CPP: Modify NVIHub.ql. 2018-11-21 13:11:08 +00:00
Asger F
8c7e19567b JS: fix string value of taint configuration 2018-11-21 12:35:35 +00:00
calum
69ab1ed5bd C#: Add nodes predicate to all path queries. 2018-11-21 12:35:05 +00:00
Asger F
4ae2493798 JS: rename query to Unsafe Dynamic Method Access 2018-11-21 12:34:18 +00:00
Max Schaefer
19aa12106c JavaScript: Teach AutoBuild to exclude minified files from extraction by default .
This adds default exclusion filters for `**/*.min.js` and `**/*-min.js` to the JavaScript auto-builder, meaning that files matching these patterns will no longer be extracted,
unless they are re-included in the `.lgtm.yml` file.

Alerts in minified code aren't shown by default anyway, so we can save ourselves some work by not analyzing them in the first place.

While including minified files in the snapshot can in theory improve analysis results in non-minified files, this is likely to be rare in practice.
2018-11-21 12:27:39 +00:00
calumgrant
1b12e845c5 Merge pull request #491 from hvitved/csharp/cfg/split-negation
C#: Fix two bugs in Boolean CFG splitting
2018-11-21 11:48:08 +00:00
calum
8c753d7e94 C#: Fix ReDoS query. 2018-11-21 11:15:55 +00:00
Asger F
cb832b1de9 Merge branch 'unsafe-global-object-access' of github.com:asger-semmle/ql into unsafe-global-object-access 2018-11-21 11:14:21 +00:00
Asger F
84d642612e JS: more comments 2018-11-21 11:14:13 +00:00
Max Schaefer
fa761c07bd Update javascript/ql/src/Security/CWE-094/MethodNameInjection.ql
Co-Authored-By: asger-semmle <42069257+asger-semmle@users.noreply.github.com>
2018-11-21 10:55:38 +00:00
Jonas Jensen
f177e348bd Merge pull request #471 from geoffw0/query-tags-2
CPP: Query tags 2 (JSF queries)
2018-11-21 11:43:29 +01:00
Pavel Avgustinov
5cd3a9c40d Merge pull request #500 from markshannon/python-python-security-queries-to-high
Python: Set precision of security queries to 'high'
2018-11-21 09:41:38 +00:00
Esben Sparre Andreasen
caea6212ed JS: use inheritance in js/mixed-static-instance-this-access 2018-11-21 09:48:37 +01:00
Esben Sparre Andreasen
01ad9ed8bc JS: address review comments 2018-11-21 09:19:20 +01:00
Dave Bartolomeo
3715215b3f C++: Add IR support for ConditionalDeclExpr
Also fixes several places in the library that weren't handling `ConditionalDeclExpr`  correctly.
2018-11-21 00:14:44 -08:00
Esben Sparre Andreasen
41b45352aa JS(ql): support optional chaining 2018-11-21 08:57:10 +01:00
Esben Sparre Andreasen
00587ba7b4 JS(extractor): support optional chaining 2018-11-21 08:57:10 +01:00
Dave Bartolomeo
07f9fe6ee4 C++: Add Uninitialized instruction for list-initialized variables
This commit inserts an `Uninitialized` instruction to "initialize" a local variable when that variable is initialized with an initializer list. This ensures that there is always a definition of the whole variable before any read or write to part of that variable.

This change appears in a different form in @rdmarsh2's Chi node PR, but I needed to refactor the initialization code anyway to handle ConditionDeclExpr.
2018-11-20 16:12:44 -08:00
Tom Hvitved
8233e34ba2 C#: Fix Boolean splitting for variables defined in a loop 2018-11-20 21:22:00 +01:00
Tom Hvitved
89d5daa137 C#: Fix Boolean splitting negation bug 2018-11-20 21:22:00 +01:00
Tom Hvitved
841218540e C#: Add CFG test
This test exhibits two issues with Boolean CFG splitting: incorrect handling of
negated variables and incorrect splitting for variables defined inside a loop.
2018-11-20 21:22:00 +01:00
calumgrant
87072dfb0e Merge pull request #489 from hvitved/csharp/pre-ssa-extensions
C#: Extensions to pre-SSA library
2018-11-20 20:20:41 +00:00
Asger F
7d80847832 JS: add qhelp example to test suite 2018-11-20 18:44:18 +00:00
Asger F
4138f814d8 JS: expand example 2018-11-20 18:42:49 +00:00
Asger F
260ae36cf8 JS: document the shared module 2018-11-20 18:27:02 +00:00
Asger F
3902f752d0 JS: share detection of objects with unsafe methods 2018-11-20 18:26:20 +00:00
Asger F
b16072a7be JS: share ConcatSanitizer in common module 2018-11-20 18:24:52 +00:00
Asger F
49cd2876c9 JS: use StringConcatenation library in ConcatSanitizer 2018-11-20 18:12:07 +00:00
Asger F
1c06f45046 JS: address some comments 2018-11-20 18:11:46 +00:00
semmle-qlci
b21b066255 Merge pull request #499 from xiemaisi/js/target-blank-location
Approved by esben-semmle
2018-11-20 17:16:05 +00:00
Geoffrey White
3c7ed9b7ab CPP: Fix typo. 2018-11-20 17:13:23 +00:00
Geoffrey White
8aeaf0bc8e CPP: Add an external/jsf tag as well. 2018-11-20 17:13:23 +00:00
Geoffrey White
bb7da78c95 CPP: Tag the JSF queries. 2018-11-20 17:13:22 +00:00
Geoffrey White
9922e36590 CPP: Add missing file. 2018-11-20 16:55:10 +00:00
Geoffrey White
ae91581204 CPP: Change note. 2018-11-20 16:52:36 +00:00
Geoffrey White
0493b68b50 Merge pull request #497 from jbj/disable-no-virtual-destructor
C++: Remove @precision from AV Rule 78
2018-11-20 16:44:36 +00:00
Geoffrey White
d8381ef448 CPP: Add change notes for some more changes. 2018-11-20 16:42:17 +00:00
Geoffrey White
7df7d8dd9e CPP: Add change notes for new query contributions. 2018-11-20 16:14:22 +00:00
Geoffrey White
e8f967a477 CPP: Add change notes for my recent changes. 2018-11-20 16:14:22 +00:00
Asger F
8aff66616b JS: suppress similar alerts from RemotePropertyInjection 2018-11-20 15:57:18 +00:00
Asger F
a2e5003c09 JS: add to security suite 2018-11-20 15:57:18 +00:00
Asger F
2239f863f7 JS: add query MethodNameInjection 2018-11-20 15:57:18 +00:00
Taus
7ba4d71ffb Merge pull request #494 from markshannon/python-tests
QL tests for Python queries and libraries.
2018-11-20 16:00:06 +01:00
Taus
6317546cdb Merge pull request #493 from markshannon/python-queries
Initial commit of Python queries and QL libraries.
2018-11-20 15:59:15 +01:00
Mark Shannon
a135e4665e Update lgtm.yml file to exclude Python source in query and test folders. 2018-11-20 14:57:36 +00:00
Asger F
bc3b983768 JS: move CodeInjection tests into subfolder 2018-11-20 14:24:37 +00:00
Tom Hvitved
3e78c2671f C#: Generalize pre-SSA library to include local-scope-like fields/properties 2018-11-20 15:07:44 +01:00
Tom Hvitved
25150265dc C#: Compute phi inputs in pre-SSA library
Logic is copied directly from the ordinary SSA library.
2018-11-20 15:07:43 +01:00
Jonas Jensen
33111b6b27 Merge pull request #498 from geoffw0/test-cleanup
CPP: Clean up some test code.
2018-11-20 14:44:52 +01:00
Tom Hvitved
252b756184 Merge pull request #472 from felicity-semmle/csharp/SD-2778-qhelp-update
C#: Minor updates for consistency (SD-2778)
2018-11-20 14:28:29 +01:00
semmle-qlci
4b5f24d99e Merge pull request #449 from hvitved/csharp/ssa/live-at-rank
Approved by calumgrant
2018-11-20 13:01:02 +00:00
semmle-qlci
1c1d2e943a Merge pull request #496 from esben-semmle/js/yui-directives
Approved by xiemaisi
2018-11-20 12:59:55 +00:00
semmle-qlci
8333f72030 Merge pull request #470 from esben-semmle/custom-abstract-values-only
Approved by xiemaisi
2018-11-20 12:59:35 +00:00
Max Schaefer
c1690a69e5 JavaScript: Make TargetBlank only highlight the first line of the link.
Otherwise alerts for multi-line `<a>` elements end up looking very red.

I also took the opportunity to improve the tests slightly.
2018-11-20 12:53:27 +00:00
Esben Sparre Andreasen
82fc8ae32a JS: support indirection with extra args in js/missing-this-qualifier 2018-11-20 11:29:03 +01:00
Geoffrey White
342164ff71 CPP: Clean up / normalize some test code. 2018-11-20 09:50:59 +00:00
Jonas Jensen
6c0305cb80 Merge pull request #495 from geoffw0/returnvalue
CPP: Fix 'Missing return statement'
2018-11-20 10:16:30 +01:00
Jonas Jensen
d7c2f9d185 C++: Remove @precision from AV Rule 78
This rule, named "No virtual destructor", was supposed to be superseded
by `cpp/virtual-destructor` in 0c796de83, but that commit didn't
actually disable this rule, so both rules are now active in the LGTM
suite.

This commit disables the rule by removing `@precision`. We're still
discussing the best way to disable rules that are precise and valid but
not universally applicable. For now, removing `@precision` is consistent
with how we're keeping most other JSF queries from appearing on LGTM.
2018-11-20 09:43:54 +01:00
Jonas Jensen
cc28d04ba7 Merge pull request #405 from geoffw0/selfcompare
CPP: Fix false positives in PointlessSelfComparison.ql
2018-11-20 09:25:10 +01:00
Tom Hvitved
9f7eef02ec C#: Address review comments 2018-11-20 09:24:53 +01:00
Esben Sparre Andreasen
54fea1a4cb JS: support "xyz:nomunge" YUI compressor directives 2018-11-20 09:00:33 +01:00
Esben Sparre Andreasen
ee7a6af7c7 JS: address review comments 2018-11-20 08:37:23 +01:00
Felicity Chapman
fc6e9be75a Fix incorrect tag 2018-11-20 07:12:48 +00:00
semmle-qlci
26a248b14a Merge pull request #487 from xiemaisi/js/lint-join-order
Approved by esben-semmle
2018-11-20 06:51:33 +00:00
semmle-qlci
7df397f8ab Merge pull request #486 from xiemaisi/js/lower-severities
Approved by asger-semmle
2018-11-20 06:39:23 +00:00
Mark Shannon
e930b43bf3 Python security queries. Choose a precision reflecting actual precision for Security queries. 2018-11-19 17:10:40 +00:00
Mark Shannon
c2e0ee1c47 Add .qlpath and .project files for Python queries. 2018-11-19 16:28:53 +00:00
semmle-qlci
f5e25e61e0 Merge pull request #490 from xiemaisi/js/remove-actual
Approved by asger-semmle
2018-11-19 16:20:19 +00:00
Geoffrey White
5cae65295d CPP: Fix FPs from AV Rule 114.ql. 2018-11-19 16:09:40 +00:00
Geoffrey White
d18a7012f5 CPP: Add a test case. 2018-11-19 16:08:32 +00:00
Mark Shannon
05b69a1c0f QL tests for Python queries and libraries. 2018-11-19 15:15:54 +00:00
Aditya Sharad
165bb8b6b8 Merge pull request #488 from pavgust/bump/master-next
Mergeback master to next
2018-11-19 15:12:37 +00:00
Mark Shannon
5f58824d1b Initial commit of Python queries and QL libraries. 2018-11-19 15:10:42 +00:00
Geoffrey White
33130b9800 CPP: Apply recommended fix. 2018-11-19 14:39:28 +00:00
Geoffrey White
6a14748af8 CPP: Add recommended test. 2018-11-19 14:25:11 +00:00
Geoffrey White
646bb01a5f CPP: Change note. 2018-11-19 14:04:14 +00:00
Jonas Jensen
111df470c3 Merge pull request #485 from geoffw0/limitedscopefunction
CPP: Fix Limitedscopefunction.ql
2018-11-19 14:51:20 +01:00
Jonas Jensen
6d17642240 Merge pull request #476 from geoffw0/av_165
CPP: Fix AV Rule 165
2018-11-19 14:32:02 +01:00
Jonas Jensen
2ce2c0a876 Merge pull request #475 from geoffw0/av_164
CPP: Fix AV Rule 164
2018-11-19 14:23:36 +01:00
Max Schaefer
6021d2499d JavaScript: Remove accidentally committed .actual file. 2018-11-19 12:24:19 +00:00
Geoffrey White
cf27978325 CPP: Give OffsetUseBeforeRangeCheck.ql a precision. 2018-11-19 11:56:07 +00:00
Geoffrey White
e72505707b CPP: Check for a range check before the use. 2018-11-19 11:49:22 +00:00
Geoffrey White
6cdfaeea3c CPP: getAChild() -> getAChild*(). 2018-11-19 11:47:14 +00:00
Geoffrey White
01611d4d96 CPP: Add a test for OffsetUseBeforeRangeCheck.ql. 2018-11-19 11:47:14 +00:00
Pavel Avgustinov
16ec9f1aa4 Merge remote-tracking branch 'origin/next' into bump/master-next 2018-11-19 10:37:07 +00:00
Geoffrey White
90c75cd362 Merge pull request #478 from felicity-semmle/cpp/SD-2777-jsf-note
C++: Add JSF note to qhelp for sub-set of JSF queries
2018-11-19 09:30:39 +00:00
Max Schaefer
73ad3f5c8a JavaScript: Tweak JSLint library to avoid bad join order. 2018-11-19 09:12:02 +00:00
Tom Hvitved
dd4c9654f2 Merge pull request #483 from calumgrant/cs/vulnerable-package
C#: Remove duplicate results from cs/use-of-vulnerable-package
2018-11-19 10:09:37 +01:00
Max Schaefer
1b59a28be0 JavaScript: Downgrade a few "error" rules to "warning".
For all of these queries, the results we tend to see in practice are certainly worth investigating, but aren't crashing bugs, so making them warnings seems more appropriate.
2018-11-19 09:09:26 +00:00
Max Schaefer
db175f5584 JavaScript: Sort change notes alphabetically. 2018-11-19 09:00:38 +00:00
semmle-qlci
9e4aeb36a6 Merge pull request #436 from asger-semmle/url-concat
Approved by xiemaisi
2018-11-19 08:57:24 +00:00
semmle-qlci
328c86c552 Merge pull request #479 from asger-semmle/typescript-extractor-perf1
Approved by xiemaisi
2018-11-19 08:53:41 +00:00
semmle-qlci
128118cfa7 Merge pull request #481 from asger-semmle/typescript-jsx
Approved by xiemaisi
2018-11-19 08:53:15 +00:00
yh-semmle
47b9218b05 Merge pull request #480 from aschackmull/java/path-problem-conversion
Java: Convert security queries to path-problem.
2018-11-18 20:55:52 -05:00
Felicity Chapman
d4bcc1e9d4 Add note to further file 2018-11-17 13:03:48 +00:00
Felicity Chapman
5c924307ca Remove incorrect comment from query 2018-11-17 13:03:46 +00:00
Felicity Chapman
9ce1a2a040 Add JSF note to qhelp for sub-set of JSF queries 2018-11-17 13:03:45 +00:00
Geoffrey White
a51b9847b2 CPP: Modify similar query as well. 2018-11-16 22:49:35 +00:00
Geoffrey White
9f688eb7e2 CPP: Exclude variables that have non-function accesses. 2018-11-16 22:48:30 +00:00
Geoffrey White
2d07410f97 CPP: Exclude variables that are part of an interface. 2018-11-16 22:46:11 +00:00
Geoffrey White
b70c572e34 CPP: Add a test for LimitedScopeFunction. 2018-11-16 22:44:41 +00:00
Geoffrey White
1cba1d0b1a CPP: Modify similar query as well. 2018-11-16 22:38:20 +00:00
Geoffrey White
e253ab54d7 CPP: Exclude variables that are part of an interface. 2018-11-16 22:38:16 +00:00
Geoffrey White
0e5d23e78b CPP: Add a test of LimitedScopeFile. 2018-11-16 22:37:30 +00:00
calum
1aa5e24108 C#: Remove duplicate results from cs/use-of-vulnerable-package 2018-11-16 16:50:35 +00:00
Asger F
84c1ba0b31 TS: fix the fix 2018-11-16 14:39:43 +00:00
Asger F
a35061ee79 TS: dont create JSON nodes in convertJsxSelfClosingElement 2018-11-16 12:58:14 +00:00
Asger F
d839fcdafc TS: refactor to fix AutoBuildTest 2018-11-16 12:52:26 +00:00
Anders Schack-Mulligen
918fc90515 Java: Add change note. 2018-11-16 13:48:50 +01:00
Anders Schack-Mulligen
deb61d6f29 Java: Update test output. 2018-11-16 13:48:50 +01:00
Anders Schack-Mulligen
5e03b6f681 Java: Convert security queries to path-problems. 2018-11-16 13:48:50 +01:00
Anders Schack-Mulligen
437b2c1503 Java: Cosmetic changes and missing overrides. 2018-11-16 13:48:50 +01:00
calum
cf4b04a3ee C#: Address review comments - adding .getNode() where appropriate. 2018-11-16 11:52:20 +00:00
Asger F
c06c9a02f7 JS: fix copy pasta and test output 2018-11-16 10:47:02 +00:00
Asger F
dd5f485fff JS: use original sanitizer for SSRF query 2018-11-16 10:46:14 +00:00
Asger F
0153a4794e JS: add change note 2018-11-16 10:44:52 +00:00
Asger F
6ec13feab4 JS: recognize sanitizing slashes in URL redirection queries 2018-11-16 10:43:25 +00:00
Asger F
b5d3dd5e22 TS: do more work in parallel 2018-11-16 10:39:27 +00:00
calum
e908b090fd C#: Always use PathNode in a path-problem query. 2018-11-16 10:32:24 +00:00
calum
eddc52852d C#: Convert security queries to path-problem and update qltest expected output. 2018-11-16 10:31:20 +00:00
semmle-qlci
0647743333 Merge pull request #467 from xiemaisi/js/amd-imports
Approved by asger-semmle
2018-11-16 09:31:50 +00:00
Tom Hvitved
57bbe0291b Merge pull request #393 from calumgrant/cs/extractor/dynamic-type-name
C#: Minor extractor fixes
2018-11-16 09:09:46 +01:00
calum
9eed758642 C#: Update change notes. 2018-11-15 18:28:17 +00:00
calum
090e896ff5 C#: Change Property TagStackBehaviour to push a tag, to give the expression body a tag stack. 2018-11-15 18:28:17 +00:00
calum
bb49fe170b C# extractor: Handle the type name of dynamic. 2018-11-15 18:27:53 +00:00
semmle-qlci
536f3f36b8 Merge pull request #428 from hvitved/csharp/more-guards
Approved by calumgrant
2018-11-15 15:07:56 +00:00
Asger F
737ec70ca2 Merge pull request #460 from xiemaisi/js/in-dist-trap-cache
JavaScript: Teach `AutoBuild` to use in-dist externs trap cache.
2018-11-15 13:08:44 +00:00
Geoffrey White
0d7c5eaa6e Merge pull request #441 from felicity-semmle/cpp/SD-2777-cwe-qhelp
C++: Bring qhelp inline with current guidelines, part 1 (SD-2777)
2018-11-15 11:38:23 +00:00
Tom Hvitved
5f118d423f Merge pull request #477 from calumgrant/cs/indent-change-notes
C#: Fix indentation in change notes.
2018-11-15 11:56:01 +01:00
calum
03b8ed6597 C#: Fix indentation in change notes. 2018-11-15 10:49:16 +00:00
Tom Hvitved
185700a236 Merge pull request #437 from calumgrant/cs/in-parameters
C#: Correctly handle `in` arguments
2018-11-15 11:47:43 +01:00
Asger F
fb1908465c Merge pull request #469 from xiemaisi/js/bye-bye-rhino
JavaScript: Remove dependency on esregex, doctrine and Rhino.
2018-11-15 09:52:58 +00:00
Felicity Chapman
1776ebd991 Fix typo in code tag 2018-11-15 08:14:08 +00:00
Felicity Chapman
fbf5a052ed Remove stray </p> tag 2018-11-15 07:09:11 +00:00
Felicity Chapman
6312f31f59 Remove the duplicate overview tag 2018-11-14 22:08:59 +00:00
Geoffrey White
d1adc0e3ec CPP: Fix for explicitly cast expressions. 2018-11-14 19:43:24 +00:00
Geoffrey White
3028e85457 CPP: Add a test of AV Rule 164. 2018-11-14 19:40:29 +00:00
Geoffrey White
3f428a8876 CPP: Fix for explicitly cast expressions. 2018-11-14 19:11:56 +00:00
Geoffrey White
5cddabb1fd CPP: Add a test of AV Rule 165. 2018-11-14 19:05:35 +00:00
Geoffrey White
01de4160c6 Merge pull request #453 from felicity-semmle/cpp/SD-2777-cwe-qhelp-2
C++: Update to bring into line with current guidelines, part 2 (SD-2777)
2018-11-14 17:27:25 +00:00
Felicity Chapman
39ef869e21 Fix partial edit - thanks Tom 2018-11-14 16:49:30 +00:00
Asger F
df202eff76 Merge pull request #468 from xiemaisi/js/has{Path,Flow}+
JavaScript: Rename `hasPathFlow` to `hasFlowPath` for consistency with other languages.
2018-11-14 16:48:47 +00:00
Felicity Chapman
f9612a8f21 Minor updates for consistency 2018-11-14 16:25:28 +00:00
semmle-qlci
4a14bef507 Merge pull request #466 from xiemaisi/js/more-data-flow-predicates
Approved by asger-semmle
2018-11-14 16:07:59 +00:00
yh-semmle
50a905d54a Merge pull request #459 from aschackmull/java/inherit-fix
Java: Fix inheritance relation for co-/contra-variant subtypes.
2018-11-14 10:53:41 -05:00
Geoffrey White
77ca0cf9cb Merge pull request #438 from felicity-semmle/cpp/SD-2777-delete-poor-qhelp
C++: Delete qhelp files with little useful content (SD-2777)
2018-11-14 14:21:24 +00:00
Max Schaefer
406511fb5f JavaScript: Update .classpath. 2018-11-14 14:06:33 +00:00
Max Schaefer
585347fb5d JavaScript: Remove obsolete Rhino interface classes. 2018-11-14 14:06:33 +00:00
Max Schaefer
2cd5702aa6 JavaScript: Remove doctrine. 2018-11-14 14:06:33 +00:00
Max Schaefer
5506cec35e JavaScript: Remove esregex. 2018-11-14 14:06:33 +00:00
semmle-qlci
025054e44a Merge pull request #461 from xiemaisi/js/bye-bye-rhino
Approved by esben-semmle
2018-11-14 14:00:07 +00:00
semmle-qlci
77213aa0d8 Merge pull request #462 from xiemaisi/js/security-paths
Approved by esben-semmle
2018-11-14 13:01:34 +00:00
Max Schaefer
19b9b85c22 JavaScript: Add change note. 2018-11-14 12:03:04 +00:00
Aditya Sharad
a066749d90 Merge pull request #464 from esben-semmle/js/fixup-suite-master
JS: rename query file in suite
2018-11-14 12:02:05 +00:00
Aditya Sharad
696178e6cc Merge pull request #465 from esben-semmle/js/fixup-suite-master
JS: rename query file in suite
2018-11-14 12:01:37 +00:00
Max Schaefer
6f6b3b0d5e JavaScript: Add a convenience method to SourceNode and use it in a few places. 2018-11-14 11:58:45 +00:00
Esben Sparre Andreasen
7585e61af6 JS: rename query file in suite 2018-11-14 12:55:53 +01:00
Max Schaefer
a441bfb751 JavaScript: Add a convenience method to AMDModuleDefinition. 2018-11-14 11:36:40 +00:00
Max Schaefer
3fcd02ab0e JavaScript: Rename hasPathFlow to hasFlowPath for consistency with other languages. 2018-11-14 11:23:17 +00:00
Arthur Baars
8493adf676 Merge pull request #463 from adityasharad/merge/master-next-141118
Merge master into next.
2018-11-14 11:36:01 +01:00
Aditya Sharad
f0715b09e1 Merge master into next. 2018-11-14 10:06:27 +00:00
Max Schaefer
4112af5b3f JavaScript: Add change note. 2018-11-14 09:35:17 +00:00
Max Schaefer
d6198fcc2a JavaScript: Introduce two more short-circuiting conjuncts. 2018-11-14 09:33:09 +00:00
Max Schaefer
9221b62ded JavaScript: Update expectd test output for security path queries to include nodes and edges query predicates. 2018-11-14 09:32:31 +00:00
Max Schaefer
d57b5d9628 JavaScript: Remove ReflectdXssPath.ql, which is now spurious. 2018-11-14 09:16:40 +00:00
Max Schaefer
52ae757279 JavaScript: Select Nodes (instead of PathNodes) everywhere. 2018-11-14 09:16:40 +00:00
Max Schaefer
e365b722ee JavaScript: Select source and sink in all path queries. 2018-11-14 09:16:40 +00:00
Max Schaefer
d5af008e31 JavaScript: Adjust ConditionalBypass query. 2018-11-14 09:16:40 +00:00
Max Schaefer
11d6259dbf JavaScript: Move from Node to PathNode. 2018-11-14 09:16:40 +00:00
Max Schaefer
8d87f556e1 JavaScript: Add import DataFlow::PathGraph. 2018-11-14 09:16:40 +00:00
Max Schaefer
4860364d91 JavaScript: Add explicit nodes query predicate in PathGraph.
This is needed to correctly handle the case where `edges` is empty.
2018-11-14 09:16:40 +00:00
Max Schaefer
60a1357092 JavaScript: Make all taint-based security queries have @kind path-problem. 2018-11-14 09:16:40 +00:00
Max Schaefer
65bcf0f526 JavaScript: Refactor security queries for uniformity. 2018-11-14 09:16:40 +00:00
Max Schaefer
9b4ae9e4d3 JavaScript: Refactor HostHeaderPoisoningInEmailGeneration query. 2018-11-14 09:16:40 +00:00
Max Schaefer
c51cd50133 JavaScript: Remove a few unnecessary imports. 2018-11-14 09:16:40 +00:00
semmle-qlci
d83381918d Merge pull request #458 from xiemaisi/js/more-externs
Approved by asger-semmle
2018-11-14 08:31:15 +00:00
Arthur Baars
969c2796a0 Merge pull request #457 from adityasharad/merge/1.18-master-131118
Merge rc/1.18 into master.
2018-11-13 22:25:03 +01:00
yh-semmle
758e74a8f9 Merge pull request #455 from felicity-semmle/java/SD-2779-qhelp-updates
Java: Update qhelp for queries with CWE tags (SD-2779)
2018-11-13 14:49:32 -05:00
Max Schaefer
a499009f59 Merge pull request #395 from esben-semmle/js/useless-defensive-code
JS: add query: js/useless-defensive-code
2018-11-13 16:55:59 +00:00
Max Schaefer
4fdfbb77cc Merge pull request #444 from esben-semmle/js/browser-based-client-requests
JS: add models of $.ajax, $.getJSON and XMLHttpRequst
2018-11-13 16:53:52 +00:00
Felicity Chapman
c6af79979c Update for feedback 2018-11-13 16:50:00 +00:00
Felicity Chapman
fe15159756 Update for feedback 2018-11-13 16:34:06 +00:00
Anders Schack-Mulligen
fe8dfeec0d Java: Add some this-qualifiers. 2018-11-13 14:58:25 +01:00
Anders Schack-Mulligen
411891c303 Java: Don't inherit methods from co-/contra-variant supertypes. 2018-11-13 14:56:22 +01:00
Max Schaefer
96989a1fd6 Merge pull request #427 from adityasharad/eclipse/remove-plugin-metadata
Eclipse plugins: Remove plugin metadata.
2018-11-13 13:12:49 +00:00
calum
9f04ace4ae C#: Update change notes. 2018-11-13 10:59:41 +00:00
calum
a5d50fc1db C#: Handle in arguments, and add AssignableAccess::isInArgument() predicate. 2018-11-13 10:58:43 +00:00
Aditya Sharad
bc06831d01 Merge rc/1.18 into master. 2018-11-13 10:55:08 +00:00
Esben Sparre Andreasen
daed0653cb JS: support property tracking of custom abstract values 2018-11-13 11:42:09 +01:00
Esben Sparre Andreasen
1d87c580b3 JS: introduce DefinedCustomAbstractValue 2018-11-13 11:40:31 +01:00
Jonas Jensen
cd874f7982 Merge pull request #454 from geoffw0/move-tests
CPP: Move the tests from library-tests/queries
2018-11-13 10:19:56 +01:00
semmle-qlci
86e31a584e Merge pull request #447 from esben-semmle/js/indirect-sanitization
Approved by asger-semmle
2018-11-13 09:14:28 +00:00
Tom Hvitved
17414f0395 Merge pull request #451 from jbj/mergeback-20181112
Mergeback master -> next
2018-11-13 09:52:33 +01:00
Max Schaefer
851e71c7d0 JavaScript: Warn about externs trap cache absence/miss. 2018-11-13 08:41:53 +00:00
Max Schaefer
d9d4051184 JavaScript: Extract auxiliary method. 2018-11-13 08:41:38 +00:00
Max Schaefer
79a6cfdf38 JavaScript: Add generic externs for BDD/TDD-style testing frameworks. 2018-11-13 08:30:35 +00:00
Esben Sparre Andreasen
5666deac14 JS: rename js/useless-defensive-code to js/unneeded-defensive-code 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
1db2e6ca55 JS: add source code examples to docstrings 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
3aae1d17db JS: avoid two uses of getChildExpr(0) 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
15123da0b7 JS: minor fixup: only traverse LogNotExprs 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
8ea9fd4cca JS: address review comments 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
8b71b25a2a JS: annotate test file with expected results 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
a636319c97 JS: change notes for js/useless-defensive-code 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
7d4cf49545 JS: fixup double reporting of alerts 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
f440c9221a JS: replace some Expr.stripParens with Expr.getUnderlyingValue 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
358e6188d9 JS: downgrade other alerts to js/useless-defensive-code 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
e29c57a58e JS: add whitelist to js/useless-defensive-code 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
b073fcfca2 JS: add query: js/useless-defensive-code 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
7b215ecb2b JS: recognize defensive programming patterns using typeof 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
c403416fef JS: recognize defensive expressions that prevents exceptions 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
6e77489a3b JS: add utilities for expression guards to DefensiveProgramming.qll 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
a2ecf40878 JS: recognize defensive expressions for null/undefined 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
2b6ef24bc2 JS: add utilities to DefensiveProgramming.qll 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
8086e88587 JS: add utilities to DefensiveProgramming.qll 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
a5eeba3c3a JS: prepare DefensiveProgramming.qll for additions 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
c2fb14640e JS: move isDefensiveInit to DefensiveProgramming.qll 2018-11-13 08:19:38 +01:00
Esben Sparre Andreasen
37b7b39ec6 JS: change notes for improved js/request-forgery 2018-11-13 08:17:24 +01:00
Esben Sparre Andreasen
577b225429 JS: sort change notes table 2018-11-13 08:17:24 +01:00
Esben Sparre Andreasen
ce0dd241f6 JS: add models of $.ajax, $.getJSON and XMLHttpRequst 2018-11-13 08:14:51 +01:00
semmle-qlci
2f0e693b38 Merge pull request #450 from xiemaisi/js/improve-externs-extractor-options
Approved by esben-semmle
2018-11-12 20:32:35 +00:00
Felicity Chapman
fa8fd0513c Update qhelp for queries with CWE tags 2018-11-12 18:00:17 +00:00
Geoffrey White
1c27c5e5ed CPP: Tag Padding queries. 2018-11-12 17:45:58 +00:00
Geoffrey White
bcb4ebffc3 CPP: Tag NVI queries. 2018-11-12 17:45:58 +00:00
Geoffrey White
850937efcc CPP: Tag Include queries. 2018-11-12 17:45:58 +00:00
Geoffrey White
93b3165e86 CPP: Tag Magic*UseConstant queries. 2018-11-12 17:45:58 +00:00
Max Schaefer
663bdd60a0 Merge pull request #396 from esben-semmle/js/unconditional-property-override
JS: add query: js/unconditional-property-override
2018-11-12 17:10:32 +00:00
Felicity Chapman
2847d5eaac Replace '&' symbols in URL 2018-11-12 16:34:19 +00:00
Geoffrey White
1d464ae35d CPP: Merge the ExprHasNoEffect tests. 2018-11-12 16:26:50 +00:00
Geoffrey White
1417929cdf CPP: Merge the Todo/FixmeComments tests. 2018-11-12 16:26:50 +00:00
Geoffrey White
03cad6c084 CPP: Move the AV Rule 97 test. 2018-11-12 16:07:03 +00:00
Geoffrey White
2d665e51d0 CPP: Move the BitwiseSignCheck.ql test. 2018-11-12 16:07:03 +00:00
Felicity Chapman
05930812a1 Update for feedback 2018-11-12 15:56:10 +00:00
Felicity Chapman
2e8f51a545 Update to bring into line with current guidelines 2018-11-12 15:30:19 +00:00
Arthur Baars
effabc667c Merge pull request #452 from adityasharad/version/1.18.3-dev
Version: Bump to 1.18.3 dev.
2018-11-12 16:01:22 +01:00
Aditya Sharad
271628c280 Version: Bump to 1.18.3 dev. 2018-11-12 14:55:26 +00:00
Jonas Jensen
0cb09b113f Merge pull request #251 from rdmarsh2/rdmarsh/cpp/sign-analysis
C++: Sign analysis library
2018-11-12 15:23:18 +01:00
Max Schaefer
2c1a37c652 JavaScript: Add WebRTC externs. 2018-11-12 12:25:32 +00:00
Jonas Jensen
1500237009 Merge remote-tracking branch 'upstream/master' into mergeback-20181112 2018-11-12 13:24:27 +01:00
Felicity Chapman
978fc4928f Fix syntax errors in qhelp files 2018-11-12 10:55:13 +00:00
Felicity Chapman
72ac2e5498 Fix typos 2018-11-12 09:52:00 +00:00
Tom Hvitved
dd6fd400aa Merge pull request #335 from calumgrant/cs/cwe-937
C#: New query VulnerablePackage
2018-11-12 10:34:53 +01:00
Esben Sparre Andreasen
eaad84bb4f JS: add support for dis- and conjunctions in SanitizingFunction 2018-11-12 10:23:52 +01:00
Esben Sparre Andreasen
ffc3d6ba49 JS: simplify test (move alerts four lines up) 2018-11-12 10:21:41 +01:00
Esben Sparre Andreasen
6d0c93b6a8 JS: introduce TaintTracking::AdditionalSanitizingCall 2018-11-12 10:21:39 +01:00
Esben Sparre Andreasen
2033bf81cc JS: address docstring review comments 2018-11-12 10:03:08 +01:00
Tom Hvitved
40def8d364 Merge pull request #418 from dave-bartolomeo/dave/FormatConfig
Allow mixed whitespace in certain test and external directories
2018-11-12 09:43:39 +01:00
Tom Hvitved
21887d7c6f C#: Refactor SSA liveness logic
Simplify liveness analysis by avoiding the two extra copies of `liveAtRank()`
(and other auxiliary predicates) for fields/captured variables analysis.
2018-11-12 09:41:53 +01:00
semmle-qlci
c9d77a2d6d Merge pull request #443 from xiemaisi/js/improve-stack-trace-exposure
Approved by asger-semmle
2018-11-12 08:40:26 +00:00
semmle-qlci
bf18175f7a Merge pull request #445 from xiemaisi/js/aliases
Approved by esben-semmle
2018-11-12 08:39:11 +00:00
Max Schaefer
01b43dff72 JavaScript: Make in-dist trap cache read-only. 2018-11-12 08:33:11 +00:00
Jonas Jensen
e9dac22cfd Merge pull request #446 from geoffw0/minor-corrections
CPP: Minor corrections to examples
2018-11-12 09:30:39 +01:00
Max Schaefer
032ed12242 JavaScript: Use in-dist trap cache when extracting externs. 2018-11-12 08:28:08 +00:00
Jonas Jensen
0caf0f1f15 Merge pull request #430 from geoffw0/exprtemplate
CPP: Exclude template code from ExprHasNoEffect.ql
2018-11-12 09:27:36 +01:00
Max Schaefer
f26d47aacb JavaScript: Bump extractor version.
This is not so much because extractor output has changed (it hasn't, except for corner cases) but to disable trap caching so as to help us to flush out bugs.
2018-11-12 08:19:17 +00:00
Max Schaefer
f06cef5d40 JavaScript: Port JSDoc parser to Java. 2018-11-12 08:18:53 +00:00
Max Schaefer
c14ebac455 JavaScript: Port regular expression parser to Java. 2018-11-12 08:18:53 +00:00
Max Schaefer
47fda72b91 Merge pull request #448 from adityasharad/merge/master-next-091118
Merge master into next.
2018-11-12 08:04:31 +00:00
Aditya Sharad
761e5efd60 Merge master into next.
JavaScript semantic conflicts fixed by referring to the `LegacyLanguage` enum.
C++ conflicts fixed by accepting Qltest output.
2018-11-09 18:49:35 +00:00
Robert Marsh
d9495da225 C++: fix test 2018-11-09 10:15:28 -08:00
yh-semmle
992a015467 Merge pull request #415 from aschackmull/java/obinit-extraction
Java: Account for extraction of calls to <obinit>.
2018-11-09 12:34:00 -05:00
Geoffrey White
09782d145e CPP: Annotate expr_has_no_effect test. 2018-11-09 17:23:59 +00:00
Geoffrey White
3f0e28aea9 CPP: Fix additional expr_has_no_effect test. 2018-11-09 17:23:59 +00:00
Max Schaefer
63933cdecd JavaScript: Don't extract extens with --experimental turned on.
There isn't any particularly compelling reason for doing so.
2018-11-09 16:22:55 +00:00
Max Schaefer
f7d693d06f JavaScript: Make default extractor options more sensible.
We now use module auto-detection and no TypeScript mode.

This only affects extern extraction in `AutoBuild`, everything else sets these options explicitly.
We currently do not have any ES2015 modules or TypeScript code in our externs, so in practice this is behaviour-preserving.
2018-11-09 16:21:35 +00:00
Geoffrey White
0e9c7fc085 Merge pull request #416 from raulgarciamsft/users/raulga/c6317
cpp: Incorrect not operator usage
2018-11-09 15:59:57 +00:00
Aditya Sharad
355473abb3 Merge pull request #439 from aschackmull/java/move-lgtm-suites
Java: Move the LGTM query suites to the public repo.
2018-11-09 12:56:44 +00:00
Anders Schack-Mulligen
f6941af86c Java: Move the LGTM query suites to the public repo. 2018-11-09 13:48:49 +01:00
Anders Schack-Mulligen
46bebc898a Java: Add test. 2018-11-09 13:36:05 +01:00
Anders Schack-Mulligen
6f791bb530 Java: Account for extraction of calls to <obinit>. 2018-11-09 13:36:05 +01:00
Geoffrey White
e645166fee CPP: Make InconsistentNullnessTest.cpp example plausible. 2018-11-09 11:41:02 +00:00
Geoffrey White
d5c6f4fd64 CPP: Correct typo in OverflowCalculated.cpp example. 2018-11-09 11:38:33 +00:00
Max Schaefer
fa8736adbc JavaScript: Introduce aliases for compatibility with other language libraries. 2018-11-09 11:27:14 +00:00
semmle-qlci
e35cb3a98a Merge pull request #442 from xiemaisi/js/change-notes
Approved by esben-semmle
2018-11-09 10:38:39 +00:00
Max Schaefer
bdfe938d02 JavaScript: Improve StackTraceExposure query.
It now also flags exposure of the entire exception object (not just the `stack` property).
2018-11-09 09:42:09 +00:00
Max Schaefer
71bbbb77eb JavaScript: Update 1.19 change notes to remove changes that ended up in 1.18.1. 2018-11-09 09:17:14 +00:00
semmle-qlci
a7290e5aeb Merge pull request #434 from esben-semmle/js/type-confusion-with-taint-kinds
Approved by asger-semmle
2018-11-09 08:25:55 +00:00
semmle-qlci
c19747803b Merge pull request #425 from xiemaisi/js/lodash-recognition-extensible
Approved by esben-semmle
2018-11-09 08:08:40 +00:00
Robert Marsh
4fdc992cd9 C++: IRGuards uses Operand; fix CP in SignAnalysis 2018-11-08 14:43:51 -08:00
Robert Marsh
72bb7c9c42 C++: remove double backtick in qldoc 2018-11-08 11:39:47 -08:00
Robert Marsh
0d9e2098f2 C++: test for bounded bounds in sign analysis 2018-11-08 11:38:34 -08:00
Tom Hvitved
29f163fd4e C#: Fix guards implications logic 2018-11-08 20:21:34 +01:00
Tom Hvitved
e4aa196c37 C#: Teach guards library about custom null guards 2018-11-08 20:21:34 +01:00
Tom Hvitved
a5dfc10197 C#: Add tests for custom null guards 2018-11-08 20:21:34 +01:00
Tom Hvitved
5921a9ea51 C#: Teach guards library about assertions 2018-11-08 20:21:34 +01:00
Tom Hvitved
0fb7ddc956 C#: Add assertion guard tests 2018-11-08 20:21:34 +01:00
Dave Bartolomeo
2977395c32 Ignore whitespace errors in everything under lib 2018-11-08 11:06:42 -08:00
Dave Bartolomeo
d521502ded Allow mixed whitespace in parser tests 2018-11-08 11:06:42 -08:00
Dave Bartolomeo
a141f4c81a Allow mixed whitespace in C#, C++, and Java test sources 2018-11-08 11:06:42 -08:00
Dave Bartolomeo
55f4839abf Allow mixed whitespace in JavaScript test sources 2018-11-08 11:06:42 -08:00
Felicity Chapman
48a7565a7f Fix tag error spotted by PR check 2018-11-08 18:43:32 +00:00
Felicity Chapman
3d779ddebb Bring qhelp inline with current guidelines 2018-11-08 18:37:41 +00:00
Aditya Sharad
1a5d4626bc Merge pull request #435 from calumgrant/cs/fix-extractor
C#: Fix an ArgumentNullException.
2018-11-08 17:29:08 +00:00
Felicity Chapman
8a444b6034 Update qhelp with content and remove autogenerated qhelp files 2018-11-08 16:16:50 +00:00
calumgrant
6fdb0aab41 Merge pull request #426 from hvitved/csharp/accessor-argument
C#: Improve `AccessorCall::getArgument()`
2018-11-08 16:03:48 +00:00
Esben Sparre Andreasen
bd2fc33621 JS: annotate tests with expectations 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
ca215391b4 JS: substitute Assignment for DataFlow::PropWrite 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
b7f424df41 JS: introduce DataFlow::PropWrite::getWriteNode 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
d813a7cad2 JS: push negation 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
470c241c82 JS: use range instead of ad hoc LT/GT 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
1389009388 JS: naming and doc cleanups 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
e82f5157c6 JS: change note for js/useless-assignment-to-property 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
33a297c829 JS: add query: js/useless-assignment-to-property 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
6ee47c437e JS: generalize and move DeadStoreOfLocal.qhelp to DeadStore.qhelp 2018-11-08 13:23:19 +01:00
Esben Sparre Andreasen
cacb8fdee0 JS: move DeadStoreOfLocal::isDefaultInit to separate module 2018-11-08 13:23:19 +01:00
Aditya Sharad
05ef589b79 Merge pull request #433 from rdmarsh2/rdmarsh/cpp/buffersize-backport
C++: Backport "Improve memberMayBeVarSize" to rc/1.18
2018-11-08 11:54:40 +00:00
semmle-qlci
3c49bc6e67 Merge pull request #407 from asger-semmle/email-xss
Approved by xiemaisi
2018-11-08 10:53:10 +00:00
semmle-qlci
29cabc0e09 Merge pull request #424 from esben-semmle/js/syntactic-nullOrUndefined
Approved by asger-semmle
2018-11-08 10:52:44 +00:00
calum
789e2fcf6d C#: Fix an ArgumentNullException. 2018-11-08 10:39:38 +00:00
Geoffrey White
5b09e11a52 CPP: Repair macro case. 2018-11-08 10:01:07 +00:00
Geoffrey White
d6f27f0b2d CPP: Add a test of macros. 2018-11-08 09:58:59 +00:00
Tom Hvitved
f7db845331 C#: Add change note 2018-11-08 09:26:59 +01:00
Tom Hvitved
06a2bcc244 C#: Fix XmlReaderSettingsCreation logic 2018-11-08 09:20:21 +01:00
Robert Marsh
1d7e802157 C++: move sign analysis to new Operand type 2018-11-07 16:07:37 -08:00
semmle-qlci
990c7e057f Merge pull request #419 from xiemaisi/js/fix-mixed-whitespace
Approved by esben-semmle
2018-11-07 23:47:48 +00:00
yh-semmle
49fbc410a1 Merge pull request #414 from aschackmull/java/unreachable-ssa
Java: Don't construct nonsense SSA for unreachable code.
2018-11-07 18:30:46 -05:00
yh-semmle
fc5b1958aa Merge pull request #422 from aschackmull/java/ws-in-examples
Java: Fix mixed tabs/spaces in qhelp examples.
2018-11-07 18:25:10 -05:00
Geoffrey White
57dafe2734 CPP: BinaryArithmeticOperation -> AddExpr. 2018-11-07 15:14:39 -08:00
Geoffrey White
313624fd2e CPP: Support builtin offsetof. 2018-11-07 15:14:39 -08:00
Geoffrey White
79ff559f7a CPP: Don't require alloc in memberMayBeVarSize. 2018-11-07 15:11:53 -08:00
Geoffrey White
19a53cde79 CPP: Fix array size bug in memberMayBeVarSize. 2018-11-07 15:11:53 -08:00
Geoffrey White
3610d35321 CPP: Include offsetof type calculations in memberMayBeVarSize. 2018-11-07 15:11:52 -08:00
Geoffrey White
b9c727c772 CPP: Include sizeof(expr) expressions in isDynamicallyAllocatedWithDifferentSize. 2018-11-07 15:11:52 -08:00
ian-semmle
f2a3054aae Merge pull request #432 from dave-bartolomeo/dave/FixCppWhitespace
C++: Fix mixed tabs and spaces in non-test code
2018-11-07 23:11:38 +00:00
Raul Garcia
3af2f6f6e9 Update .gitignore 2018-11-07 13:35:02 -08:00
Raul Garcia
f9edaba5aa Fixing typo.
Restricting to analyze only logical & and | operations
2018-11-07 13:26:09 -08:00
Dave Bartolomeo
5bf88f0f0a C++: Fix mixed tabs and spaces in non-test code 2018-11-07 11:32:17 -08:00
Arthur Baars
f159c7e240 Merge pull request #429 from adityasharad/version/1.18.2-release
Version: Bump to 1.18.2 release.
2018-11-07 15:52:41 +01:00
Aditya Sharad
ed49c623f1 Version: Bump to 1.18.2 release. 2018-11-07 14:36:40 +00:00
Geoffrey White
5f12c188df CPP: Change note. 2018-11-07 14:28:24 +00:00
Esben Sparre Andreasen
0afbea968c Merge pull request #421 from xiemaisi/js/open-source-extractor
JavaScript: Open-source extractor
2018-11-07 15:13:27 +01:00
Geoffrey White
7bf9200a18 CPP: Fix (it looks like we already had a similar test, both are fixed. 2018-11-07 14:12:52 +00:00
calumgrant
a8eabeb660 Merge pull request #420 from hvitved/csharp/whitespaces
C#: Fix whitespaces
2018-11-07 13:44:31 +00:00
Geoffrey White
73b186a695 CPP: Add test case. 2018-11-07 13:34:42 +00:00
semmle-qlci
ee3a332568 Merge pull request #423 from aschackmull/docs/ws-fix-style-guide
Approved by xiemaisi
2018-11-07 13:05:43 +00:00
Luke Cartey
4939db1c96 Merge pull request #411 from adityasharad/cpp/constant-exprs-fn-value-performance
C++: Improve performance of `ExprEvaluator::getFunctionValue`.
2018-11-07 13:05:15 +00:00
Jonas Jensen
9ee4d3b187 Merge pull request #378 from nickrolfe/uuidof0
C++: handle __uuidof(0)
2018-11-07 12:53:44 +01:00
Asger F
92f1c9a521 JS: add change note 2018-11-07 11:31:52 +00:00
Asger F
e0d5557ef4 JS: add email HTML body as XSS sink 2018-11-07 11:31:40 +00:00
Esben Sparre Andreasen
f0343d0678 JS: use isUserControlledObject in js/type-confusion-through-parameter-tampering 2018-11-07 12:18:46 +01:00
Esben Sparre Andreasen
a2df4f9bfe JS: mark Koa params as user-controlled objects 2018-11-07 12:18:46 +01:00
Aditya Sharad
194042348a Eclipse plugins: Remove plugin metadata.
This is only needed to build QL for Eclipse, and will be moved into the internal Semmle repository.
2018-11-07 11:01:05 +00:00
Tom Hvitved
5d8162cc8b C#: Improve AccessorCall::getArgument()
- Handle tuple assignments.
- Handle compound `+=` assignments.
2018-11-07 11:30:04 +01:00
Tom Hvitved
48634d4c9a Merge pull request #391 from calumgrant/cs/extractor/dump-args
C#: Reduce extractor log size
2018-11-07 11:17:21 +01:00
Tom Hvitved
7423916214 C#: Add tests for calls to accessors with arguments 2018-11-07 10:38:36 +01:00
Max Schaefer
b058854964 JavaScript: Teach type inference about AMD imports. 2018-11-07 09:18:21 +00:00
Max Schaefer
22640f891e JavaScript: Make lodash/underscore recognition extensible. 2018-11-07 09:02:17 +00:00
Esben Sparre Andreasen
e6a190c06e JS: replace .stripParens query uses w. .getUnderlyingReference 2018-11-07 09:32:02 +01:00
Esben Sparre Andreasen
f04293f73c JS: replace .stripParens library uses w. .getUnderlyingReference 2018-11-07 09:32:02 +01:00
Esben Sparre Andreasen
43e215c7af JS: replace .stripParens query uses w. .getUnderlyingValue 2018-11-07 09:32:02 +01:00
Esben Sparre Andreasen
030d9202de JS: replace .stripParens library uses w. .getUnderlyingValue 2018-11-07 09:32:02 +01:00
semmle-qlci
4225e0bb44 Merge pull request #356 from asger-semmle/parameter-node
Approved by xiemaisi
2018-11-07 08:31:05 +00:00
semmle-qlci
2457eb98df Merge pull request #166 from asger-semmle/documentable-self-assign
Approved by esben-semmle, xiemaisi
2018-11-07 08:30:17 +00:00
semmle-qlci
c20e24d549 Merge pull request #385 from asger-semmle/async-model
Approved by xiemaisi
2018-11-07 08:28:37 +00:00
semmle-qlci
282d1e2096 Merge pull request #404 from asger-semmle/useless-conditional2
Approved by xiemaisi
2018-11-07 08:28:01 +00:00
Max Schaefer
212a78b5fc Merge pull request #323 from esben-semmle/js/always-return-type-inference
JS: additional return type inference
2018-11-07 08:25:28 +00:00
Jonas Jensen
6f2fd05480 Merge pull request #354 from geoffw0/return-exception
CPP: Remove successor edges after calls to non-returning functions
2018-11-07 09:24:41 +01:00
Anders Schack-Mulligen
268de8de4f Style guide: Fix whitespace. 2018-11-07 09:12:55 +01:00
Anders Schack-Mulligen
92f265844b Java: Fix mixed tabs/spaces in qhelp examples. 2018-11-07 09:02:41 +01:00
Tom Hvitved
67e64f21d8 C#: Fix whitespaces 2018-11-07 08:52:38 +01:00
Max Schaefer
f75ce7a6ef JavaScript: Fix project layout for trap tests. 2018-11-07 07:48:25 +00:00
Max Schaefer
afe271c679 JavaScript: Update file classification in .lgtm.yml. 2018-11-07 07:48:25 +00:00
Max Schaefer
52e5879a2d JavaScript: Move extractor change notes. 2018-11-07 07:48:25 +00:00
Max Schaefer
4c4920c3a9 JavaScript: Open-source extractor. 2018-11-07 07:48:25 +00:00
Max Schaefer
5ffe45a80b JavaScript: Fix mixed tabs/spaces in qhelp. 2018-11-07 07:40:51 +00:00
semmle-qlci
b38effd55b Merge pull request #402 from geoffw0/tag-typos
Approved by dave-bartolomeo
2018-11-07 00:59:21 +00:00
Raul Garcia
5212aa0911 Update .gitignore 2018-11-06 12:51:56 -08:00
Raul Garcia
5a35edfbe2 cpp: Incorrect not opeartor usage
Marked as Low precision as Linux kernel code mix the usage of logical operators and bit-wise opeartors.
warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)
2018-11-06 12:49:33 -08:00
Robert Marsh
9d2d381e68 C++: test fixes for sign analysis 2018-11-06 12:02:39 -08:00
Robert Marsh
2d04d9ea04 C++: sync NegateInstruction between IR passes 2018-11-06 12:02:39 -08:00
Robert Marsh
6d06db7989 C++: fix comments 2018-11-06 12:02:39 -08:00
Robert Marsh
d9e6a6ea24 Move cached predicates to cached module 2018-11-06 12:02:38 -08:00
Robert Marsh
bf946c3ec3 C++: remove comments about Java implies predicates
The Java guards library includes a set of "implies" predicates to handle
short-circuiting conditionals. C++ handles those in IR generation, so
dominance on the IR produces correct results for controlling blocks.
2018-11-06 12:02:38 -08:00
Robert Marsh
554fea46c7 C++: Sign analysis for casts and unsigned integers 2018-11-06 12:02:38 -08:00
Robert Marsh
d1ae939c9c C++: use guards and operands in sign analysis 2018-11-06 12:02:38 -08:00
Robert Marsh
08e9eea1f2 Add NegateInstruction 2018-11-06 12:02:38 -08:00
Robert Marsh
a3c6b8e575 C++: port sign analysis library from Java 2018-11-06 12:02:38 -08:00
Jonas Jensen
e03b4f0cb6 Merge pull request #293 from geoffw0/zerosizebuffer
CPP: Better handling of zero-sized buffers
2018-11-06 20:08:39 +01:00
semmle-qlci
33c02fe928 Merge pull request #355 from hvitved/csharp/guards-logic
Approved by calumgrant
2018-11-06 19:06:30 +00:00
Dave Bartolomeo
62a5aef0de Merge pull request #410 from jbj/range-analysis-tests
C++: Tests for two range analysis bugs
2018-11-06 10:51:12 -08:00
Geoffrey White
ee4cfe8eb7 CPP: Update expected output for changes elsewhere. 2018-11-06 17:58:33 +00:00
Geoffrey White
e6e0d69b7d CPP: Re-apply effect of discover_walk. 2018-11-06 17:53:18 +00:00
Geoffrey White
301c133bef CPP: More descriptive. 2018-11-06 17:53:18 +00:00
Geoffrey White
2042c9c863 CPP: Extend the CPP-205 test (results prior to discover_walk). 2018-11-06 17:53:18 +00:00
Arthur Baars
89d728a50f Merge pull request #412 from adityasharad/merge/master-next-061118
Merge master into next.
2018-11-06 18:46:50 +01:00
Geoffrey White
b671ef504d Merge pull request #413 from jbj/return-this-getblock
C++: Restore `exists(getBlock())` in AV Rule 82
2018-11-06 17:04:05 +00:00
Geoffrey White
9c97176896 CPP: Tabs/spaces. 2018-11-06 17:01:30 +00:00
Anders Schack-Mulligen
fa3fa33c51 Java: Don't construct nonsense SSA for unreachable code. 2018-11-06 16:43:08 +01:00
Anders Schack-Mulligen
2004445817 Merge pull request #409 from yh-semmle/java/move-tests
Java: move/tweak some tests
2018-11-06 16:38:03 +01:00
Jonas Jensen
9382c9d528 C++: Regression tests for AV Rule 82
Without the last commit, this addition to the test gives the following
results:

```
+| AV Rule 82.cpp:176:14:176:22 | operator= | Assignment operator in class Forgivable does not return a reference to *this. |
+| AV Rule 82.cpp:181:14:181:22 | operator= | Assignment operator in class Forgivable does not return a reference to *this. |
```
2018-11-06 16:13:44 +01:00
Esben Sparre Andreasen
e396a55653 JS: change notes for type inference improvements 2018-11-06 16:04:46 +01:00
Esben Sparre Andreasen
a79a6a07b8 JS: stop tracking properties of object literals 2018-11-06 16:04:46 +01:00
Esben Sparre Andreasen
a07c094437 JS: introduce TypeInferredCalleeWithAnalyzedReturnFlow 2018-11-06 16:04:46 +01:00
Esben Sparre Andreasen
fef3573152 JS: use global layer in AnalyzedNode::getABooleanValue and -getAType 2018-11-06 16:04:46 +01:00
Geoffrey White
792369917a CPP: Fix CWE tags. 2018-11-06 14:36:12 +00:00
Geoffrey White
698f8953c7 CPP: Change note. 2018-11-06 14:29:08 +00:00
Geoffrey White
dd8aa5a8d9 CPP: Fix StrncpyFlippedArgs.ql as well. 2018-11-06 14:29:08 +00:00
Geoffrey White
ad44416189 CPP: Move the fix into Buffer.qll so that it applies to other queries. 2018-11-06 14:29:08 +00:00
Sauyon Lee
f99f44a571 If a destination buffer has size 0, there's probably some hackery going on 2018-11-06 14:29:08 +00:00
Jonas Jensen
da73a033e5 C++: Restore exists(getBlock()) in AV Rule 82
I removed this condition in #362, thinking it was covered by the new
conditions on return statements, but it turns out it wasn't in at least
the following cases.

1. Assignment operators that are deleted or marked private in order to
   make them inaccessible.
2. Templates whose body was not extracted.

While some of these results are technically valid, they are not nearly
as interesting as the results that this query was designed to produce.
2018-11-06 13:42:20 +01:00
Asger F
1252cde7f3 JS: remove a comma 2018-11-06 12:24:34 +00:00
Asger F
dcf6218d1d JS: update test expectations 2018-11-06 12:22:05 +00:00
Asger F
799cd33b88 JS: add change note 2018-11-06 12:13:34 +00:00
Asger F
c991d67fcb JS: fix typos 2018-11-06 12:12:43 +00:00
Asger F
460521616c JS: rename getIteratee to getIteratorCallback 2018-11-06 12:12:43 +00:00
Asger F
97d65fb82f JS: fix bad join ordering 2018-11-06 12:12:43 +00:00
Asger F
b40fa3845f JS: add model of async package 2018-11-06 12:12:43 +00:00
Aditya Sharad
553c2f5d34 Merge master into next.
As of 2846d80f1c.
2018-11-06 11:52:51 +00:00
semmle-qlci
76475fef3b Merge pull request #406 from xiemaisi/js/configuration-fiddling
Approved by asger-semmle
2018-11-06 11:51:12 +00:00
Jonas Jensen
4a02b3946d C++: Tests for two range analysis bugs 2018-11-06 11:57:41 +01:00
Asger F
87e0027974 JS: address comments 2018-11-06 10:29:04 +00:00
Asger F
56707fc79a JS: recognize more conditionals in useless-conditional 2018-11-06 10:28:05 +00:00
Jonas Jensen
786377d8dc Merge pull request #408 from dave-bartolomeo/dave/NonVirtualDestructorInBaseClass
C++: Fork AV Rule 78 into NonVirtualDestructorInBaseClass
2018-11-06 09:51:27 +01:00
Dave Bartolomeo
3133bf6675 C++: Fix test expectation 2018-11-05 14:19:59 -08:00
Dave Bartolomeo
0c796de831 C++: Fork AV Rule 78 into NonVirtualDestructorInBaseClass
AV Rule 78 has proved too noisy for use on lgtm.com. However, if we make the rule less noisy by, say, allowing a protected destructor to be non-virtual, we're no longer actually enforcing AV Rule 78. Instead, I've copied AV Rule 78 into NonVirtualDestructorInBaseClass.ql, given the new query the `@id` that AV Rule 78 had, and given AV Rule 78 a new JSF-specific `@id`. The new rule allows non-public non-virtual destructors, which is the problem originally reported by an lgtm.com user.
2018-11-05 14:16:35 -08:00
Jonas Jensen
ba91f3e77c Merge pull request #401 from geoffw0/loopdir
CPP: Speed up inconsistentLoopDirection.ql.
2018-11-05 18:22:19 +01:00
yh-semmle
64a50c522d Java: tweak a test 2018-11-05 12:10:08 -05:00
yh-semmle
c0fcf7fc9b Java: move a few more tests 2018-11-05 12:08:43 -05:00
yh-semmle
f3fbc8a153 Java: move a few tests 2018-11-05 12:08:42 -05:00
Aditya Sharad
bfa4c30784 C++: Improve performance of ExprEvaluator::getFunctionValue.
Changes the `forex` range to join on both `this` (the current `ExprEvaluator`) and `ret` (the expected function return value),
so that we look at the relevant return values rather than all interesting functions.
2018-11-05 16:51:23 +00:00
Geoffrey White
5cd7103841 Merge pull request #403 from jbj/FlowVar-getAnAccess-perf
C++: Performance fix for FlowVar.getAnAccess
2018-11-05 16:46:49 +00:00
semmle-qlci
5c9939b8ef Merge pull request #390 from esben-semmle/js/improve-useless-conditional-message
Approved by xiemaisi
2018-11-05 16:34:59 +00:00
Tom Hvitved
2d25a04a2e C#: Add test for guard implications logic 2018-11-05 16:47:10 +01:00
Geoffrey White
a38fefe7ba CPP: Fix trailing space. 2018-11-05 15:21:27 +00:00
Tom Hvitved
f5e6b79add C#: Address review comments 2018-11-05 16:14:15 +01:00
Geoffrey White
27fe996269 CPP: Change note. 2018-11-05 15:11:17 +00:00
Geoffrey White
3cb4211c78 CPP: Exclude code in macro invocations. 2018-11-05 15:07:22 +00:00
Geoffrey White
b4adfec2ef CPP: Add test case. 2018-11-05 14:19:16 +00:00
Esben Sparre Andreasen
651f32514b JS: use 'Util::describeExpression' in js/trivial-conditional 2018-11-05 13:00:07 +01:00
Esben Sparre Andreasen
4e54af3b41 JS: introduce 'Util::describeExpression' 2018-11-05 12:58:12 +01:00
Asger F
e670919807 JS: mention @type tag in qhelp 2018-11-05 11:31:32 +00:00
Asger F
ad7ecc1df0 JavaScript: added change note 2018-11-05 11:31:32 +00:00
Asger F
e39b0c7a75 JavaScript: address comments 2018-11-05 11:31:02 +00:00
Asger F
4f4ad2b942 JavaScript: ignore self-assignments with a JSDoc comment 2018-11-05 11:31:02 +00:00
Tom Hvitved
2846d80f1c Merge pull request #359 from calumgrant/cs/with-stubs
C#: Sources and sinks for ASP.NET Core
2018-11-05 11:46:02 +01:00
Jonas Jensen
9a3907c97f C++: Performance fix for FlowVar.getAnAccess
The previous formulation of this predicate caused a CP in snapshots
where a variable had a large number of definitions and also reached a
large number of sub-basic-blocks.

This should fix performance of https://github.com/FrodeSolheim/fs-uae
and https://github.com/libretro/libretro-uae.

The `FlowVar.getAnAccess` predicate is still at risk of CP'ing when a
large group of defs has a large group of uses, but that has not been
observed to happen in practice yet. We would need to make
`localFlowStep` expose phi definitions in order to avoid that risk.
2018-11-05 10:52:17 +01:00
semmle-qlci
b743ee4179 Merge pull request #314 from esben-semmle/js/json-stringify-as-command-line-injection-source-heuristic
Approved by xiemaisi
2018-11-05 07:37:36 +00:00
Arthur Baars
a525c181e2 Merge pull request #400 from adityasharad/merge/1.18-master-021118
Merge rc/1.18 into master.
2018-11-03 20:43:48 +01:00
calum
c003150ed8 C#: Add missing file. 2018-11-02 16:46:49 +00:00
calum
29df7f5e96 C#: Mark false-negatives. 2018-11-02 16:46:49 +00:00
calum
7fa442d127 C#: Merge tests. 2018-11-02 16:46:49 +00:00
calum
ae96b347e2 C#: Address review comments. 2018-11-02 16:46:49 +00:00
calum
13f0a401f3 C#: Update analysis change notes. 2018-11-02 16:46:48 +00:00
calum
aff47c9f38 C#: Tidy up whitespace. 2018-11-02 16:45:48 +00:00
calum
62fb693924 C#: Tidy up code and fix performance of remote flow sources. 2018-11-02 16:45:48 +00:00
calum
2090d69c3f C#: Tidy up tests. 2018-11-02 16:45:48 +00:00
calum
697e66e312 C#: Move test into subdirectory. 2018-11-02 16:45:48 +00:00
calum
d6e6ae66b8 C#: qltest stubs for UrlRedirect.ASPNETCore 2018-11-02 16:45:47 +00:00
calum
4655acadb2 C#: Stubs for XSSFlowASPNetCore test. 2018-11-02 16:45:47 +00:00
calum
8b8d2f9bef C#: Add auto-generated stubs. 2018-11-02 16:45:47 +00:00
Denis Levin
ba9cb5e22d cs: Adding sources and sinks for ASPNET.Core
Inintial query checkin.
Note: tests require Nuget packages with ASPNET and ASPNETCore in Packages directory, and won't compile without them.
The packages.config should include this:
  <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net461" />
  <package id="Microsoft.AspNetCore.Antiforgery" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Authorization" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Cors" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Cryptography.Internal" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.DataProtection" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.DataProtection.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Diagnostics" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.Diagnostics.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Hosting" version="1.1.3" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.Hosting.Abstractions" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Hosting.Server.Abstractions" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Html.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Http" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Http.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Http.Extensions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Http.Features" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.HttpOverrides" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.JsonPatch" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Localization" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Abstractions" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.ApiExplorer" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Core" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Cors" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.DataAnnotations" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Formatters.Json" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Localization" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Razor" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.Razor.Host" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.TagHelpers" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Mvc.ViewFeatures" version="1.1.3" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Razor" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Razor.Runtime" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.ResponseCaching" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.ResponseCaching.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.ResponseCompression" version="1.0.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.Rewrite" version="1.0.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.Routing" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Routing.Abstractions" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.AspNetCore.Server.Kestrel" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.Server.Kestrel.Https" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.Server.WebListener" version="1.1.4" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.StaticFiles" version="1.1.2" targetFramework="net452" />
  <package id="Microsoft.AspNetCore.WebUtilities" version="1.1.2" targetFramework="net451" />
  <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="1.1.1" targetFramework="net451" />
  <package id="Microsoft.Extensions.Primitives" version="2.1.0" targetFramework="net451" />
  <package id="Microsoft.NETCore.App" version="2.0.0" />
  <package id="Microsoft.AspNetCore.Mvc" version="2.1.0" />
  <package id="Microsoft.AspNetCore.Mvc.Core" version="2.1.0" />
  <package id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.1.0" />
  <package id="Microsoft.AspNetCore.Http.Extensions" version="2.1.0" />
  <package id="Microsoft.AspNetCore.Http.Abstractions" version="2.1.0" />
  <package id="Microsoft.AspNetCore.Http.Features" version="2.1.0" />
2018-11-02 16:45:47 +00:00
Geoffrey White
1561363582 CPP: Speed up illDefined*ForStmt in inconsistentLoopDirection.ql. 2018-11-02 16:01:23 +00:00
Aditya Sharad
3483245870 Merge rc/1.18 into master.
As of 3291a30bf4.
2018-11-02 09:54:50 +00:00
Arthur Baars
19f238a51a Merge pull request #399 from adityasharad/version/1.18.2-dev
Version: Bump to 1.18.2 dev.
2018-11-02 08:56:33 +01:00
Max Schaefer
e77ea62179 JavaScript: Tweak storeStep predicate. 2018-11-01 21:24:16 -04:00
Max Schaefer
94bba88080 JavaScript: Avoid unhelpful magic. 2018-11-01 21:22:51 -04:00
Max Schaefer
a72507a621 JavaScript: Remove a pragma[noopt]. 2018-11-01 21:22:03 -04:00
Aditya Sharad
3291a30bf4 Version: Bump to 1.18.2 dev. 2018-11-01 18:46:56 +00:00
Geoffrey White
40ad2c9db9 Merge pull request #397 from pavgust/fix/suspicious-memset-perf
SuspiciousCallToMemset: Simplify pointer indirection computation
2018-11-01 18:46:30 +00:00
semmle-qlci
b130335adb Merge pull request #398 from aschackmull/java/autoformat
Approved by yh-semmle
2018-11-01 16:57:30 +00:00
Anders Schack-Mulligen
41c89475fe Java: Rerun autoformat. 2018-11-01 17:01:12 +01:00
Geoffrey White
a3dfa3140c CPP: Make Handlers always begin a BasicBlock. 2018-11-01 15:27:43 +00:00
Pavel Avgustinov
d5c8ea38b1 SuspiciousCallToMemset: Simplify pointer indirection computation 2018-11-01 14:34:04 +00:00
ian-semmle
cb3a6514f8 Merge pull request #389 from adityasharad/merge/master-next-311018
Merge master into next.
2018-11-01 14:13:45 +00:00
Esben Sparre Andreasen
8f3497a7bf JS: improve tests for interprocedural type inference 2018-11-01 13:51:38 +01:00
semmle-qlci
08833465a0 Merge pull request #386 from xiemaisi/js/lodash_partial
Approved by esben-semmle
2018-11-01 09:44:14 +00:00
semmle-qlci
86b3f0156b Merge pull request #387 from xiemaisi/js/amd-fixes
Approved by esben-semmle
2018-11-01 09:42:17 +00:00
semmle-qlci
a22aa3524e Merge pull request #388 from asger-semmle/revert-useless-conditional
Approved by esben-semmle
2018-11-01 09:23:19 +00:00
Jonas Jensen
ea601b2dc0 Merge pull request #352 from dave-bartolomeo/dave/Operands
C++: Operands as IPA types
2018-11-01 10:12:38 +01:00
semmle-qlci
fa81084d79 Merge pull request #330 from aschackmull/java/zipslip
Approved by yh-semmle
2018-10-31 14:40:43 +00:00
calum
7494bd66a4 C#: Address review comment. 2018-10-31 14:22:19 +00:00
calum
8bea6fa7c9 C#: Unit tests. 2018-10-31 12:01:43 +00:00
calum
681953ae70 C#: Reduce logging output and write arguments to separate files. Fix missing response file. 2018-10-31 11:56:47 +00:00
Aditya Sharad
b896899f4c Merge master into next.
master as of dc3c5a684c
Version numbers resolved in favour of `next`.
C++ expected output file updated to accept test output.
2018-10-31 10:47:31 +00:00
Max Schaefer
3d2a27b039 JavaScript: Make a useful member predicate public. 2018-10-31 06:46:09 -04:00
semmle-qlci
f00863fb58 Merge pull request #383 from esben-semmle/js/unused-eval-variable
Approved by xiemaisi
2018-10-31 10:42:55 +00:00
Asger F
2c11844c5b Revert "Merge pull request #380 from asger-semmle/generalize-useless-conditional"
This reverts commit 28f3b686a7, reversing
changes made to dc3c5a684c.
2018-10-31 10:38:38 +00:00
Anders Schack-Mulligen
c3f71c2d42 Java: Change main ZipSlip location to the source. 2018-10-31 11:38:28 +01:00
Anders Schack-Mulligen
36f41a3e16 Java: Fix performance issue, and add Path.resolve as taint step. 2018-10-31 11:38:27 +01:00
Anders Schack-Mulligen
4953e4923a Java: Add test for sanitization using toAbsolutePath(). 2018-10-31 11:38:27 +01:00
Anders Schack-Mulligen
bf6b7c4734 Java: Add ZipSlip query. 2018-10-31 11:38:27 +01:00
Max Schaefer
c75d785684 JavaScript: Fix modelling of _.partial.
Like `Function.prototype.bind` (but unlike `ramda.partial`) it takes the curried arguments as rest arguments, not as an array;
cf. https://lodash.com/docs/4.17.10#partial and https://underscorejs.org/#partial.
2018-10-31 06:31:59 -04:00
Asger F
0bc30003af JS: add change note 2018-10-31 10:28:31 +00:00
Asger F
f07aa5bb2c JS: ensure parameters always have a dataflow node 2018-10-31 10:28:31 +00:00
semmle-qlci
28f3b686a7 Merge pull request #380 from asger-semmle/generalize-useless-conditional
Approved by esben-semmle
2018-10-31 07:31:06 +00:00
Robert Marsh
dc3c5a684c Merge pull request #272 from Semmle/rdmarsh/cpp/memset-decltype-changenote
C++/Doc: change note for PR #269
2018-10-30 09:53:44 -07:00
Geoffrey White
092db18f96 CPP: Also update reachable for ControlFlowNodes. 2018-10-30 14:28:47 +00:00
Geoffrey White
1092cb97e5 CPP: Have reachability flow to the Handler as well as the CAtchBlock of an exception. 2018-10-30 14:27:22 +00:00
Geoffrey White
6e940d7bf2 CPP: Improve nonReturningFunction. 2018-10-30 14:25:38 +00:00
Geoffrey White
1a6229621c CPP: Tidy up query formatting a little. 2018-10-30 14:25:37 +00:00
Geoffrey White
6427e9658b CPP: Remove successor edges from non-returning functions from the control flow graph. 2018-10-30 14:25:32 +00:00
Asger F
1568d5dadd JS: add change note 2018-10-30 14:25:05 +00:00
Asger F
44d10cb74c JS: add test cases 2018-10-30 14:24:33 +00:00
Asger F
7e5e5aea11 JS: use guard nodes instead of synactic isConditional check 2018-10-30 14:22:31 +00:00
Geoffrey White
44f5e26fb0 CPP: More test cases. 2018-10-30 14:20:48 +00:00
Geoffrey White
f2ba627291 CPP: Extend the c++_exceptions test. 2018-10-30 14:11:48 +00:00
Geoffrey White
a346f412bc CPP: Add test cases. 2018-10-30 14:11:36 +00:00
Jonas Jensen
784b2749e6 Merge branch 'master' into rdmarsh/cpp/memset-decltype-changenote 2018-10-30 14:05:26 +01:00
Tom Hvitved
665173692c C#: Fix whitespaces 2018-10-30 13:15:46 +01:00
Tom Hvitved
e76e448953 C#: Unify logic in guards library
Unify the logic for Boolean/nullness/matching guards.
2018-10-30 13:15:15 +01:00
Arthur Baars
336f605153 Merge pull request #384 from adityasharad/merge/1.18-master-301018
Merge rc/1.18 into master.
2018-10-30 13:09:19 +01:00
Esben Sparre Andreasen
eb7add6f15 JS: change note for js/unused-local-variable eval whitelisting 2018-10-30 13:08:24 +01:00
Esben Sparre Andreasen
74642b9b81 JS: whitelist js/unused-local-variable near direct eval calls 2018-10-30 13:08:24 +01:00
Esben Sparre Andreasen
ce3b4a6400 JS: add additional js/unused-local-variable tests 2018-10-30 13:07:23 +01:00
Aditya Sharad
256b829201 Merge rc/1.18 into master. 2018-10-30 11:21:50 +00:00
semmle-qlci
8b866ade0e Merge pull request #373 from asger-semmle/jsx-factory-import
Approved by xiemaisi
2018-10-30 10:35:49 +00:00
semmle-qlci
1509752df6 Merge pull request #345 from esben-semmle/js/intro-getUnderlying
Approved by xiemaisi
2018-10-30 10:34:00 +00:00
Geoffrey White
e609a95f30 Merge pull request #357 from jbj/cpp-codeowners
C++: Add C++ analysis team to CODEOWNERS
2018-10-30 10:21:10 +00:00
semmle-qlci
79794612fe Merge pull request #379 from hvitved/csharp/assert-forward
Approved by calumgrant
2018-10-30 09:16:20 +00:00
Geoffrey White
bfb5731b19 Merge pull request #377 from ian-semmle/fix_member_function_indices
C++: Accept test changes following fix_member_function_indices
2018-10-30 08:57:04 +00:00
Jonas Jensen
3340e79aad Merge pull request #371 from ian-semmle/av85
C++: Fix AV Rule 85
2018-10-30 08:40:43 +01:00
Robert Marsh
fda75abcd7 Merge pull request #381 from geoffw0/comments
CPP: Fix false positive in EmptyBlock.ql
2018-10-29 15:35:08 -07:00
Arthur Baars
778a484ce0 Merge pull request #382 from adityasharad/version/1.18.1-release
Version: Bump to 1.18.1 release.
2018-10-29 21:30:54 +01:00
Aditya Sharad
5e7b7818df Version: Bump to 1.18.1 release. 2018-10-29 18:02:58 +00:00
semmle-qlci
a4371ca824 Merge pull request #338 from geoffw0/hresult
Approved by dave-bartolomeo
2018-10-29 17:04:54 +00:00
Geoffrey White
e7f2d7fb45 CPP: Change note. 2018-10-29 16:54:31 +00:00
Geoffrey White
fc6b791f58 CPP: Speed it up. 2018-10-29 16:52:44 +00:00
Geoffrey White
55465c3eae CPP: Add some comments to the QL. 2018-10-29 16:39:49 +00:00
Geoffrey White
3ccbeb0c65 CPP: Fix issue. 2018-10-29 16:34:57 +00:00
Geoffrey White
630233fc3e CPP: Additional test cases. 2018-10-29 16:34:43 +00:00
Ian Lynagh
5359f5d044 C++: Accept test changes following fix_member_function_indices 2018-10-29 15:30:56 +00:00
Ian Lynagh
94347aef9b C++: AV Rule 85: Check templates rather than instantiations 2018-10-29 15:04:30 +00:00
Tom Hvitved
cddc519546 C#: Improve performance in ForwarderAssertMethod 2018-10-29 15:49:42 +01:00
semmle-qlci
7b84f5b1fd Merge pull request #372 from aschackmull/java/rangeanalysis-array-phinodes
Approved by yh-semmle
2018-10-29 13:02:58 +00:00
Nick Rolfe
9a412c9202 C++: handle __uuidof(0) 2018-10-29 12:57:55 +00:00
semmle-qlci
7d37cf4bb3 Merge pull request #374 from jbj/range-analysis-rounding
Approved by kevinbackhouse
2018-10-29 10:28:15 +00:00
Tom Hvitved
3f6fb0f573 Merge pull request #364 from calumgrant/cs/extractor/fix-violations
C#: Remove results from cs/local-shadows-member
2018-10-29 11:25:23 +01:00
Nick Rolfe
3e171960dc Merge pull request #369 from ian-semmle/generated_members
C++: Accept test changes after generating class membership info for generated functions
2018-10-29 10:05:05 +00:00
semmle-qlci
72012a93cb Merge pull request #375 from esben-semmle/js/limit-directive-sizes
Approved by xiemaisi
2018-10-29 09:59:03 +00:00
Esben Sparre Andreasen
c9890fee1e JS: address review comments 2018-10-29 09:22:53 +01:00
Esben Sparre Andreasen
90c77134af JS: make use of getUnderlyingValue in js/useless-assignment-to-local 2018-10-29 09:22:53 +01:00
Esben Sparre Andreasen
ec1722c4db JS: add utility SyntacticConstants::isNullOrUndefined 2018-10-29 09:22:53 +01:00
Esben Sparre Andreasen
7c7cd7c213 JS: make use of getUnderlyingValue 2018-10-29 09:22:53 +01:00
Esben Sparre Andreasen
376245da06 JS: introduce Expr::getUnderlyingReference 2018-10-29 09:22:53 +01:00
Esben Sparre Andreasen
8fc89e2e36 JS: introduce Expr::getUnderlyingValue 2018-10-29 09:22:53 +01:00
Esben Sparre Andreasen
fbd3a097a2 JS: add misc. tests 2018-10-29 09:22:53 +01:00
Dave Bartolomeo
459b05d875 C++: Rename a couple predicates based on PR feedback 2018-10-26 14:38:34 -07:00
Jonas Jensen
47096bbc5f Merge pull request #318 from geoffw0/overflowstatic
CPP: Speed up OverflowStatic.ql
2018-10-26 20:19:41 +02:00
semmle-qlci
c2e7627f61 Merge pull request #351 from nystrom/master
Approved by pavgust
2018-10-26 19:09:02 +01:00
Robert Marsh
306b711e76 Merge pull request #368 from geoffw0/buffersize
CPP: Improve memberMayBeVarSize
2018-10-26 09:59:45 -07:00
Geoffrey White
35a5bca98a Merge pull request #376 from ian-semmle/functionName
C++: Simplify a test's query
2018-10-26 17:24:11 +01:00
Ian Lynagh
09959cbbfc C++: Simplify a test's query
This test predated Function.getFullSignature()
2018-10-26 15:08:18 +01:00
Esben Sparre Andreasen
8f635e6493 JS: truncate js/unknown-directive message content 2018-10-26 15:21:16 +02:00
Esben Sparre Andreasen
244d8d5778 JS: introduce truncate utility 2018-10-26 15:20:58 +02:00
Esben Sparre Andreasen
2565b35c3d JS: Fix indentation 2018-10-26 15:19:43 +02:00
Asger F
47f59b4fd8 JS: fix typo 2018-10-26 14:08:44 +01:00
Geoffrey White
2f517deb77 CPP: BinaryArithmeticOperation -> AddExpr. 2018-10-26 13:40:56 +01:00
calum
68194b4474 C#: Fix typo again. 2018-10-26 13:10:16 +01:00
Asger F
3bd91bdf08 JS: introduce common class for Babel plugins 2018-10-26 12:55:37 +01:00
Jonas Jensen
a3505e008b C++: Fix range analysis rounding for negative zero 2018-10-26 13:40:17 +02:00
Asger F
7285562c72 JS: add change note 2018-10-26 12:09:10 +01:00
Asger F
91943ae2cb JS: support transform-react-jsx plugin 2018-10-26 12:06:56 +01:00
Asger F
d7eb4ef40e JS: test case for transform-react-jsx plugin 2018-10-26 12:06:18 +01:00
Jonas Jensen
cbe16e56d7 C++: Pull rounding functions out to new predicates 2018-10-26 12:47:25 +02:00
Ian Lynagh
01d27d331e C++: Accept test changes 2018-10-26 11:07:18 +01:00
Jonas Jensen
006594fefe C++: Round towards +/- Inf in range analysis
Original author: Kevin Backhouse
2018-10-26 11:53:51 +02:00
calumgrant
ec2bf914c8 Merge pull request #339 from hvitved/csharp/cfg/assertions
C#: Detect constantly failing assertions in the CFG
2018-10-26 10:32:23 +01:00
Anders Schack-Mulligen
3d81328c41 Java: Improve array length bounds on array phi nodes that may be null. 2018-10-26 11:18:31 +02:00
Anders Schack-Mulligen
4227cdb423 Java: Tweak query description. 2018-10-26 10:50:06 +02:00
Geoffrey White
fa55e31f7a Merge pull request #362 from jbj/return-this-noreturn
C++: Fix "Overloaded assignment does not return 'this'" for non-returning functions
2018-10-26 09:30:36 +01:00
Geoffrey White
91dad02b7e Merge pull request #370 from ian-semmle/update_comment
C++: Update a comment
2018-10-26 08:55:12 +01:00
Max Schaefer
a08233e13d Merge pull request #366 from adityasharad/merge/master-next-251018
Merge master into next.
2018-10-26 08:13:33 +01:00
semmle-qlci
cbc2d9e257 Merge pull request #361 from aschackmull/java/springweb-servlet-sources
Approved by yh-semmle
2018-10-26 02:06:11 +01:00
semmle-qlci
905911014d Merge pull request #358 from aschackmull/java/sql-sinks
Approved by yh-semmle
2018-10-26 01:42:37 +01:00
Ian Lynagh
d6afbd8bb0 C++: Update a comment 2018-10-25 21:18:37 +01:00
Max Schaefer
b880a60095 Merge pull request #363 from xiemaisi/js/destructuring-assignment-cfg
JavaScript: Improve handling of destructuring assignments.
2018-10-25 20:28:53 +01:00
Geoffrey White
c9ed0396c5 CPP: Support builtin offsetof. 2018-10-25 16:41:37 +01:00
Aditya Sharad
56ee5ff99a Merge master into next.
`master` up to and including cfe0b8803a.
2018-10-25 15:32:47 +01:00
Max Schaefer
38534a6e2f JavaScript: Address review comment. 2018-10-25 15:31:46 +01:00
Max Schaefer
34b33ca04c JavaScript: Recognise rest patterns as lvalues. 2018-10-25 15:31:46 +01:00
Max Schaefer
394d7b7a9b JavaScript: Update expected output of CFG test. 2018-10-25 15:31:46 +01:00
Max Schaefer
8402ee8374 JavaScript: Refactor getDefReachingEndOf to improve performance. 2018-10-25 15:31:46 +01:00
Max Schaefer
09ef1a719a JavaScript: Pull out auxiliary predicates to improve join order in liveAfterDef. 2018-10-25 15:31:46 +01:00
Max Schaefer
59bbd025a5 JavaScript: Pull out auxiliary predicate to improve join order in TPhi. 2018-10-25 15:31:46 +01:00
Max Schaefer
d2993b9e04 JavaScript: Model data flow of destructuring assignments more precisely. 2018-10-25 15:31:46 +01:00
Jonas Jensen
354f8bd0ff C++: Test of range analysis 64-bit rounding issue 2018-10-25 16:18:22 +02:00
Geoffrey White
4c6cc3abdb CPP: Change note. 2018-10-25 15:01:00 +01:00
Geoffrey White
2dcec4dce3 CPP: Don't require alloc in memberMayBeVarSize. 2018-10-25 15:01:00 +01:00
Geoffrey White
035823cff0 CPP: Fix array size bug in memberMayBeVarSize. 2018-10-25 15:01:00 +01:00
Ian Lynagh
eef8719a40 C++: Fix AV Rule 85
We have to be careful to avoid giving alerts to functions that might be
correctly defined, but we can't see the definition as it wasn't
instantiated.
2018-10-25 14:26:31 +01:00
calum
fde3341455 C#: Addressed documentation review. 2018-10-25 14:18:30 +01:00
calum
448b080d4f C#: Fix typos. 2018-10-25 13:45:46 +01:00
Anders Schack-Mulligen
26bcf4bf5f Java: Add change note. 2018-10-25 14:34:14 +02:00
Anders Schack-Mulligen
42e659c645 Java: Minor fixups. 2018-10-25 14:30:40 +02:00
Pavel Avgustinov
c577f6d9f8 Merge pull request #365 from aschackmull/java/response-splitting-whitelist-cookiename
Java: Whitelist Cookie::getName for HTTP response splitting.
2018-10-25 13:18:03 +01:00
Tom Hvitved
a3d74b00e0 C#: Address review comments 2018-10-25 14:15:09 +02:00
Anders Schack-Mulligen
8a27c09447 Java: Add .expected file. 2018-10-25 14:12:50 +02:00
Anders Schack-Mulligen
8fe1634fcc Java: Add test. 2018-10-25 13:00:15 +02:00
Anders Schack-Mulligen
1188e18837 Java: Whitelist Cookie::getName for HTTP response splitting. 2018-10-25 12:02:33 +02:00
Jonas Jensen
5cbfdd1029 C++: Cover more cases of returning *this 2018-10-25 10:41:56 +02:00
Geoffrey White
69785fcae6 CPP: Include offsetof type calculations in memberMayBeVarSize. 2018-10-25 09:09:29 +01:00
Jonas Jensen
d144f0d154 C++: Test for unreachable return statement
This test shows that the previous fix did not solve the problem where a
bad return statement exists but is unreachable.
2018-10-25 09:42:15 +02:00
semmle-qlci
cfe0b8803a Merge pull request #332 from raulgarciamsft/users/raulga/c6293a
Approved by dave-bartolomeo
2018-10-25 00:59:35 +01:00
Raul Garcia
e1efcb0b26 Update .gitignore 2018-10-24 15:23:40 -07:00
Raul Garcia
a04eb53189 Documentation bug fix.
Encoding the "<" character
2018-10-24 15:22:53 -07:00
calum
8cdfb8707c C#: Update change notes. 2018-10-24 17:54:10 +01:00
calum
3041756207 C#: Allow constructor parameters to shadow class members. 2018-10-24 17:48:51 +01:00
calum
5c0b9867f8 C#: Fix violations for cs/local-shadows-member 2018-10-24 17:36:51 +01:00
Nate Nystrom
33ba814551 fixed mixed tabs and spaces 2018-10-24 17:37:18 +02:00
Geoffrey White
ec205e995b CPP: Include sizeof(expr) expressions in isDynamicallyAllocatedWithDifferentSize. 2018-10-24 16:17:04 +01:00
Aditya Sharad
292189c1e0 Merge pull request #347 from xiemaisi/rc/1.18-master-merge
Mergeback rc/1.18 to master
2018-10-24 16:03:30 +01:00
Nate Nystrom
d228bd0b13 Fixed compilation error 2018-10-24 15:50:00 +02:00
Nate Nystrom
4ebfb019d8 ref to NumberFormatException.ql 2018-10-24 15:49:25 +02:00
Nate Nystrom
8228b46223 test case for NumberFormatException 2018-10-24 15:48:56 +02:00
Jonas Jensen
3c6bed4de6 C++: FP fix for "operator= doesn't return *this" 2018-10-24 15:44:00 +02:00
Jonas Jensen
47a548f564 C++: FP test for "operator= doesn't return *this"
This rule should not apply to functions that never return.
2018-10-24 15:42:39 +02:00
Nate Nystrom
d04fde7157 Fixed compilation error. 2018-10-24 15:27:23 +02:00
Anders Schack-Mulligen
1d716ae461 Java: Add remote user input sources for Spring servlets. 2018-10-24 15:00:15 +02:00
Anders Schack-Mulligen
263de5219a Java: Add additional SQL injection sinks. 2018-10-24 13:58:21 +02:00
semmle-qlci
21ff87d6a3 Merge pull request #353 from xiemaisi/js/port-tests
Approved by asger-semmle, esben-semmle
2018-10-24 12:47:48 +01:00
Jonas Jensen
fc2b64a8b3 C++: Add C++ analysis team to CODEOWNERS
We previously removed our entry because the notifications got too noisy,
but we agreed recently in the C++ analysis team to try adding an entry
with just the analysis team and only in the public repository.
2018-10-24 11:58:37 +02:00
Tom Hvitved
97904eb202 Revert "JavaScript: Patch CFG to improve support for non-top level import declarations."
This reverts commit f05e777e64.
2018-10-24 10:45:57 +01:00
Max Schaefer
9a856935db Merge remote-tracking branch 'upstream/rc/1.18' into rc/1.18-master-merge 2018-10-24 10:43:37 +01:00
Max Schaefer
f103b1a371 JavaScript: Copy over a test left in internal repo.
This test seems to have been accidentally committed into the old location in the internal repo.
2018-10-24 08:40:54 +01:00
Jonas Jensen
7affbe4a7d Merge pull request #341 from geoffw0/av_114
CPP: Improve AV Rule 114.ql's understanding of return types.
2018-10-24 09:39:51 +02:00
Dave Bartolomeo
f278f4fa47 C++: Operands as IPA types
@rdmarsh2 has been working on various queries and libraries on top of the IR, and has pointed out that having to always refer to an operand of an instruction by the pair of (instruction, operandTag) makes using the IR a bit clunky. This PR adds a new `Operand` IPA type that represents an operand of an instruction. `OperandTag` still exists, but is now an internal type used only in the IR implementation.
2018-10-23 14:58:44 -07:00
Jonas Jensen
640de0c947 Merge pull request #304 from geoffw0/resource-released
CPP: Fix false positive in AV Rule 79.ql
2018-10-23 20:24:23 +02:00
Nate Nystrom
e174ca6ed8 Query for uncaught NumberFormatException 2018-10-23 19:03:15 +02:00
semmledocs-ac
1f390f2f77 Merge pull request #326 from rdmarsh2/rdmarsh/cpp/dead-code-goto
C++: new query for dead code after goto or break
2018-10-23 16:55:14 +01:00
Geoffrey White
dda7069890 CPP: Look for destructors in the template. 2018-10-23 13:05:43 +01:00
Geoffrey White
76a5072c8b CPP: Change in results presumed to result from discover_walk extractor changes. 2018-10-23 13:05:43 +01:00
Geoffrey White
982fd522f1 CPP: Change note. 2018-10-23 13:05:43 +01:00
Geoffrey White
905336a625 CPP: Refine fix. 2018-10-23 13:05:42 +01:00
Geoffrey White
b861df0887 CPP: Fix issue when destructor body is missing. 2018-10-23 13:05:42 +01:00
Geoffrey White
5931a978dc CPP: Add a test of a template instantiation where the destructor is never called. 2018-10-23 13:05:42 +01:00
Geoffrey White
f20af4906b CPP: Add a test of a Shutdown / Clear method. 2018-10-23 13:05:42 +01:00
semmle-qlci
b1a463bf93 Merge pull request #349 from hvitved/csharp/extractor/no-global-json
Approved by calumgrant
2018-10-23 12:00:28 +01:00
Tom Hvitved
a3fafd9ad1 C#: Remove global.json 2018-10-23 11:51:27 +02:00
Aditya Sharad
c88db424fa Merge pull request #343 from geoffw0/av-35-1.18
CPP: Fix hasXMacro performance.
2018-10-23 10:24:16 +01:00
Max Schaefer
3522200e90 Merge pull request #342 from xiemaisi/rc/1.18-cherry-picks
JavaScript: 1.18.1 cherry-picks
2018-10-22 20:03:22 +01:00
Geoffrey White
de1556042a CPP: Fix hasXMacro performance. 2018-10-22 19:43:04 +01:00
Robert Marsh
f674d43ab1 Merge pull request #329 from geoffw0/overflowdest
CPP: Improve Overflowdest.ql
2018-10-22 10:51:41 -07:00
Robert Marsh
7bcc4379fc C++: accept loops with arbitrary labels or cases 2018-10-22 09:59:49 -07:00
Robert Marsh
4bed86f566 Merge pull request #313 from geoffw0/av-35
CPP: Fix hasXMacro performance.
2018-10-22 09:33:19 -07:00
Max Schaefer
212edc2e18 Merge pull request #307 from esben-semmle/js/unused-import
JS: make js/unused-local-variable flag import statements
2018-10-22 13:13:02 +01:00
Tom Hvitved
135271e9ad Merge pull request #287 from calumgrant/cs/lock-order
C#: Improvements to cs/inconsistent-lock-sequence
2018-10-22 14:11:20 +02:00
Max Schaefer
7702b58794 Merge pull request #305 from asger-semmle/json-taint-kind
JS: Add flow label for tainted objects and sharpen NosqlInjection
2018-10-22 11:58:50 +01:00
Dave Bartolomeo
dbae5c2d62 Update change-notes/1.19/analysis-cpp.md
Co-Authored-By: geoffw0 <geoffrey@semmle.com>
2018-10-22 11:50:18 +01:00
Max Schaefer
25224cc4a0 Revert "TypeScript: disable queries that rely on token information"
This reverts commit 003b600e24.
2018-10-22 11:06:11 +01:00
semmle-qlci
c78f3f8edf Merge pull request #336 from aschackmull/java/dataflow-cleanup
Approved by yh-semmle
2018-10-20 03:43:49 +01:00
semmle-qlci
465a55f8ac Merge pull request #333 from aschackmull/java/useless-comp-concurrent
Approved by yh-semmle
2018-10-20 01:37:13 +01:00
Raul Garcia
d5ed332bf5 Merge branch 'users/raulga/c6293a' of https://github.com/raulgarciamsft/ql into users/raulga/c6293a 2018-10-19 15:22:33 -07:00
Raul Garcia
2f4da8841f Changing the name (file & tags) to match the JS version. 2018-10-19 15:21:56 -07:00
Geoffrey White
ebeda2fb99 CPP: Change note. 2018-10-19 22:55:09 +01:00
Geoffrey White
5158984613 CPP: Fix the issue. 2018-10-19 22:51:35 +01:00
Geoffrey White
c97a5ed292 CPP: Add tests of AV Rule 114.ql with non-trivial return types. 2018-10-19 22:49:53 +01:00
calum
8c29d0eb0a C#: Address review comments. 2018-10-19 18:13:03 +01:00
calum
5a4af0c2b2 C#: Update test case for LockOrder. 2018-10-19 18:13:03 +01:00
calum
aab30ade93 C#: Restrict nested locks to static variables, and report the variable itself as well as the lock sequences in order to handle large numbers of results. 2018-10-19 18:13:03 +01:00
calum
4200c5b57c C#: Analysis change notes. 2018-10-19 18:13:03 +01:00
calum
5864e57398 C#: Improvements to LockOrder.ql. Detect inter-procedural locks, and tidy up the tests. 2018-10-19 18:11:49 +01:00
calum
61232cb08e C#: Address review comments in QL. 2018-10-19 16:33:04 +01:00
calum
6e96fba7f6 C#: Address review comments: Merge XML index commands. 2018-10-19 16:14:35 +01:00
Asger F
b72e2aa602 JS: address comments and introduce LabeledBarrierGuardNode 2018-10-19 15:26:52 +01:00
Anders Schack-Mulligen
6f11849fef Java: Add test. 2018-10-19 15:02:52 +02:00
Tom Hvitved
a683990bfd C#: Add change note 2018-10-19 14:42:03 +02:00
Tom Hvitved
515d6b6d26 C#: Detect constantly failing assertions in the CFG 2018-10-19 14:07:40 +02:00
Tom Hvitved
acea4ddfc4 C#: Introduce control flow exit completions 2018-10-19 14:07:35 +02:00
Tom Hvitved
0c1db6afc3 C#: Add more CFG tests
Added tests for exits inside `try` statements and constantly failing assertions.
2018-10-19 14:05:30 +02:00
Tom Hvitved
b233961a9a C#: Add assertion tests 2018-10-19 14:05:30 +02:00
calumgrant
6811d527e1 Merge pull request #327 from hvitved/csharp/compiler-flag-linux
C#: Pass `--compiler` flag to extractor on Linux
2018-10-19 11:18:46 +01:00
Geoffrey White
e9499b59e4 CPP: Exclude switch statements. 2018-10-19 10:24:29 +01:00
Geoffrey White
298ead162d CPP: Add more test cases for HResultBooleanConversion.ql. 2018-10-19 10:24:29 +01:00
Tom Hvitved
826d15e6c1 C#: Address review comments 2018-10-19 10:42:13 +02:00
Esben Sparre Andreasen
2e49cd117a JS: avoid flagging early returns in js/user-controlled-bypass
(cherry picked from commit ffbbb807f4)
2018-10-19 08:30:03 +01:00
Asger F
f9634040b0 TypeScript: add test case with mixed rescanned tokens
(cherry picked from commit 057af7c865)
2018-10-19 08:30:03 +01:00
Asger F
39c788f4f1 TypeScript: test case for tokens starting with ">"
(cherry picked from commit d3a1df644c)
2018-10-19 08:30:03 +01:00
Asger F
2abe34b2f9 TypeScript: test case for whitespace before a rescanned token
(cherry picked from commit a199035a05)
2018-10-19 08:30:03 +01:00
Asger F
cbf06ae74d TypeScript: test case for tokenization of template literals
(cherry picked from commit 9146cc26bd)
2018-10-19 08:30:03 +01:00
Asger F
4d7e762629 TS: test case for type expansion through type parameter bound
(cherry picked from commit 8bc92bd534)
2018-10-19 08:30:03 +01:00
Max Schaefer
374fd597d7 JavaScript: Reinstate override.
(cherry picked from commit df5a8651c3)
2018-10-19 08:30:03 +01:00
Max Schaefer
b0425a298c JavaScript: Eliminate slow antijoin predicate.
(cherry picked from commit 0cfd04dfa2)
2018-10-19 08:30:03 +01:00
Max Schaefer
5167d43fbc JavaScript: Refactor AnalyzedPropertyWrite::writes to enable correct modelling of variable exports.
(cherry picked from commit 080f974663)
2018-10-19 08:30:03 +01:00
Max Schaefer
898ba94837 JavaScript: Address review comments.
(cherry picked from commit 6835815673)
2018-10-19 08:30:03 +01:00
Max Schaefer
2b7d69aaf4 JavaScript: Add support for Google Cloud Spanner.
(cherry picked from commit cd284b2f97)
2018-10-19 08:30:03 +01:00
Tom Hvitved
b282444740 Revert "JavaScript: Patch CFG to improve support for non-top level import declarations."
This reverts commit f05e777e64.
2018-10-19 08:30:03 +01:00
Max Schaefer
5e75a62f5c JavaScript: Add test case for type inference in the presence of non-toplevel imports.
(cherry picked from commit 8b7bb8cecc)
2018-10-19 08:30:03 +01:00
Max Schaefer
e683b51611 JavaScript: Generalise code that assumes imports only appear at the toplevel.
(cherry picked from commit db32dc2bdf)
2018-10-19 08:30:03 +01:00
Max Schaefer
de108a843d JavaScript: Patch CFG to improve support for non-top level import declarations. 2018-10-19 08:30:03 +01:00
Raul Garcia
8138a3be07 Update .gitignore 2018-10-18 14:45:09 -07:00
Raul Garcia
e2fcaa9e20 Fixing typos & implementing the PR feedback 2018-10-18 14:44:24 -07:00
Robert Marsh
36a1ac52ac Merge pull request #331 from geoffw0/av-35b
CPP: Speed up startsWithIfndef.
2018-10-18 14:22:37 -07:00
Dave Bartolomeo
ce99f469a9 Update cpp/ql/src/Likely Bugs/Likely Typos/illDefinedForLoop.ql 2018-10-18 12:02:06 -07:00
Nick Rolfe
121596dfe6 Merge pull request #317 from ian-semmle/discover_walk
C++: Test changes for discover_walk
2018-10-18 16:51:23 +01:00
semmle-qlci
4dd868fb3d Merge pull request #334 from aschackmull/java/autoformat-rangeanalysis
Approved by yh-semmle
2018-10-18 15:38:33 +01:00
Anders Schack-Mulligen
0b46ffa7d7 Java/CPP: Sync files. 2018-10-18 15:10:23 +02:00
Anders Schack-Mulligen
bf58b6c9ab Java: Remove self-ref tracking; improve AccessPath.toString on numbers. 2018-10-18 15:05:04 +02:00
Ian Lynagh
ef1552339e C++: Enhance MagicConstantsNumbers test 2018-10-18 12:36:42 +01:00
Ian Lynagh
894a37ccda C++: Accept test changes 2018-10-18 12:36:42 +01:00
Ian Lynagh
1b7961367a C++: Enhance a test 2018-10-18 12:36:42 +01:00
Esben Sparre Andreasen
9c2ca9a7fa JS: make js/unused-local-variable flag import statements 2018-10-18 11:49:45 +02:00
Esben Sparre Andreasen
c65bc5cc90 JS: add Util::pluralize, also add tests for Util::capitalize 2018-10-18 11:49:28 +02:00
calum
ee396af385 C#: Update analysis change notes. 2018-10-18 10:24:28 +01:00
calum
5ad060c1be C#: qhelp for VulnerablePackage. 2018-10-18 10:24:20 +01:00
calum
ff3ed2db18 C#: Autobuilder extracts XML for .csproj and .props files. 2018-10-18 10:24:20 +01:00
calum
3de1f3b101 C#: Query and qltest for VulnerablePackage. 2018-10-18 10:23:51 +01:00
Anders Schack-Mulligen
187918396c Java: Autoformat the last 5 files (RangeAnalysis). 2018-10-18 10:03:08 +02:00
Anders Schack-Mulligen
0c37ea876d Java: Fix FPs for concurrent modification checks. 2018-10-18 09:44:26 +02:00
semmle-qlci
3af91d5d0a Merge pull request #301 from aschackmull/java/modulus-analysis
Approved by yh-semmle
2018-10-18 08:24:32 +01:00
Raul Garcia
8eaba03506 Update .gitignore 2018-10-17 16:28:01 -07:00
Raul Garcia
f99756c07f Update .gitignore 2018-10-17 16:27:42 -07:00
Raul Garcia
739804acb2 CPP : Ill-defined for-loop (C6293)
Superset of C6293, it looks for a mismatch between the initialization statement && condition and the direction of the iteration expression in a for loop.
2018-10-17 16:24:34 -07:00
Robert Marsh
b40219bb01 C++: add good example for DeadCodeGoto 2018-10-17 11:58:51 -07:00
Robert Marsh
17537bb88b C++: respond to doc comments 2018-10-17 11:57:54 -07:00
calumgrant
0ddb7027ee Merge pull request #284 from hvitved/csharp/null-guards
C#: Teach null-guards library about pattern matching
2018-10-17 17:49:51 +01:00
Geoffrey White
6e10f39612 Merge pull request #319 from raulgarciamsft/users/raulga/c6277
C++ : NULL application name with an unquoted path in call to CreateProcess
2018-10-17 17:36:59 +01:00
Geoffrey White
b8d7292b46 CPP: Speed up startsWithIfndef. 2018-10-17 15:26:05 +01:00
Anders Schack-Mulligen
3dc9071a44 Java: Add missing word in deprecation comments. 2018-10-17 15:59:52 +02:00
Geoffrey White
757107660f CPP: Give the query a precision. 2018-10-17 13:25:44 +01:00
Geoffrey White
48c56cf744 CPP: Remove PointsTo. 2018-10-17 13:25:43 +01:00
Geoffrey White
99374301b8 CPP: Use taint library. 2018-10-17 13:25:43 +01:00
Geoffrey White
e77f3eb5b8 CPP: Simplify slightly. 2018-10-17 13:25:43 +01:00
Geoffrey White
939a836393 CPP: Add some comments. 2018-10-17 13:25:43 +01:00
Geoffrey White
f85889d052 CPP: Fix the example code. 2018-10-17 13:25:43 +01:00
semmle-qlci
d976168b59 Merge pull request #328 from hvitved/mergeback-2018-10-17
Approved by adityasharad, xiemaisi
2018-10-17 12:53:41 +01:00
Tom Hvitved
58a0815033 Merge remote-tracking branch 'upstream/master' into mergeback-2018-10-17 2018-10-17 13:24:37 +02:00
Arthur Baars
749206a9ce Merge pull request #324 from hvitved/lgtm-yml
Add `.lgtm.yml` file
2018-10-17 13:24:20 +02:00
Max Schaefer
6a75ebbae2 JavaScript: Update model of DOMException.
cf. https://developer.mozilla.org/en-US/docs/Web/API/DOMException/DOMException

(cherry picked from commit 8cc7f5c242)
2018-10-17 11:38:29 +01:00
Max Schaefer
d57e93d5c6 JavaScript: Fix typo in query help.
(cherry picked from commit 1ab943c16b)
2018-10-17 11:38:29 +01:00
Tom Hvitved
976e5ed80f C#: Pass --compiler flag to extractor on Linux 2018-10-17 10:25:53 +02:00
Tom Hvitved
8158d456f3 C#: Use hashing to detect duplicate trap files 2018-10-17 10:25:05 +02:00
semmle-qlci
1da873e819 Merge pull request #315 from esben-semmle/js/conditional-bypass-early-return
Approved by xiemaisi
2018-10-17 08:25:55 +01:00
Robert Marsh
61f338449c C++: Change note and precision for DeadCodeGoto.ql 2018-10-16 15:40:59 -07:00
Robert Marsh
73cae5390e C++: new query for dead code after goto or break 2018-10-16 15:37:06 -07:00
Tom Hvitved
29f655b0dc Add .lgtm.yml file 2018-10-16 20:43:44 +02:00
Raul Garcia
7ab723ae79 Fixing typos & incorporating feedback.
(MSFT feedback) Adding a new tag in the header @msrc.severity important
2018-10-16 10:00:51 -07:00
semmle-qlci
6172c95e60 Merge pull request #320 from geoffw0/deprecated
Approved by yh-semmle
2018-10-16 15:45:06 +01:00
calumgrant
2836743c03 Merge pull request #322 from hvitved/csharp/compiler-settings
C#: Add `csharp-compiler-settings` files
2018-10-16 13:36:06 +01:00
semmle-qlci
e55eaefded Merge pull request #310 from esben-semmle/js/additional-client-request-data-nodes
Approved by xiemaisi
2018-10-16 12:59:22 +01:00
Esben Sparre Andreasen
2881649310 JS: add js/command-line-injection heuristic source: JSON.stringify() 2018-10-16 13:56:06 +02:00
semmle-qlci
e319159a59 Merge pull request #316 from xiemaisi/js/odasa-7355-workaround
Approved by esben-semmle
2018-10-16 12:47:58 +01:00
Anders Schack-Mulligen
26009065af Java: Fix regression. 2018-10-16 11:29:15 +02:00
Esben Sparre Andreasen
870811a509 JS: change note for improved ClientRequests (overdue) 2018-10-16 08:51:32 +02:00
Esben Sparre Andreasen
c7fe96d4bd JS: implement getADataNode for Electron::ClientRequest 2018-10-16 08:51:32 +02:00
Esben Sparre Andreasen
e7836d74ab JS: implement getADataNode for NodeHttpUrlRequest 2018-10-16 08:51:32 +02:00
Esben Sparre Andreasen
3c07b4faf1 JS: implement getADataNode for SuperAgentUrlRequest 2018-10-16 08:51:32 +02:00
Esben Sparre Andreasen
eef0b8c94d JS: implement getADataNode for GotUrlRequest 2018-10-16 08:51:32 +02:00
Esben Sparre Andreasen
977b287129 JS: implement getADataNode for FetchUrlRequest 2018-10-16 08:51:30 +02:00
Esben Sparre Andreasen
c21a0472d4 JS: implement getADataNode for AxiosUrlRequest 2018-10-16 08:50:56 +02:00
Esben Sparre Andreasen
1e115bce2c JS: add SourceNode support for chained method calls 2018-10-16 08:48:09 +02:00
Esben Sparre Andreasen
ffbbb807f4 JS: avoid flagging early returns in js/user-controlled-bypass 2018-10-16 08:39:59 +02:00
Max Schaefer
df5a8651c3 JavaScript: Reinstate override. 2018-10-16 07:31:28 +01:00
semmle-qlci
1e7696664e Merge pull request #302 from xiemaisi/js/google-spanner
Approved by esben-semmle
2018-10-16 06:48:43 +01:00
Raul Garcia
22d54801e5 Removed one false-positive scenario (no space on lpCommandLine)
Improved the query to avoid multiple calls to hasGlobalName
Fixed typos
Simplified the test case file
2018-10-15 15:53:02 -07:00
Raul Garcia
cd5e788aa7 Update UnsafeCreateProcessCall.ql 2018-10-15 13:41:21 -07:00
Raul Garcia
1d853691eb Update UnsafeCreateProcessCall.qhelp 2018-10-15 13:40:40 -07:00
Raul Garcia
b8f8c99529 Update UnsafeCreateProcessCall.qhelp 2018-10-15 13:39:46 -07:00
Raul Garcia
bc398733b3 Update .gitignore 2018-10-15 13:38:00 -07:00
Max Schaefer
6835815673 JavaScript: Address review comments. 2018-10-15 20:14:40 +01:00
semmle-qlci
7543fa4a10 Merge pull request #298 from asger-semmle/partial-calls-merged
Approved by xiemaisi
2018-10-15 14:58:22 +01:00
Tom Hvitved
0754abc03f C#: Add csharp-compiler-settings files 2018-10-15 13:14:40 +02:00
Tom Hvitved
5548524a39 Merge pull request #321 from esben-semmle/js/newlines-csharp
C#: use unix newlines in analysis-csharp.md
2018-10-15 12:39:34 +02:00
Esben Sparre Andreasen
2652ba78d7 C#: use unix newlines in analysis-csharp.md 2018-10-15 12:08:41 +02:00
Tom Hvitved
603c3d6a43 C#: Teach null-guards library about pattern matching 2018-10-15 10:55:16 +02:00
Geoffrey White
ff34ae2a46 CPP: Add deprecated metadata. 2018-10-15 08:56:49 +01:00
Raul Garcia
242d40369b Merge branch 'master' into users/raulga/c6277 2018-10-12 15:59:54 -07:00
Raul Garcia
85283d63ce C++ : NULL application name with an unquoted path in call to CreateProcess
Calling a function of the CreatePorcess* family of functions, which may result in a security vulnerability if the path contains spaces.
2018-10-12 15:57:01 -07:00
semmle-qlci
a8be7f2434 Merge pull request #312 from aschackmull/java/autoformat-libs
Approved by yh-semmle
2018-10-12 20:02:52 +01:00
Geoffrey White
a9b55534b4 CPP: Speed up phi_node > frontier_phi_node > ssa_defn recursion. 2018-10-12 18:11:53 +01:00
semmle-qlci
9ec52a43ee Merge pull request #308 from aschackmull/java/autoformat-queries
Approved by yh-semmle
2018-10-12 17:43:02 +01:00
Max Schaefer
0cfd04dfa2 JavaScript: Eliminate slow antijoin predicate. 2018-10-12 13:01:01 +01:00
Max Schaefer
080f974663 JavaScript: Refactor AnalyzedPropertyWrite::writes to enable correct modelling of variable exports. 2018-10-12 13:00:52 +01:00
Anders Schack-Mulligen
22c986af77 Java: Autoformat. 2018-10-12 13:44:55 +02:00
Anders Schack-Mulligen
11279d4c83 Java: Autoformat Overflow.qll and add comment about imprecise float. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
0f5a3d3bb7 Java: Adjust comment style. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
2f0b983335 Java: Autoformat most of semmle.code.java. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
bc7ea93608 Java: Adjust some comment positions and break some lines. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
5502db4c74 Java: Autoformat most of semmle.code.java.dataflow. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
f341aa79a3 Java/C: Sync dataflow copies. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
3cdcbf0129 Java: Autoformat DataFlowImpl.qll and DataFlowImplCommon.qll. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
815c245f44 Java: Adjust comment style. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
bf63139c16 Java: Autoformat semmle.code.java.controlflow. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
291fb11c48 Java: Autoformat semmle.code.java.dispatch. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
89828b8284 Java: Autoformat semmle.code.java.metrics. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
9ebc294ee2 Java: Adjust comment style. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
f3d65c0ef9 Java: Autoformat semmle.code.java.deadcode. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
9009a50227 Java: Adjust comment style. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
e781990960 Java: Autoformat semmle.code.java.security. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
c6c6e4319d Java: Undo autoformat bug. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
ade293407b Java: Adjust comment style. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
24f30999a4 Java: Autoformat semmle.code.java.frameworks. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
482733569a Java: Adjust comment style. 2018-10-12 13:40:32 +02:00
Anders Schack-Mulligen
67d1c72e64 Java: Autoformat libs outside semmle.code.java. 2018-10-12 13:40:32 +02:00
Geoffrey White
6fc5ff53d7 CPP: Speed up getBufferSize. 2018-10-12 12:34:22 +01:00
Geoffrey White
3b8c72bf1e Merge pull request #303 from jbj/UnsignedGEZero-templates
C++: Suppress UnsignedGEZero.ql in template instantiations
2018-10-12 09:43:48 +01:00
Anders Schack-Mulligen
03c80c18d6 Java: Update location in .expected file. 2018-10-12 10:08:24 +02:00
semmle-qlci
16b29b2d08 Merge pull request #299 from asger-semmle/nosql-sinks
Approved by xiemaisi
2018-10-12 07:12:05 +01:00
semmle-qlci
44fd18c4a9 Merge pull request #309 from aschackmull/java/fix-some-lib-qldoc
Approved by yh-semmle
2018-10-11 21:35:33 +01:00
semmle-qlci
76af2d2e3d Merge pull request #249 from hvitved/csharp/cfg/boolean-splitting
Approved by calumgrant
2018-10-11 20:14:37 +01:00
Geoffrey White
9d5e674fc5 CPP: Fix hasXMacro performance. 2018-10-11 16:42:36 +01:00
calumgrant
f2663d43aa Merge pull request #311 from hvitved/mergeback-2018-10-11
Merge master into next
2018-10-11 14:40:33 +01:00
Tom Hvitved
b29b314f4e Merge remote-tracking branch 'upstream/master' into mergeback-2018-10-11 2018-10-11 14:36:44 +02:00
Tom Hvitved
98db3f89c2 C#: Extend pre-SSA consistency tests 2018-10-11 13:59:06 +02:00
Tom Hvitved
68dae60927 Merge pull request #295 from calumgrant/cs/extractor/open-source
C#: Open-source extractor
2018-10-11 13:57:16 +02:00
Asger F
da3e960e39 JS: address review comments 2018-10-11 12:45:45 +01:00
Tom Hvitved
cc14328be5 C#: Add change note 2018-10-11 13:20:24 +02:00
Felicity Chapman
e2629728ba Merge pull request #235 from jbj/hresult-boolean-qhelp
C++: Finalise docs for cpp/hresult-boolean-conversion and cpp/unsafe-dacl-security-descriptor
2018-10-11 11:02:17 +01:00
Anders Schack-Mulligen
73f1beecfd Java: Fix likely bug in ExposeRepresentation and re-autoformat. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
6a8a27201e Java: Autoformat ExposeRepresentation, revealing likely bug. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
236c79b561 Java: Adjust comment position and re-autoformat. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
c16f0df823 Java: Autoformat 1. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
e291b5ec2b Java: Break line and re-autoformat. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
62e942bb8b Java: Autoformat 1. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
62ef811169 Java: Autoformat. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
766b07ba59 Java: Adjust comment style. 2018-10-11 11:31:38 +02:00
Anders Schack-Mulligen
dd5a8f0c14 Java: Autoformat most queries. 2018-10-11 11:31:37 +02:00
calum
a06c8bd2f5 C#: Address review comments. 2018-10-11 10:28:34 +01:00
Anders Schack-Mulligen
1a66f7e249 Java: Add change note. 2018-10-11 11:27:53 +02:00
Anders Schack-Mulligen
ca8ca55828 Java: Deprecate ParityAnalysis. 2018-10-11 11:26:17 +02:00
Anders Schack-Mulligen
5c53249612 Java: Add ModulusAnalysis. 2018-10-11 11:26:17 +02:00
Anders Schack-Mulligen
e7b0d399d1 Java: Refactor parts of RangeAnalysis needed for ModulusAnalysis. 2018-10-11 11:26:17 +02:00
Anders Schack-Mulligen
a78a0b52ec Java: Add test. 2018-10-11 11:26:17 +02:00
Anders Schack-Mulligen
8659bedbd9 Java: Extract Bound class to its own file. 2018-10-11 11:26:17 +02:00
Anders Schack-Mulligen
6dfbb72fc8 Java: Add constant array lengths to ConstantIntegerExpr. 2018-10-11 11:26:16 +02:00
Anders Schack-Mulligen
85cca69721 Merge pull request #220 from yh-semmle/java/update-tests
Java: refine `java/unreachable-catch-clause`
2018-10-11 11:12:15 +02:00
Anders Schack-Mulligen
fc359b75d3 Java: Add qldoc to a few libraries. 2018-10-11 11:05:39 +02:00
Max Schaefer
cd284b2f97 JavaScript: Add support for Google Cloud Spanner. 2018-10-11 09:30:39 +01:00
semmle-qlci
6a03bd8f5c Merge pull request #300 from esben-semmle/js/http-file-access-polish
Approved by asger-semmle
2018-10-11 09:00:00 +01:00
yh-semmle
c1473f5425 Java: add query ID in change note for java/unreachable-catch-clause 2018-10-10 19:16:57 -04:00
Asger F
9b10254cd4 JS: support label-specific sanitizer guards 2018-10-10 18:27:14 +01:00
calumgrant
e6e4502cdb Merge pull request #148 from aschackmull/docs/ql-style-guide
QL style guide: Clarify some outstanding issues
2018-10-10 18:22:05 +01:00
Asger F
5e720486d5 JS: recognize req.query.x as deep object taint 2018-10-10 17:15:56 +01:00
Asger F
d72d7345b8 JS: make NosqlInjection use object taint 2018-10-10 17:05:59 +01:00
Asger F
b70f70f722 JS: Add TaintedObject flow label library 2018-10-10 17:05:59 +01:00
Asger F
396ad336a3 JS: add RemoteFlowSource.isDeepObject() and populate it 2018-10-10 17:05:59 +01:00
Asger F
46b2015065 JS: fix an outdated comment 2018-10-10 17:05:59 +01:00
Asger F
03b479114f JS: preserve document.url label out of .href property 2018-10-10 17:05:59 +01:00
Asger F
ea297dd442 JS: bugfix in handling of custom flow labels 2018-10-10 16:06:44 +01:00
Jonas Jensen
a10c3bcffb C++: Suppress UnsignedGEZero in template inst.
It still runs on uninstantiated templates because its underlying
libraries do. It's not clear whether that leads to other false
positives, but that's independent of the change I'm making here.
2018-10-10 17:06:24 +02:00
Jonas Jensen
383dafac5c C++: Test for UnsignedGEZero with templates 2018-10-10 17:04:35 +02:00
Anders Schack-Mulligen
99846474eb QL style guide: Adjust style rules for if-then-else. 2018-10-10 16:42:34 +02:00
Anders Schack-Mulligen
31e1706c98 QL style guide: Address some review comments. 2018-10-10 16:42:34 +02:00
Anders Schack-Mulligen
6feb1d0766 QL style guide: Clarify some outstanding issues. 2018-10-10 16:42:34 +02:00
Esben Sparre Andreasen
6687dfd558 JS: improve model of express' req.sendFile 2018-10-10 15:46:43 +02:00
calum
518c901ddc C#: Merge latest changes. 2018-10-10 14:40:52 +01:00
calum
103d140e71 C#: Migrate extractor to this repository. 2018-10-10 14:40:52 +01:00
Esben Sparre Andreasen
358b6c3413 JS: change "remote request" to "network request" 2018-10-10 15:34:39 +02:00
Esben Sparre Andreasen
e93545d16e JS: address more review comments 2018-10-10 15:28:42 +02:00
Jonas Jensen
3e022ad36f Merge pull request #270 from geoffw0/negindex
CPP: Improvements to Buffer.qll
2018-10-10 14:59:41 +02:00
Esben Sparre Andreasen
c885490c7e JS: address review comments 2018-10-10 12:18:30 +02:00
Esben Sparre Andreasen
6b8fd49fba JS: add change notes for two new queries 2018-10-10 12:17:46 +02:00
Esben Sparre Andreasen
0da1ac4d75 JS: naming and documentation cleanup for NodeJS file system accesses 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
64b0d39390 JS: polish HttpToFileAccess.qll 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
df72492f16 JS: polish FileAccessToHttp.qll 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
43f98a7ef8 JS: refactor NodeJSFileSystemRead* to FileStreamRead 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
30f7f41dff JS: refactor NodeJSFileSystemWrite to FileStreamWrite 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
e99b9d34c5 JS: polish characters of NodeJSFileSystemAccess*Call 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
4e4597a24d JS: replace HTTP::RequestBody with ClientRequest.getADataNode 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
0fc56e443e JS: introduce ClientRequest.getADataNode 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
3b2440e850 JS: remove useless externs definitions for tests 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
a3ec739210 JS: restructure FileSystemWriteAccess/FileSystemReadAccess API 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
b00aa36cdc JS: polish HttpToFileAccess.ql 2018-10-10 12:12:54 +02:00
Esben Sparre Andreasen
d261915598 JS: polish FileAccessToHttp.ql 2018-10-10 12:12:54 +02:00
Asger F
74f115fa40 JS: add test case 2018-10-10 10:46:40 +01:00
Asger F
2a87d53db4 JS: Add additional Mongoose/MongoDB sinks 2018-10-10 10:11:18 +01:00
Tom Hvitved
c064b1f41d Merge pull request #103 from lukecartey/csharp/zipslip-update
C#: ZipSlip - Refine sanitizers
2018-10-10 10:47:23 +02:00
Asger F
4e7f171f54 JavaScript: do not cache AdditionalPartialInvokeNode 2018-10-10 09:40:49 +01:00
Max Schaefer
8d8148d58e Merge pull request #294 from asger-semmle/canonical-this-source
JS: Canonicalize 'this' in the data-flow graph
2018-10-10 08:10:53 +01:00
Max Schaefer
355786c2d8 Merge pull request #296 from esben-semmle/js/more-array-creation
JS: use DataFlow::ArrayCreationNode in additional places
2018-10-10 08:10:17 +01:00
yh-semmle
fa3b9a6997 Java: add change note for java/unreachable-catch-clause 2018-10-09 21:31:19 -04:00
yh-semmle
26b630f700 Java: clarify help for java/unreachable-catch-clause 2018-10-09 21:15:51 -04:00
yh-semmle
001b9f8b56 Java: account for generic exceptions in java/unreachable-catch-clause 2018-10-09 21:15:45 -04:00
semmle-qlci
b1ece81e13 Merge pull request #297 from xiemaisi/csharp/line-endings
Approved by hvitved
2018-10-09 21:30:05 +01:00
Jonas Jensen
4b59c0cb80 Merge branch 'master' into hresult-boolean-qhelp 2018-10-09 14:56:58 +02:00
Max Schaefer
2d8f424ce8 C#: Convert tests/query-tests/Stubs/Test.cs to Unix line endings. 2018-10-09 13:01:00 +01:00
semmle-qlci
2a9abcbb8c Merge pull request #279 from hvitved/csharp/type-conversion-performance
Approved by calumgrant
2018-10-09 10:15:53 +01:00
Jonas Jensen
95abf557ac Merge pull request #292 from hvitved/mergeback-2018-10-08
Merge master into next
2018-10-09 11:10:44 +02:00
Tom Hvitved
8df657c9f0 Merge pull request #217 from calumgrant/cs/make_stubs
C#: Tool to generate stubs for qltests
2018-10-09 09:59:53 +02:00
Asger F
9fb73f41c9 JS: rename ReactComponent::getAThisAccess -> getAThisNode 2018-10-09 08:54:44 +01:00
Asger F
fd58039753 JS: update additional QL test output 2018-10-09 08:54:14 +01:00
Asger F
e551ff3818 JS: add change note 2018-10-09 08:54:14 +01:00
Jonas Jensen
0e25649a5b Merge pull request #289 from geoffw0/change-notes
CPP: Additional change notes.
2018-10-09 09:53:44 +02:00
Asger F
030bae9454 JS: Canonicalize ThisNode 2018-10-09 08:53:41 +01:00
Asger F
3bc5e3bfdf JS: Replace some uses AnalyzedValueNode with AnalyzedNode 2018-10-09 08:53:41 +01:00
yh-semmle
7962530789 Java: add .project file in test directory 2018-10-08 20:25:43 -04:00
calum
2fdf766750 C#: Address review comments. 2018-10-08 17:26:30 +01:00
Geoffrey White
8163def3ae CPP: Alter the dataflow case. 2018-10-08 15:45:17 +01:00
Geoffrey White
8ab830f21c CPP: Allow multiple dataflow sources. 2018-10-08 15:45:17 +01:00
Geoffrey White
fe6c9f9ea2 CPP: Stricter dataflow in getBufferSize. 2018-10-08 15:45:17 +01:00
Geoffrey White
beb21f92d3 CPP: Separate the dataflow case from dynamic allocation. 2018-10-08 15:45:17 +01:00
Geoffrey White
ef8ca5de58 CPP: Replace def-use with dataflow in getBufferSize. 2018-10-08 15:45:17 +01:00
Geoffrey White
c747f24b39 CPP: Fix the initialized array case in getBufferSize. 2018-10-08 15:45:17 +01:00
Geoffrey White
03fd1ce83d CPP: Remove external/microsoft tag. 2018-10-08 15:30:43 +01:00
Tom Hvitved
ccebd5eb11 Merge remote-tracking branch 'upstream/master' into mergeback-2018-10-08 2018-10-08 16:23:29 +02:00
Tom Hvitved
546a91e192 Revert "JavaScript: Patch CFG to improve support for non-top level import declarations."
This reverts commit f05e777e64.
2018-10-08 16:20:40 +02:00
Max Schaefer
e354694173 Merge pull request #273 from asger-semmle/csrf-sources
JS: add RemoteFlowSource.isThirdPartyControllable()
2018-10-08 15:09:38 +01:00
Asger F
d2af4ab94a Merge pull request #227 from xiemaisi/js/taint-kinds
JavaScript: Add support for state-based taint tracking.
2018-10-08 15:09:12 +01:00
Esben Sparre Andreasen
70cd03d3bc JS: use DataFlow::ArrayCreationNode in additional places 2018-10-08 15:47:11 +02:00
Pavel Avgustinov
2904ebb8a3 Merge pull request #291 from jbj/mergeback-20181008
Mergeback rc/1.18 to master
2018-10-08 13:56:50 +01:00
Jonas Jensen
4e25929f82 Merge pull request #288 from geoffw0/widechartype
CPP: Address Widechartype / WChar_t
2018-10-08 13:46:28 +02:00
semmle-qlci
887daeca12 Merge pull request #290 from esben-semmle/js/autobind-classes
Approved by xiemaisi
2018-10-08 12:37:30 +01:00
Tom Hvitved
ff2abe0356 C#: Add qldoc to getTypeArgumentRanked() 2018-10-08 13:33:50 +02:00
Geoffrey White
4fb6611dbe CPP: Change note for #264. 2018-10-08 12:19:45 +01:00
Geoffrey White
f706d2a96c CPP: Change notes. 2018-10-08 12:19:45 +01:00
Tom Hvitved
49644bfb47 Merge remote-tracking branch 'upstream/master' into mergeback-2018-10-08 2018-10-08 11:48:56 +02:00
Jonas Jensen
799c034a5e Merge pull request #282 from rdmarsh2/rdmarsh/cpp/simple-range-analysis-caching
C++: add cached module to SimpleRangeAnalysis
2018-10-08 11:44:35 +02:00
Jonas Jensen
628540cf7b Merge remote-tracking branch 'upstream/rc/1.18' into mergeback-20181008 2018-10-08 09:55:31 +02:00
Jonas Jensen
0644e0ffb2 Merge pull request #286 from geoffw0/wrongtype16
CPP: Fix WrongTypeFormatArguments.ql char16_t * issues (and others)
2018-10-08 09:50:02 +02:00
Esben Sparre Andreasen
a668f906bc JS: recognize binding decorators on classes 2018-10-08 07:58:12 +02:00
Geoffrey White
e2a001f925 Merge pull request #285 from jbj/primitive-bb-joinorder
C++: Speed up primitive basic block calculation
2018-10-06 19:47:49 +01:00
Geoffrey White
e0140f9112 CPP: Change some uses of WideCharType to Wchar_t. 2018-10-05 22:03:47 +01:00
Geoffrey White
ecf8e5d936 CPP: Add backticks. 2018-10-05 21:42:16 +01:00
Geoffrey White
d649835f45 CPP: Add an explanatory comment on WideCharType and Wchar_t. 2018-10-05 21:41:35 +01:00
Robert Marsh
c0cf16ab2e C++: move expr predicactes to cached module 2018-10-05 09:34:16 -07:00
Geoffrey White
99816d77e3 CPP: Additional test case fixed in combination with typedef work. 2018-10-05 17:13:50 +01:00
Geoffrey White
998b28b359 CPP: Change note. 2018-10-05 16:52:06 +01:00
Geoffrey White
67a7b75b84 CPP: Simplify getAFormatterWideType. 2018-10-05 16:40:54 +01:00
Geoffrey White
605db444a6 CPP: Fix for consistency. 2018-10-05 16:40:54 +01:00
Geoffrey White
94ff2e5693 CPP: Lets just not report when we're not sure. 2018-10-05 16:40:54 +01:00
Geoffrey White
2841897e3a CPP: Make getAFormatterWideType more general and move it into FormattingFunction.qll. 2018-10-05 16:40:54 +01:00
Geoffrey White
580471ab1d CPP: Replace stripTopLevelSpecifiers to emulate old behaviour. 2018-10-05 16:40:54 +01:00
Geoffrey White
89c56486b5 CPP: Test getDefaultCharType etc. 2018-10-05 16:40:54 +01:00
Geoffrey White
e2be19b555 CPP: New mechanism for string types in printf.qll. 2018-10-05 16:40:54 +01:00
Geoffrey White
1af6c10888 CPP: Add a test where different word sizes are present. 2018-10-05 16:40:54 +01:00
Geoffrey White
800555865a CPP: More test cases. 2018-10-05 16:40:54 +01:00
Geoffrey White
2af56b89b1 CPP: Add a test where different wide types are present. 2018-10-05 15:32:36 +01:00
Geoffrey White
39f030b8f7 CPP: Annotate test. 2018-10-05 15:32:36 +01:00
Geoffrey White
e74721e3a4 CPP: Test fixes as a result of changes. 2018-10-05 15:32:36 +01:00
Geoffrey White
6e5207ce3c CPP: Allow declarations of library printf functions in source (repairs most of the tests). 2018-10-05 15:32:36 +01:00
Robert Marsh
fe8f7e9624 C++: consider attributes when finding wide string functions 2018-10-05 15:32:36 +01:00
Robert Marsh
5b8925c699 C++: document new predicate 2018-10-05 15:32:36 +01:00
Robert Marsh
a3459ddf08 C++: add support for custom wide character sizes
Certain Microsoft projects, such as CoreCLR and ChakraCore, use a
library called the PAL, which enables two-byte strings in the printf
family of functions, even when built on a platform with four-byte
strings. This adds support for determining the size of a wide character
from the definitions of such functions, rather than assuming that they
match the compiler's wchar_t.
2018-10-05 15:32:35 +01:00
Jonas Jensen
11e03b3161 C++: Fix primitive_basic_block_member join order
This predicate looked like a join of two already-computed predicates,
but it was a bit more complicated because the `*` operator expands into
two cases: the reflexive case and the transitive case. The join order
for the transitive case placed the `PrimitiveBasicBlock` charpred call
_after_ the `member_step+` call, which means that all the tuples of
`member_step+` passed through the pipeline.

This commit changes the implementation by fully writing out the
expansion of `*` into two cases, where the base case is manually
specialised to make sure the join orderer doesn't get tempted into
reusing the same strategy for both cases. This speeds up the predicate
from 2m38s to 1s on a snapshot of our own C/C++ code.
2018-10-05 14:26:04 +02:00
Jonas Jensen
265852058d C++: Faster implementation of BB entry node
The existing implementation of `primitive_basic_block_entry_node` was
"cleverly" computing two properties about `node` with a single
`strictcount`: whether `node` had multiple predecessors and whether any
of those predecessors had more than once successor. This was fast enough
on most snapshots, but on the snapshot of our own code it took 37
seconds to compute `primitive_basic_block_entry_node` and its auxiliary
predicates. This is likely to have affected other large snapshots too.

With this change, the property is computed like in our other languages,
and it brings the run time down to 4 seconds.
2018-10-05 14:20:03 +02:00
Robert Marsh
f3539e472c C++: add cached module to SimplerangeAnalysis 2018-10-04 15:25:10 -07:00
Jonas Jensen
4720c5ab60 Merge pull request #264 from raulgarciamsft/users/raulga/c6276
C++: incorrect string type conversion
2018-10-04 21:06:07 +02:00
Jonas Jensen
7691c0a345 Merge pull request #280 from pavgust/imp/use-in-own-init
UseInOwnInitialiser: Refactor logic slightly.
2018-10-04 20:25:36 +02:00
Max Schaefer
989a82fd1e Merge pull request #271 from asger-semmle/ts-expansive-types
TypeScript: test case for type expansion through function type parameter
2018-10-04 19:23:54 +01:00
semmle-qlci
03f2d8f605 Merge pull request #247 from aschackmull/java/dispatchflow-typepruning
Approved by yh-semmle
2018-10-04 18:22:44 +01:00
Robert Marsh
d6f6d67c13 Merge pull request #281 from kevinbackhouse/GlobalValueNumberingBugFix
Workaround for getFullyConverted returning multiple results.
2018-10-04 09:54:36 -07:00
Anders Schack-Mulligen
1c2807e5e7 Java: Add missing private annotations. 2018-10-04 17:33:10 +02:00
Kevin Backhouse
6df9bc855a Workaround for getFullyConverted returning multiple results. 2018-10-04 15:40:18 +01:00
Pavel Avgustinov
6d77a791ac UseInOwnInitialiser: Refactor logic slightly.
By pulling out the class `VariableAccessInInitialiser`, we can
avoid some redundant work on pathological databases, improving
performance.
2018-10-04 14:25:59 +01:00
semmle-qlci
262cb998fc Merge pull request #278 from hvitved/csharp/metrics-queries-xml
Approved by pavgust
2018-10-04 14:10:40 +01:00
semmle-qlci
98254e87e1 Merge pull request #132 from denislevin/denisl/js/HttpToFileAccessTest
Approved by xiemaisi
2018-10-04 14:06:46 +01:00
semmle-qlci
30412caa16 Merge pull request #276 from jbj/PointlessComparison-templates
Approved by kevinbackhouse
2018-10-04 12:34:52 +01:00
Asger F
8bc92bd534 TS: test case for type expansion through type parameter bound 2018-10-04 12:05:05 +01:00
Asger F
c2a5f99d9c JS: include referer header as reflected XSS source 2018-10-04 10:53:10 +01:00
Asger F
dc26bdc5e7 JS: Move isThirdPartyControllable into RequestInputAccess 2018-10-04 10:36:49 +01:00
Tom Hvitved
4ca10986cb C#: Remove queries.xml from the Metrics folder 2018-10-04 11:13:01 +02:00
Tom Hvitved
19215d0868 C#: Improve performance of type conversion library 2018-10-04 11:00:33 +02:00
Nick Rolfe
ae9b492b33 Merge pull request #277 from jbj/missing-return-high
C++: Make cpp/missing-return visible on LGTM again
2018-10-04 09:45:34 +01:00
semmle-qlci
bea86e52fb Merge pull request #275 from xiemaisi/js/workaround-for-nested-imports
Approved by asger-semmle
2018-10-04 08:25:52 +01:00
Raul Garcia
3873cbdde0 Chnaging the @name & @description. 2018-10-03 15:32:34 -07:00
Max Schaefer
335adee69c JavaScript: Add change note. 2018-10-03 16:03:12 +01:00
Max Schaefer
e326dd4688 JavaScript: Add TaintKind as an alias to FlowLabel. 2018-10-03 15:54:58 +01:00
Max Schaefer
86ee58d019 JavaScript: Address review comments. 2018-10-03 15:49:02 +01:00
Max Schaefer
a8a8754c89 JavaScript: Restrict default sink flow labels to StandardFlowLabel. 2018-10-03 15:49:02 +01:00
Max Schaefer
5727b2a5f4 JavaScript: Properly handle value-preserving paths.
When constructing a path through a property write/read pair, we want to make sure that we only use value-preserving steps to track the base object. However, the value flowing in from the right-hand side of the assignment may have a different flow label (such as `taint()`), so we cannot use the normal `append` predicate to construct the composite path.
2018-10-03 15:49:02 +01:00
Max Schaefer
910d6de47d JavaScript: Add new tests. 2018-10-03 15:49:02 +01:00
Max Schaefer
3affe922e3 JavaScript: Make PathSummary.toString more useful. 2018-10-03 15:49:02 +01:00
Max Schaefer
dad13c9b64 JavaScript: Simplify onPath predicate. 2018-10-03 15:49:02 +01:00
Max Schaefer
8d471f01ef JavaScript: Simplify a few helper predicates. 2018-10-03 15:49:02 +01:00
Max Schaefer
017ae4990d JavaScript: Use custom flow labels in ClientSideUrlRedirect. 2018-10-03 15:49:02 +01:00
Max Schaefer
f4ea8bc82a JavaScript: Introduce flow labels. 2018-10-03 15:49:02 +01:00
Max Schaefer
4e4ef520ab JavaScript: Rename a predicate in CommandInjection.qll. 2018-10-03 15:49:02 +01:00
Max Schaefer
f3239cbec9 JavaScript: Respect barriers on return edges. 2018-10-03 15:49:01 +01:00
Max Schaefer
cc1c7b11d6 Merge pull request #263 from asger-semmle/ts-tokens
TypeScript: add tokenization test cases
2018-10-03 15:38:58 +01:00
Jonas Jensen
9c0ba51873 C++: Make cpp/missing-return visible on LGTM again 2018-10-03 15:02:15 +02:00
Jonas Jensen
364c9a6961 C++: Suppress pointless compare in template inst.
It still runs on uninstantiated templates because its underlying
libraries do. It's not clear whether that leads to other false
positives, but that's independent of the change I'm making here.
2018-10-03 14:48:11 +02:00
Jonas Jensen
2eea359f79 C++: Test for PointlessComparison with templates 2018-10-03 14:47:00 +02:00
Max Schaefer
220fcb59bd JavaScript: Add change note. 2018-10-03 13:08:31 +01:00
Max Schaefer
8b7bb8cecc JavaScript: Add test case for type inference in the presence of non-toplevel imports. 2018-10-03 13:08:31 +01:00
Max Schaefer
db32dc2bdf JavaScript: Generalise code that assumes imports only appear at the toplevel. 2018-10-03 13:08:31 +01:00
Max Schaefer
f05e777e64 JavaScript: Patch CFG to improve support for non-top level import declarations. 2018-10-03 13:08:31 +01:00
Luke Cartey
1a90f7df2c C#: ZipSlip - Address review comments.
- Add backticks
 - Add extra test.
2018-10-03 11:38:48 +01:00
Asger F
271b2f3ce3 JS: add RemoteFlowSource.isThirdPartyControllable()
Use it in ReflectedXSS and ServerSideURrlRedirect
2018-10-03 10:09:02 +01:00
semmle-qlci
604ff232e2 Merge pull request #267 from xiemaisi/js/fix-deprecated-use
Approved by asger-semmle
2018-10-03 09:12:02 +01:00
semmle-qlci
e9adc63d91 Merge pull request #260 from xiemaisi/js/confusing-precedence
Approved by esben-semmle, mc-semmle
2018-10-03 09:07:18 +01:00
Jonas Jensen
4ad4b19911 Merge pull request #189 from geoffw0/wrongtypedef
CPP: Permit more typedefs in WrongTypeFormatArguments.ql
2018-10-03 09:40:06 +02:00
Max Schaefer
09aa04bf00 Merge pull request #268 from sjvs/fix-javascript-example
JavaScript: fix two examples based on LGTM.com alerts
2018-10-03 08:16:19 +01:00
Denis Levin
e147e690ee Merge branch 'master' into denisl/js/HttpToFileAccessTest 2018-10-02 15:13:35 -07:00
Robert Marsh
7c2bcf6fa6 C++/Doc: change note for PR #269 2018-10-02 14:25:08 -07:00
Robert Marsh
d44761eaca Merge pull request #269 from tosmolka/tosmolka/cpp/suspicious-call-to-memset
C++: support Decltype in suspicious-call-to-memset
2018-10-02 14:21:06 -07:00
Raul Garcia
492b511cdf Merge operation 2018-10-02 11:27:39 -07:00
Raul Garcia
230724c085 Updates based on feedback 2018-10-02 11:17:23 -07:00
Max Schaefer
425d2bfba7 Merge pull request #266 from esben-semmle/js/improve-dead-store-of-local
JS: support noop parentheses in js/useless-assignment-to-local
2018-10-02 16:19:56 +01:00
Tobias Smolka
51dcdeff59 C++: support Decltype in suspicious-call-to-memset 2018-10-02 16:47:04 +02:00
Bas van Schaik
c4eb6f0056 fix JS example based on LGTM.com alerts
1f7ef5b0d7/files/javascript/ql/src/Security/CWE-079/examples/StoredXssGood.js (x95b0280fcab9007a):1
1f7ef5b0d7/files/javascript/ql/src/Security/CWE-079/examples/StoredXss.js (xaef03a63aa3e02e4):1
2018-10-02 14:47:52 +01:00
Max Schaefer
c7b4238408 JavaScript: Fix use of deprecated predicate. 2018-10-02 12:12:59 +01:00
Max Schaefer
18a74a2163 Merge pull request #255 from Semmle/js/typo-in-query-help
JavaScript: Fix typo in query help.
2018-10-02 11:33:03 +01:00
semmle-qlci
b35f450b01 Merge pull request #162 from asger-semmle/partial-calls
Approved by esben-semmle, xiemaisi
2018-10-02 11:24:02 +01:00
Asger F
057af7c865 TypeScript: add test case with mixed rescanned tokens 2018-10-02 10:42:33 +01:00
Max Schaefer
768368498f JavaScript: Introduce new query UnclearOperatorPrecedence. 2018-10-02 08:46:51 +01:00
Max Schaefer
a63b7fc215 JavaScript: Introduce new library predicate for computing whitespace around binary operators. 2018-10-02 08:46:11 +01:00
semmle-qlci
829a5cc451 Merge pull request #259 from asger-semmle/open-redirect-expr
Approved by xiemaisi
2018-10-02 08:32:48 +01:00
Max Schaefer
92afcd32f8 Merge pull request #241 from asger-semmle/host-header-forgery
JS: Add HostHeaderPoisoningInEmailGeneration query
2018-10-02 08:32:00 +01:00
Esben Sparre Andreasen
595fe217dd JS: support noop parentheses in js/useless-assignment-to-local
The syntatic recognizer `isNullOrUndef` did not handle expressions
that were wrapped in parentheses.

This eliminates some results here:
https://lgtm.com/projects/g/vuejs/vue/alerts?mode=tree&ruleFocus=7900088
2018-10-02 09:31:32 +02:00
Jonas Jensen
6bfa59a412 Merge pull request #262 from adityasharad/merge/master-next-011018
Merge master into next.
2018-10-02 09:04:04 +02:00
Denis Levin
9c487bc6d9 Merge branch 'master' 2018-10-01 14:51:56 -07:00
Denis Levin
82d8b4e371 Adding the source link to the test case samples 2018-10-01 11:45:38 -07:00
Raul Garcia
99e6708b2b Merge branch 'master' into users/raulga/c6276 2018-10-01 10:28:54 -07:00
Raul Garcia
253b8d1287 C++ : cpp/incorrect-string-type-conversion
Cast between semantically different string types: char* from/to wchar_t*
NOTE: Please let me know if you want to use a different CWE than CWE-704
2018-10-01 10:25:49 -07:00
Aditya Sharad
337defdf3d Merge master into next. 2018-10-01 17:39:27 +01:00
Arthur Baars
13ef492fc1 Merge pull request #258 from adityasharad/merge/1.18-master-011018
Merge rc/1.18 into master.
2018-10-01 18:36:16 +02:00
Asger F
d3a1df644c TypeScript: test case for tokens starting with ">" 2018-10-01 17:35:21 +01:00
Asger F
a199035a05 TypeScript: test case for whitespace before a rescanned token 2018-10-01 17:35:15 +01:00
Max Schaefer
7518267281 Merge pull request #257 from xiemaisi/js/fix-DOMException-model
JavaScript: Update model of `DOMException`.
2018-10-01 17:12:50 +01:00
Asger F
9146cc26bd TypeScript: test case for tokenization of template literals 2018-10-01 14:36:19 +01:00
Jonas Jensen
308631e8ff C++: Add two recent queries to query suites 2018-10-01 13:42:12 +02:00
Jonas Jensen
54cd173da8 C++: Changelog entries for two new queries 2018-10-01 13:41:44 +02:00
Asger F
9f07b1011d JS: bugfix in server-side redirect query 2018-10-01 12:34:13 +01:00
Aditya Sharad
0882eb7bb3 Merge rc/1.18 into master. 2018-10-01 12:08:16 +01:00
Jonas Jensen
532a64f211 C++: Name/description of HResultBooleanConversion
This commit changes the name and description of the new
`HResultBooleanConversion` query to follow our internal guidelines.
2018-10-01 12:12:00 +02:00
Nick Rolfe
828d3cb138 Merge pull request #250 from adityasharad/version/1.18.1-dev
Version: Bump to 1.18.1 dev.
2018-10-01 10:59:52 +01:00
Asger F
d005d7127f JS: address doc review 2018-10-01 10:58:38 +01:00
Max Schaefer
8cc7f5c242 JavaScript: Update model of DOMException.
cf. https://developer.mozilla.org/en-US/docs/Web/API/DOMException/DOMException
2018-10-01 08:50:53 +01:00
Max Schaefer
1ab943c16b JavaScript: Fix typo in query help. 2018-10-01 08:04:45 +01:00
Jonas Jensen
9ffdf3b69e Merge pull request #254 from dave-bartolomeo/dave/InstructionToString
C++: Make `Instruction.toString()` less expensive
2018-10-01 08:57:24 +02:00
Dave Bartolomeo
37091953dc C++: Fix test expectations after rebase 2018-09-30 08:25:42 -07:00
Dave Bartolomeo
eb987d5da9 C++: Make Instruction.toString() less expensive
Previously, `Instruction.toString()` returned the same string that is used in IR dumps, which requires numbering all instructions and generating a unique string for each instruction. This is too expensive on large snapshots. I've moved the original code into the new `Instruction.getDumpString()`, and made `Instruction.toString()` just return the opcode plus `getAST().toString()`.
2018-09-30 08:22:15 -07:00
semmle-qlci
89183bd61b Merge pull request #244 from aschackmull/java/typeflow-perf
Approved by yh-semmle
2018-09-29 01:08:15 +01:00
Jonas Jensen
16004facd9 Merge pull request #197 from rdmarsh2/rdmarsh/cpp/ir-guards
IR-based guards library
2018-09-28 21:14:08 +02:00
Aditya Sharad
1c71a856e1 Version: Bump to 1.18.1 dev. 2018-09-28 16:39:44 +01:00
Tom Hvitved
e8cd99335a C#: Simple Boolean control flow graph splitting 2018-09-28 14:59:39 +02:00
Tom Hvitved
d0f63ca303 C#: Introduce SplitKind class 2018-09-28 14:59:39 +02:00
Tom Hvitved
c4a167cb0e C#: Group cached predicates 2018-09-28 14:59:39 +02:00
Tom Hvitved
05e00ab05b C#: Fix whitespaces 2018-09-28 14:59:39 +02:00
Tom Hvitved
a48d77f7b8 C#: Add internal PreSsa library 2018-09-28 14:59:38 +02:00
Tom Hvitved
b8caa117f1 C#: Add internal PreBasicBlocks library 2018-09-28 14:59:38 +02:00
Anders Schack-Mulligen
839168570e Java: Reorder predicates. 2018-09-28 14:25:11 +02:00
Anders Schack-Mulligen
34fdfe47ca Java: Prune nodes in DispatchFlow based on their types. 2018-09-28 14:21:04 +02:00
Robert Marsh
93732d8b5a C++: Combine IR guard tests into one ql file
This is motivated by test performance; IR compilation happens separately
for each test and takes a bit over a minute, so combining these 8 tests
saves about 10 minutes of test running.
2018-09-27 13:53:02 -07:00
Pavel Avgustinov
c7137cee75 Merge pull request #245 from adityasharad/merge/1.18-next-270918
Merge rc/1.18 into next.
2018-09-27 21:51:44 +01:00
Robert Marsh
b6cc6a3b23 C++: Fix BinaryLogicalOperators always being guards 2018-09-27 13:09:15 -07:00
Robert Marsh
f323fa1df8 C++: test changes from previous commit
The IR for the conversion to bool results in a comparison where the left
hand side is not the result of any expression in the AST, so they can't
be usefully converted back to the AST
2018-09-27 13:06:57 -07:00
Aditya Sharad
87271fb391 Merge pull request #234 from jbj/gitignore-vs
.gitignore everything under .vs in repo root dir
2018-09-27 17:54:56 +01:00
Aditya Sharad
54c678a95d Merge pull request #246 from nickrolfe/lineending
C++: CRLF → LF in .expected file
2018-09-27 17:15:54 +01:00
Nick Rolfe
a55d6d7631 C++: CRLF -> LF in .expected file 2018-09-27 17:03:31 +01:00
Asger F
e4c8653549 JS: Factor RequestHeaderAccess into separate class 2018-09-27 16:28:58 +01:00
Aditya Sharad
5ff9e3514d Merge rc/1.18 into next. 2018-09-27 15:20:25 +01:00
Anders Schack-Mulligen
b3dbb44e3a Java: Improve performance of TypeFlow. 2018-09-27 15:39:26 +02:00
semmle-qlci
df4bd36b0f Merge pull request #236 from aschackmull/xml-qll/use-concat
Approved by hvitved, xiemaisi, yh-semmle
2018-09-27 11:58:58 +01:00
Aditya Sharad
41775c9704 Merge pull request #233 from Semmle/qlucie/master
Master-to-next merge
2018-09-27 11:50:07 +01:00
Asger F
c879654796 JS: add qhelp 2018-09-27 10:21:57 +01:00
Asger F
8d3ac39b65 JS: change note 2018-09-27 10:21:57 +01:00
Asger F
433db7a3e6 JS: add to security suite 2018-09-27 10:20:35 +01:00
Asger F
46336a5643 JS: Add HostHeaderPoisoningInEmailGeneration query 2018-09-27 10:20:35 +01:00
Asger F
1b4fc93e9d JS: add HTTP::RequestInputAccess.getAHeaderName() 2018-09-27 10:20:35 +01:00
Asger F
f7775f36a8 JS: Add EmailClients lib 2018-09-27 10:20:35 +01:00
Aditya Sharad
4ff79b046d C++: Update HashCons test output. 2018-09-26 17:56:21 +01:00
semmle-qlci
c36e7f07be Merge pull request #231 from asger-semmle/express-headers
Approved by xiemaisi
2018-09-26 15:40:58 +01:00
Asger F
f0886fd0bb JS: fix indefinite check on callback 2018-09-26 15:25:26 +01:00
Jonas Jensen
c5d08ffcd4 Don't .gitignore .vs/VSWorkspaceSettings.json 2018-09-26 15:52:44 +02:00
Anders Schack-Mulligen
9198f5b9bd CPP/CSharp/Java/Javascript: Use concat in XMLParent.allCharactersString(). 2018-09-26 15:47:21 +02:00
Anders Schack-Mulligen
26c1397216 CPP/CSharp/Javascript: Clean up QLDoc and bring the different XML.qll files closer. 2018-09-26 15:36:20 +02:00
Jonas Jensen
d813cb63e7 C++: Upper-case Boolean and <code> around HRESULT 2018-09-26 15:29:07 +02:00
semmle-qlci
a93939b827 Merge pull request #230 from esben-semmle/js/ad-hoc-whitelisting
Approved by xiemaisi
2018-09-26 14:14:25 +01:00
Jonas Jensen
e2ccd57bdd .gitignore everything under .vs in repo root dir
We have external users editing queries with Visual Studio, and it seems
to automatically add very specific files to `.gitignore`. These changes
cause conflicts between unrelated PRs.

This commit adds all of `/.vs` to `.gitignore`, which should hopfully
make Visual Studio stop adding more entries.
2018-09-26 15:12:32 +02:00
Aditya Sharad
75680dbfef Merge branch 'next' into qlucie/master 2018-09-26 12:08:33 +01:00
Nick Rolfe
57f3ac8a79 Merge pull request #226 from adityasharad/merge/1.18-master-250918
Merge rc/1.18 into master.
2018-09-26 10:47:03 +01:00
Nick Rolfe
314e1a1e8c Merge pull request #228 from adityasharad/merge/1.18-next-250918
Merge rc/1.18 into next.
2018-09-26 10:42:46 +01:00
Asger F
057c3a92b4 JS: update other Express test outputs 2018-09-26 08:36:52 +01:00
Jonas Jensen
397c8b5750 Merge pull request #212 from raulgarciamsft/master
Setting a SECURITY_DESCRIPTOR’s DACL to NULL
2018-09-26 09:32:29 +02:00
Esben Sparre Andreasen
7c006d4530 Merge pull request #222 from xiemaisi/js/identity-replacement
JavaScript: Add new query flagging identity replacements.
2018-09-26 09:25:19 +02:00
Asger F
a47b1dc774 JS: recognize Express header access with dynamic name 2018-09-26 08:22:21 +01:00
Esben Sparre Andreasen
097a2811e1 JS: change notes for AdHocWhitelistCheckSanitizer 2018-09-26 09:20:40 +02:00
Esben Sparre Andreasen
52061b35d8 JS: address review comments: improve regex, limit sanitizer usage 2018-09-26 09:20:07 +02:00
Asger F
e78a4e9f10 JS: update output from other Express tests 2018-09-26 07:58:44 +01:00
Asger F
ce11b5330d JS: recognize Express headers as RequestInputAccess 2018-09-26 07:58:44 +01:00
Geoffrey White
9c219b958c Merge pull request #225 from sauyon/sizeofcheck
Allow void* pointer arithmetic with sizeof
2018-09-25 22:53:07 +01:00
Aditya Sharad
accacdc9a4 Merge rc/1.18 into next. 2018-09-25 21:59:47 +01:00
Raul Garcia
54493eb990 Merge branch 'master' into master 2018-09-25 10:58:51 -07:00
Raul Garcia
d6d27df27b Removing all usage of single quotes 2018-09-25 10:50:34 -07:00
Aditya Sharad
28329562a7 Merge rc/1.18 into master. 2018-09-25 14:31:45 +01:00
Max Schaefer
0e63ea1b51 JavaScript: Update tests. 2018-09-25 11:27:12 +01:00
Max Schaefer
659c67c715 JavaScript: Produce friendlier message for empty-string replacements. 2018-09-25 11:27:12 +01:00
Max Schaefer
5fb22ba021 JavaScript: Handle zero-width assertions and sequences. 2018-09-25 11:27:12 +01:00
Max Schaefer
ec9a3c87a7 JavaScript: Do not flag case-insensitive replace. 2018-09-25 11:27:11 +01:00
Max Schaefer
1ab11109f9 JavaScript: Add new query flagging identity replacements. 2018-09-25 11:27:11 +01:00
Asger F
0936cda0e9 JS: avoid expensive join_rhs in callInputStep 2018-09-25 10:16:40 +01:00
Asger F
52c913b325 JavaScript: cache AdditionalPartialInvokeNode 2018-09-25 10:16:40 +01:00
Asger F
3ca7d6b4bf JavaScript: address comments 2018-09-25 10:16:40 +01:00
Asger F
269bbc9a1a JavaScript: add flow steps through partial function application 2018-09-25 10:16:40 +01:00
Jonas Jensen
8f19efe2e8 Merge pull request #211 from raulgarciamsft/users/raulga/HESULT
Cast between semantically different integer types: HRESULT to/from bool
2018-09-25 09:01:35 +02:00
Sauyon Lee
614a8ef091 Allow void* pointer arithmetic with sizeof
Technically this isn't allowed by the C spec, but it's been seen in the wild:
see 3763c7b338/files/src/csp_buffer.c\#x1d04047d2bb68c21:1
2018-09-24 11:05:40 -07:00
Denis Levin
1438cae362 Correction to the test's expected file as the test was modified. 2018-09-24 10:45:54 -07:00
Geoffrey White
473252632c Merge pull request #221 from jbj/IntMultToLong-char
C++: Suppress IntMultToLong alert on char-typed numbers
2018-09-24 18:42:41 +01:00
Raul Garcia
a566ffae4a Fixed the test .expected file 2018-09-24 10:18:39 -07:00
Raul Garcia
c75019726c Removing tabs & reformatting 2018-09-24 10:10:58 -07:00
Raul Garcia
c3b523cdc4 Fixing a missed reference to renamed file. 2018-09-24 10:02:52 -07:00
Geoffrey White
d975c09012 CPP: Change note. 2018-09-24 17:25:34 +01:00
Geoffrey White
4edc54df0c CPP: Use unspecified types everywhere (for simplicity and robustness). 2018-09-24 17:17:41 +01:00
Geoffrey White
b15db5d1e5 CPP: Add a test case that we handle poorly. 2018-09-24 17:17:41 +01:00
Jonas Jensen
a56376a2df C++: rename effectivelyConstant to likelySmall
This reflects the existing QLDoc better and makes it more clear why it
includes char-typed expressions.
2018-09-24 14:37:11 +02:00
Jonas Jensen
4d2e4c53f1 C++: Suppress IntMultToLong alert on char 2018-09-24 14:37:09 +02:00
Jonas Jensen
2b5d150829 C++: Test for IntMultToLong on char-typed numbers 2018-09-24 14:36:36 +02:00
semmle-qlci
7f56be6fe2 Merge pull request #216 from asger-semmle/lusca-csrf
Approved by esben-semmle
2018-09-24 11:34:24 +01:00
semmle-qlci
46178271d1 Merge pull request #213 from asger-semmle/sendfile
Approved by xiemaisi
2018-09-24 11:32:46 +01:00
Esben Sparre Andreasen
42fc28bc55 JS: add ad hoc whitelist checks as sanitizers 2018-09-24 11:17:35 +02:00
Jonas Jensen
d2f11dc18c Merge pull request #209 from dave-bartolomeo/dave/CNewLines
LF all the things
2018-09-24 09:02:54 +02:00
Dave Bartolomeo
396d7ea928 Mark several known binary extensions as -text 2018-09-23 16:24:32 -07:00
Dave Bartolomeo
1f36f5552f Normalize all text files to LF
Use `* text=auto eol=lf`
2018-09-23 16:24:31 -07:00
Dave Bartolomeo
26abf5d4a2 Force LF for basically everything. 2018-09-23 16:24:31 -07:00
Dave Bartolomeo
aa267c8302 C++: Force LF for .c,.cpp,.h,.hpp 2018-09-23 16:23:52 -07:00
Jonas Jensen
caf4a767ad Merge pull request #219 from geoffw0/resource-not-released
C++: Exclude placement new from AV Rule 79.ql
2018-09-22 17:41:36 +02:00
Raul Garcia
242ee10806 Major change in order to support the rule for C as well as cpp 2018-09-21 16:47:31 -07:00
Denis Levin
8152cefa60 Squished changes for HttpToFileAccess commint 2018-09-21 16:44:01 -07:00
Raul Garcia
925c3b51f9 Adding semmle-extractor-options: --microsoft to test 2018-09-21 15:21:07 -07:00
Geoffrey White
492d79ea53 CPP: Change note. 2018-09-21 21:13:37 +01:00
Raul Garcia
1fd7b4ad22 Merge branch 'master' of https://github.com/raulgarciamsft/ql 2018-09-21 13:07:45 -07:00
Raul Garcia
8519f1a9e1 Fixing tabs replaced to spaces 2018-09-21 13:07:39 -07:00
Raul Garcia
c22787293e Update .gitignore 2018-09-21 11:35:43 -07:00
Geoffrey White
3922082e7d CPP: Tidy and simplify AV Rule 79.ql. 2018-09-21 19:35:23 +01:00
Raul Garcia
75ef377ac1 Replace Unicode apostrophe with ANSI single quote 2018-09-21 11:34:22 -07:00
Raul Garcia
94f752c59c Merge branch 'users/raulga/HESULT' of https://github.com/raulgarciamsft/ql into users/raulga/HESULT 2018-09-21 11:14:49 -07:00
Raul Garcia
783be15a45 Fixing typos & ID.
NOTE: There is an ongoing discussion on the proper CWE we should use
2018-09-21 11:14:14 -07:00
Nick Rolfe
e21a5e4b4c Merge pull request #214 from jbj/mergeback-20180921_104253
Mergeback rc/1.18 -> master
2018-09-21 17:54:28 +01:00
semmle-qlci
d281558fb1 Merge pull request #218 from yh-semmle/java/query-severities
Approved by aschackmull
2018-09-21 16:59:03 +01:00
Geoffrey White
d5a48ad63e CPP: Additional test cases. 2018-09-21 15:55:29 +01:00
Asger F
4797924bea JS: review comments 2018-09-21 14:46:21 +01:00
Asger F
d2a04d32be JS: add change note 2018-09-21 13:20:02 +01:00
Asger F
5f467d2fc5 JS: recognize CSRF middleware from lusca package 2018-09-21 13:15:40 +01:00
calum
abe5d0dd72 C#: Fixes to stub generation. 2018-09-21 13:06:33 +01:00
Asger F
6f109a742f JS: add a test case for res.sendfile 2018-09-21 11:04:33 +01:00
Geoffrey White
84f9900c8c CPP: Exclude placement new. 2018-09-21 10:53:42 +01:00
Geoffrey White
c7aa5c169b CPP: Add a test of placement new for AV Rule 79.ql. 2018-09-21 10:47:00 +01:00
Jonas Jensen
e2a17e9740 Merge remote-tracking branch 'upstream/rc/1.18' into mergeback-20180921_104253 2018-09-21 10:45:54 +02:00
Esben Sparre Andreasen
8a950a587d Merge pull request #208 from aeyerstaylor/fix-qltest-change
JavaScript: Fix expected output due to qltest change.
2018-09-21 08:08:50 +02:00
Raul Garcia
5ccc1a32aa Merge branch 'master' into master 2018-09-20 16:30:48 -07:00
Raul Garcia
48c99fb1d1 Setting a SECURITY_DESCRIPTOR’s DACL to NULL
Closing the gap between Semmle & PreFAST
This rule is equivalent to C6248
2018-09-20 16:28:37 -07:00
Raul Garcia
64b8a5ba01 Merge branch 'master' into users/raulga/HESULT 2018-09-20 16:20:26 -07:00
Raul Garcia
b0ec929aad Cast between semantically different integer types: HRESULT to/from a Boolean type.
Closing the gap between Semmle and PreFast.
Covers C6214, C6215, C6216, C6217, C6230
2018-09-20 16:16:32 -07:00
Robert Marsh
e2d24a2743 C++: fix comment 2018-09-20 13:07:36 -07:00
Robert Marsh
9011e1381b C++: handle conversions in IR to AST translation 2018-09-20 12:56:43 -07:00
Robert Marsh
cc97cf9297 C++: add isReachableFromFunctionEntry 2018-09-20 10:06:19 -07:00
Robert Marsh
4c94144089 C++: remove abstract classes in IR 2018-09-20 10:06:18 -07:00
Robert Marsh
755e21d355 C++: improve conversion handling in IRGuards.qll 2018-09-20 10:06:18 -07:00
Robert Marsh
e40ce91e7e C++: document new IR class and predicates 2018-09-20 10:06:18 -07:00
Robert Marsh
d6cea1b203 C++: Add class and predicates to other IR stages 2018-09-20 10:06:17 -07:00
Robert Marsh
b5cd48d819 C++: comments on new classes and predicates 2018-09-20 10:06:17 -07:00
Robert Marsh
0273b20743 C++: make internal classes private 2018-09-20 10:06:17 -07:00
Robert Marsh
ad8f30d2f7 C++: accept test output and add IR guards tests 2018-09-20 10:06:17 -07:00
Robert Marsh
d7e630b3c6 C++: Add IR-based port of Guards library
For ease of reviewing, I've checked in the .expected files from the
AST-based guards library. The next commit accepts output for these tests
and adds tests that use getAST rather than the translation layer.
2018-09-20 10:06:16 -07:00
Robert Marsh
4e1a37cd6e C++: add isStrict to RelationalInstruction 2018-09-20 10:06:16 -07:00
Robert Marsh
27a83e65b2 C++: add RelationalOpcode and RelationalInstruction 2018-09-20 10:06:16 -07:00
Robert Marsh
69962bd06c Merge pull request #203 from dave-bartolomeo/dave/GVN
C++: Initial attempt at IR-based value numbering
2018-09-20 10:00:45 -07:00
Dave Bartolomeo
5a25602c28 C++: Move GVN out of "internal" directory 2018-09-20 08:21:15 -07:00
Dave Bartolomeo
27cee9bd80 C++: Handle inheritance conversions in IR GVN 2018-09-20 08:00:38 -07:00
alexet
b94df82833 JavaScript: Fix expected output due to qltest change. 2018-09-20 15:56:20 +01:00
calum
593f0a9d71 C#: Implement query and script for generating C# qltest stubs. 2018-09-20 15:01:26 +01:00
semmle-qlci
f146e34e26 Merge pull request #207 from dave-bartolomeo/dave/JSNewlines
Approved by esben-semmle
2018-09-20 14:49:54 +01:00
Anders Schack-Mulligen
4d46385c51 Merge pull request #206 from yh-semmle/java/codeowners
Java: add Semmle/java team to `CODEOWNERS`
2018-09-20 09:24:14 +02:00
Dave Bartolomeo
e06969ddb4 JavaScript: Normalize .mjs files to LF 2018-09-19 21:33:39 -07:00
Dave Bartolomeo
524c67c3fb JavaScript: Normalize .ts line endings to LF 2018-09-19 21:33:35 -07:00
Dave Bartolomeo
2b9f42b308 JavaScript: Force LF for .json and .yml 2018-09-19 21:33:32 -07:00
Dave Bartolomeo
b12c739915 JavaScript: Normalize line endings of .js and .html files
Added .gitattributes files for the two directories where we intentionally have line endings other than LF
2018-09-19 21:33:27 -07:00
Dave Bartolomeo
bd156757d3 C++: Remove accidental add of IR.md 2018-09-19 14:26:17 -07:00
semmle-qlci
4aca8f4fd3 Merge pull request #201 from asger-semmle/string-concatenation-squashed
Approved by esben-semmle
2018-09-19 21:59:17 +01:00
semmle-qlci
2f4aa647be Merge pull request #200 from esben-semmle/js/post-polish-167
Approved by asger-semmle
2018-09-19 21:43:17 +01:00
ian-semmle
ebc924a6f9 Merge pull request #204 from nickrolfe/std_layout
C++: add Class::isStandardLayout()
2018-09-19 17:32:19 +01:00
yh-semmle
7d69c84453 Java: tweak some query metadata
The severity of four queries is reduced to `warning`.
2018-09-19 11:04:21 -04:00
Asger F
1d793c0a7b JavaScript: fix expected output 2018-09-19 14:33:23 +01:00
Esben Sparre Andreasen
2cedc81774 JS: polish js/enabling-electron-renderer-node-integration meta info 2018-09-19 13:45:42 +02:00
semmle-qlci
89f2dbf8db Merge pull request #195 from esben-semmle/js/reflected-xss-through-filenames
Approved by asger-semmle
2018-09-19 12:42:22 +01:00
Nick Rolfe
017e3a390f C++: stats for is_standard_layout_class 2018-09-19 10:26:11 +01:00
Nick Rolfe
f1358b7c02 C++: test for Class::isStandardLayout() 2018-09-19 10:26:11 +01:00
Nick Rolfe
e5b9dca312 C++: add Class::isStandardLayout() 2018-09-19 10:26:11 +01:00
Dave Bartolomeo
43f0289f0f C++: Remove Phi instructions from previous IR generations
It turns out that when building aliased SSA IR, we were still keeping around the Phi instructions from unaliased SSA IR. These leftover instructions didn't show up in dumps because they were not assigned to a block. However, when dumping additional instruction properties, they would show up as a top-level node in the dump, without a label.
2018-09-18 11:28:09 -07:00
Jonas Jensen
86fe0ce42e Merge pull request #107 from rdmarsh2/rdmarsh/cpp/HashCons
C++: HashCons library
2018-09-18 11:45:26 +02:00
Dave Bartolomeo
46b2c19c66 C++: Initial attempt at IR-based value numbering 2018-09-17 17:19:05 -07:00
Asger F
9384b85bcc JavaScript: ensure prefix sanitizers work for array.join() 2018-09-17 14:31:26 +01:00
Asger F
e2cdf5d7ed JavaScript: add string concatenation library 2018-09-17 12:47:37 +01:00
Asger F
b20fd3c084 JS: recognize res.sendfile as alias for res.sendFile in Express 2018-09-17 11:31:10 +01:00
Esben Sparre Andreasen
bb48421d77 JS: address doc review comments 2018-09-17 11:08:35 +02:00
semmle-qlci
782e91bb97 Merge pull request #167 from bnxi/NodeIntegration
Approved by esben-semmle
2018-09-15 21:35:56 +01:00
Geoffrey White
e4b9d31f8e Merge pull request #194 from raulgarciamsft/overflow_buffer_negindex
Detect access to an array using a negative index
2018-09-14 21:56:16 +01:00
Behrang Fouladi Azarnaminy
7071c75567 revert "Chaning EOL in two files"
This reverts commit ecd08d4560.
2018-09-14 09:03:48 -07:00
Esben Sparre Andreasen
444a09a17c JS: add models of five file system libraries 2018-09-14 15:30:44 +02:00
Esben Sparre Andreasen
5781b518bc JS: change notes for js/stored-xss 2018-09-14 15:30:44 +02:00
Esben Sparre Andreasen
33f98dd1a7 JS: add query: js/stored-xss 2018-09-14 15:30:44 +02:00
Asger F
a3562aa4a7 Merge pull request #193 from esben-semmle/js/reduce-precision-of-remote-property-injection
JS: lower @precision of js/remote-property-injection
2018-09-14 11:14:13 +01:00
Nick Rolfe
440d64d0b8 Merge pull request #191 from jbj/merge-master-next-20180913
Merge master to next
2018-09-14 10:24:32 +01:00
Esben Sparre Andreasen
e2fac8a03c JS: introduce concept: FileNameSource 2018-09-14 11:09:29 +02:00
Esben Sparre Andreasen
6d3c1a1d22 JS: introduce fsModuleMember 2018-09-14 11:09:29 +02:00
Esben Sparre Andreasen
8de269e1fb JS: add support for fs-extra in NodeJSFileSystemAccess 2018-09-14 11:09:29 +02:00
semmle-qlci
abbadf24f0 Merge pull request #192 from esben-semmle/js/additional-array-taint-steps
Approved by asger-semmle
2018-09-14 10:02:36 +01:00
Esben Sparre Andreasen
81aeda69e1 JS: lower @precision of js/remote-property-injection 2018-09-14 07:37:47 +02:00
semmle-qlci
961ecfb43f Merge pull request #187 from esben-semmle/js/additional-whitelisting-form-unbound-event-handlers
Approved by asger-semmle
2018-09-14 06:35:39 +01:00
Raul Garcia
28050e1415 Change to cpp/overflow-buffer to detect access to an array using a negative index (static, out of range access, lower bound). 2018-09-13 15:44:32 -07:00
Esben Sparre Andreasen
cb2bd9e0ae JS: change notes for additional array taint steps 2018-09-13 21:36:53 +02:00
Esben Sparre Andreasen
4c13e6b46b JS: add additional array-specific taint steps 2018-09-13 21:36:53 +02:00
Jonas Jensen
9886e4a056 Merge remote-tracking branch 'upstream/master' into merge-master-next-20180913 2018-09-13 20:28:17 +02:00
Robert Marsh
1a14b13703 C++: migrate change note 2018-09-13 09:53:41 -07:00
semmle-qlci
6266d8bf01 Merge pull request #184 from aschackmull/java/intmulttolong-message
Approved by yh-semmle
2018-09-13 15:00:14 +01:00
ian-semmle
bc0d4f1855 Merge pull request #188 from nickrolfe/convvec
C++: support clang's __builtin_convertvector
2018-09-13 14:55:19 +01:00
Esben Sparre Andreasen
763da72ce5 JS: modernize old array taint steps 2018-09-13 15:52:25 +02:00
Esben Sparre Andreasen
ea37665ec6 JS: move array-specific taint steps to separate class 2018-09-13 15:52:25 +02:00
semmle-qlci
3d022298dc Merge pull request #186 from Semmle/rc/1.18
Approved by esben-semmle
2018-09-13 12:34:54 +01:00
Nick Rolfe
3d2637a249 C++: stats for builtinconvertvector 2018-09-13 10:28:42 +01:00
Nick Rolfe
0957ee7c1b C++: support clang's __builtin_convertvector 2018-09-13 10:28:41 +01:00
Anders Schack-Mulligen
b9acdf573a Java: Update qltest. 2018-09-13 10:18:09 +02:00
Esben Sparre Andreasen
52013f3071 JS: change notes for improved js/unbound-event-handler-receiver 2018-09-13 08:43:01 +02:00
Esben Sparre Andreasen
fcc33ce93d JS: whitelist auto-bind methods in js/unbound-event-handler-receiver 2018-09-13 08:41:41 +02:00
Esben Sparre Andreasen
eb10f603ab JS: whitelist decorator-bound methods in js/unbound-event-handler-receiver 2018-09-13 08:41:41 +02:00
Esben Sparre Andreasen
1220b50737 JS: whitelist _.bindAll-methods in js/unbound-event-handler-receiver 2018-09-13 08:41:41 +02:00
Behrang Fouladi Azarnaminy
ecd08d4560 Chaning EOL in two files 2018-09-12 12:05:57 -07:00
Tom Hvitved
7db2589aae Merge pull request #185 from adityasharad/merge/1.18-next-120918
Merge rc/1.18 into next.
2018-09-12 16:51:34 +02:00
Aditya Sharad
767045b55d Merge rc/1.18 into next. 2018-09-12 14:59:54 +01:00
Anders Schack-Mulligen
1bbc67b57c Java: Autoformat query. 2018-09-12 10:14:41 +02:00
Anders Schack-Mulligen
ccbd8aaebc Java: Improve alert message of IntMultToLong. 2018-09-12 10:13:57 +02:00
semmle-qlci
9e0ba51280 Merge pull request #179 from esben-semmle/js/classify-multi-license-fix
Approved by asger-semmle
2018-09-11 21:30:10 +01:00
Behrang Fouladi Azarnaminy
fc087ffb71 Replaceing query and test files with suggested ones 2018-09-11 12:32:56 -07:00
Behrang Fouladi Azarnaminy
befca6cafa Remove webview example and its reference in qlhelp file 2018-09-11 12:31:00 -07:00
Dave Bartolomeo
49b8db9631 Merge pull request #180 from jbj/ArrayType-size-docs
C++: Document the three predicates for array size
2018-09-11 10:11:45 -07:00
Esben Sparre Andreasen
43c65e02ec JS: classify bundle files based on multiple license comments 2018-09-11 15:40:24 +02:00
Jonas Jensen
4304a4e1bc C++: Fix docs copy-paste error 2018-09-11 15:39:44 +02:00
Jonas Jensen
d956bf90ad C++: Document the three predicates for array size 2018-09-11 15:15:44 +02:00
ian-semmle
628d7b95d9 Merge pull request #178 from jbj/ir-duplicateOperand-perf
C++: IR: InstructionSanity::duplicateOperand perf
2018-09-11 12:53:27 +01:00
Jonas Jensen
3c3cc2eb3e Merge pull request #175 from hvitved/merge-rc
Merge rc/1.18 into master
2018-09-11 13:10:02 +02:00
Jonas Jensen
ecfc53668f C++: IR: InstructionSanity::duplicateOperand perf
The `InstructionSanity::duplicateOperand` predicate used `count` instead
of `strictcount`. The 0-case of this `count` was as large as the
Cartesian product of `Instruction` and `OperandTag`, which made
`duplicateOperand` take forever to compute on large snapshots.
2018-09-11 12:04:27 +02:00
Tom Hvitved
70e713122f Merge branch 'rc/1.18' into merge-rc 2018-09-11 09:11:03 +02:00
Robert Marsh
0e44bf3c30 C++: Add import for LGTM 2018-09-10 12:22:45 -07:00
Robert Marsh
cb9f1269f9 C++: select example exprs for HashCons portably
This makes two changes to how example exprs are selected. Example exprs
are now ordered separately by each piece of the location, rather than by
stringifying their location. Second, UnknownLocations are now ordered
after locations with absolute paths, by using "~" in the lexicographic
comparison of absolute paths. I think this works on both POSIX and
Windows systems, but it's possible I'm missing a way to start an
absolute path with a unicode character.
2018-09-10 12:22:45 -07:00
Robert Marsh
fb8ad9387d C++: Uniqueness fixes for HashCons 2018-09-10 12:22:45 -07:00
Robert Marsh
990bfb4663 C++: change note for HashCons library 2018-09-10 12:22:45 -07:00
Robert Marsh
166dba288b C++: accept test output 2018-09-10 12:22:45 -07:00
Robert Marsh
bbafcd9941 C++: typeid and noexcept fixes in HashCons 2018-09-10 12:22:45 -07:00
Robert Marsh
2d098fed98 fix HashCons for typeid of type 2018-09-10 12:22:44 -07:00
Robert Marsh
c42ecfe8f9 C++: Simplify HashCons for new and handle extents 2018-09-10 12:22:44 -07:00
Robert Marsh
9f476e585a C++: Simplify some code 2018-09-10 12:22:44 -07:00
Robert Marsh
fa9eeea302 C++: remove implicit this handling in HashCons 2018-09-10 12:22:44 -07:00
Robert Marsh
246ae2d7e8 C++: fix performance of argument hash-consing 2018-09-10 12:22:44 -07:00
Robert Marsh
06a3e8fc76 C++: Hashcons for ?:, ExprCall, and weird stuff 2018-09-10 12:22:44 -07:00
Robert Marsh
cfeed30a89 C++: Hashcons tests for ArrayExpr 2018-09-10 12:22:44 -07:00
Robert Marsh
8189798f43 C++: HashCons for throw 2018-09-10 12:22:43 -07:00
Robert Marsh
85cfb0202f C++: add HashCons for delete expressions 2018-09-10 12:22:43 -07:00
Robert Marsh
752f39b537 C++: initial support for aggregate initializers 2018-09-10 12:22:43 -07:00
Robert Marsh
8f446aa9cc C++: fix handling of aligned allocators 2018-09-10 12:22:43 -07:00
Robert Marsh
5549b6fcab C++: HashCons for new, new[], sizeof, alignof 2018-09-10 12:22:43 -07:00
Robert Marsh
fede8d63d4 C++: respond to PR comments 2018-09-10 12:22:43 -07:00
Robert Marsh
e6314c5f35 C++: add support for enums in HashCons 2018-09-10 12:22:43 -07:00
Robert Marsh
91da02bacf C++: uniqueness fixes for HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
3a5eb03055 C++: change floating point value in test 2018-09-10 12:22:42 -07:00
Robert Marsh
e0af30a789 C++: clean up commented-out code 2018-09-10 12:22:42 -07:00
Robert Marsh
77c5a8e7bf C++: support impure binary operations in HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
b8bd285d64 C++: support functions in HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
a8895f4bed C++: Support crement ops in HashCons 2018-09-10 12:22:42 -07:00
Robert Marsh
cf222c51ac C++: treat constant-valued exprs structurally 2018-09-10 12:22:42 -07:00
Robert Marsh
d8dc75abf4 C++: rename HashCons test 2018-09-10 12:22:41 -07:00
Robert Marsh
8b8ec7c5aa C++: add literal tests 2018-09-10 12:22:41 -07:00
Robert Marsh
3c6a9c08a2 C++: first tests for HashCons 2018-09-10 12:22:41 -07:00
Kevin Backhouse
2d7109b8f5 C++: initial implementation of a HashCons library. 2018-09-10 12:22:41 -07:00
Behrang Fouladi Azarnaminy
02047ea260 Edit .expected file 2018-09-10 10:27:29 -07:00
ian-semmle
953537e856 Merge pull request #174 from nickrolfe/vec_fill
C++: support for clang `__builtin_addressof` and GNU vector fill operations
2018-09-10 14:31:11 +01:00
Nick Rolfe
ab05be7b13 C++: update stats for builtin_addressof and vec_fill 2018-09-10 10:19:20 +01:00
semmle-qlci
b6b3581e7c Merge pull request #168 from esben-semmle/js/fix-test-case-typo
Approved by asger-semmle
2018-09-09 22:11:15 +01:00
Jonas Jensen
6bfbd21390 Merge pull request #159 from ian-semmle/EnumConstant
C++: Fix spurious extra qualified names for enum constants within a class
2018-09-08 14:55:33 +02:00
Behrang Fouladi
43a9d511c2 Update EnablingNodeIntegration.qhelp 2018-09-07 14:58:24 -07:00
Behrang Fouladi
302e271a79 Update EnablingNodeIntegration.expected
Change EOL to unix format
2018-09-07 09:52:52 -07:00
Behrang Fouladi Azarnaminy
bd92cd14c5 Changing EOL in all files to unix format 2018-09-07 09:47:15 -07:00
Behrang Fouladi Azarnaminy
ebbd3b3111 Adding html encoding to EnablingNodeIntegration.qhelp 2018-09-07 08:47:35 -07:00
Nick Rolfe
2abf91b6ab C++: class and test for clang's __builtin_addressof 2018-09-07 12:35:12 +01:00
Nick Rolfe
93103e1042 C++: add class and test for a GNU vector fill operation 2018-09-07 12:07:28 +01:00
Nick Rolfe
8e3f63954c C++: add dbscheme expr kinds for __builtin_addressof and vector fill 2018-09-07 12:06:44 +01:00
Tom Hvitved
04f29951a5 Merge pull request #98 from calumgrant/cs/literal-conversion-fix
C#: Regression test for extractor
2018-09-07 08:42:00 +02:00
Esben Sparre Andreasen
3d3b7b0254 JS: fix typo in test case 2018-09-06 22:54:07 +02:00
Jonas Jensen
4d8a6e586f Merge pull request #156 from geoffw0/empty-file
C++: Remove empty files.
2018-09-06 20:42:43 +02:00
Behrang Fouladi Azarnaminy
9179701248 JavaScript: Add query for Node.js integration in Electron framework 2018-09-06 11:38:08 -07:00
Aditya Sharad
272bed706a Merge pull request #164 from jbj/master-to-next-20180905
Merge master to next
2018-09-06 12:06:02 +01:00
yh-semmle
abd6df3047 Java: add Semmle/java team to CODEOWNERS 2018-09-05 20:16:18 -04:00
Jonas Jensen
69e915639d Merge branch 'master-to-next-20180905-master' into master-to-next-20180905 2018-09-05 21:08:06 +02:00
Jonas Jensen
d5e0357201 Revert "Revert "Version: Bump to 1.19.0 dev.""
This reverts commit ab2bec743a.
2018-09-05 21:07:19 +02:00
Jonas Jensen
ec626573c8 Merge pull request #161 from adityasharad/merge/1.18-master-050918
Merge rc/1.18 into master.
2018-09-05 20:54:14 +02:00
Aditya Sharad
f27945216f Merge rc/1.18 into master. 2018-09-05 15:32:30 +01:00
Max Schaefer
8fbc191bf0 Merge pull request #160 from adityasharad/merge/1.18-next-050918
Merge rc/1.18 into next.
2018-09-05 15:15:23 +01:00
Aditya Sharad
cbdbda3723 Merge rc/1.18 into next. 2018-09-05 14:09:06 +01:00
semmle-qlci
5fcd663e9f Merge pull request #158 from esben-semmle/js/sharpen-regexp-injection
Approved by xiemaisi
2018-09-05 12:45:59 +01:00
Ian Lynagh
ca082be371 C++: Fix spurious extra qualified names for enum constants within a class 2018-09-05 12:29:43 +01:00
Ian Lynagh
c204ec3a8f C++: Enhance qualifiers/class-enum test 2018-09-05 12:28:57 +01:00
Esben Sparre Andreasen
b9d825b379 JS: better matching of String.prototype.search in js/regex-injection 2018-09-05 08:35:00 +02:00
semmle-qlci
a46df8e0a2 Merge pull request #154 from jbj/mergeback-master-20180904
Approved by adityasharad
2018-09-05 07:21:00 +01:00
semmle-qlci
2d4f664be8 Merge pull request #157 from ian-semmle/declarationName
Approved by jbj
2018-09-04 23:08:27 +01:00
Nick Rolfe
ccceef30e6 Merge pull request #155 from adityasharad/revert/master/version-1.19.0
Revert "Version: Bump to 1.19.0 dev."
2018-09-04 21:16:43 +01:00
Jonas Jensen
43704e2f0d Merge pull request #144 from ian-semmle/topLevel2
C++: Improve GlobalNamespace.getADeclaration()
2018-09-04 20:22:22 +02:00
semmle-qlci
20ade48975 Merge pull request #146 from ian-semmle/TemplateParameterName
Approved by jbj
2018-09-04 19:16:55 +01:00
Ian Lynagh
ce5653a2f6 C++: Tweak qldoc for declaration names 2018-09-04 19:14:16 +01:00
Geoffrey White
ae80b8dbec Merge pull request #145 from nickrolfe/rewording
C++: clearer alert wording in integer-multiplication-cast-to-long
2018-09-04 18:00:37 +01:00
Geoffrey White
71483c7025 CPP: Remove some empty source files. 2018-09-04 17:51:46 +01:00
Aditya Sharad
ab2bec743a Revert "Version: Bump to 1.19.0 dev."
The version bump should now go into the `next` branch rather than `master`.
This reverts commit 2363f49e3a.
2018-09-04 16:01:09 +01:00
Jonas Jensen
9535f83d3a Revert "Revert "C++: update expected sizes of error and unknown types to be 1 byte""
This commit was reverted on `master` but should remain on `next`, so I'm
reverting the revert before merging `master` into `next`.

This reverts commit adda4c91cf.
2018-09-04 16:10:46 +02:00
calumgrant
98aa7f88b2 Merge pull request #121 from hvitved/csharp/sync-test-files
C#: Synchronize a few test files
2018-09-04 15:01:19 +01:00
Nick Rolfe
f2d030a7e6 C++: shorten message in integer-multiplication-cast-to-long 2018-09-04 14:45:12 +01:00
ian-semmle
cbca1e1105 Merge pull request #149 from jbj/revert-builtin_types_on_demand3
Revert "C++: update expected sizes of error and unknown types to be 1 byte"
2018-09-04 14:32:55 +01:00
Jonas Jensen
adda4c91cf Revert "C++: update expected sizes of error and unknown types to be 1 byte"
This commit to update test changes got merged to Semmle/ql master but
doesn't belong there because it's not compatible with how the 1.18
extractor works. The corresponding extractor change got merged to the
internal-repo master right after the internal branch for 1.18 was taken.

This reverts commit d4f9b5eb52.
2018-09-04 13:45:08 +02:00
Jonas Jensen
ab944f3807 Merge pull request #139 from geoffw0/function-wrappers
CPP: Make FunctionWithWrappers `toCause` work on builtins.
2018-09-04 13:36:33 +02:00
Ian Lynagh
3fd6a8de7d C++: Fix the definition of GlobalNamespace.getADeclaration()
Globals can still have declarations in declaration statements.
We already rule out local variables etc via the isTopLevel check,
so we don't need to consider DeclStmt.
2018-09-04 11:37:10 +01:00
Ian Lynagh
1fcf156e7e C++: Add another test to namespaces test 2018-09-04 11:36:50 +01:00
Ian Lynagh
e39a0d2f72 C++: Tweak namespaces test 2018-09-04 11:36:09 +01:00
Jonas Jensen
73675e29f2 Merge pull request #138 from ian-semmle/topLevel
C++: Use Declaration.isTopLevel() in GlobalNamespace.getADeclaration()
2018-09-04 10:03:19 +02:00
Jonas Jensen
6e9cc46e80 Merge pull request #131 from ian-semmle/namespace_vars
C++: Give namespace variables a qualified name
2018-09-04 08:56:01 +02:00
Jonas Jensen
a2946f71bd Merge pull request #96 from ian-semmle/typo
C++: Fix typo
2018-09-04 08:51:15 +02:00
Jonas Jensen
adc5ee86ad Merge pull request #128 from geoffw0/cwe-190-precision
CPP: Adjust precisions for the CWE-190 queries.
2018-09-04 08:44:38 +02:00
Ian Lynagh
4230adbca2 C++: Remove reundant override 2018-09-03 18:12:30 +01:00
Nick Rolfe
78f5be0d49 Merge pull request #143 from adityasharad/version/1.19.0
Version: Bump to 1.19.0 dev.
2018-09-03 17:40:23 +01:00
Nick Rolfe
04e919df9d C++: clearer alert wording in integer-multiplication-cast-to-long 2018-09-03 16:56:56 +01:00
Aditya Sharad
2363f49e3a Version: Bump to 1.19.0 dev.
This keeps the QL for Eclipse language plugins in sync with internal `master`.
2018-09-03 16:41:28 +01:00
Geoffrey White
d5b7ab5aa1 CPP: Make FunctionWithWrappers toCause work on builtin functions. 2018-09-03 11:26:02 +01:00
Ian Lynagh
c8fcab8cfe C++: Use Declaration.isTopLevel() in GlobalNamespace.getADeclaration() 2018-09-03 01:01:10 +01:00
Ian Lynagh
f6582ef285 C++: Fix typo 2018-09-01 15:45:41 +01:00
ian-semmle
eac82f2a8a Merge pull request #18 from nickrolfe/builtin_types_on_demand3
C++: built-in type tweaks
2018-08-31 16:41:02 +01:00
Ian Lynagh
3a00e24e89 C++: Give NamespaceVariables a qualified name 2018-08-31 16:39:21 +01:00
Ian Lynagh
d7d8186bbe C++: Improve namespaces/namespaces test 2018-08-31 16:37:59 +01:00
Geoffrey White
074894298c CPP: Adjust precisions for the CWE-190 queries. 2018-08-31 16:15:53 +01:00
ian-semmle
1ed82d63f3 Merge pull request #124 from nickrolfe/desig_init_changenote
C++: change note for designated intializer fixes
2018-08-31 13:19:52 +01:00
Nick Rolfe
35d31aeefe C++: change note for designated intializer fixes 2018-08-31 13:15:53 +01:00
Nick Rolfe
d4f9b5eb52 C++: update expected sizes of error and unknown types to be 1 byte 2018-08-31 12:08:15 +01:00
ian-semmle
6c7396424e Merge pull request #116 from nickrolfe/desig_init
C++: support for designated initializers
2018-08-31 11:56:34 +01:00
Max Schaefer
69ca103e06 Merge pull request #115 from esben-semmle/js/composed-function-taint
JS: model composed functions
2018-08-31 08:14:18 +01:00
Max Schaefer
7e18426fde Merge pull request #113 from esben-semmle/js/pick-get-taint-steps
JS: model property projection calls
2018-08-31 08:13:40 +01:00
Tom Hvitved
809da42f00 C#: Synchronize a few test files
Synchronized test files with the examples used in query help.
2018-08-30 21:46:37 +02:00
Luke Cartey
f9227eeee5 C#: ZipSlip - Module documentation improvements. 2018-08-24 14:34:20 +01:00
Luke Cartey
b1d5d5bf86 C#: ZipSlip - Refine StartsWith sanitizer.
ZipSlip can be avoided by checking that the combined and resolved
path `StartsWith` the appropriate destination directory. Refine the
`StartsWith` sanitizer to:

 * Consider expressions guarded by an appropriate StartsWith check to be
sanitized.
 * Consider a StartsWith check to be inappropriate if it is checking the
result of `Path.Combine`, as that has not been appropriately resolved.

Tests have been updated to reflect this refinement.
2018-08-24 14:27:25 +01:00
Luke Cartey
fc925d49f4 C#: ZipSlip - Treat the result of Substring as sanitized.
As with the previous commit, this considers the result of substring as
sanitized, rather than the argument.
2018-08-24 12:38:01 +01:00
Luke Cartey
43d7e598a5 C#: Treat GetFileName method call as sanitizer
Use the GetFileName call as a sanitizer, rather than an argument to that
call. It is the _result_ of the GetFileName call which should be
considered sanitized. By using the argument, we can spuriously suppress
use-use flow. Consider:
```
var path = Path.Combine(destDir, entry.GetFullName());
var fileName = Path.GetFileName(path);
log("Extracting " + fileName);
entry.ExtractToFile(path);
```
Previously, the `ExtractToFile(path)` call would not have been flagged,
because the `path` argument to `GetFileName` was considered sanitized,
and that argument formed a use-use pair with the `path` argument to
`ExtractToFile`. Now, this result would be flagged because only the
result of the `GetFileName` call is considered sanitized.
2018-08-24 12:08:57 +01:00
calum
41382dd732 C#: A regression test for extractor crash when wrong expression type is used for a literal. 2018-08-23 17:45:40 +01:00
10042 changed files with 505220 additions and 113057 deletions

View File

@@ -1,2 +1,2 @@
[*.{ql,qll,qlref,dbscheme,qhelp}]
end_of_line = lf
[*]
end_of_line = lf

58
.gitattributes vendored
View File

@@ -1,17 +1,49 @@
# The following file types will be normalized to LF line endings in the Git
# database, and will keep those LF line endings in the working tree even on
# Windows. Any other files will have whatever line endings they had when they
# were committed. If you add new entries below, you should renormalize the
# affected files by running the following from the root of this repo (requires
# Git 2.16 or greater):
# Text files will be normalized to LF line endings in the Git database, and will keep those LF line
# endings in the working tree even on Windows. If you make changes below, you should renormalize the
# affected files by running the following from the root of this repo (requires Git 2.16 or greater):
#
# git add --renormalize .
# git status [just to show what files were renormalized]
# git commit -m "Normalize line endings"
#
# Also, please update .editorconfig to handle any new entries as well.
*.ql eol=lf
*.qll eol=lf
*.qlref eol=lf
*.dbscheme eol=lf
*.qhelp eol=lf
# Anything Git auto-detects as text gets normalized and checked out as LF
* text=auto eol=lf
# Explicitly set a bunch of known extensions to text, in case auto detection gets confused.
*.ql text
*.qll text
*.qlref text
*.dbscheme text
*.qhelp text
*.html text
*.htm text
*.xhtml text
*.xhtm text
*.js text
*.mjs text
*.ts text
*.json text
*.yml text
*.yaml text
*.c text
*.cpp text
*.h text
*.hpp text
*.md text
*.stats text
*.xml text
*.sh text
*.pl text
*.java text
*.cs text
*.py text
*.lua text
*.expected text
# Explicitly set a bunch of known extensions to binary, because Git < 2.10 will treat
# `* text=auto eol=lf` as `* text eol=lf`
*.png -text
*.jpg -text
*.jpeg -text
*.gif -text
*.dll -text

4
.gitignore vendored
View File

@@ -8,3 +8,7 @@
# qltest projects and artifacts
*/ql/test/**/*.testproj
*/ql/test/**/*.actual
# Visual studio temporaries, except a file used by QL4VS
.vs/*
!.vs/VSWorkspaceSettings.json

22
.lgtm.yml Executable file
View File

@@ -0,0 +1,22 @@
path_classifiers:
library:
- javascript/externs
- javascript/extractor/lib
test:
- csharp/ql/src
- csharp/ql/test
- javascript/extractor/parser-tests
- javascript/extractor/tests
- javascript/ql/src
- javascript/ql/test
- python/ql/src
- python/ql/test
queries:
- include: "*"
extraction:
python:
python_setup:
version: 3

View File

@@ -1,2 +1,4 @@
/csharp/ @Semmle/cs
/java/ @Semmle/java
/javascript/ @Semmle/js
/cpp/ @Semmle/cpp-analysis

View File

@@ -4,8 +4,8 @@ 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
@@ -13,4 +13,4 @@ We welcome contributions to our standard library and standard checks. Do you hav
## 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,53 @@
# Improvements to C/C++ analysis
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Cast between `HRESULT` and a Boolean type (`cpp/hresult-boolean-conversion`) | security, external/cwe/cwe-253 | Finds logic errors caused by mistakenly treating the Windows `HRESULT` type as a Boolean instead of testing it with the appropriate macros. Results are shown on LGTM by default. |
| Cast from `char*` to `wchar_t*` (`cpp/incorrect-string-type-conversion`) | security, external/cwe/cwe-704 | Detects potentially dangerous casts from `char*` to `wchar_t*`. Results are shown on LGTM by default. |
| Dead code due to `goto` or `break` statement (`cpp/dead-code-goto`) | maintainability, external/cwe/cwe-561 | Detects dead code following a `goto` or `break` statement. Results are shown on LGTM by default. |
| Inconsistent direction of for loop (`cpp/inconsistent-loop-direction`) | correctness, external/cwe/cwe-835 | Detects `for` loops where the increment and guard condition don't appear to correspond. Results are shown on LGTM by default. |
| Incorrect 'not' operator usage (`cpp/incorrect-not-operator-usage`) | security, external/cwe/cwe-480 | Finds uses of the logical not (`!`) operator that look like they should be bit-wise not (`~`). Results are hidden on LGTM by default. |
| Non-virtual destructor in base class (`cpp/virtual-destructor`) | reliability, readability, language-features | This query, `NonVirtualDestructorInBaseClass.ql`, is a replacement in LGTM for the query: No virtual destructor (`AV Rule 78.ql`). The new query ignores base classes with non-public destructors since we consider those to be adequately protected. The new version retains the query identifier, `cpp/virtual-destructor`, and results are displayed by default on LGTM. The old query is no longer run on LGTM. |
| `NULL` application name with an unquoted path in call to `CreateProcess` (`cpp/unsafe-create-process-call`) | security, external/cwe/cwe-428 | Finds unsafe uses of the `CreateProcess` function. Results are hidden on LGTM by default. |
| Setting a DACL to `NULL` in a `SECURITY_DESCRIPTOR` (`cpp/unsafe-dacl-security-descriptor`) | security, external/cwe/cwe-732 | Finds code that creates world-writable objects on Windows by setting their DACL to `NULL`. Results are shown on LGTM by default. |
## Changes to existing LGTM queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Comparison result is always the same (`cpp/constant-comparison`) | Fewer false positive results | Comparisons in template instantiations are now excluded from results. |
| Empty branch of conditional (`cpp/empty-block`) | Fewer false positive results | Now recognizes commented blocks more reliably. |
| Expression has no effect (`cpp/useless-expression`) | Fewer false positive results | Expressions in template instantiations are now excluded from results. |
| Missing return statement (`cpp/missing-return`) | Fewer false positive results, visible by default | Improved results when a function returns a template-dependent type, or makes a non-returning call to another function. Precision increased from 'medium' to 'high' so that alerts are shown by default in LGTM. |
| Multiplication result converted to larger type (`cpp/integer-multiplication-cast-to-long`) | Fewer false positive results | Char-typed numbers are no longer considered to be potentially large. |
| No virtual destructor (`cpp/jsf/av-rule-78`) | No results in LGTM | This query is part of the [Joint Strike Fighter](http://www.stroustrup.com/JSF-AV-rules.pdf) suite which defines strict coding rules for air vehicles. Its query identifier has been revised to reflect this. On LGTM this query has been replaced by the similar query "Non-virtual destructor in base class", see New queries above. The new query highlights only code that is likely to be a problem in the majority of projects. |
| Overloaded assignment does not return 'this' (`cpp/assignment-does-not-return-this`) | Fewer false positive results | Any return statements that are unreachable are now ignored. |
| Resource not released in destructor (`cpp/resource-not-released-in-destructor`) | Fewer false positive results | No longer highlights uses of C++ _placement new_ and results are no longer reported for resources where the destructor body is not in the snapshot database. |
| Self comparison (`cpp/comparison-of-identical-expressions`) | Fewer false positive results | Code inside macro invocations is now excluded from the query. |
| Static array access may cause overflow (`cpp/static-buffer-overflow`) | More correct results | Data flow to the `size` argument of a buffer operation is now checked in this query. |
| Suspicious add with sizeof (`cpp/suspicious-add-sizeof`) | Fewer false positive results | Arithmetic with void pointers (where allowed) is now excluded from results. |
| Unsigned comparison to zero (`cpp/unsigned-comparison-zero`) | Fewer false positive results | Comparisons in template instantiations are now excluded from results. |
| Wrong type of arguments to formatting function (`cpp/wrong-type-format-argument`) | Fewer false positive results | False positive results involving `typedef`s have been removed. Expected argument types are determined more accurately, especially for wide string and pointer types. Custom (non-standard) formatting functions are also identified more accurately. |
## Changes to other queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Array offset used before range check (`cpp/offset-use-before-range-check`) | More results and fewer false positive results | Now recognizes array accesses in different positions within the expression. Code where the range is checked before and after the array access is no longer highlighted. |
| AV Rule 164 (`cpp/jsf/av-rule-164`) | Fewer false positive results | Now accounts for explicit casts. |
| Call to memory access function may overflow buffer (`cpp/overflow-buffer`) | More correct results | Array indexing with a negative index is now detected by this query. |
| Global could be static (`cpp/jpl-c/limited-scope-file` and `cpp/power-of-10/global-could-be-static`)| Fewer false positive results | Variables with declarations in header files are now excluded from results. |
| Memory is never freed (`cpp/memory-never-freed`)| Fewer false positive results | No longer highlights uses of C++ _placement new_, which returns a pointer that does not need to be freed. |
| Negation of unsigned value (`cpp/jsf/av-rule-165`) | Fewer false positive results | Now accounts for explicit casts. |
| Suspicious call to memset (`cpp/suspicious-call-to-memset`) | Fewer false positive results | Types involving `decltype` are now correctly compared. |
| Variable scope too large (`cpp/jpl-c/limited-scope-function` and `cpp/power-of-10/variable-scope-too-large`) | Fewer false positive results | Variables with declarations in header files, or that are used at file scope, are now excluded from results. |
## Changes to QL libraries
* New hash consing library (`semmle.code.cpp.valuenumbering.HashCons`) for structural comparison of expressions. Unlike the existing library for global value numbering, this library implements a pure syntactic comparison of expressions and will equate expressions even if they may not compute the same value.
* The `Buffer.qll` library has more conservative treatment of arrays embedded in structs. This reduces false positive results in a number of security queries, especially `cpp/overflow-buffer`.
* Pre-C99 encodings of _flexible array members_ are recognized more reliably.
* Arrays of zero size are now treated as a special case.
* The library `semmle.code.cpp.dataflow.RecursionPrevention` is now deprecated. It was an aid for transitioning data-flow queries from 1.16 to 1.17, and it no longer has any function. Imports of this library should simply be deleted.

View File

@@ -0,0 +1,44 @@
# Improvements to C# analysis
## General improvements
### Changes to the autobuilder
During code extraction, when determining the target of `msbuild` or `dotnet build`, the autobuilder now looks for:
* `.proj` files,
* then `.sln` files,
* and finally `.csproj`/`.vcxproj` files.
In all three cases, when multiple files of the same type are found, the project/solution file closest to the root is used to build the project.
### Control flow graph improvements
* The control flow graph construction now takes simple Boolean conditions on local scope variables into account. For example, in `if (b) x = 0; if (b) x = 1;`, the control flow graph will reflect the fact that taking the `true` (resp. `false`) branch in the first condition implies taking the same branch in the second condition. In effect, the first assignment to `x` will now be identified as being dead.
* Code that is only reachable from a constant failing assertion, such as `Debug.Assert(false)`, is considered to be unreachable.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Uncontrolled format string (`cs/uncontrolled-format-string`) | security, external/cwe/cwe-134 | Finds data flow from remote inputs to the format string in `String.Format`. Results are shown on LGTM by default. |
| Using a package with a known vulnerability (`cs/use-of-vulnerable-package`) | security, external/cwe/cwe-937 | Finds project build files that import packages with known vulnerabilities. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Cross-site scripting (`cs/web/xss`) | More results | Finds cross-site scripting vulnerabilities in ASP.NET Core applications. |
| Inconsistent lock sequence (`cs/inconsistent-lock-sequence`) | More results | Finds inconsistent lock sequences globally across calls. |
| Local scope variable shadows member (`cs/local-shadows-member`) | Fewer results | Results have been removed where a constructor parameter shadows a member, because the parameter is probably used to initialize the member. |
## Changes to code extraction
* Arguments passed using `in` are now extracted.
* Fixed a bug where the `dynamic` type name was not extracted correctly in certain circumstances.
* Fixed a bug where method type signatures were extracted incorrectly in some circumstances.
## Changes to QL libraries
* `getArgument()` on `AccessorCall` has been improved so it now takes tuple assignments into account. For example, the argument for the implicit `value` parameter in the setter of property `P` is `0` in `(P, x) = (0, 1)`. Additionally, the argument for the `value` parameter in compound assignments is now only the expanded value, for example, in `P += 7` the argument is `P + 7` and not `7`.
* The predicate `isInArgument()` has been added to the `AssignableAccess` class. This holds for expressions that are passed as arguments using `in`

View File

@@ -0,0 +1,39 @@
# Improvements to Java analysis
## General improvements
Path explanations have been added to the relevant security queries.
Use [QL for Eclipse](https://help.semmle.com/ql-for-eclipse/Content/WebHelp/getting-started.html)
to run queries and explore the data flow in results.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Arbitrary file write during archive extraction ("Zip Slip") (`java/zipslip`) | security, external/cwe/cwe-022 | Identifies extraction routines that allow arbitrary file overwrite vulnerabilities. Results are shown on LGTM by default. |
| Missing catch of NumberFormatException (`java/uncaught-number-format-exception`) | reliability, external/cwe/cwe-248 | Finds calls to `Integer.parseInt` and similar string-to-number conversions that might raise a `NumberFormatException` without a corresponding `catch`-clause. Results are hidden on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Array index out of bounds (`java/index-out-of-bounds`) | Fewer false positive results | Results for arrays with a length evenly divisible by 3, or some greater number, and an index being increased with a similar stride length are no longer reported. |
| Confusing overloading of methods (`java/confusing-method-signature`) | Fewer false positive results | A correction to the inheritance relation ensures that spurious results on certain generic classes no longer occur. |
| Query built from user-controlled sources (`java/sql-injection`) | More results | SQL injection sinks from the Spring JDBC, MyBatis, and Hibernate frameworks are now reported. |
| Query built without neutralizing special characters (`java/concatenated-sql-query`) | More results | SQL injection sinks from the Spring JDBC, MyBatis, and Hibernate frameworks are now reported. |
| Unreachable catch clause (`java/unreachable-catch-clause`) | Fewer false positive results | Now accounts for calls to generic methods that throw generic exceptions. |
| Useless comparison test (`java/constant-comparison`) | Fewer false positive results | Constant comparisons guarding `java.util.ConcurrentModificationException` are no longer reported, as they are intended to always be false in the absence of API misuse. |
## Changes to QL libraries
* The class `ControlFlowNode` (and by extension `BasicBlock`) has until now
been directly equatable to `Expr` and `Stmt`. Exploiting these equalities,
for example by using casts, is now deprecated, and the conversions
`Expr.getControlFlowNode()` and `Stmt.getControlFlowNode()` should be used
instead.
* The default set of taint sources in the `FlowSources` library is extended to
cover parameters annotated with Spring framework annotations indicating
remote user input from servlets. This affects all security queries, which
will yield additional results on projects that use the Spring Web framework.
* The `ParityAnalysis` library is replaced with the more general `ModulusAnalysis` library, which improves the range analysis.

View File

@@ -0,0 +1,82 @@
# Improvements to JavaScript analysis
## General improvements
* Modeling of taint flow through array and buffer operations has been improved. This may give additional results for the security queries.
* Support for AMD modules has been improved. This may give additional results for the security queries, as well as any queries that use type inference on code bases that use such modules.
* Support for popular libraries has been improved. Consequently, queries may produce more results on code bases that use the following features:
- File system access, for example, through [fs-extra](https://github.com/jprichardson/node-fs-extra) or [globby](https://www.npmjs.com/package/globby)
- Outbound network access, for example, through the [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
- The [lodash](https://lodash.com), [underscore](https://underscorejs.org/), [async](https://www.npmjs.com/package/async) and [async-es](https://www.npmjs.com/package/async-es) libraries
* The taint tracking library now recognizes additional sanitization patterns. This may give fewer false-positive 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.
* Path explanations have been added to the relevant security queries.
Use [QL for Eclipse](https://help.semmle.com/ql-for-eclipse/Content/WebHelp/getting-started.html)
to run queries and explore the data flow in results.
## New LGTM queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Hard-coded data interpreted as code (`js/hardcoded-data-interpreted-as-code`) | security, external/cwe/cwe-506 | Highlights locations where hard-coded data is transformed and then executed as code or interpreted as an import path, which may indicate embedded malicious code ([CWE-506](https://cwe.mitre.org/data/definitions/506.html)). Results are hidden on LGTM by default. |
| Host header poisoning in email generation (`js/host-header-forgery-in-email-generation`)| security, external/cwe/cwe-640 | Highlights code that generates emails with links that can be hijacked by HTTP host header poisoning, indicating a potential violation of [CWE-640](https://cwe.mitre.org/data/definitions/640.html). Results shown on LGTM by default. |
| Replacement of a substring with itself (`js/identity-replacement`) | correctness, security, external/cwe/cwe-116 | Highlights string replacements that replace a string with itself, which usually indicates a mistake. Results shown on LGTM by default. |
| Stored cross-site scripting (`js/stored-xss`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights uncontrolled stored values flowing into HTML content, indicating a potential violation of [CWE-079](https://cwe.mitre.org/data/definitions/79.html). Results shown on LGTM by default. |
| Unclear precedence of nested operators (`js/unclear-operator-precedence`) | maintainability, correctness, external/cwe/cwe-783 | Highlights nested binary operators whose relative precedence is easy to misunderstand. Results shown on LGTM by default. |
| Unneeded defensive code (`js/unneeded-defensive-code`) | correctness, external/cwe/cwe-570, external/cwe/cwe-571 | Highlights locations where defensive code is not needed. Results are shown on LGTM by default. |
| Unsafe dynamic method access (`js/unsafe-dynamic-method-access` ) | security, external/cwe/cwe-094 | Highlights code that invokes a user-controlled method on an object with unsafe methods. Results are shown on LGTM by default. |
| Unvalidated dynamic method access (`js/unvalidated-dynamic-method-call` ) | security, external/cwe/cwe-754 | Highlights code that invokes a user-controlled method without guarding against exceptional circumstances. Results are shown on LGTM by default. |
| Useless assignment to property (`js/useless-assignment-to-property`) | maintainability | Highlights property assignments whose value is always overwritten. Results are shown on LGTM by default. |
## Other new queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------------------------|------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Enabling Node.js integration for Electron web content renderers (`js/enabling-electron-renderer-node-integration`) | security, frameworks/electron, external/cwe/cwe-094 | Highlights Electron web content renderer preferences with Node.js integration enabled, indicating a potential violation of [CWE-94](https://cwe.mitre.org/data/definitions/94.html). |
| File data in outbound network request (`js/file-access-to-http`) | security, external/cwe/cwe-200 | Highlights locations where file data is sent in a network request, indicating a potential violation of [CWE-200](https://cwe.mitre.org/data/definitions/200.html). |
| User-controlled data written to file (`js/http-to-file-access`) | security, external/cwe/cwe-434, external/cwe/cwe-912 | Highlights locations where user-controlled data is written to a file, indicating a potential violation of [CWE-912](https://cwe.mitre.org/data/definitions/912.html). |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|--------------------------------|----------------------------|----------------------------------------------|
| Ambiguous HTML id attribute (`js/duplicate-html-id`) | Lower severity | Severity revised to "warning". |
| Clear-text logging of sensitive information (`js/clear-text-logging`) | Fewer results | Query now tracks flow more precisely. |
| Client side cross-site scripting (`js/xss`) | More results | HTML injection in the body of an email is also highlighted. |
| Client-side URL redirect (`js/client-side-unvalidated-url-redirection`) | Fewer false positive results | Safe redirects recognized in more cases. |
| Conflicting HTML element attributes (`js/conflicting-html-attribute`) | Lower severity | Severity revised to "warning". |
| Duplicate 'if' condition (`js/duplicate-condition`) | Lower severity | Severity revised to "warning". |
| Duplicate switch case (`js/duplicate-switch-case`) | Lower severity | Severity revised to "warning". |
| Inconsistent use of 'new' (`js/inconsistent-use-of-new`) | Simpler result presentation | Results show one call with `new` and one without. |
| Information exposure through a stack trace (`js/stack-trace-exposure`) | More results | Cases where the entire exception object (including the stack trace) may be exposed are highlighted. |
| Missing 'this' qualifier (`js/missing-this-qualifier`) | Fewer false positive results | Additional intentional calls to global functions are recognized. |
| Missing CSRF middleware (`js/missing-token-validation`) | Fewer false positive results | Additional types of CSRF protection middleware are recognized. |
| Missing variable declaration (`js/missing-variable-declaration`) | Lower severity | Severity revised to "warning". |
| Regular expression injection (`js/regex-injection`) | Fewer false positive results | Calls to `String.prototype.search` are identified with more precision. |
| Remote property injection (`js/remote-property-injection`) | Fewer results | No longer highlights dynamic method calls, which are now handled by two new queries: `js/unsafe-dynamic-method-access` and `js/unvalidated-dynamic-method-call`. The precision of this rule has been revised to "medium", reflecting the precision of the remaining results. Results are now hidden on LGTM by default. |
| Self assignment (`js/redundant-assignment`) | Fewer false positive results | Self-assignments preceded by a JSDoc comment with a `@type` tag are no longer highlighted. |
| Server-side URL redirect (`js/server-side-unvalidated-url-redirection`) | More results and fewer false positive results | More redirection calls are identified. More safe redirections are recognized and ignored. |
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | Additional ways that class methods can be bound are recognized. |
| Uncontrolled data used in network request (`js/request-forgery`) | More results | Additional kinds of requests are identified. |
| Unknown directive (`js/unknown-directive`) | Fewer false positives results | YUI compressor directives are now recognized. |
| Unused variable, import, function or class (`js/unused-local-variable`) | Fewer false positive results and fewer results | Imports used by the `transform-react-jsx` Babel plugin and fewer variables that may be used by `eval` calls are highlighted. Only one result is reported for an import statement with multiple unused imports. |
| Useless assignment to local variable (`js/useless-assignment-to-local`) | Fewer false positive results | Additional ways default values can be set are recognized. |
| Useless conditional (`js/trivial-conditional`) | More results, fewer false positive results | More types of conditional are recognized. Additional defensive coding patterns are now ignored. |
| Whitespace contradicts operator precedence (`js/whitespace-contradicts-precedence`) | Fewer false positive results | Operators with asymmetric whitespace are no longer highlighted. |
| Wrong use of 'this' for static method (`js/mixed-static-instance-this-access`) | More results, fewer false-positive results | Inherited methods are now identified. |
## Changes to QL libraries
* A `DataFlow::ParameterNode` instance now exists for all function parameters. Previously, unused parameters did not have a corresponding data-flow node.
* `ReactComponent::getAThisAccess` has been renamed to `getAThisNode`. The old name is still usable but is deprecated. It no longer gets individual `this` expressions, but the `ThisNode` mentioned below.
* The `DataFlow::ThisNode` class now corresponds to the implicit receiver parameter of a function, as opposed to an individual `this` expression. This means that `getALocalSource` now maps all `this` expressions within a given function to the same source. The data-flow node associated with a `ThisExpr` can no longer be cast to `DataFlow::SourceNode` or `DataFlow::ThisNode`. Using `getALocalSource` before casting, or instead of casting, is recommended.
* The flow configuration framework now supports distinguishing and tracking different kinds of taint, specified by an extensible class `FlowLabel` (which can also be referred to by its alias `TaintKind`).

View File

@@ -0,0 +1,94 @@
# Improvements to Python analysis
## General improvements
### Representation of the control flow graph
The representation of the control flow graph (CFG) has been modified to better reflect the semantics of Python. As part of these changes, a new predicate `Stmt.getAnEntryNode()` has been added to make it easier to write reachability queries involving statements.
#### CFG nodes removed
The following statement types no longer have a CFG node for the statement itself, as their sub-expressions already contain all the
semantically significant information:
* `ExprStmt`
* `If`
* `Assign`
* `Import`
For example, the CFG for `if cond: foo else bar` now starts with the CFG node for `cond`.
#### CFG nodes reordered
For the following statement types, the CFG node for the statement now follows the CFG nodes of its sub-expressions to follow Python semantics:
* `Print`
* `TemplateWrite`
* `ImportStar`
For example the CFG for `print foo` (in Python 2) has changed from `print -> foo` to `foo -> print`, to reflect the runtime behavior.
The CFG for the `with` statement has been re-ordered to more closely reflect the semantics.
For the `with` statement:
```python
with cm as var:
body
```
* Previous CFG node order: `<with>` -> `cm` -> `var` -> `body`
* New CFG node order: `cm` -> `<with>` -> `var` -> `body`
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Assert statement tests the truth value of a literal constant (`py/assert-literal-constant`) | reliability, correctness | Checks whether an assert statement is testing the truth of a literal constant value. Results are hidden on LGTM by default. |
| Flask app is run in debug mode (`py/flask-debug`) | security, external/cwe/cwe-215, external/cwe/cwe-489 | Finds instances where a Flask application is run in debug mode. Results are shown on LGTM by default. |
| Information exposure through an exception (`py/stack-trace-exposure`) | security, external/cwe/cwe-209, external/cwe/cwe-497 | Finds instances where information about an exception may be leaked to an external user. Results are shown on LGTM by default. |
| Jinja2 templating with autoescape=False (`py/jinja2/autoescape-false`) | security, external/cwe/cwe-079 | Finds instantiations of `jinja2.Environment` with `autoescape=False` which may allow XSS attacks. Results are hidden on LGTM by default. |
| Request without certificate validation (`py/request-without-cert-validation`) | security, external/cwe/cwe-295 | Finds requests where certificate verification has been explicitly turned off, possibly allowing man-in-the-middle attacks. Results are hidden on LGTM by default. |
| Use of weak cryptographic key (`py/weak-crypto-key`) | security, external/cwe/cwe-326 | Finds creation of weak cryptographic keys. Results are shown on LGTM by default. |
## Changes to existing queries
All taint-tracking queries now support visualization of paths in QL for Eclipse.
Most security alerts are now visible on LGTM by default. This means that you may see results that were previously hidden for the following queries:
* Code injection (`py/code-injection`)
* Reflected server-side cross-site scripting (`py/reflective-xss`)
* SQL query built from user-controlled sources (`py/sql-injection`)
* Uncontrolled data used in path expression (`py/path-injection`)
* Uncontrolled command line (`py/command-line-injection`)
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Command injection (`py/command-line-injection`) | More results | Additional sinks in the `os`, and `popen` modules may find more results in some projects. |
| Encoding error (`py/encoding-error`) | Better alert location | Alerts are now shown at the start of the encoding error, rather than at the top of the file. |
| Missing call to \_\_init\_\_ during object initialization (`py/missing-call-to-init`) | Fewer false positive results | Results where it is likely that the full call chain has not been analyzed are no longer reported. |
| URL redirection from remote source (`py/url-redirection`) | Fewer false positive results | Taint is no longer tracked from the right-hand side of binary expressions. In other words `SAFE + TAINTED` is now treated as safe. |
## Changes to code extraction
## Improved reporting of encoding errors
The extractor now outputs the location of the first character that triggers an `EncodingError`.
Any queries that report encoding errors will now show results at the location of the character that caused the error.
### Improved scalability
Scaling is near linear to at least 20 CPU cores.
### Improved logging
* Five levels of logging are available: `CRITICAL`, `ERROR`, `WARN`, `INFO` and `DEBUG`. `WARN` is the default.
* LGTM uses `INFO` level logging. QL tools use `WARN` level logging by default.
* The `--verbose` flag can be specified specified multiple times to increase the logging level once per flag added.
* The `--quiet` flag can be specified multiple times to reduce the logging level once per flag added.
* Log lines are now in the `[SEVERITY] message` style and never overlap.
## Changes to QL libraries
* Taint-tracking analysis now understands HTTP requests in the `twisted` library.
* The analysis now handles `isinstance` and `issubclass` tests involving the basic abstract base classes better. For example, the test `issubclass(list, collections.Sequence)` is now understood to be `True`
* Taint tracking automatically tracks tainted mappings and collections, without you having to add additional taint kinds. This means that custom taints are tracked from `x` to `y` in the following flow: `l = [x]; y =l[0]`.

View File

@@ -0,0 +1,27 @@
[[ condition: enterprise-only ]]
# Improvements to JavaScript analysis
## General improvements
* On LGTM, files whose name ends in `.min.js` or `-min.js` are no longer extracted by default. These files usually contain minified code and any alerts in these files would be hidden by default. If you still want to extract code from these files, you can add the following filters to your `lgtm.yml` file (or add them to existing filters):
```yaml
extraction:
javascript:
index:
filters:
- include: "**/*.min.js"
- include: "**/*-min.js"
```
* The TypeScript compiler is now included in the LGTM Enterprise and QL command-line tools installations, and you no longer need to install it manually.
If you need to override the compiler version, set the `SEMMLE_TYPESCRIPT_HOME` environment variable to
point to an installation of the `typescript` NPM package.
## Changes to code extraction
The extractor now supports:
* [Optional Chaining](https://github.com/tc39/proposal-optional-chaining) expressions.
* Additional [Flow](https://flow.org/) syntax.

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

@@ -0,0 +1,48 @@
# Improvements to C/C++ analysis
## General improvements
* 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** |
|----------------------------|------------------------|------------------------------------------------------------------|
| 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. |
| 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

@@ -0,0 +1,38 @@
# Improvements to C# analysis
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| 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
* Fix extraction of `for` statements where the condition declares new variables using `is`.
* Initializers of `stackalloc` arrays are now extracted.
## Changes to QL libraries
* 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

@@ -0,0 +1,32 @@
# Improvements to Java analysis
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Double-checked locking is not thread-safe (`java/unsafe-double-checked-locking`) | reliability, correctness, concurrency, external/cwe/cwe-609 | Identifies wrong implementations of double-checked locking that does not use the `volatile` keyword. |
| Race condition in double-checked locking object initialization (`java/unsafe-double-checked-locking-init-order`) | reliability, correctness, concurrency, external/cwe/cwe-609 | Identifies wrong implementations of double-checked locking that performs additional initialization after exposing the constructed object. |
## Changes to existing queries
| **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

@@ -0,0 +1,67 @@
# Improvements to JavaScript analysis
## General improvements
* 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/)
* 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** |
|--------------------------------------------|------------------------------|------------------------------------------------------------------------------|
| 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

@@ -0,0 +1,12 @@
[[ condition: enterprise-only ]]
# Improvements to JavaScript analysis
## Changes to code extraction
* 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,9 @@
Name, Category
ASP.NET, Web application framework
ASP.NET Core, Web application framework
ASP.NET Razor templates, Web application framework
EntityFramework, Database ORM
EntityFramework Core, Database ORM
Json.NET, Serialization
NHibernate, Database ORM
WinForms, User interface
1 Name Category
2 ASP.NET Web application framework
3 ASP.NET Core Web application framework
4 ASP.NET Razor templates Web application framework
5 EntityFramework Database ORM
6 EntityFramework Core Database ORM
7 Json.NET Serialization
8 NHibernate Database ORM
9 WinForms User interface

View File

@@ -0,0 +1,58 @@
Frameworks and libraries
########################
The QL libraries and queries in version |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
================================
.. csv-table::
:file: csharp-frameworks.csv
:header-rows: 1
:class: fullWidthTable
:widths: auto
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,13 @@
Name, Category
Hibernate, Database
iBatis / MyBatis, Database
Java Persistence API (JPA), Database
JDBC, Database
Protobuf, Serialization
Kryo deserialization, Serialization
SnakeYaml, Serialization
Spring JDBC, Database
Spring MVC, Web application framework
Struts, Web application framework
Thrift, RPC framework
XStream, Serialization
1 Name Category
2 Hibernate Database
3 iBatis / MyBatis Database
4 Java Persistence API (JPA) Database
5 JDBC Database
6 Protobuf Serialization
7 Kryo deserialization Serialization
8 SnakeYaml Serialization
9 Spring JDBC Database
10 Spring MVC Web application framework
11 Struts Web application framework
12 Thrift RPC framework
13 XStream Serialization

View File

@@ -0,0 +1,23 @@
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
socket.io, Network communicator
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 socket.io Network communicator
21 sqlite3 Database
22 superagent Network communicator
23 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] Builds that execute on Java 6 to 11 can be analyzed. The analysis understands Java 11 language features.
.. [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,11 @@
Name, Category
Bottle, Web framework
CherryPy, Web framework
Django, Web application framework
Falcon, Web API framework
Flask, Microframework
Pyramid, Web application framework
Tornado, Web application framework and asynchronous networking library
Turbogears, Web framework
Twisted, Networking engine
WebOb, WSGI request library
1 Name Category
2 Bottle Web framework
3 CherryPy Web framework
4 Django Web application framework
5 Falcon Web API framework
6 Flask Microframework
7 Pyramid Web application framework
8 Tornado Web application framework and asynchronous networking library
9 Turbogears Web framework
10 Twisted Networking engine
11 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.3 together with .NET versions up to 4.7.1,"Microsoft Visual Studio up to 2017,
.NET Core up to 2.2","``.sln``, ``.csproj``, ``.cs``, ``.cshtml``, ``.xaml``"
COBOL,ANSI 85 or newer [1]_.,Not applicable,"``.cbl``, ``.CBL``, ``.cpy``, ``.CPY``, ``.copy``, ``.COPY``"
Java,"Java 6 to 11 [2]_.","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, 3.2",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.3 together with .NET versions up to 4.7.1 Microsoft Visual Studio up to 2017, .NET Core up to 2.2 ``.sln``, ``.csproj``, ``.cs``, ``.cshtml``, ``.xaml``
4 COBOL ANSI 85 or newer [1]_. Not applicable ``.cbl``, ``.CBL``, ``.cpy``, ``.CPY``, ``.copy``, ``.COPY``
5 Java Java 6 to 11 [2]_. 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, 3.2 Standard TypeScript compiler ``.ts``, ``.tsx``

View File

@@ -1,58 +1,106 @@
{
"C++ 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"
],
"C++ 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"
],
"C++ 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"
],
"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"
],
"C++ IR OperandTag": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/OperandTag.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/OperandTag.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/OperandTag.qll"
],
"C++ IR IRImpl": [
"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"
],
"C++ IR IRSanityImpl": [
"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"
],
"C++ IR PrintIRImpl": [
"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"
],
"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 SimpleSSA": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SimpleSSA.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SimpleSSA.qll"
],
"C++ SSA IRBlockConstruction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRBlockConstruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRBlockConstruction.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"
]
"DataFlow Java/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/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"
],
"DataFlow Java/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"
],
"C++ 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"
],
"C++ 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"
],
"C++ 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"
],
"C++ 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"
],
"C++ 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"
],
"C++ IR IRImpl": [
"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"
],
"C++ IR IRSanityImpl": [
"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"
],
"C++ IR PrintIRImpl": [
"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"
],
"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++ 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"
],
"C++ 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"
],
"C++ IR ConstantAnalysis": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/constant/ConstantAnalysis.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/constant/ConstantAnalysis.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/constant/ConstantAnalysis.qll"
],
"C++ IR PrintConstantAnalysis": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/constant/PrintConstantAnalysis.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/constant/PrintConstantAnalysis.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/constant/PrintConstantAnalysis.qll"
],
"C++ IR ReachableBlock": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/reachability/ReachableBlock.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/reachability/ReachableBlock.qll"
],
"C++ IR PrintReachableBlock": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/reachability/PrintReachableBlock.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/reachability/PrintReachableBlock.qll"
],
"C++ IR Dominance": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/reachability/Dominance.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/reachability/Dominance.qll"
],
"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"
]
}

View File

@@ -6,7 +6,8 @@
+ 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
# Consistent Use
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /Correctness/Dangerous Conversions
# 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
@@ -14,6 +15,7 @@
+ 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/Likely Typos/FutileParams.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,7 +7,8 @@
+ 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
# Consistent Use
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /Correctness/Dangerous Conversions
# 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,7 @@
+ 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/Likely Typos/FutileParams.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

@@ -1,13 +1,13 @@
# CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
+ semmlecode-cpp-queries/Security/CWE/CWE-120/UnboundedWrite.ql: /CWE/CWE-120
@name Unbounded write (CWE-120)
+ semmlecode-cpp-queries/Security/CWE/CWE-120/BadlyBoundedWrite.ql: /CWE/CWE-120
@name Badly bounded write (CWE-120)
+ semmlecode-cpp-queries/Security/CWE/CWE-120/OverrunWrite.ql: /CWE/CWE-120
@name Potentially overrunning write (CWE-120)
+ semmlecode-cpp-queries/Security/CWE/CWE-120/OverrunWriteFloat.ql: /CWE/CWE-120
@name Potentially overrunning write with float to string conversion (CWE-120)
+ semmlecode-cpp-queries/Best Practices/Likely Errors/OffsetUseBeforeRangeCheck.ql: /CWE/CWE-120
@name Array offset used before range check (CWE-120)
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/UnsafeUseOfStrcat.ql: /CWE/CWE-120
@name Potentially unsafe use of strcat (CWE-120)
# CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
+ semmlecode-cpp-queries/Security/CWE/CWE-120/UnboundedWrite.ql: /CWE/CWE-120
@name Unbounded write (CWE-120)
+ semmlecode-cpp-queries/Security/CWE/CWE-120/BadlyBoundedWrite.ql: /CWE/CWE-120
@name Badly bounded write (CWE-120)
+ semmlecode-cpp-queries/Security/CWE/CWE-120/OverrunWrite.ql: /CWE/CWE-120
@name Potentially overrunning write (CWE-120)
+ semmlecode-cpp-queries/Security/CWE/CWE-120/OverrunWriteFloat.ql: /CWE/CWE-120
@name Potentially overrunning write with float to string conversion (CWE-120)
+ semmlecode-cpp-queries/Best Practices/Likely Errors/OffsetUseBeforeRangeCheck.ql: /CWE/CWE-120
@name Array offset used before range check (CWE-120)
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/UnsafeUseOfStrcat.ql: /CWE/CWE-120
@name Potentially unsafe use of strcat (CWE-120)

View File

@@ -1,3 +1,3 @@
# CWE-121: Stack-based Buffer Overflow
+ semmlecode-cpp-queries/Security/CWE/CWE-121/UnterminatedVarargsCall.ql: /CWE/CWE-121
@name Unterminated variadic call (CWE-121)
# CWE-121: Stack-based Buffer Overflow
+ semmlecode-cpp-queries/Security/CWE/CWE-121/UnterminatedVarargsCall.ql: /CWE/CWE-121
@name Unterminated variadic call (CWE-121)

View File

@@ -1,7 +1,7 @@
# CWE-131: Incorrect Calculation of Buffer Size
+ semmlecode-cpp-queries/Security/CWE/CWE-131/NoSpaceForZeroTerminator.ql: /CWE/CWE-131
@name No space for zero terminator (CWE-131)
+ semmlecode-cpp-queries/Critical/SizeCheck.ql: /CWE/CWE-131
@name Not enough memory allocated for pointer type (CWE-131)
+ semmlecode-cpp-queries/Critical/SizeCheck2.ql: /CWE/CWE-131
@name Not enough memory allocated for array of pointer type (CWE-131)
# CWE-131: Incorrect Calculation of Buffer Size
+ semmlecode-cpp-queries/Security/CWE/CWE-131/NoSpaceForZeroTerminator.ql: /CWE/CWE-131
@name No space for zero terminator (CWE-131)
+ semmlecode-cpp-queries/Critical/SizeCheck.ql: /CWE/CWE-131
@name Not enough memory allocated for pointer type (CWE-131)
+ semmlecode-cpp-queries/Critical/SizeCheck2.ql: /CWE/CWE-131
@name Not enough memory allocated for array of pointer type (CWE-131)

View File

@@ -1,13 +1,13 @@
# CWE-134: Uncontrolled Format String
+ semmlecode-cpp-queries/Likely Bugs/Format/NonConstantFormat.ql: /CWE/CWE-134
@name Non-constant format string (CWE-134)
# This one runs out of memory. See ODASA-608.
#+ semmlecode-cpp-queries/PointsTo/TaintedFormatStrings.ql: /CWE/CWE-134
+ semmlecode-cpp-queries/Likely Bugs/Format/WrongNumberOfFormatArguments.ql: /CWE/CWE-134
@name Wrong number of arguments to formatting function (CWE-134)
+ semmlecode-cpp-queries/Likely Bugs/Format/WrongTypeFormatArguments.ql: /CWE/CWE-134
@name Wrong type of arguments to formatting function (CWE-134)
+ semmlecode-cpp-queries/Security/CWE/CWE-134/UncontrolledFormatString.ql: /CWE/CWE-134
@name Uncontrolled format string (CWE-134)
+ semmlecode-cpp-queries/Security/CWE/CWE-134/UncontrolledFormatStringThroughGlobalVar.ql: /CWE/CWE-134
@name Uncontrolled format string (through global variable) (CWE-134)
# CWE-134: Uncontrolled Format String
+ semmlecode-cpp-queries/Likely Bugs/Format/NonConstantFormat.ql: /CWE/CWE-134
@name Non-constant format string (CWE-134)
# This one runs out of memory. See ODASA-608.
#+ semmlecode-cpp-queries/PointsTo/TaintedFormatStrings.ql: /CWE/CWE-134
+ semmlecode-cpp-queries/Likely Bugs/Format/WrongNumberOfFormatArguments.ql: /CWE/CWE-134
@name Wrong number of arguments to formatting function (CWE-134)
+ semmlecode-cpp-queries/Likely Bugs/Format/WrongTypeFormatArguments.ql: /CWE/CWE-134
@name Wrong type of arguments to formatting function (CWE-134)
+ semmlecode-cpp-queries/Security/CWE/CWE-134/UncontrolledFormatString.ql: /CWE/CWE-134
@name Uncontrolled format string (CWE-134)
+ semmlecode-cpp-queries/Security/CWE/CWE-134/UncontrolledFormatStringThroughGlobalVar.ql: /CWE/CWE-134
@name Uncontrolled format string (through global variable) (CWE-134)

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

@@ -0,0 +1,3 @@
# CWE-253: Incorrect Check of Function Return Value
+ semmlecode-cpp-queries/Security/CWE/CWE-253/HResultBooleanConversion.ql: /CWE/CWE-253
@name Cast between HRESULT and a Boolean type (CWE-253)

View File

@@ -0,0 +1,3 @@
# CWE-428: Unquoted Search Path or Element
+ semmlecode-cpp-queries/Security/CWE/CWE-428/UnsafeCreateProcessCall.ql: /CWE/CWE-428
@name NULL application name with an unquoted path in call to CreateProcess (CWE-428)

View File

@@ -1,3 +1,5 @@
# CWE-732: Incorrect Permission Assignment for Critical Resource
+ semmlecode-cpp-queries/Security/CWE/CWE-732/DoNotCreateWorldWritable.ql: /CWE/CWE-732
@name File created without restricting permissions (CWE-732)
+ semmlecode-cpp-queries/Security/CWE/CWE-732/UnsafeDaclSecurityDescriptor.ql: /CWE/CWE-732
@name Setting a DACL to NULL in a SECURITY_DESCRIPTOR (CWE-732)

View File

@@ -12,12 +12,13 @@
@import "cwe-134"
@import "cwe-170"
@import "cwe-190"
@import "cwe-242"
@import "cwe-253"
@import "cwe-290"
@import "cwe-311"
@import "cwe-327"
@import "cwe-367"
@import "cwe-416"
@import "cwe-428"
@import "cwe-457"
@import "cwe-468"
@import "cwe-676"

View File

@@ -64,7 +64,7 @@ class SuppressionScope extends ElementBase {
* 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).
* [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)

View File

@@ -1,24 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This query shows graph of class inheritance hierarchy</p>
<p />
</overview>
<section title="How to Address the Query Results">
<p />
</section>
<references>
</references>
</qhelp>

View File

@@ -1,12 +1,13 @@
/**
* @name Class hierarchies
* @description Shows classes and their base classes.
* @description Shows an inheritance hierarchy for classes and their base classes.
* @kind graph
* @id cpp/architecture/class-hierarchies
* @graph.layout organic
* @workingset jhotdraw
* @result succeed 48
* @result_ondemand succeed 48
* @tags maintainability
*/
import cpp

View File

@@ -1,25 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This query shows coupling between classes.</p>
<p>Red, large boxes are hub types that depend on many other classes
and are depended on by many other classes.</p>
</overview>
<section title="How to Address the Query Results">
<p />
</section>
<references>
</references>
</qhelp>

View File

@@ -1,10 +1,11 @@
/**
* @name Hub classes
* @description Shows coupling between classes; red, large boxes are hub types that depend on many other 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

View File

@@ -5,44 +5,30 @@
<overview>
<p>This query shows the distribution of inheritance depth across all types, i.e. classes. Library types are ignored.</p>
<p>This query shows the distribution of inheritance depth across all types, that is, classes. Library types are ignored.</p>
<p>The result of this query is a line graph showing, for each number <i>n</i>, how many types have an inheritance depth of <i>n</i>, where
the inheritance depth of a type is the length of a longest path in the inheritance hierarchy from top class to the type.</p>
<p>When hovering the mouse pointer over a specific depth value, the number of types having this inheritance depth is displayed.</p>
</overview>
<section title="How to Address the Query Results">
<recommendation>
<p>The depth of a type is an indication of how deeply nested a type is in a given design.
Very deep types can be an indication of over-engineering, whereas a system with predominantly shallow types
may not be exploiting object-orientation to the full.</p>
</recommendation>
</section>
<references>
<li>
Shyam R. Chidamber and Chris F. Kemerer.
<a href="http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf">A Metrics Suite for Object Oriented Design
</a>.
Shyam R. Chidamber and Chris F. Kemerer,
<i><a href="http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf">A Metrics Suite for Object Oriented Design
</a></i>.
IEEE Transactions on Software Engineering,
20(6), pages 476-493, June 1994.
20(6), pages 476-493, June 1994.</li>
<a href="http://www.dmst.aueb.gr/dds/index.en.html">Diomides D. Spinnelis</a>.
<a href="http://www.spinellis.gr/codequality/">Code Quality: The Open Source Perspective</a>.
Addison-Wesley 2007.
<a href="http://www.dmst.aueb.gr/dds/index.en.html">Diomides D. Spinnelis</a>.
<a href="http://www.spinellis.gr/sw/ckjm/">ckjm - Chidamber and Kemerer Java Metrics</a>.
(implementation of CK metrics), 2006.
</li></references></qhelp>
<li>
Lutz Prechelt, Barbara Unger, Michael Philippsen, and Walter Tich, <i><a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.159.2229&amp;rep=rep1&amp;type=pdf">A Controlled Experiment on Inheritance Depth as a Cost Factor for Code Maintenance
</a></i>.
Journal of Systems and Software, 65 (2):115-126, 2003.
</li>
</references>
</qhelp>

View File

@@ -1,12 +1,13 @@
/**
* @name Inheritance depth distribution
* @description Shows distribution of inheritance depth across all classes.
* @description Shows the distribution of inheritance depth across all classes.
* @kind chart
* @id cpp/architecture/inheritance-depth-distribution
* @chart.type line
* @workingset jhotdraw
* @result succeed 48
* @result_ondemand succeed 48
* @tags maintainability
*/
import cpp

View File

@@ -7,19 +7,15 @@
<overview>
<p>This query shows namespaces that cyclically depend
on one another.</p>
<p />
</overview>
<section title="How to Address the Query Results">
<p>If there are cyclic dependencies between packages, they cannot be developed and tested independently. It is thus preferable to
eliminate such cycles from the program.</p>
<recommendation>
<p>If there are cyclic dependencies between packages, they cannot be developed and tested independently.
It is better to eliminate such cycles from the program.</p>
</recommendation>
</section>
<references>
<li>Robert Martin's <a href="https://drive.google.com/file/d/0BwhCYaYDn8EgOGM2ZGFhNmYtNmE4ZS00OGY5LWFkZTYtMjE0ZGNjODQ0MjEx/view">Acyclic Dependencies Principle</a>.
</li></references></qhelp>
</li>
</references>
</qhelp>

View File

@@ -5,6 +5,7 @@
* @id cpp/architecture/cyclic-namespaces
* @graph.layout hierarchical
* @tags maintainability
* modularity
*/
import cpp

View File

@@ -5,18 +5,15 @@
<overview>
<p>This query finds classes that belong to no namespace</p>
<p>This query finds classes that belong to no namespace.</p>
</overview>
<section title="How to Address the Query Results">
<p>If there are too many classes that belong to no namespace, consider creating namespaces to get a better project structure.</p>
<recommendation>
<p>If there are many classes that belong to no namespace, consider defining namespaces to create a better project structure.</p>
</recommendation>
</section>
<references>
<li>C++ reference: <a href="https://en.cppreference.com/w/cpp/language/namespace">Namespaces</a>
</li>
</references>
</qhelp>

View File

@@ -1,8 +1,10 @@
/**
* @name Global namespace classes
* @description Finds classes that belong to no namespace
* @description Finds classes that belong to no namespace.
* @kind table
* @id cpp/architecture/global-namespace-classes
* @tags maintainability
* modularity
*/
import cpp

View File

@@ -1,24 +0,0 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>This query finds namespace dependencies and draws hierarchical graph.</p>
<p />
</overview>
<section title="How to Address the Query Results">
<p />
</section>
<references>
</references>
</qhelp>

View File

@@ -1,9 +1,11 @@
/**
* @name Namespace dependencies
* @description Shows dependencies between namespaces.
* @description Shows dependencies between namespaces as a hierarchical graph.
* @kind graph
* @id cpp/architecture/namespace-dependencies
* @graph.layout hierarchical
* @tags maintainability
* modularity
*/
import cpp

View File

@@ -15,20 +15,9 @@ functions, and the total number of source code resp. comment lines.</p>
depends on third-party libraries: low self-containedness means that many dependencies
are to library classes (as opposed to source classes within the same application).</p>
</overview>
<section title="How to Address the Query Results">
<p>The results of this query are purely informative and more useful for getting an overall impression of the application than for
identifying particular defects.</p>
identifying particular problems with the code.</p>
</overview>
</section>
<references>
</references>
</qhelp>

View File

@@ -3,6 +3,7 @@
* @description Shows general statistics about the application.
* @kind table
* @id cpp/architecture/general-statistics
* @tags maintainability
*/
import cpp

View File

@@ -1,17 +1,17 @@
// an include declaration just adds one source dependency, it does not automatically
// add a dependency from this file to all the declarations in stdio.h
#include <stdio.h>
#include <myfile.h> // contains non-static global myfile_err
extern int myfile_err; // this external declaration adds a dependency on myfile.h
class C {
public:
C() {
// one dependency for printf:
printf("Hello world!");
// one dependency for FILE type, and one for NULL macro:
FILE fp = NULL;
}
};
// an include declaration just adds one source dependency, it does not automatically
// add a dependency from this file to all the declarations in stdio.h
#include <stdio.h>
#include <myfile.h> // contains non-static global myfile_err
extern int myfile_err; // this external declaration adds a dependency on myfile.h
class C {
public:
C() {
// one dependency for printf:
printf("Hello world!");
// one dependency for FILE type, and one for NULL macro:
FILE fp = NULL;
}
};

View File

@@ -1,20 +1,20 @@
//This struct contains 30 fields.
struct MyParticle {
bool isActive;
int priority;
float x, y, z;
float dx, dy, dz;
float ddx, ddy, ddz;
bool isCollider;
int age, maxAge;
float size1, size2;
bool hasColor;
unsigned char r1, g1, b1, a1;
unsigned char r2, g2, b2, a2;
class texture *tex;
float u1, v1, u2, v2;
};
//This struct contains 30 fields.
struct MyParticle {
bool isActive;
int priority;
float x, y, z;
float dx, dy, dz;
float ddx, ddy, ddz;
bool isCollider;
int age, maxAge;
float size1, size2;
bool hasColor;
unsigned char r1, g1, b1, a1;
unsigned char r2, g2, b2, a2;
class texture *tex;
float u1, v1, u2, v2;
};

View File

@@ -1,8 +1,8 @@
// this example has 15 parameters.
void fillRect(int x, int y, int w, int h,
int r1, int g1, int b1, int a1,
int r2, int g2, int b2, int a2,
gradient_type grad, unsigned int flags, bool border)
{
// ...
}
// this example has 15 parameters.
void fillRect(int x, int y, int w, int h,
int r1, int g1, int b1, int a1,
int r2, int g2, int b2, int a2,
gradient_type grad, unsigned int flags, bool border)
{
// ...
}

View File

@@ -1,13 +1,13 @@
//This condition is too complex and can be improved by using local variables
bool accept_message =
(message_type == CONNECT && _state != CONNECTED) ||
(message_type == DISCONNECT && _state == CONNECTED) ||
(message_type == DATA && _state == CONNECTED);
//This condition is acceptable, as all the logical operators are of the same type (&&)
bool valid_connect =
message_type == CONNECT &&
_state != CONNECTED &&
time_since_prev_connect > MAX_CONNECT_INTERVAL &&
message_length <= MAX_PACKET_SIZE &&
//This condition is too complex and can be improved by using local variables
bool accept_message =
(message_type == CONNECT && _state != CONNECTED) ||
(message_type == DISCONNECT && _state == CONNECTED) ||
(message_type == DATA && _state == CONNECTED);
//This condition is acceptable, as all the logical operators are of the same type (&&)
bool valid_connect =
message_type == CONNECT &&
_state != CONNECTED &&
time_since_prev_connect > MAX_CONNECT_INTERVAL &&
message_length <= MAX_PACKET_SIZE &&
checksum(message) == get_checksum_field(message);

View File

@@ -1,6 +1,6 @@
void f(int i) {
for (int i = 0; i < 10; ++i) { //the loop variable hides the parameter to f()
...
}
}
void f(int i) {
for (int i = 0; i < 10; ++i) { //the loop variable hides the parameter to f()
...
}
}

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"

View File

@@ -1,12 +1,12 @@
void f() {
int i = 10;
for (int i = 0; i < 10; i++) { //the loop counter hides the variable
...
}
{
int i = 12; //this variable hides the variable in the outer block
...
}
}
void f() {
int i = 10;
for (int i = 0; i < 10; i++) { //the loop counter hides the variable
...
}
{
int i = 12; //this variable hides the variable in the outer block
...
}
}

View File

@@ -1,12 +1,12 @@
int i = 10;
void f() {
for (int i = 0; i < 10; i++) { //the loop counter hides the global variable i
...
}
{
int i = 12; //this variable hides the global variable i
...
}
}
int i = 10;
void f() {
for (int i = 0; i < 10; i++) { //the loop counter hides the global variable i
...
}
{
int i = 12; //this variable hides the global variable i
...
}
}

View File

@@ -1,9 +1,9 @@
void f(int i) {
if (i == 10); //empty then block
... //won't be part of the if statement
if (i == 12) {
...
} else { //empty else block, most likely a mistake
}
}
void f(int i) {
if (i == 10); //empty then block
... //won't be part of the if statement
if (i == 12) {
...
} else { //empty else block, most likely a mistake
}
}

View File

@@ -29,6 +29,10 @@ class AffectedFile extends File {
}
}
/**
* A block, or an element we might find textually within a block that is
* not a child of it in the AST.
*/
class BlockOrNonChild extends Element {
BlockOrNonChild() {
( this instanceof Block
@@ -68,6 +72,9 @@ class BlockOrNonChild extends Element {
}
}
/**
* A block that contains a non-child element.
*/
predicate emptyBlockContainsNonchild(Block b) {
emptyBlock(_, b) and
exists(BlockOrNonChild c, AffectedFile file |
@@ -78,7 +85,27 @@ predicate emptyBlockContainsNonchild(Block b) {
)
}
/**
* A block that is entirely on one line, which also contains a comment. Chances
* are the comment is intended to refer to the block.
*/
predicate lineComment(Block b) {
emptyBlock(_, b) and
exists(Location bLocation, File f, int line |
bLocation = b.getLocation() and
f = bLocation.getFile() and
line = bLocation.getStartLine() and
line = bLocation.getEndLine() and
exists(Comment c, Location cLocation |
cLocation = c.getLocation() and
cLocation.getFile() = f and
cLocation.getStartLine() = line
)
)
}
from ControlStructure s, Block eb
where emptyBlock(s, eb)
and not emptyBlockContainsNonchild(eb)
and not lineComment(eb)
select eb, "Empty block without comment"

View File

@@ -1,7 +1,7 @@
int find(int start, char *str, char goal)
{
int len = strlen(str);
//Potential buffer overflow
//Potential buffer overflow
for (int i = start; str[i] != 0 && i < len; i++) {
if (str[i] == goal)
return i;
@@ -12,7 +12,7 @@ int find(int start, char *str, char goal)
int findRangeCheck(int start, char *str, char goal)
{
int len = strlen(str);
//Range check protects against buffer overflow
//Range check protects against buffer overflow
for (int i = start; i < len && str[i] != 0 ; i++) {
if (str[i] == goal)
return i;

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/offset-use-before-range-check
* @problem.severity warning
* @precision medium
* @tags reliability
* security
* external/cwe/cwe-120
@@ -13,10 +14,29 @@
import cpp
from Variable v, LogicalAndExpr andexpr, ArrayExpr access, LTExpr rangecheck
where access.getArrayOffset() = v.getAnAccess()
and andexpr.getLeftOperand().getAChild() = access
and andexpr.getRightOperand() = rangecheck
and rangecheck.getLeftOperand() = v.getAnAccess()
and not access.isInMacroExpansion()
predicate beforeArrayAccess(Variable v, ArrayExpr access, Expr before) {
exists(LogicalAndExpr andexpr |
access.getArrayOffset() = v.getAnAccess() and
andexpr.getRightOperand().getAChild*() = access and
andexpr.getLeftOperand() = before
)
}
predicate afterArrayAccess(Variable v, ArrayExpr access, Expr after) {
exists(LogicalAndExpr andexpr |
access.getArrayOffset() = v.getAnAccess() and
andexpr.getLeftOperand().getAChild*() = access and
andexpr.getRightOperand() = after
)
}
from Variable v, ArrayExpr access, LTExpr rangecheck
where
afterArrayAccess(v, access, rangecheck) and
rangecheck.getLeftOperand() = v.getAnAccess() and
not access.isInMacroExpansion() and
not exists(LTExpr altcheck |
beforeArrayAccess(v, access, altcheck) and
altcheck.getLeftOperand() = v.getAnAccess()
)
select access, "This use of offset '" + v.getName() + "' should follow the $@.", rangecheck, "range check"

View File

@@ -1,43 +1,43 @@
static int idctr = 0;
//Basic connection with id
class Connection {
public:
int connId;
virtual void print_info() {
cout << "id: " << connId << "\n";
}
Connection() {
connId = idctr++;
}
};
//Adds counters, and an overriding print_info
class MeteredConnection : public Connection {
public:
int txCtr;
int rxCtr;
MeteredConnection() {
txCtr = 0;
rxCtr = 0;
}
virtual void print_info() {
cout << "id: " << connId << "\n" << "tx/rx: " << txCtr << "/" << rxCtr << "\n";
}
};
int main(int argc, char* argv[]) {
Connection conn;
MeteredConnection m_conn;
Connection curr_conn = conn;
curr_conn.print_info();
curr_conn = m_conn; //Wrong: Derived MetricConnection assigned to Connection
//variable, will slice off the counters and the overriding print_info
curr_conn.print_info(); //Will not print the counters.
Connection* curr_pconn = &conn;
curr_pconn->print_info();
curr_pconn = &m_conn; //Correct: Pointer assigned to address of the MetricConnection.
//Counters and virtual functions remain intact.
curr_pconn->print_info(); //Will call the correct method MeteredConnection::print_info
}
static int idctr = 0;
//Basic connection with id
class Connection {
public:
int connId;
virtual void print_info() {
cout << "id: " << connId << "\n";
}
Connection() {
connId = idctr++;
}
};
//Adds counters, and an overriding print_info
class MeteredConnection : public Connection {
public:
int txCtr;
int rxCtr;
MeteredConnection() {
txCtr = 0;
rxCtr = 0;
}
virtual void print_info() {
cout << "id: " << connId << "\n" << "tx/rx: " << txCtr << "/" << rxCtr << "\n";
}
};
int main(int argc, char* argv[]) {
Connection conn;
MeteredConnection m_conn;
Connection curr_conn = conn;
curr_conn.print_info();
curr_conn = m_conn; //Wrong: Derived MetricConnection assigned to Connection
//variable, will slice off the counters and the overriding print_info
curr_conn.print_info(); //Will not print the counters.
Connection* curr_pconn = &conn;
curr_pconn->print_info();
curr_pconn = &m_conn; //Correct: Pointer assigned to address of the MetricConnection.
//Counters and virtual functions remain intact.
curr_pconn->print_info(); //Will call the correct method MeteredConnection::print_info
}

View File

@@ -1,16 +1,16 @@
void sanitize(Fields[] record) {
//The number of fields here can be put in a const
for (fieldCtr = 0; field < 7; field++) {
sanitize(fields[fieldCtr]);
}
}
#define NUM_FIELDS 7
void process(Fields[] record) {
//This avoids using a magic constant by using the macro instead
for (fieldCtr = 0; field < NUM_FIELDS; field++) {
process(fields[fieldCtr]);
}
}
void sanitize(Fields[] record) {
//The number of fields here can be put in a const
for (fieldCtr = 0; field < 7; field++) {
sanitize(fields[fieldCtr]);
}
}
#define NUM_FIELDS 7
void process(Fields[] record) {
//This avoids using a magic constant by using the macro instead
for (fieldCtr = 0; field < NUM_FIELDS; field++) {
process(fields[fieldCtr]);
}
}

View File

@@ -4,6 +4,8 @@
* @kind problem
* @id cpp/use-number-constant
* @problem.severity recommendation
* @precision low
* @tags maintainability
*/
import cpp
import MagicConstants

View File

@@ -4,6 +4,8 @@
* @kind problem
* @id cpp/use-string-constant
* @problem.severity recommendation
* @precision low
* @tags maintainability
*/
import cpp
import MagicConstants

View File

@@ -4,7 +4,9 @@
* to enforce invariants that should hold for the whole hierarchy.
* @kind problem
* @id cpp/nvi
* @problem.severity warning
* @problem.severity recommendation
* @precision low
* @tags maintainability
*/
import cpp

View File

@@ -4,8 +4,11 @@
* to enforce invariants that should hold for the whole hierarchy.
* This is especially problematic in classes with many
* dependencies or dependents.
* @kind table
* @kind problem
* @id cpp/nvi-hub
* @problem.severity recommendation
* @precision low
* @tags maintainability
*/
import cpp
@@ -19,4 +22,4 @@ where f.hasSpecifier("public") and
fclass = f.getDeclaringType() and
hubIndex = fclass.getMetrics().getAfferentCoupling() * fclass.getMetrics().getEfferentCoupling() and
hubIndex > 100
select f.getFile(), f, "Avoid having public virtual methods (NVI idiom)"
select f, "Avoid having public virtual methods (NVI idiom)"

View File

@@ -8,17 +8,13 @@
<p>This query finds classes that define a destructor, a copy constructor, or a copy assignment operator, but not all three of them. The compiler generates default implementations for these functions, and since they deal with similar concerns it is likely that if the default implementation of one of them is not satisfactory, then neither are those of the others.</p>
<p>The query flags any such class with a warning, and also display the list of generated warnings in the result view.</p>
</overview>
<section title="How to Address the Query Results">
<recommendation>
<p>Explicitly define the missing functions.</p>
</recommendation>
</section>
<references>
<li><a href="http://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)">Wikipedia article</a>
</li></references></qhelp>
<li>Wikipedia: <a href="http://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)">Rule of three (C++ programming)</a></li>
</references>
</qhelp>

View File

@@ -1,26 +1,26 @@
class C {
private:
Other* other = NULL;
public:
C(const C& copyFrom) {
Other* newOther = new Other();
*newOther = copyFrom.other;
this->other = newOther;
}
//No operator=, by default will just copy the pointer other, will not create a new object
};
class D {
Other* other = NULL;
public:
D& operator=(D& rhs) {
Other* newOther = new Other();
*newOther = rhs.other;
this->other = newOther;
return *this;
}
//No copy constructor, will just copy the pointer other and not create a new object
};
class C {
private:
Other* other = NULL;
public:
C(const C& copyFrom) {
Other* newOther = new Other();
*newOther = copyFrom.other;
this->other = newOther;
}
//No operator=, by default will just copy the pointer other, will not create a new object
};
class D {
Other* other = NULL;
public:
D& operator=(D& rhs) {
Other* newOther = new Other();
*newOther = rhs.other;
this->other = newOther;
return *this;
}
//No copy constructor, will just copy the pointer other and not create a new object
};

View File

@@ -1,32 +1,32 @@
//This switch statement has long case statements, and can become difficult to
//read as the processing for each message type becomes more complex
switch (message_type) {
case CONNECT:
_state = CONNECTING;
int message_id = message_get_id(message);
int source = connect_get_source(message);
//More code here...
send(connect_response);
break;
case DISCONNECT:
_state = DISCONNECTING;
int message_id = message_get_id(message);
int source = disconnect_get_source(message);
//More code here...
send(disconnect_response);
break;
default:
log("Invalid message, id : %d", message_get_id(message));
}
//This is better, as each case is split out to a separate function
switch (packet_type) {
case STREAM:
process_stream_packet(packet);
break;
case DATAGRAM:
process_datagram_packet(packet);
break;
default:
log("Invalid packet type: %d", packet_type);
//This switch statement has long case statements, and can become difficult to
//read as the processing for each message type becomes more complex
switch (message_type) {
case CONNECT:
_state = CONNECTING;
int message_id = message_get_id(message);
int source = connect_get_source(message);
//More code here...
send(connect_response);
break;
case DISCONNECT:
_state = DISCONNECTING;
int message_id = message_get_id(message);
int source = disconnect_get_source(message);
//More code here...
send(disconnect_response);
break;
default:
log("Invalid message, id : %d", message_get_id(message));
}
//This is better, as each case is split out to a separate function
switch (packet_type) {
case STREAM:
process_stream_packet(packet);
break;
case DATAGRAM:
process_datagram_packet(packet);
break;
default:
log("Invalid packet type: %d", packet_type);
}

View File

@@ -4,7 +4,10 @@
* the included elements are used.
* @kind problem
* @id cpp/unused-includes
* @problem.severity warning
* @problem.severity recommendation
* @precision low
* @tags maintainability
* useless-code
*/
import cpp

View File

@@ -1,5 +1,5 @@
{
int x = 0; //x is unused
int y = 0;
cout << y;
}
{
int x = 0; //x is unused
int y = 0;
cout << y;
}

View File

@@ -1,14 +1,14 @@
//start of file
static void f() { //static function f() is unused in the file
//...
}
static void g() {
//...
}
void public_func() { //non-static function public_func is not called in file,
//but could be visible in other files
//...
g(); //call to g()
//...
}
//end of file
//start of file
static void f() { //static function f() is unused in the file
//...
}
static void g() {
//...
}
void public_func() { //non-static function public_func is not called in file,
//but could be visible in other files
//...
g(); //call to g()
//...
}
//end of file

View File

@@ -1,5 +1,5 @@
void f() {
static int i = 0; //i is unused
...
return;
}
void f() {
static int i = 0; //i is unused
...
return;
}

View File

@@ -25,4 +25,5 @@ where v.isStatic()
and not v instanceof MemberVariable
and not declarationHasSideEffects(v)
and not v.getAnAttribute().hasName("used")
and not v.getAnAttribute().hasName("unused")
select v, "Static variable " + v.getName() + " is never read"

View File

@@ -1,199 +0,0 @@
import cpp
import CPython.Extensions
/* A call to an argument parsing function */
class PyArgParseTupleCall extends FunctionCall {
PyArgParseTupleCall() {
this.getTarget().hasGlobalName("PyArg_Parse") or
this.getTarget().hasGlobalName("PyArg_ParseTuple") or
this.getTarget().hasGlobalName("PyArg_VaParse") or
this.getTarget().hasGlobalName("PyArg_ParseTupleAndKeywords") or
this.getTarget().hasGlobalName("PyArg_VaParseAndKeywords")
}
private int getFormatIndex() {
exists(Function f | f = this.getTarget() |
(f.hasGlobalName("PyArg_Parse") or f.hasGlobalName("PyArg_ParseTuple") or f.hasGlobalName("PyArg_VaParse")) and result = 1
or
(f.hasGlobalName("PyArg_ParseTupleAndKeywords") or f.hasGlobalName("PyArg_VaParseAndKeywords")) and result = 2
)
}
private string getFormatString() {
result = this.getArgument(this.getFormatIndex()).(StringLiteral).getValue()
}
string getArgumentFormat() {
exists(string fmt | fmt = this.getFormatString() |
exists(int i | fmt.charAt(i) = ";" or fmt.charAt(i) = ":" | result = fmt.prefix(i))
or
not exists(int i | fmt.charAt(i) = ";" or fmt.charAt(i) = ":") and result = fmt
)
}
string getPyArgumentType(int index) {
parse_format_string(this.getArgumentFormat(), index, _, result) and result != "typed"
or
exists(int cindex, PythonClass cls | parse_format_string(this.getArgumentFormat(), index, cindex, "typed") |
cls.getAnAccess() = this.getArgument(this.getFormatIndex() * 2 + cindex).(AddressOfExpr).getOperand() and
result = cls.getTpName()
)
or
exists(int cindex | parse_format_string(this.getArgumentFormat(), index, cindex, "typed") and
not exists(PythonClass cls | cls.getAnAccess() = this.getArgument(this.getFormatIndex() * 2 + cindex).(AddressOfExpr).getOperand())
and result = "object"
)
}
predicate pyArgumentIsOptional(int index) {
exists(string suffix | split_format_string(this.getArgumentFormat(), _, _, suffix, index, _) |
suffix.charAt(0) = "|")
}
predicate pyArgumentIsKwOnly(int index) {
exists(string suffix | split_format_string(this.getArgumentFormat(), _, _, suffix, index, _) |
suffix.charAt(0) = "$")
}
}
class PyUnpackTupleCall extends FunctionCall {
PyUnpackTupleCall() {
this.getTarget().hasGlobalName("PyArg_UnpackTuple")
}
int getMinSize() {
result = this.getArgument(2).getValue().toInt()
}
int getMaxSize() {
result = this.getArgument(3).getValue().toInt()
}
}
predicate limiting_format(string text, string limit) {
text = "t#" and limit = "read-only"
or
(text = "B" or text = "H" or text = "I" or text = "k" or text = "K") and limit = "non-negative"
or
(text = "c" or text = "C") and limit = "length-one"
}
predicate format_string(string text, string type, int cargs) {
tuple_format(text, type, cargs) or simple_format(text, type, cargs)
}
private
predicate simple_format(string text, string type, int cargs) {
text = "s" and (type = "str" or type = "unicode") and cargs = 1
or
text = "s#" and (type = "str" or type = "unicode") and cargs = 2
or
text = "s*" and (type = "str" or type = "unicode") and cargs = 1
or
text = "z" and (type = "str" or type = "unicode" or type = "NoneType") and cargs = 1
or
text = "z#" and (type = "str" or type = "unicode" or type = "NoneType" or type = "buffer") and cargs = 2
or
text = "z*" and (type = "str" or type = "unicode" or type = "NoneType" or type = "buffer") and cargs = 1
or
text = "u" and type = "unicode" and cargs = 1
or
text = "u#" and type = "unicode" and cargs = 2
or
text = "O" and type = "object" and cargs = 1
or
text = "p" and type = "object" and cargs = 1
or
text = "O&" and type = "object" and cargs = 2
or
text = "O!" and type = "typed" and cargs = 2
or
(text = "b" or text = "h" or text = "i" or text = "l" or text = "L" or text = "n") and type = "int" and cargs = 1
or
(text = "B" or text = "H" or text = "I" or text = "k" or text = "K") and type = "int" and cargs = 1
or
text = "c" and (type = "bytes" or type = "bytearray") and cargs = 1
or
text = "C" and type = "unicode" and cargs = 1
or
text = "D" and type = "complex" and cargs = 1
or
(text = "f" or text = "d") and type = "float" and cargs = 1
or
text = "S" and type = "str" and cargs = 1
or
text = "U" and type = "unicode" and cargs = 1
or
text = "t#" and type = "buffer" and cargs = 2
or
text = "w" and type = "buffer" and cargs = 1
or
text = "w#" and type = "buffer" and cargs = 2
or
text = "w*" and type = "buffer" and cargs = 1
or
(text = "es" or text = "et") and (type = "str" or type = "unicode" or type = "buffer") and cargs = 2
or
(text = "es#" or text = "et#") and (type = "str" or type = "unicode" or type = "buffer") and cargs = 3
or
text = "y" and type = "bytes" and cargs = 1
or
text = "y*" and (type = "bytes" or type = "bytearray" or type = "buffer") and cargs = 1
or
text = "y#" and (type = "bytes" or type = "bytearray" or type = "buffer") and cargs = 2
}
private
predicate tuple_format(string text, string type, int cargs) {
type = "tuple" and
exists(PyArgParseTupleCall call | exists(call.getArgumentFormat().indexOf(text)))
and
exists(string body | text = "(" + body + ")" | tuple_body(body, _, cargs))
}
private
predicate tuple_body(string body, int pyargs, int cargs) {
body = "" and cargs = 0 and pyargs = 0
or
(exists(PyArgParseTupleCall call | exists(call.getArgumentFormat().indexOf(body))) and
exists(string p, int pargs, string s, int sargs, int pyargsm1 | pyargs = pyargsm1+1 and tuple_body(p, pyargsm1, pargs) and
format_string(s, _, sargs) and body = p + s and cargs = pargs + sargs)
)
}
predicate format_token(string token, int delta, int cdelta) {
format_string(token, _, cdelta) and delta = 1
or
token = "|" and delta = 0 and cdelta = 0
or
token = "$" and delta = 0 and cdelta = 0
}
predicate split_format_string(string full, string prefix, string text, string suffix, int index, int cindex) {
exists(PyArgParseTupleCall call | call.getArgumentFormat() = full) and
full = prefix + text + suffix and
(suffix = "" or exists(string s | suffix.prefix(s.length()) = s | format_token(s, _, _))) and
format_token(text, _, _) and
(prefix = "" and index = 0 and cindex = 0 and suffix = full.suffix(text.length())
or
exists(string prefixm1, string suffixm1, string textm1, int im1, int cim1, int prev, int cprev |
full = prefixm1 + textm1 + suffixm1 and
split_format_string(full, prefixm1, textm1, suffixm1, im1, cim1) and
format_token(textm1, prev, cprev) and
index = im1+prev and
cindex = cim1+cprev and
prefix = prefixm1 + textm1 and
suffix = suffixm1.suffix(text.length()) and
text = suffixm1.prefix(text.length())
)
)
}
predicate parse_format_string(string full, int index, int cindex, string type) {
exists(string prefix, string text, string suffix | split_format_string(full, prefix, text, suffix, index, cindex) and format_string(text, type, _))
}

View File

@@ -1,14 +0,0 @@
/**
* @name Parameter type trap file generator
* @description Generate trap files (in CSV form) describing CPython extension function parameter types.
* @kind trap
* @id cpp/c-python/argument-type-trap
*/
import cpp
import CPython.Extensions
from TypedPythonExtensionFunction func, int arg, PythonClass cls
where func.getArgumentType(arg) = cls
select "ext_argtype", func.getTrapID(), arg, cls.getTrapID()

View File

@@ -1,13 +0,0 @@
/**
* @name py_cobject_sources() trap file generator
* @description Generate trap files (in CSV form) for CPython objects.
* @kind trap
* @id cpp/c-python/c-object-sources-trap
*/
import cpp
import CPython.Extensions
from CObject c
select "py_cobject_sources", c.getTrapID(), 1

View File

@@ -1,14 +0,0 @@
/**
* @name py_cobject() trap file generator
* @description Generate trap files (in CSV form) for CPython objects.
* @kind trap
* @id cpp/c-python/c-object-trap
*/
import cpp
import CPython.Extensions
from CObject c
select "py_cobjects", c.getTrapID()

View File

@@ -1,893 +0,0 @@
import cpp
import CPython.ArgParse
/* Root class of all 'C' objects */
abstract class CObject extends Element {
abstract string getTrapID();
}
/**
A Python class is an instance of PyTypeObject.
*/
class PythonClass extends Variable, CObject {
PythonClass() {
getType().hasName("PyTypeObject")
}
/** Gets the function table (if any) associated with the class. */
PythonFunctionTable getFunctionTable() {
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = getInitializer().getExpr()
and tt.hasName("PyTypeObject")
and f.hasName("tp_methods")
and f.getDeclaringType() = tt.getBaseType()
and result.getAnAccess() = l.getFieldExpr(f)
)
}
/** Gets the getset table (if any) associated with the class. */
PythonGetSetTable getGetSetTable() {
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = getInitializer().getExpr()
and tt.hasName("PyTypeObject")
and f.hasName("tp_getset")
and f.getDeclaringType() = tt.getBaseType()
and result.getAnAccess() = l.getFieldExpr(f)
)
}
/** Gets the Python module (if any) containing this class. */
PythonModule getModule() {
result = getFile()
}
Expr getSlot(string name) {
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = getInitializer().getExpr()
and tt.hasName("PyTypeObject")
and f.hasName(name)
and f.getDeclaringType() = tt.getBaseType()
and l.getFieldExpr(f) = result
)
}
string getTpName() {
exists(StringLiteral lit |
lit = this.getSlot("tp_name") |
result = lit.getValue()
)
}
Expr getSizeOf() {
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = getInitializer().getExpr()
and tt.hasName("PyTypeObject")
and f.hasName("tp_basicsize")
and f.getDeclaringType() = tt.getBaseType()
and l.getFieldExpr(f) = result
)
}
override string getTrapID() {
/* This needs to be kept in sync with extractor-python/semmle/passes/type.py */
result = "C_type$" + this.getTpName()
}
}
/**
A call to a Py_InitModule function. These functions register a Python module.
*/
class Py_InitModuleCall extends FunctionCall {
Py_InitModuleCall() {
// Py_InitModule itself is actually a macro, ultimately defined to be something like Py_InitModule4_64.
getTarget().getName().matches("Py\\_Init%")
}
/** Gets the name of the module being registered. */
string getModuleName() {
result = getArgument(0).(StringLiteral).getValue()
}
/** Gets the function table associated with this Py_InitModule call. */
PythonFunctionTable getFunctionTable() {
exists(VariableAccess va |
va = getArgument(1)
and result = va.getTarget()
)
}
}
/**
A Python module, represented by the file containing an initialising call for it.
*/
class PythonModule extends File {
PythonModule() {
exists(PythonModuleDefinition def | def.getFile() = this)
or
exists(FunctionCall c | c.getFile() = this |
c.getTarget().getName().matches("Py\\_InitModule%")
)
}
/** Gets a Python class that is in this module. */
PythonClass getAClass() {
result.getFile() = this
}
/** Gets the function table associated with the module. */
PythonFunctionTable getFunctionTable() {
result = this.getDefinition().getFunctionTable()
or
exists(FunctionCall c | c.getFile() = this |
c.getTarget().getName().matches("Py\\_InitModule%") and
c.getAnArgument() = result.getAnAccess()
)
}
/** Gets the Py_InitModule call that was used to register the module. */
//private
PythonModuleDefinition getDefinition() {
result.getFile() = this
}
/** Gets the name of the module. */
string getModuleName() {
result = this.getDefinition().getModuleName()
or
exists(FunctionCall c |c.getFile() = this |
c.getTarget().getName().matches("Py\\_InitModule%") and
c.getArgument(0).getValue() = result
)
}
}
/**
The function table for a Python module.
*/
class PythonFunctionTable extends Variable {
PythonFunctionTable() {
not(this instanceof Parameter)
and exists(ArrayType at | at = getType().getUnspecifiedType() and at.getBaseType().hasName("PyMethodDef"))
}
/** Gets an entry in the table. */
PythonFunctionTableEntry getATableEntry() {
result = getInitializer().getExpr().getAChild()
and exists(result.getRegisteredFunctionName())
}
/** Gets the class (if any) for which this is the function table. */
PythonClass getClass() {
result.getFunctionTable() = this
or
exists(FunctionAccess getattr, Call find_method |
result.getSlot("tp_getattr") = getattr |
find_method.getEnclosingFunction() = getattr.getTarget() and
find_method.getArgument(0) = this.getAnAccess()
)
}
/** Gets the module (if any) for which this is the function table. */
PythonModule getModule() {
result.getFunctionTable() = this
}
}
/**
The getset table for a Python module or type
*/
class PythonGetSetTable extends Variable {
PythonGetSetTable() {
not(this instanceof Parameter) and
exists(ArrayType at | at = getType() and at.getBaseType().hasName("PyGetSetDef"))
}
/** Gets the class (if any) for which this is the function table. */
PythonClass getClass() {
result.getGetSetTable() = this
}
/** Gets an entry in the table. */
PythonGetSetTableEntry getATableEntry() {
result = getInitializer().getExpr().getAChild()
and exists(result.getRegisteredPropertyName())
}
}
class PythonModuleDefinition extends Variable {
PythonModuleDefinition() {
not(this instanceof Parameter)
and exists(Type moddef_t | moddef_t = this.getType() and moddef_t.hasName("PyModuleDef"))
}
/** Gets the function table (if any) associated with the class. */
PythonFunctionTable getFunctionTable() {
exists(ClassAggregateLiteral l, Type moddef_t, Field f |
l = this.getInitializer().getExpr()
and moddef_t.hasName("PyModuleDef")
and f.hasName("m_methods")
and f.getDeclaringType() = moddef_t
and result.getAnAccess() = l.getFieldExpr(f)
)
}
/** Gets the function table (if any) associated with the class. */
string getModuleName() {
exists(ClassAggregateLiteral l, Type moddef_t, Field f |
l = this.getInitializer().getExpr()
and moddef_t.hasName("PyModuleDef")
and f.hasName("m_name")
and f.getDeclaringType() = moddef_t
and result = l.getFieldExpr(f).getValue()
)
}
}
/** A special (__xxx__) method implemented in C
*/
class PythonSpecialMethod extends Function {
PythonSpecialMethod() {
class_special_methods(_, _, this)
}
PythonClass getClass() {
class_special_methods(result, _, this)
}
string getPyName() {
class_special_methods(_, result, this)
}
}
predicate class_special_methods(PythonClass cls, string name, Function method) {
exists(string slot, FunctionAccess fa |
special_methods(name, slot) and cls.getSlot(slot) = fa and fa.getTarget() = method
or
number_methods(name, slot) and
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = cls.getSlot("tp_as_number")
and tt.hasName("PyNumberMethods")
and f.hasName(slot)
and f.getDeclaringType() = tt.getBaseType()
and l.getFieldExpr(f) = fa
and fa.getTarget() = method
)
or
sequence_methods(name, slot) and
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = cls.getSlot("tp_as_sequence")
and tt.hasName("PySequenceMethods")
and f.hasName(slot)
and f.getDeclaringType() = tt.getBaseType()
and l.getFieldExpr(f) = fa
and fa.getTarget() = method
)
or
mapping_methods(name, slot) and
exists(ClassAggregateLiteral l, TypedefType tt, Field f |
l = cls.getSlot("tp_as_mapping")
and tt.hasName("PyMappingMethods")
and f.hasName(slot)
and f.getDeclaringType() = tt.getBaseType()
and l.getFieldExpr(f) = fa
and fa.getTarget() = method
)
)
}
predicate special_methods(string name, string slot_name) {
name = "__getattr__" and slot_name = "tp_getattr"
or
name = "__hash__" and slot_name = "tp_hash"
or
name = "__call__" and slot_name = "tp_call"
or
name = "__str__" and slot_name = "tp_str"
or
name = "__getattribute__" and slot_name = "tp_getattro"
or
name = "__setattro__" and slot_name = "tp_setattro"
or
name = "__iter__" and slot_name = "tp_iter"
or
name = "__descr_get__" and slot_name = "tp_descr_get"
or
name = "__descr_set__" and slot_name = "tp_descr_set"
}
predicate number_methods(string name, string slot_name) {
name = "__add__" and slot_name = "nb_add"
or
name = "__sub__" and slot_name = "nb_subtract"
or
name = "__mul__" and slot_name = "nb_multiply"
or
name = "__mod__" and slot_name = "nb_remainder"
or
name = "__pow__" and slot_name = "nb_power"
or
name = "__neg__" and slot_name = "nb_negative"
or
name = "__pos__" and slot_name = "nb_positive"
or
name = "__abs__" and slot_name = "nb_absolute"
or
name = "__bool__" and slot_name = "nb_bool"
or
name = "__bool__" and slot_name = "nb_bool"
or
name = "__invert__" and slot_name = "nb_invert"
or
name = "__lshift__" and slot_name = "nb_lshift"
or
name = "__rshift__" and slot_name = "nb_rshift"
or
name = "__and__" and slot_name = "nb_and"
or
name = "__xor__" and slot_name = "nb_xor"
or
name = "__or__" and slot_name = "nb_or"
or
name = "__int__" and slot_name = "nb_int"
or
name = "__long__" and slot_name = "nb_long"
or
name = "__float__" and slot_name = "nb_float"
or
name = "__iadd__" and slot_name = "nb_inplace_add"
or
name = "__isub__" and slot_name = "nb_inplace_subtract"
or
name = "__imul__" and slot_name = "nb_inplace_multiply"
or
name = "__imod__" and slot_name = "nb_inplace_remainder"
or
name = "__ilshift__" and slot_name = "nb_inplace_lshift"
or
name = "__irshift__" and slot_name = "nb_inplace_rshift"
or
name = "__iand__" and slot_name = "nb_inplace_and"
or
name = "__ixor__" and slot_name = "nb_inplace_xor"
or
name = "__ior__" and slot_name = "nb_inplace_or"
or
name = "__index__" and slot_name = "nb_index"
}
predicate sequence_methods(string name, string slot_name) {
name = "__len__" and slot_name = "sq_length"
or
name = "__add__" and slot_name = "sq_concat"
or
name = "__mul__" and slot_name = "sq_repeat"
or
name = "__getitem__" and slot_name = "sq_item"
or
name = "__setitem__" and slot_name = "sq_ass_item"
or
name = "__contains__" and slot_name = "sq_contains"
or
name = "__iadd__" and slot_name = "sq_inplace_concat"
or
name = "__imul__" and slot_name = "sq_inplace_repeat"
}
predicate mapping_methods(string name, string slot_name) {
name = "__len__" and slot_name = "mp_length"
or
name = "__getitem__" and slot_name = "mp_subscript"
or
name = "__setitem__" and slot_name = "mp_ass_subscript"
}
/**
An entry in the getset table for a Python class.
This is the C code item that corresponds 1-to-1 with the Python-level property
*/
class PythonGetSetTableEntry extends AggregateLiteral {
PythonGetSetTableEntry() {
this.getUnderlyingType().hasName("PyGetSetDef")
and
this.getChild(0) instanceof StringLiteral
}
Function getGetter() {
exists(FunctionAccess fa | fa = getChild(1) and result = fa.getTarget())
}
Function getSetter() {
exists(FunctionAccess fa | fa = getChild(2) and result = fa.getTarget())
}
StringLiteral getRegisteredPropertyName() {
result = this.getChild(0)
}
PythonGetSetTable getTable() {
result.getATableEntry() = this
}
}
/**
An entry in the function table for a Python class or module.
This is the C code item that corresponds 1-to-1 with the Python-level function.
*/
class PythonFunctionTableEntry extends AggregateLiteral {
PythonFunctionTableEntry() {
this.getUnderlyingType().hasName("PyMethodDef")
and
this.getChild(0) instanceof StringLiteral
}
/** Gets the doc string to be associated with the function being registered. */
string getDocString() {
result = getChild(3).(StringLiteral).getValueText()
}
/** Gets the flags for the function being registered. */
int getFlags() {
result = getChild(2).getValue().toInt()
}
/** Gets the function being registered. */
Function getFunction() {
exists(FunctionAccess fa | fa = getChild(1) and result = fa.getTarget())
}
/** Gets the module containing the function table. */
PythonModule getModule() {
result = getTable().getModule()
}
/** Gets the name with which the function should be referenced from Python. */
StringLiteral getRegisteredFunctionName() {
result = this.getChild(0)
}
/** Gets the function table containing this entry. */
PythonFunctionTable getTable() {
result.getATableEntry() = this
}
/** Gets a flag associated with this function. */
string getAFlag() {
exists(int f | f = this.getFlags() |
(f % 2 = 1 and result = "METH_VARARGS")
or ((f / 2) % 2 = 1 and result = "METH_KEYWORDS")
or ((f / 4) % 2 = 1 and result = "METH_NOARGS")
or ((f / 8) % 2 = 1 and result = "METH_O")
or ((f / 16) % 2 = 1 and result = "METH_CLASS")
or ((f / 32) % 2 = 1 and result = "METH_STATIC")
or ((f / 64) % 2 = 1 and result = "METH_COEXIST")
)
}
}
library class PythonBuildReturnCall extends FunctionCall {
PythonBuildReturnCall() {
exists(string name | name = getTarget().getName() |
name = "Py_BuildValue"
or name = "Py_VaBuildValue"
)
}
string getFormatString() {
result = getArgument(0).(StringLiteral).getValue()
}
}
/**
An extension function for Python (written in C).
*/
class PythonExtensionFunction extends Function {
PythonExtensionFunction() {
exists(PythonFunctionTableEntry e | e.getFunction() = this)
and exists(getAParameter())
}
/** Gets a function table entry registering this function. */
PythonFunctionTableEntry getATableEntry() {
result.getFunction() = this
}
}
class TypedPythonExtensionProperty extends PythonGetSetTableEntry, CObject {
PythonClass getPropertyType() {
result = py_return_type(this.getGetter())
}
private string trapClass() {
result = this.getClass().getTrapID()
}
override string getTrapID() {
result = this.trapClass() + "$" + this.getPyName()
}
string getPyName() {
result = this.getRegisteredPropertyName().getValue()
}
/** Gets the class containing this function. */
PythonClass getClass() {
result = this.getTable().getClass()
}
}
/* An extension function for Python (written in C); Python facing aspect */
abstract class TypedPythonExtensionFunction extends PythonFunctionTableEntry, CObject {
override Location getLocation() {
result = this.getRegisteredFunctionName().getLocation()
}
override
string toString() {
result = "MethodDef " + this.getRegisteredFunctionName().getValue()
}
abstract PythonClass getArgumentType(int index);
abstract predicate argumentIsOptional(int index);
abstract predicate argumentIsKwOnly(int index);
PythonExtensionFunction getCode() {
result.getATableEntry() = this
}
predicate isMethod() {
exists(this.getTable().getClass()) and not this.getAFlag() = "METH_STATIC"
}
int c_index(int index) {
index in [0..20] and result in [-1..20]
and
(if this.isMethod() then
result = index - 1
else
result = index
)
}
string getPyName() {
result = this.getRegisteredFunctionName().getValue()
}
PythonClass getReturnType() {
result = py_return_type(this.getCode())
}
/** Gets the module containing this function. */
override PythonModule getModule() {
result = getTable().getModule()
}
/** Gets the class containing this function. */
PythonClass getClass() {
result = getTable().getClass()
}
//private
string trapModule() {
result = this.getModule().getModuleName()
}
//private
string trapClass() {
result = this.getClass().getTrapID()
}
/* A globally unique name for use in trap files.
*/
override string getTrapID() {
result = "C_builtin_function_or_method$" + this.trapModule() + "." + this.getPyName()
or
result = this.trapClass() + "$" + this.getPyName()
}
}
predicate src_dest_pair(Element src, ControlFlowNode dest) {
exists(LocalScopeVariable v, ControlFlowNode def |
definitionUsePair(v, def, dest) and
exprDefinition(v, def, src) and
not exists(AddressOfExpr addr | addr.getOperand() = v.getAnAccess())
)
or
exists(Parameter p | dest = p.getAnAccess() and not definitionUsePair(_, _, dest) and src = p)
}
cached
predicate local_flows_to(Element src, ControlFlowNode dest) {
not unreachable(src) and not unreachable(dest) and
(src = dest
or
src_dest_pair(src, dest)
or
exists(Element mid | local_flows_to(src, mid) and src_dest_pair(mid, dest))
)
}
PythonClass py_return_type(Function f) {
exists(ReturnStmt ret |
ret.getEnclosingFunction() = f and
result = python_type(ret.getExpr()) and
not ret.getExpr().getValue() = "0"
)
or
exists(Macro m | m.getAnInvocation().getEnclosingFunction() = f and m.getName() = "Py_RETURN_NONE" and result.getTpName() = "NoneType")
or
exists(Macro m | m.getAnInvocation().getEnclosingFunction() = f and m.getName() = "Py_RETURN_TRUE" and result.getTpName() = "bool")
or
exists(Macro m | m.getAnInvocation().getEnclosingFunction() = f and m.getName() = "Py_RETURN_FALSE" and result.getTpName() = "bool")
}
PythonClass python_type_from_size(Expr e) {
exists(Type t, string name |
t = e.getUnderlyingType().(PointerType).getBaseType() and name = t.getName() and name.matches("Py\\_%Object") |
exists(PythonClass cls | cls.getSizeOf().getValueText() = "sizeof(" + t.getName() + ")" |
result = cls and not result.getTpName() = "int" and not result.getTpName() = "bool"
)
)
}
predicate py_bool(Expr e) {
exists(MacroInvocation mi, string name |
mi.getExpr() = e and name = mi.getMacroName() |
name = "Py_False" or name = "Py_True"
)
}
PythonClass python_type_from_name(Expr e) {
exists(Type t, string name |
t = e.getUnderlyingType().(PointerType).getBaseType() and name = t.getName() |
name = "PyBytesObject" and result.getTpName() = "bytes"
or
name = "PyTupleObject" and result.getTpName() = "tuple"
or
name = "PyLongObject" and result.getTpName() = "int" and not py_bool(e)
or
name = "PyIntObject" and result.getTpName() = "int" and not py_bool(e)
or
name = "PyStringObject" and result.getTpName() = "str" and cpython_major_version() = 2
or
name = "PyStringObject" and result.getTpName() = "bytes" and cpython_major_version() = 3
or
name = "PyUnicodeObject" and result.getTpName() = "unicode" and cpython_major_version() = 2
or
name = "PyUnicodeObject" and result.getTpName() = "str" and cpython_major_version() = 3
)
}
PythonClass python_type(Expr e) {
result = python_type_from_size(e)
or
result = python_type_from_name(e)
or
call_to_new(e, result)
or
exists(Element src | result = python_type(src) and local_flows_to(src, e))
or
result = type_from_build_value(e)
or
result = type_from_call(e)
or
py_bool(e) and result.getTpName() = "bool"
or
call_to_type(e, result)
or
exists(MacroInvocation mi |
mi.getExpr() = e and mi.getMacroName() = "Py_None" |
result.getTpName() = "NoneType"
)
}
predicate build_value_function(Function f) {
f.getName().regexpMatch("_?Py_(Va)?BuildValue(_SizeT)?")
}
PythonClass type_from_build_value(Expr e) {
exists(FunctionCall c |
c = e |
build_value_function(c.getTarget()) and
result = type_from_build_value_code(c.getArgument(0).getValue())
)
}
PythonClass type_from_call(Expr e) {
exists(Function f |
not build_value_function(f) and
/* Do not type to infer return type of the interpreter */
not f.getName().matches("PyEval%") and
f = e.(FunctionCall).getTarget() and
result = py_return_type(f)
)
or
exists(Function f |
f = e.(FunctionCall).getTarget() and
result.getTpName() = "dict"
|
f.hasName("PyEval_GetBuiltins") or
f.hasName("PyEval_GetGlobals") or
f.hasName("PyEval_GetLocals")
)
}
PythonClass type_from_build_value_code(string s) {
exists(FunctionCall c | c.getArgument(0).getValue() = s)
and
(result = type_from_simple_code(s)
or
result.getTpName() = "dict" and s.charAt(0) = "{"
or
result.getTpName() = "tuple" and not exists(type_from_simple_code(s)) and not s.charAt(0) = "{"
)
}
private PythonClass theBytesClass() {
cpython_major_version() = 2 and result.getTpName() = "str"
or
cpython_major_version() = 3 and result.getTpName() = "bytes"
}
private PythonClass theUnicodeClass() {
cpython_major_version() = 2 and result.getTpName() = "unicode"
or
cpython_major_version() = 3 and result.getTpName() = "str"
}
PythonClass type_from_simple_code(string s) {
(s = "s" or s = "s#" or s = "z" or s = "z#") and result.getTpName() = "str"
or
(s = "u" or s = "u#" or s = "U" or s = "U#" or s = "C") and result = theUnicodeClass()
or
(s = "y" or s = "y#" or s = "c") and result = theBytesClass()
or
(s = "i" or s = "I" or s = "b" or s = "B" or s = "h" or s = "H" or
s = "k" or s = "K" or s = "l" or s = "L" or s = "n"
) and result.getTpName() = "int"
or
(s = "f" or s = "d") and result.getTpName() = "float"
or
s = "D" and result.getTpName() = "complex"
or
(s = "O" or s = "O&" or s = "N") and result.getTpName() = "object"
}
predicate call_to_new(FunctionCall call, PythonClass cls) {
exists(string name |
name = call.getTarget().getName() |
name = "_PyObject_New" or
name = "_PyObject_GC_New" or
name = "_PyObject_NewVar" or
name = "_PyObject_GC_NewVar"
) and
exists(AddressOfExpr addr |
addr = call.getArgument(0) |
addr.getAddressable() = cls
)
}
predicate call_to_type(FunctionCall call, PythonClass cls) {
exists(AddressOfExpr aoe |
call.getTarget().getName().matches("PyObject\\_Call%") and
call.getArgument(0) = aoe and
aoe.getAddressable() = cls
)
}
predicate pyargs_function(PythonFunctionTableEntry func, PyArgParseTupleCall call) {
func.getFunction().getParameter(1).getAnAccess() = call.getArgument(0)
}
class PyArgsFunction extends TypedPythonExtensionFunction {
PyArgsFunction() {
this.getAFlag() = "METH_VARARGS"
}
PyArgParseTupleCall getParseArgsCall() {
strictcount(PyArgParseTupleCall other | this.getCode().getParameter(1).getAnAccess() = other.getArgument(0)) = 1 and
pyargs_function(this, result)
}
override PythonClass getArgumentType(int index) {
this.isMethod() and index = 0 and result = this.getTable().getClass()
or
result.getTpName() = this.getParseArgsCall().getPyArgumentType(this.c_index(index))
}
override predicate argumentIsOptional(int index) {
this.getParseArgsCall().pyArgumentIsOptional(this.c_index(index))
}
override predicate argumentIsKwOnly(int index) {
this.getParseArgsCall().pyArgumentIsKwOnly(this.c_index(index))
}
}
class PyOFunction extends TypedPythonExtensionFunction {
PyOFunction() {
this.getAFlag() = "METH_O"
}
override PythonClass getArgumentType(int index) {
this.isMethod() and index = 0 and result = this.getTable().getClass()
or
/* TO DO -- Better analysis */
this.c_index(index) = 0 and result.getTpName() = "object"
}
override predicate argumentIsOptional(int index) {
none()
}
override predicate argumentIsKwOnly(int index) {
none()
}
}
class PyNoArgFunction extends TypedPythonExtensionFunction {
PyNoArgFunction() {
this.getAFlag() = "METH_NOARGS"
}
override PythonClass getArgumentType(int index) {
this.isMethod() and index = 0 and result = this.getTable().getClass()
}
override predicate argumentIsOptional(int index) {
none()
}
override predicate argumentIsKwOnly(int index) {
none()
}
}
int cpython_major_version() {
exists(MacroInvocation mi |
mi.getMacroName() = "PY_MAJOR_VERSION" |
result = mi.getExpr().getValue().toInt()
)
}
int cpython_minor_version() {
exists(MacroInvocation mi |
mi.getMacroName() = "PY_MINOR_VERSION" |
result = mi.getExpr().getValue().toInt()
)
}
string cpython_version() {
result = cpython_major_version().toString() + "." + cpython_minor_version().toString()
}

View File

@@ -1,20 +0,0 @@
/**
* @name Parameter return trap file generator
* @description Generate trap files (in CSV form) describing CPython extension functions return one of their parameters.
* @kind trap
* @id cpp/c-python/parameter-return-trap
*/
import cpp
import CPython.Extensions
predicate argument_flows_to_return(Function func, int arg) {
exists(Parameter p | p = func.getParameter(arg) |
forall(ReturnStmt ret | ret.getEnclosingFunction() = func |
local_flows_to(p, ret.getExpr()))
)
}
from TypedPythonExtensionFunction func, PythonExtensionFunction code, int arg
where func.getCode() = code and argument_flows_to_return(code, arg)
select "ext_argreturn", func.getTrapID(), arg

View File

@@ -1,15 +0,0 @@
/**
* @name Property type trap file generator
* @description Generate trap files (in CSV form) describing CPython extension property types.
* @kind trap
* @id cpp/c-python/property-type-trap
*/
import cpp
import CPython.Extensions
from TypedPythonExtensionProperty p, PythonClass cls
where cls = p.getPropertyType()
select "ext_proptype", p.getTrapID(), cls.getTrapID()

View File

@@ -1,15 +0,0 @@
/**
* @name Return type trap file generator
* @description Generate trap files (in CSV form) describing CPython extension function return types.
* @kind trap
* @id cpp/c-python/return-type-trap
*/
import cpp
import CPython.Extensions
from TypedPythonExtensionFunction func, PythonClass cls
where cls = func.getReturnType()
select "ext_rettype", func.getTrapID(), cls.getTrapID()

View File

@@ -1,19 +1,19 @@
while(result) {
if ( ... )
...
else if (result //wrong: this test is redundant
&& result->flags != 0)
...
result = next(queue);
}
fp = fopen(log, "r");
if (fp) {
/*
* large block of code
*/
if (!fp) { //wrong: always false
... /* dead code */
}
}
while(result) {
if ( ... )
...
else if (result //wrong: this test is redundant
&& result->flags != 0)
...
result = next(queue);
}
fp = fopen(log, "r");
if (fp) {
/*
* large block of code
*/
if (!fp) { //wrong: always false
... /* dead code */
}
}

View File

@@ -5,23 +5,26 @@
<overview>
<p>This rule finds branching statements with conditions that always evaluate to the same value.
More likely than not these conditions indicate a defect in the branching condition or are an artifact left behind after debugging.</p>
<p>This query finds branching statements with conditions that always evaluate to the same value.
It is likely that these conditions indicate an error in the branching condition.
Alternatively, the conditions may have been left behind after debugging.</p>
<include src="aliasAnalysisWarning.qhelp" />
</overview>
<recommendation>
<p>Check the branch condition for defects, and verify that it isn't a remnant from debugging.</p>
<p>Check the branch condition for logic errors. Check whether it is still required.</p>
</recommendation>
<example><sample src="DeadCodeCondition.cpp" />
<example>
<p>This example shows two branch conditions that always evaluate to the same value.
The two conditions and their associated branches should be deleted.
This will simplify the code and make it easier to maintain.</p>
<sample src="DeadCodeCondition.cpp" />
</example>
<references>
<li>SEI CERT C++ Coding Standard <a href="https://wiki.sei.cmu.edu/confluence/display/c/MSC12-C.+Detect+and+remove+code+that+has+no+effect+or+is+never+executed">MSC12-C. Detect and remove code that has no effect or is never executed</a>.</li>
</references>
</qhelp>

View File

@@ -7,51 +7,64 @@
* @tags reliability
* external/cwe/cwe-561
*/
import cpp
predicate testAndBranch(Expr e, Stmt branch)
{
exists(IfStmt ifstmt | ifstmt.getCondition() = e and
(ifstmt.getThen() = branch or ifstmt.getElse() = branch))
predicate testAndBranch(Expr e, Stmt branch) {
exists(IfStmt ifstmt |
ifstmt.getCondition() = e and
(ifstmt.getThen() = branch or ifstmt.getElse() = branch)
)
or
exists(WhileStmt while | while.getCondition() = e and
while.getStmt() = branch)
exists(WhileStmt while |
while.getCondition() = e and
while.getStmt() = branch
)
}
predicate choice(LocalScopeVariable v, Stmt branch, string value)
{
predicate choice(LocalScopeVariable v, Stmt branch, string value) {
exists(AnalysedExpr e |
testAndBranch(e, branch) and
(
(e.getNullSuccessor(v) = branch and value = "null")
or
(e.getNonNullSuccessor(v) = branch and value = "non-null")
))
)
)
}
predicate guarded(LocalScopeVariable v, Stmt loopstart, AnalysedExpr child)
{
predicate guarded(LocalScopeVariable v, Stmt loopstart, AnalysedExpr child) {
choice(v, loopstart, _) and
loopstart.getChildStmt*() = child.getEnclosingStmt() and
(definition(v, child) or exists(child.getNullSuccessor(v)))
}
predicate addressLeak(Variable v, Stmt leak)
{
predicate addressLeak(Variable v, Stmt leak) {
exists(VariableAccess access |
v.getAnAccess() = access and
access.getEnclosingStmt() = leak and
access.isAddressOfAccess())
access.isAddressOfAccess()
)
}
from LocalScopeVariable v, Stmt branch, AnalysedExpr cond, string context, string test, string testresult
where choice(v, branch, context)
and forall(ControlFlowNode def | definition(v, def) and definitionReaches(def, cond) | not guarded(v, branch, def))
and not cond.isDef(v)
and guarded(v, branch, cond)
and exists(cond.getNullSuccessor(v))
and not addressLeak(v, branch.getChildStmt*())
and ((cond.isNullCheck(v) and test = "null") or (cond.isValidCheck(v) and test = "non-null"))
and (if context = test then testresult = "succeed" else testresult = "fail")
select cond, "Variable '" + v.getName() + "' is always " + context + " here, this check will always " + testresult + "."
from
LocalScopeVariable v, Stmt branch, AnalysedExpr cond, string context, string test,
string testresult
where
choice(v, branch, context) and
forall(ControlFlowNode def | definition(v, def) and definitionReaches(def, cond) |
not guarded(v, branch, def)
) and
not cond.isDef(v) and
guarded(v, branch, cond) and
exists(cond.getNullSuccessor(v)) and
not addressLeak(v, branch.getChildStmt*()) and
(
(cond.isNullCheck(v) and test = "null")
or
(cond.isValidCheck(v) and test = "non-null")
) and
(if context = test then testresult = "succeed" else testresult = "fail")
select cond,
"Variable '" + v.getName() + "' is always " + context + " here, this check will always " +
testresult + "."

View File

@@ -1,12 +1,12 @@
class C {
public:
void g() {
...
//f() was previously used but is now commented, orphaning f()
//f();
...
}
private:
void f() { //is now unused, and can be removed
}
};
class C {
public:
void g() {
...
//f() was previously used but is now commented-out, orphaning f()
//f();
...
}
private:
void f() { //is now unused, and can be removed
}
};

View File

@@ -3,28 +3,31 @@
"qhelp.dtd">
<qhelp>
<overview>
<p>This rule finds functions that are non-public, non-virtual and are never called. Dead functions are often deprecated pieces of code, and should be removed
as they may increase object code size, decrease code comprehensibility, and create the possibility of misuse.</p>
<p>This query highlights functions that are non-public, non-virtual, and are never called.
Dead functions are often deprecated pieces of code, and should be removed.
If left in the code base they increase object code size, decrease code comprehensibility, and create the possibility of misuse.</p>
<p>
<code>public</code> and <code>protected</code> functions are not considered by the check, as they could be part of the program's
API and could be used by external programs.
<code>public</code> and <code>protected</code> functions are ignored by this query.
This type of function may be part of the program's API and could be used by external programs.
</p>
<include src="callGraphWarning.qhelp" />
</overview>
<recommendation>
<p>Consider removing the function.</p>
<p>Verify that the function is genuinely unused and consider removing it.</p>
</recommendation>
<example><sample src="DeadCodeFunction.cpp" />
<example>
<p>The example below includes a function <code>f</code> that is no longer used and should be deleted.</p>
<sample src="DeadCodeFunction.cpp" />
</example>
<references>
<li>SEI CERT C++ Coding Standard: <a href="https://wiki.sei.cmu.edu/confluence/display/c/MSC12-C.+Detect+and+remove+code+that+has+no+effect+or+is+never+executed">MSC12-C. Detect and remove code that has no effect or is never executed</a>.</li>
</references>
</qhelp>

View File

@@ -1,6 +1,6 @@
/**
* @name Function is never called
* @description A function is never called, and should be considered for removal. Unused functions may increase object size, decrease readability and create the possibility of misuse.
* @description Unused functions may increase object size, decrease readability, and create the possibility of misuse.
* @kind problem
* @id cpp/dead-code-function
* @problem.severity warning

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