Compare commits

..

5231 Commits

Author SHA1 Message Date
Chris Gavin
53dbc0ad71 Merge rc/1.24 into master. 2020-04-17 09:36:09 +01:00
Taus
964a619450 Merge pull request #3211 from RasmusWL/python-unused-import-small-fix
Python: Fix FN in unused import
2020-04-16 14:22:50 +02:00
Taus
a92d926b56 Merge pull request #3218 from RasmusWL/python-add-missing-override
Python: Add missing override to ClassValue.hasAttribute
2020-04-16 14:06:23 +02:00
Tom Hvitved
922e52f061 Merge pull request #3257 from hvitved/csharp/dataflow/tests
C#: Update data flow tests
2020-04-16 11:47:45 +02:00
Mathias Vorreiter Pedersen
86ba03bea8 Merge pull request #3256 from Semmle/rdmarsh/cpp/add-qldoc-1
C++: Add QLdoc to some AST methods (Class.qll-Diagnostics.qll)
2020-04-15 21:46:36 +02:00
Rasmus Wriedt Larsen
5a51d2cc4c Merge pull request #3245 from BekaValentine/python-objectapi-to-valueapi-wrongnameforargumentinclassinstantiation
Python: ObjectAPI to ValueAPI: WrongNameForArgumentInClassInstantiation
2020-04-15 16:48:26 +02:00
Rasmus Wriedt Larsen
390959713a Merge pull request #3246 from BekaValentine/python-objectapi-to-valueapi-uselessclass
Python: ObjectAPI to ValueAPI: UselessClass
2020-04-15 16:45:02 +02:00
Jonas Jensen
aa8f30cd83 Merge pull request #3268 from MathiasVP/ql-doc-negativitiy
C++: Add QLDoc to public predicates in Negativity.qll
2020-04-15 15:12:07 +02:00
Mathias Vorreiter Pedersen
3d0ac53266 Apply suggestions from code review
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-04-15 14:01:49 +02:00
Jonas Jensen
6eba3380dd Merge pull request #3241 from geoffw0/alloc-size2
C++ Improvements to TaintedAllocationSize.ql
2020-04-15 12:58:19 +02:00
semmle-qlci
bfd80b42a7 Merge pull request #3260 from asger-semmle/js/location-tweaks
Approved by erik-krogh
2020-04-15 10:47:35 +01:00
Asger F
34d40b5035 Merge pull request #3237 from asger-semmle/js/sparse-capture
JS: Add CapturedVariableNode to avoid N^2 edges
2020-04-15 10:42:48 +01:00
Geoffrey White
2aa64db40e Merge remote-tracking branch 'upstream/rc/1.24' into alloc-size2 2020-04-15 10:09:54 +01:00
Mathias Vorreiter Pedersen
a2fbe9e9da C++: Add QLDoc to public predicates in Negativity 2020-04-15 08:18:03 +02:00
Jonas Jensen
b603a3da64 Merge pull request #3259 from MathiasVP/ql-doc-fileclosed-loopbounds-memoryfreed
C++: QLDoc for FileClosed, LoopBounds and MemoryFreed
2020-04-15 08:08:04 +02:00
Jonas Jensen
6eac35c753 Merge pull request #3264 from Semmle/merge-rc/1.24
Merge rc/1.24 into master.
2020-04-15 07:56:58 +02:00
Jonas Jensen
ae11e7b72c Merge pull request #3265 from Semmle/rdmarsh/cpp/deprecate-isDefined
C++: deprecate Declaration::isDefined()
2020-04-15 07:53:19 +02:00
Chris Gavin
4e981d8e70 Merge rc/1.24 into master. 2020-04-14 21:30:29 +01:00
Robert Marsh
146bfca2ad Merge pull request #3254 from dbartol/dbartol/ImplicitReturnValue2
C++: Treat implicit end of body of non`-void` function as `Unreached`
2020-04-14 12:18:50 -07:00
Asger Feldthaus
1107e7c6a6 JS: Rename other uses of getURL 2020-04-14 19:45:09 +01:00
Dave Bartolomeo
279467654e C++: Make test functions return void 2020-04-14 14:17:56 -04:00
Dave Bartolomeo
812087968f C++: Fix test output
Mostly noise, but a couple of the missing operand errors are actual fixes.
2020-04-14 14:17:20 -04:00
Robert Marsh
b5c0a0f77d C++: remove all uses of Declaration::isDefined 2020-04-14 10:54:06 -07:00
Robert Marsh
5ee60762fe C++: deprecate Declaration::isDefined() 2020-04-14 10:49:52 -07:00
Robert Marsh
7f5b3de665 C++: autoformat 2020-04-14 10:36:53 -07:00
Robert Marsh
be81a1a8b3 Merge pull request #3255 from dbartol/dbartol/UnmodeledDefinition
C++: Connect `InitializeIndirection` to `UnmodeledDefinition`
2020-04-14 10:34:30 -07:00
Taus
8402e6a2e1 Merge pull request #3243 from BekaValentine/python-objectapi-to-valueapi-incorrectlyspecifiedoverriddenmethod
Python: ObjectAPI to ValueAPI: IncorrectlySpecifiedOverriddenMethod
2020-04-14 18:55:42 +02:00
Mathias Vorreiter Pedersen
092145d571 Update cpp/ql/src/Critical/FileClosed.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-04-14 18:38:33 +02:00
Dave Bartolomeo
125a09ce6e C++: Fix IR generation of return of void expression 2020-04-14 11:40:33 -04:00
Dave Bartolomeo
95a6dd01c6 C#: Accept test output 2020-04-14 11:11:36 -04:00
Dave Bartolomeo
83cd78c6cf C++: Fix test output 2020-04-14 10:54:00 -04:00
Felicity Chapman
bc250506a1 Merge pull request #3227 from felicitymay/update-references
Update some out of date information
2020-04-14 14:56:05 +01:00
Asger F
c178eecd43 Update javascript/ql/src/semmle/javascript/Variables.qll
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-04-14 14:40:21 +01:00
Felicity Chapman
c570ebe5bd Merge branch 'rc/1.24' into update-references 2020-04-14 14:10:26 +01:00
Geoffrey White
92187d9e71 C++: Change note. 2020-04-14 14:00:46 +01:00
Mathias Vorreiter Pedersen
721e9d532a Merge pull request #2704 from rdmarsh2/rdmarsh/cpp/ir-flow-through-outparams
C++: IR dataflow edges through outparams
2020-04-14 14:20:34 +02:00
Taus
3e46604fa5 Merge pull request #3223 from BekaValentine/python-objectapi-to-valueapi-iterreturnsnoniterator
Python: ObjectAPI to ValueAPI: IterReturnsNonIterator
2020-04-14 12:55:21 +02:00
Taus
d9a2429de8 Merge pull request #3244 from BekaValentine/python-objectapi-to-valueapi-wrongnumberargumentsinclassinstantiation
Python: ObjectAPI to ValueAPI: WrongNumberArgumentsInClassInstantiation
2020-04-14 12:46:29 +02:00
semmle-qlci
e21164e5ac Merge pull request #3258 from erik-krogh/NormalPathSanitizer-patch1
Approved by asgerf
2020-04-14 11:31:45 +01:00
semmle-qlci
52b76b1373 Merge pull request #3233 from RasmusWL/python-use-getAbsolutePath
Approved by BekaValentine
2020-04-14 10:43:24 +01:00
Mathias Vorreiter Pedersen
419b511ddb C++: Format 2020-04-14 11:39:44 +02:00
semmle-qlci
2e95cab970 Merge pull request #3234 from RasmusWL/python-modenise-files
Approved by BekaValentine
2020-04-14 10:38:26 +01:00
Asger Feldthaus
3515a2b412 JS: Update test output 2020-04-14 10:31:31 +01:00
Asger Feldthaus
88667206fc JS: Remove default hasLocationInfo case 2020-04-14 10:03:10 +01:00
Asger Feldthaus
5da968e34c JS: Specialize ASTNode.getFile 2020-04-14 10:03:10 +01:00
Asger Feldthaus
244a304e1d JS: Implement getFile() directly instead of via locations 2020-04-14 10:03:10 +01:00
Asger Feldthaus
dc084628cc JS: Avoid the special name getURL 2020-04-14 10:03:09 +01:00
Erik Krogh Kristensen
e47575ce5b more precise getChild for matching "../" 2020-04-14 10:24:08 +02:00
Mathias Vorreiter Pedersen
d8dcbe3cbd C++: QLDoc for FileClosed, LoopBounds and MemoryFreed 2020-04-14 10:21:11 +02:00
Tom Hvitved
a9b88b6eaa C#: Update data flow tests 2020-04-14 09:31:10 +02:00
Robert Marsh
10824f9612 C++: add method qldoc in Class.qll 2020-04-13 15:49:37 -07:00
Dave Bartolomeo
1bde11706e C++: Connect InitializeIndirection to UnmodeledDefinition
The IR generation for `InitializeIndirection` currently connects its load operand to the result of the corresponding `InitializeParameter` instruction. This isn't exactly wrong, but it doesn't fit the IR invariant of "All unmodeled uses consume `UnmodeledDefinition`". Our current code doesn't care, because we just throw away all of the existing def-use information, modeled or otherwise, when we build unaliased SSA. However, some upcoming SSA changes don't work correctly if this invariant is broken.

I've added the trivial IR generation change, along with a new sanity query.
2020-04-13 18:37:47 -04:00
Dave Bartolomeo
603a3af19b C++: Treat implicit end of body of non-void function as Unreached
When the extractor can't prove that control flow will never reach the end of a non-`void`-returning function without reaching an explicit `return` statement, it inserts an implicit `return` without an operand. If control actually reaches this point, the behavior is undefined.

We were previously generating invalid IR for these implicit `return` statements, because the lack of an operand meant that there was no definition of the return value variable along that path. Instead, I've changed the IR generation to emit an `Unreached` instruction for the implicit `return`. This ensures that we don't create a control flow edge from the end of the body to the function epilogue.

The change to the range analysis test avoids having that test depend on the previous bad IR behavior, while still preserving the original spirit of the test.
2020-04-13 18:09:44 -04:00
Robert Marsh
f24c4e51c5 C++: add method qldoc in Diagnostics.qll 2020-04-13 14:58:30 -07:00
Robert Marsh
d065389a6b C++: add method commetns in Compilation.qll 2020-04-13 14:41:25 -07:00
Robert Marsh
de29d93ede C++: add method qldoc for Comment.qll 2020-04-13 14:39:51 -07:00
Robert Marsh
8779177839 C++: accept minor test change 2020-04-13 14:03:02 -07:00
Robert Marsh
a5e7db73b2 Merge branch 'rc/1.24' into rdmarsh/cpp/ir-flow-through-outparams
For submodule consistency
2020-04-13 12:02:59 -07:00
Pavel Avgustinov
7c5c9ea8ea Merge pull request #3240 from Semmle/update-license-in-readme
Update README to reflect new license
2020-04-10 17:36:36 +01:00
Rebecca Valentine
8e91f10030 Python: ObjectAPI to ValueAPI: UselessClass: Adds preliminary modernization 2020-04-09 15:25:38 -07:00
Rebecca Valentine
339758fa70 Python: ObjectAPI to ValueAPI: WrongNameForArgumentInClassInstantiation: Adds preliminary modernization 2020-04-09 15:04:44 -07:00
Rebecca Valentine
8dc1933a02 Python: ObjectAPI to ValueAPI: WrongNumberArgumentsInClassInstantiation: Adds preliminary modernization 2020-04-09 14:58:30 -07:00
Rebecca Valentine
336e48c5c6 Python: ObjectAPI to ValueAPI: IncorrectlySpecifiedOverriddenMethod: Adds preliminary modernization 2020-04-09 14:50:26 -07:00
Rebecca Valentine
7a586c97a4 Python: ObjectAPI to ValueAPI: IterReturnsNonIterature: Replaces custom return_type predicate with call to getAnInferredReturnType 2020-04-09 14:30:40 -07:00
Dave Bartolomeo
9f18a15a93 Merge pull request #3231 from MathiasVP/qualified-static-calls-are-static
C++: Do not generate this parameters and read/write side effects from static member functions
2020-04-09 10:48:59 -04:00
Pavel Avgustinov
6737e99d65 Merge pull request #3209 from hmakholm/baselib-extractor
Add extractor field in base language QL packs
2020-04-09 15:24:49 +01:00
Geoffrey White
ba3a8d0872 C++: Improve naming and QLDoc. 2020-04-09 15:06:23 +01:00
Geoffrey White
a7979fdc12 C++: Base results purely on allocations now, not multiplications by a sizeof. 2020-04-09 15:05:29 +01:00
Geoffrey White
febbbc4423 C++: Additional test cases. 2020-04-09 15:03:35 +01:00
James Fletcher
6e88b6d4f4 Merge pull request #3239 from jf205/update-support-project
docs: Update support project to use fewer reusables
2020-04-09 14:18:55 +01:00
Geoffrey White
2f7ec49684 Merge pull request #3238 from MathiasVP/TlsSettingsMisconfiguration-id-no-underscores
C++: Replace underscores with dashes in query @id
2020-04-09 13:07:08 +01:00
Henry Mercer
5af7d5f03a Update README to reflect new license
Per https://github.com/Semmle/ql/pull/3205, code is now licensed under the MIT License.
2020-04-09 13:06:53 +01:00
Asger Feldthaus
c070416fbe JS: Update test output 2020-04-09 12:24:11 +01:00
james
878109ccc4 docs: move language support into reusables folders 2020-04-09 12:20:27 +01:00
james
f7b3205cae docs: move supported frameworks into single reusable 2020-04-09 12:19:58 +01:00
Mathias Vorreiter Pedersen
0c5bca8f4e C++: Replace underscores with dashes in query @id 2020-04-09 12:09:15 +02:00
Asger Feldthaus
25d5cc78cb JS: Use entry location instead of whole container 2020-04-09 09:18:26 +01:00
Asger Feldthaus
d9f81b082b JS: Autoformat 2020-04-09 07:45:00 +01:00
Mathias Vorreiter Pedersen
6c7e1cdd46 C++: Make sure non-member functions are not reported to have a qualifier 2020-04-09 08:22:47 +02:00
Robert Marsh
3b591183c9 C++: remove partial flow from UnknownType 2020-04-08 17:09:30 -07:00
Robert Marsh
1199ff92e8 C++: autoformat 2020-04-08 16:41:29 -07:00
Robert Marsh
7e299e7494 C++/C#: Document ReturnIndirectionInstruction::getParameter 2020-04-08 16:41:07 -07:00
Robert Marsh
b37c13de91 C++: restore flow for non-class partial reads
This would otherwise have lost a good qltest result at
CWE-134/semmle/funcs/funcsLocal.c:58:9:58:10
2020-04-08 16:30:45 -07:00
Jonas Jensen
9f40886af9 C++: Don't allow taint out of a field read
except if it's from a union. This prevents field conflation through
buffers of `UnknownType`.
2020-04-08 14:02:33 -07:00
Robert Marsh
a0b26d66a4 C++: remove partial flow to IR loads 2020-04-08 13:56:56 -07:00
Robert Marsh
c38ccaaab6 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-04-08 12:32:35 -07:00
Asger Feldthaus
47934310ef JS: Hide captured nodes in path explanations 2020-04-08 19:58:36 +01:00
semmle-qlci
404f7225a1 Merge pull request #3196 from asger-semmle/js/unnecessary-source-node-range
Approved by esbena
2020-04-08 18:44:02 +01:00
Rasmus Wriedt Larsen
a2440f0fcd Python: Modernise semmle/python/dataflow/Files.qll 2020-04-08 16:53:19 +02:00
Rasmus Wriedt Larsen
32c04ad765 Python: Use getAbsolutePath() instead of deprecated getName() 2020-04-08 16:46:33 +02:00
James Fletcher
433794ef31 Merge pull request #3230 from jf205/tidy-up-branch
CodeQL docs: further updates to 'Learn CodeQL' project
2020-04-08 14:29:27 +01:00
yo-h
b25b6f7992 Merge pull request #3210 from yo-h/java14-ql
Java: dbscheme and library changes related to Java 14 extractor upgrade
2020-04-08 08:49:49 -04:00
Asger Feldthaus
5ab595da2e JS: Autoformat 2020-04-08 12:40:00 +01:00
Mathias Vorreiter Pedersen
7298b68674 C++: Exclude 'this' params and read/write side effects from static member function calls through qualifiers, and accept tests 2020-04-08 13:35:26 +02:00
James Fletcher
2ffcf952ae Apply suggestions from code review
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-04-08 12:28:01 +01:00
Felicity Chapman
07d9131256 Update docs/language/learn-ql/writing-queries/query-help.rst
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-04-08 12:14:40 +01:00
Mathias Vorreiter Pedersen
e4e0d3b573 C++: Add test cases showing that static member function calls get 'this' pointers and side effects for 'this' when accessed through qualifiers 2020-04-08 13:00:51 +02:00
james
6a1b11f9d1 docs: further updates to learn-codeql project 2020-04-08 11:59:40 +01:00
Felicity Chapman
eb89851025 Merge branch 'master' into update-references 2020-04-08 11:48:13 +01:00
James Fletcher
965235a3cf Merge pull request #3229 from Semmle/jf205-patch-2
CodeQL docs: fix link text in 'CodeQL queries' map topic
2020-04-08 11:44:35 +01:00
James Fletcher
6b1406f1a8 Merge pull request #3226 from jf205/update-query-help-style-guide
docs: clarify 'query help' usage in 'Query help style guide'
2020-04-08 11:44:17 +01:00
Felicity Chapman
9db6b8f1e2 Update docs/language/learn-ql/writing-queries/query-help.rst
Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2020-04-08 11:42:30 +01:00
Mathias Vorreiter Pedersen
b2759877cc Merge pull request #3219 from jbj/DefaultTaintTracking-partial-no-structs
C++: Avoid partial chi flow to struct/class
2020-04-08 12:31:53 +02:00
Shati Patel
fa6705aeb6 Merge pull request #3228 from shati-patel/docs-qhelp
Docs: Change "Qhelp" to "Query help"
2020-04-08 11:26:26 +01:00
James Fletcher
df1b450248 Update writing-queries.rst 2020-04-08 11:25:36 +01:00
Shati Patel
92aee59ca5 Change "Qhelp" to "Query help" 2020-04-08 10:43:40 +01:00
Felicity Chapman
dacbc1376c Update some out of date information 2020-04-08 10:36:04 +01:00
Asger Feldthaus
4ca3ac5ee9 JS: Add another warning 2020-04-08 10:30:45 +01:00
Asger F
4acb9da2cf Update javascript/ql/src/semmle/javascript/frameworks/LazyCache.qll
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-04-08 10:30:21 +01:00
Asger Feldthaus
171b131eb1 JS: Add test for SourceNode not depending on flowsTo 2020-04-08 10:23:47 +01:00
Jonas Jensen
6726a23c31 Merge pull request #3221 from disconnect3d/patch-1
Fix missing colon in ReturnConstTypeMember.cpp
2020-04-08 11:22:31 +02:00
James Fletcher
d055e666f7 Merge pull request #3225 from jf205/merge-docs-preparation-master
CodeQL docs: Merge `docs-preparation` into `master`
2020-04-08 09:50:54 +01:00
James Fletcher
6ca8653551 Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-04-08 09:49:56 +01:00
James Fletcher
7bf0d3d10a Update docs/language/learn-ql/writing-queries/introduction-to-queries.rst
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-04-08 09:38:18 +01:00
james
ff599a5ef3 docs: html -> HTML 2020-04-08 09:33:05 +01:00
james
7a3b310d8d docs: clarify 'query help' usage 2020-04-08 09:26:19 +01:00
Rasmus Wriedt Larsen
004523ad50 Merge pull request #3222 from BekaValentine/python-objectapi-to-valueapi-overlycomplexdelmethod
Python: ObjectAPI to ValueAPI: OverlyComplexDelMethod
2020-04-08 09:28:04 +02:00
james
407e91ce75 Merge branch 'docs-preparation' into merge-docs-preparation-master 2020-04-08 08:24:17 +01:00
Jonas Jensen
42e9d1416b Merge pull request #3206 from geoffw0/newfreefix
C++: Fix `cpp/new-free-mismatch` false positives
2020-04-08 08:39:43 +02:00
Rebecca Valentine
c2443f2342 Python: ObjectAPI to ValueAPI: OverlyComplexDelMethod: Adds preliminary modernization 2020-04-07 21:31:35 -07:00
Rebecca Valentine
0d65db148f Python: ObjectAPI to ValueAPI: IterReturnsNonIterator: Adds preliminary modernization 2020-04-07 21:14:25 -07:00
yo-h
2b3ad6042b Java 14: update supported language version in docs 2020-04-07 22:22:10 -04:00
yo-h
9a79e3be2c Java 14: add PREVIEW FEATURE notes to QLDoc 2020-04-07 22:22:10 -04:00
yo-h
697b273e32 Java 14: update expected test output 2020-04-07 22:22:10 -04:00
yo-h
e12de3b021 Java 14: add dbscheme upgrade script for records 2020-04-07 22:22:09 -04:00
yo-h
70e09ddb88 Java 14: add dbscheme stats for records 2020-04-07 22:22:08 -04:00
yo-h
662cff8316 Java 14: add class Record to Type.qll 2020-04-07 22:22:08 -04:00
yo-h
e1787f58aa Java 14: add isRecord relation to dbscheme 2020-04-07 22:22:08 -04:00
yo-h
b763342277 Java 14: account for instanceof pattern matching 2020-04-07 22:22:07 -04:00
yo-h
9d2f76849b Java 14: switch expressions are no longer in preview 2020-04-07 22:22:07 -04:00
Disconnect3d
96a0bddcf6 Update ReturnConstTypeMember.cpp 2020-04-07 22:30:57 +02:00
Geoffrey White
7fedac3266 C++: Fix apparently noncritical typo. 2020-04-07 20:56:07 +01:00
Geoffrey White
50194f372b C++: Autoformat. 2020-04-07 20:54:54 +01:00
Asger Feldthaus
1f496d3c6b JS: Add CapturedVariableNode 2020-04-07 19:02:46 +01:00
Jonas Jensen
a0992aac93 Merge pull request #3062 from geoffw0/alloc-size
C++: Improve hasUpperBoundsCheck
2020-04-07 19:31:04 +02:00
Geoffrey White
2686d9888c C++: Add QLDoc. 2020-04-07 18:12:24 +01:00
Geoffrey White
66a0b7884e Merge branch 'master' into alloc-size 2020-04-07 17:12:35 +01:00
Geoffrey White
ff39f714e8 C++: Autoformat. 2020-04-07 17:07:31 +01:00
Robert Marsh
0ccf39777c Merge pull request #3189 from jbj/DefaultTaintTracking-Configuration
C++: Path explanations in DefaultTaintTracking
2020-04-07 08:38:10 -07:00
Jonas Jensen
39911af56b C++: Avoid partial chi flow to struct/class
Flow through partial chi-instruction operands was introduced to make
definition-by-reference work, but its implementation also allowed all
other partial writes to propagate. In particular, tainting a field would
taint the whole struct, which in turn led to taint propagating across
unrelated fields of a struct.

The security test `CWE-134/semmle/argv/argvLocal.c` shows that we also
want to propagate taint from an array element to the whole array, and it
also seems right to propagate taint from a union member to the whole
union.
2020-04-07 16:24:24 +02:00
Mathias Vorreiter Pedersen
8928091dfb Merge pull request #3181 from jbj/DefaultTaintTracking-qldoc
C++: QLDoc in DefaultTaintTracking
2020-04-07 14:58:21 +02:00
Jonas Jensen
057155f28f Merge remote-tracking branch 'upstream/master' into DefaultTaintTracking-Configuration 2020-04-07 14:39:30 +02:00
Rasmus Wriedt Larsen
7af5f038ab Python: Add missing override to ClassValue.hasAttribute
I was considering if this was actually something different than
Value.hasAttribute, and the names were just accidentially the same. But after
looking at the definition for Value, I'm happy about marking this as an
override (I did not test whether it was neede though):

```codeql
class Value extends TObject {
    ...

    /** Holds if this value has the attribute `name` */
    predicate hasAttribute(string name) { this.(ObjectInternal).hasAttribute(name) }
```
2020-04-07 14:02:53 +02:00
Jonas Jensen
9a1c2d83af Merge pull request #3205 from Semmle/lic/MIT
Relicense under MIT
2020-04-07 13:24:12 +02:00
Pavel Avgustinov
6fc814632c Relicense under MIT 2020-04-07 12:03:26 +01:00
Rasmus Wriedt Larsen
75e6470009 Python: Fix FN in py/unused-import 2020-04-07 09:41:42 +02:00
Rasmus Wriedt Larsen
1077ce3a35 Python: Add FN for py/unused-import 2020-04-07 09:26:14 +02:00
Tom Hvitved
6685a5ed4d Merge pull request #3136 from calumgrant/cs/buildless-extraction
C#: Improvements to buildless extraction
2020-04-07 08:52:00 +02:00
Tom Hvitved
bacb11a563 Merge pull request #3150 from calumgrant/cs/enable-nullability
C#: Enable nullability for Autobuilder and Utils projects
2020-04-07 08:51:43 +02:00
Jonas Jensen
db0d8bbb40 Merge pull request #3208 from geoffw0/issue44
C++: Add test cases more similar to issues/44.
2020-04-06 19:40:24 +02:00
Henning Makholm
d1ff3211ef Add extractor fields to test qlpack.yml files. 2020-04-06 19:21:41 +02:00
Henning Makholm
bf579dedd4 Add extractor field in base language QL packs 2020-04-06 18:48:01 +02:00
Geoffrey White
d5accc70e1 C++: Add a test similar to issues/44. 2020-04-06 16:47:24 +01:00
Geoffrey White
a71ae2b468 C++: Consistent treatment of placement new. 2020-04-06 14:54:15 +01:00
Geoffrey White
492c5f367f C++: Simplify NewDelete.qll. 2020-04-06 14:54:15 +01:00
semmle-qlci
e5d3286ee9 Merge pull request #3183 from asger-semmle/js/bad-url-scheme-check
Approved by esbena
2020-04-06 14:53:15 +01:00
Geoffrey White
050e239507 C++: Change note. 2020-04-06 14:39:07 +01:00
Geoffrey White
cbe133d0e6 C++: Deprecate freeCall in the legacy wrapper Alloc.qll. 2020-04-06 14:32:49 +01:00
Geoffrey White
e223557201 C++: Wean NewDelete.qll off the legacy wrapper Alloc.qll. 2020-04-06 14:32:15 +01:00
Calum Grant
0d86866ba3 Merge pull request #3160 from hvitved/csharp/null-maybe-fp
C#: Add false-positive test for NullMaybe.ql
2020-04-06 14:30:31 +01:00
Geoffrey White
8059d69bbd C++: Model calls to operator new / delete for NewFreeMismatch.ql. 2020-04-06 14:27:05 +01:00
Geoffrey White
3e9f9645ae C++: Exclude calls to operator new / delete from NewFreeMismatch.ql. 2020-04-06 14:08:00 +01:00
Geoffrey White
97cdcbee63 C++: Test for NewFreeMismatch.ql with operator new / delete. 2020-04-06 13:57:28 +01:00
Calum Grant
6cce0de9b2 Merge pull request #3124 from hvitved/csharp/dataflow/sources-and-sinks
C#: Introduce `RemoteFlowSink` class
2020-04-06 12:36:14 +01:00
Asger Feldthaus
7da0345c6a JS: Autoformat 2020-04-06 12:30:04 +01:00
Asger Feldthaus
2c6beadf68 JS: Recognize more forms of scheme checks 2020-04-06 12:30:03 +01:00
James Fletcher
5034d40e64 Merge pull request #3203 from jf205/sd-55
CodeQL support docs: combine table and footnotes into single snippet
2020-04-06 09:52:02 +01:00
james
d2b0599b63 docs: combine table and footnotes 2020-04-06 09:27:30 +01:00
Robert
1096e5d947 Merge pull request #3163 from robertbrignull/code_scanning_suites
Add code-scanning suites
2020-04-06 08:45:40 +01:00
Rasmus Wriedt Larsen
4ce3d5b748 Merge pull request #3040 from BekaValentine/python-objectapi-to-valueapi-iterreturnsnonself
Python: ObjectAPI to ValueAPI: IterReturnsNonSelf
2020-04-06 09:37:40 +02:00
Tom Hvitved
c8c706a0ba C#: Un-deprecate PublicCallableParameterFlowSource 2020-04-06 09:01:44 +02:00
Jonas Jensen
530d4294b0 Merge remote-tracking branch 'upstream/master' into DefaultTaintTracking-Configuration 2020-04-05 07:27:07 +02:00
Jonas Jensen
58366b19e9 C++: Path explanations in the last two queries
For some reason I thought that these two queries were special because
they manipulate `SecurityOptions` to change the taint-tracking sources.
It turns out it was just the opposite: the queries used to be special
because they invalidated the cache for the `tainted` predicate, but that
predicate is no longer used, so these queries are no longer special.
2020-04-04 16:47:06 +02:00
Jonas Jensen
54a23a486a C++: Accept test changes for 108d5177b8 2020-04-04 16:46:59 +02:00
Jonas Jensen
d7332644f0 C++: Fix DefinitionByReferenceNode.toString
This predicate now has a value also for calls to function pointers.
2020-04-04 15:31:01 +02:00
Jonas Jensen
108d5177b8 C++: Fix two bugs found by @rdmarsh2
Co-Authored-By: Robert Marsh <rdmarsh2@gmail.com>
2020-04-04 15:24:44 +02:00
Rebecca Valentine
be86c9c066 Python: ObjectAPI to ValueAPI: IterReturnsNonSelf: ObjectAPI.qll: Explains why getAnInferredReturnType is weird for builtins 2020-04-03 15:16:16 -07:00
Rebecca Valentine
64b17888e5 Python: ObjectAPI to ValueAPI: IterReturnsNonSelf: ObjectAPI.qll: Reorganizes getAnInferredReturnType() 2020-04-03 15:14:25 -07:00
Robert Marsh
316d932829 Merge pull request #3198 from MathiasVP/valuenumbering-provider-new-file
C++/C#: Prevent accidental import of ValueNumberPropertyProvider
2020-04-03 13:31:11 -07:00
Jonas Jensen
bb3616e4c4 C++: Add example for globalVarFromId 2020-04-03 17:51:35 +02:00
semmle-qlci
a8098a2b2d Merge pull request #3197 from erik-krogh/NormalPathSanitizer
Approved by asgerf
2020-04-03 16:33:18 +01:00
Jonas Jensen
5822cd7b84 C++: Put paths in the remaining LGTM-suite queries 2020-04-03 17:10:47 +02:00
Jonas Jensen
3ec1f691c2 C++: First query with flow-paths through globals 2020-04-03 16:45:00 +02:00
Jonas Jensen
aaebe3687e C++: Fix copy-paste error in convertedExprNode 2020-04-03 16:37:23 +02:00
Jonas Jensen
469bdae9b2 C++: More helpful toString for def. by ref. node 2020-04-03 16:37:23 +02:00
Jonas Jensen
36da2d1dae C++: Manipulate the source end of paths too
Without this, we get duplicate alerts in some cases and
unnatural-looking source nodes in other cases. The source nodes were
often `Conversion`s.
2020-04-03 16:37:23 +02:00
Jonas Jensen
e916f07a8e C++: Formatting fixups 2020-04-03 15:52:13 +02:00
Jonas Jensen
427815d3d1 C++: taintedWithPath QLDoc + simplification 2020-04-03 15:52:13 +02:00
Jonas Jensen
3653627650 C++: Let configuration class extend singleton 2020-04-03 15:52:13 +02:00
Erik Krogh Kristensen
9c2053168b writing out the truth table for DotDotSlashPrefixRemovingReplace 2020-04-03 15:46:47 +02:00
semmle-qlci
676da02118 Merge pull request #3192 from asger-semmle/js/missing-await-not-delete
Approved by esbena
2020-04-03 13:21:48 +01:00
Shati Patel
a93aafcab5 Merge pull request #3194 from shati-patel/50-intro-to-ql
Docs: Include "Introduction to QL" in tutorial topic
2020-04-03 12:12:00 +01:00
Tom Hvitved
4e2d6c0250 C#: Add missing QL doc 2020-04-03 12:45:56 +02:00
Mathias Vorreiter Pedersen
c54cddead1 C++: Include PrintValueNumbering in testcase 2020-04-03 12:42:06 +02:00
Calum Grant
adde52d33c C#: Add missing files 2020-04-03 11:22:50 +01:00
Jonas Jensen
16c7a35b1c Merge pull request #3195 from geoffw0/taintstring
C++: Model taint flow through std::string constructor and c_str()
2020-04-03 12:05:07 +02:00
Erik Krogh Kristensen
94751c1b31 dst can be relative for "../" replace call 2020-04-03 11:08:31 +02:00
Calum Grant
6a26a6542a C#: Remove a function. 2020-04-03 09:42:25 +01:00
semmle-qlci
dc774e0eac Merge pull request #3166 from erik-krogh/DeadLocal
Approved by asgerf
2020-04-03 09:36:20 +01:00
Tom Hvitved
08fbd1d2ad C#: Update change notes 2020-04-03 10:25:46 +02:00
Geoffrey White
73bfd819d9 C++: Rename classes. 2020-04-03 09:23:31 +01:00
Geoffrey White
1bcf187c3e C++: Rename Strings.qll -> StdString.qll. 2020-04-03 09:17:33 +01:00
Mathias Vorreiter Pedersen
1e73528102 C++/C#: Add synchronization 2020-04-03 10:08:00 +02:00
Mathias Vorreiter Pedersen
0b12c1519b C++/C#: Sync identical files 2020-04-03 10:06:37 +02:00
Mathias Vorreiter Pedersen
0f70944a5b C++: Move ValueNumberPropertyProvider into its own file to prevent accidental imports 2020-04-03 09:55:41 +02:00
Erik Krogh Kristensen
e46cde17a1 add a "../" removing taint-step for js/path-injection 2020-04-03 09:42:05 +02:00
Shati Patel
b267df0077 Address review comments + make article intro consistent with map topic 2020-04-03 00:02:14 +01:00
Robert Marsh
a8e191248e Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams
Merge IR SSA test additions
2020-04-02 15:30:20 -07:00
Asger Feldthaus
ffbbdd7779 JS: Autoformat 2020-04-02 23:04:24 +01:00
Asger Feldthaus
93971e9433 JS: Make local flow not depend on SourceNode 2020-04-02 23:03:29 +01:00
Asger Feldthaus
346867f425 JS: Remove Import->SourceNode dependency from AMD 2020-04-02 23:03:29 +01:00
Asger Feldthaus
3804d3fcfd JS: Remove Import->SourceNode dependency from lazy cache 2020-04-02 23:03:20 +01:00
Robert Marsh
fd915bb5b1 C++: fix join order in IR virtual dispatch 2020-04-02 14:56:11 -07:00
Calum Grant
9481fada51 C#: Address review comments. 2020-04-02 20:29:45 +01:00
Geoffrey White
c9ec30fa2a C++: Update use of deprecated methods. 2020-04-02 19:49:42 +01:00
Geoffrey White
e9132d833c C++: Autoformat. 2020-04-02 19:49:42 +01:00
Geoffrey White
ab716ebe75 C++: Change note. 2020-04-02 19:49:42 +01:00
Geoffrey White
73171682b7 C++: Switch to taint flow as suggested in the old PR. 2020-04-02 19:49:41 +01:00
Geoffrey White
b14b52d0ac C++: Add models for std::string (as in old PR). 2020-04-02 19:49:41 +01:00
Geoffrey White
69f6790c83 C++: Add a test of taint through std::strings, based on the one in the old PR. 2020-04-02 19:49:31 +01:00
Rebecca Valentine
712fb8badc Python: ObjectAPI to ValueAPI: IterReturnsNonSelf: Autoformats 2020-04-02 09:19:41 -07:00
Shati Patel
26f15b8978 Include "Introduction to QL" in tutorial topic 2020-04-02 17:19:29 +01:00
Rebecca Valentine
cdda80623d Merge branch 'master' into python-objectapi-to-valueapi-iterreturnsnonself 2020-04-02 09:16:23 -07:00
Jonas Jensen
604731ba6b Merge pull request #3171 from MathiasVP/init-dynamic-alloc-newexpr
C++: Emit InitializeDynamicAllocation instructions for NewExpr and NewArrayExpr
2020-04-02 17:37:05 +02:00
Mathias Vorreiter Pedersen
e2908eaf63 C++: Add comment explaining why we can split call and allocation side effects 2020-04-02 15:11:13 +02:00
Mathias Vorreiter Pedersen
a273917e51 Merge branch 'master' into init-dynamic-alloc-newexpr 2020-04-02 14:11:03 +02:00
Jonas Jensen
4825774ce2 Merge pull request #3173 from geoffw0/opnew
C++: Support operator new and operator delete in models library
2020-04-02 14:01:10 +02:00
Anders Schack-Mulligen
01157e43e3 Merge pull request #2899 from p-/cwe-036
Java: Calling openStream on URLs created from remote source can lead to file disclosure
2020-04-02 13:55:06 +02:00
Asger Feldthaus
8f930fc3e6 JS: Remove recursive SourceNode from AngularJS 2020-04-02 12:25:33 +01:00
Asger Feldthaus
ee106b1103 JS: Remove tautological SourceNode::Range subclasses 2020-04-02 12:21:17 +01:00
semmle-qlci
6757924183 Merge pull request #3157 from tausbn/python-fix-analysis-qhelp-link
Approved by felicitymay
2020-04-02 11:43:15 +01:00
Asger Feldthaus
3a9d047cf5 JS: Ignore delete expressions in js/missing-await 2020-04-02 11:35:09 +01:00
Asger Feldthaus
ccce0205b4 JS: Add test 2020-04-02 11:34:07 +01:00
Shati Patel
926d3d0968 Merge pull request #3190 from shati-patel/53-ql-reference
Docs: Change "handbook" to "reference"
2020-04-02 11:11:55 +01:00
Taus
d540bf6ce5 Merge pull request #3039 from BekaValentine/python-objectapi-to-valueapi-returnvalueignored
Python: ObjectAPI to ValueAPI: ReturnValueIgnored
2020-04-02 11:42:01 +02:00
Shati Patel
2d602720c1 Docs: Change "handbook" to "reference" 2020-04-02 10:32:12 +01:00
Geoffrey White
ead5feb921 C++: Autoformat. 2020-04-02 09:50:14 +01:00
semmle-qlci
32cf0f14dc Merge pull request #3179 from asger-semmle/js/underscore_int_literals
Approved by erik-krogh
2020-04-02 09:48:41 +01:00
Peter Stöckli
ca80bfda4f Fix tags 2020-04-02 07:43:55 +02:00
Mathias Vorreiter Pedersen
8fdc4b037a C++: Ensure that no call side effect is an allocation side effect 2020-04-02 07:30:56 +02:00
Robert Marsh
a061811939 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams
Pick up new test for user-defined swap functions
2020-04-01 17:32:55 -07:00
Robert Marsh
bbb69d524e Merge pull request #3188 from geoffw0/swap4
C++: Add a user defined swap function to taint tests.
2020-04-01 17:28:46 -07:00
Robert Marsh
8e89c379f5 Merge pull request #1319 from geoffw0/av114
CPP: Improve locations for AV Rule 114.ql.
2020-04-01 16:48:21 -07:00
Rebecca Valentine
cc53b15a5d Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Reorganizes predicates 2020-04-01 14:41:49 -07:00
Taus
bd41bb59ec Merge pull request #3032 from BekaValentine/python-objectapi-to-valueapi-signatureoverriddenmethod
Python: ObjectAPI to ValueAPI: SignatureOverriddenMethod
2020-04-01 23:03:27 +02:00
Shati Patel
c9061f45f0 Merge pull request #3186 from shati-patel/51-move-go-docs
Docs: Copy "CodeQL for Go" docs into this repo
2020-04-01 21:39:32 +01:00
Rebecca Valentine
09349f1957 Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Autoformats 2020-04-01 12:54:42 -07:00
Rebecca Valentine
28319ee0f7 Python: ObjectAPI to ValueAPI: SignatureOverriddenMethod: Autoformats 2020-04-01 12:32:21 -07:00
Jonas Jensen
207c76b855 C++: Path explanations in DefaultTaintTracking
The first three queries are migrated to use path explanations.
2020-04-01 20:51:05 +02:00
Jonas Jensen
b07380d2eb C++: Update ppReprType for C++ IR dataflow
I forgot to do this in b1be123e31. Without this change, we suffix
` : void` on very step of an IR path explanation.
2020-04-01 20:19:00 +02:00
Geoffrey White
6b5f4d9e12 Merge branch 'master' into av114 2020-04-01 18:23:21 +01:00
James Fletcher
698252236b Merge pull request #3184 from jf205/migration-28
CodeQL docs: update query console link text
2020-04-01 18:20:24 +01:00
Geoffrey White
7a98919879 C++: Add a non-standard swap to taint tests. 2020-04-01 17:14:38 +01:00
Peter Stöckli
36c351dc68 Add input from documentation review 2020-04-01 17:59:45 +02:00
Rebecca Valentine
838e37ca98 Python: ObjectAPI to ValueAPI: ReturnValueIgnore: Moves getAnInferredType to CallableObjectInternal 2020-04-01 08:45:27 -07:00
Shati Patel
e83bee2f02 Copy Go docs into this repo 2020-04-01 16:43:52 +01:00
James Fletcher
1ba7a4d39b Update docs/language/learn-ql/introduction-to-ql.rst
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-04-01 16:09:28 +01:00
James Fletcher
aea2957570 Update docs/language/learn-ql/java/dataflow.rst
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-04-01 16:09:04 +01:00
Shati Patel
48a09ce1c0 Merge pull request #3178 from shati-patel/21-ql-language
[Migration prep] Docs: "QL language reference" category
2020-04-01 16:07:17 +01:00
Shati Patel
a514cecdf4 Fix sidebar title 2020-04-01 15:44:07 +01:00
Geoffrey White
8d3d088ae8 Merge branch 'master' into opnew 2020-04-01 15:43:32 +01:00
Rebecca Valentine
97b4077162 Merge branch 'master' into python-objectapi-to-valueapi-signatureoverriddenmethod 2020-04-01 07:42:10 -07:00
Rebecca Valentine
12377badf9 Merge branch 'master' into python-objectapi-to-valueapi-returnvalueignored 2020-04-01 07:37:17 -07:00
Rasmus Wriedt Larsen
0b09bfe2d8 Merge pull request #3180 from tausbn/python-a-few-more-autoformats
Python: Fix up (hopefully) the last file that needs autoformatting.
2020-04-01 16:36:11 +02:00
james
4d9cc8b3e0 docs: small change to query metadata table 2020-04-01 15:31:04 +01:00
Shati Patel
e246b6b9e3 Move links into different section 2020-04-01 15:26:03 +01:00
james
500f49d565 docs: fix a few more links 2020-04-01 15:22:42 +01:00
Shati Patel
0771c39294 Update docs/language/ql-handbook/about-the-ql-language.rst
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-04-01 15:21:11 +01:00
james
d9f04a8da4 docs: update query console link text 2020-04-01 15:11:05 +01:00
Geoffrey White
d71098d178 Merge branch 'master' into opnew 2020-04-01 15:00:26 +01:00
Jonas Jensen
9a55d42639 C++: QLDoc in DefaultTaintTracking
These docs are mostly copied and adapted from
`DefaultTaintTrackingImpl.qll`.
2020-04-01 15:30:31 +02:00
Geoffrey White
119d4a40a0 C++: Fix unintended consequence in IR. 2020-04-01 14:29:28 +01:00
Mathias Vorreiter Pedersen
fa7dc32dee C++: Remove dependency on implementation of models in TranslatedCall 2020-04-01 14:46:52 +02:00
Taus Brock-Nannestad
554bb76746 Python: Fix up (hopefully) the last file that needs autoformatting. 2020-04-01 14:16:35 +02:00
Taus
2dbb16e2db Merge pull request #3177 from RasmusWL/python-minor-doc-fix
Python: Add missing ` in qldoc
2020-04-01 13:50:08 +02:00
Shati Patel
79068d5e68 Update link 2020-04-01 12:33:45 +01:00
Asger Feldthaus
541ff40d24 JS: Bump extractor version string 2020-04-01 12:26:30 +01:00
Asger Feldthaus
b5e110e39e JS: Fix value of numeric literals containing underscores 2020-04-01 12:24:42 +01:00
Asger Feldthaus
9888f15a29 JS: Add test showing root cause of problem 2020-04-01 12:21:27 +01:00
Asger Feldthaus
2d864aaf1b JS: Add failing test 2020-04-01 12:21:25 +01:00
Shati Patel
27408c2584 Delete QL spec articles and add README 2020-04-01 12:03:00 +01:00
Shati Patel
c08f730bcd Delete "About QL" and references to it 2020-04-01 11:51:57 +01:00
Shati Patel
51f4575479 Include spec and "About QL" in reference sphinx project 2020-04-01 11:45:56 +01:00
Rasmus Wriedt Larsen
f8f51109d0 Python: Add missing ` in qldoc 2020-04-01 12:07:19 +02:00
Tom Hvitved
42e180d6c4 Merge pull request #3060 from aschackmull/dataflow/no-param-to-same-param-flow
Dataflow: Exclude param-param flow through with identical params.
2020-04-01 09:42:12 +02:00
Rebecca Valentine
093eb71433 Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Adds getAReturnType 2020-04-01 00:17:12 -07:00
Rebecca Valentine
eb4a567a34 Merge branch 'master' into python-objectapi-to-valueapi-signatureoverriddenmethod 2020-03-31 23:36:15 -07:00
Rebecca Valentine
eab31d3bef Python: ObjectAPI to ValueAPI: SignatureOverriddenMethod: Updates expected results 2020-03-31 23:34:17 -07:00
Rebecca Valentine
0b2db56051 Python: ObjectAPI to ValueAPI: ObjectAPI.qll: Fixes error in isIterator 2020-03-31 22:15:21 -07:00
Rebecca Valentine
42388b0d97 Python: ObjectAPI to ValueAPI: ReturnValueIgnored: Adds prototype version of getAnInferredReturnType 2020-03-31 22:11:58 -07:00
Robert Marsh
b579e6aabe C++: accept consistency test output 2020-03-31 12:56:52 -07:00
Robert Marsh
25f3f67c4a Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams
Fixes test conflicts and reveals a bug in parameter handling
2020-03-31 12:54:00 -07:00
Mathias Vorreiter Pedersen
f06ae6e9de C++: Accept more test output 2020-03-31 19:49:04 +02:00
Geoffrey White
f430cf9d18 C++: Use hasGlobalName. 2020-03-31 18:11:09 +01:00
Geoffrey White
49f8f24d0d Merge pull request #3128 from jbj/library-overview-assignment
C++: Add AssignExpr + Initializer to library overview page
2020-03-31 18:02:11 +01:00
Peter Stöckli
60d5ed9c79 Input from Review 2020-03-31 18:30:00 +02:00
Mathias Vorreiter Pedersen
97061716f9 C++: Accept test output 2020-03-31 17:10:33 +02:00
Mathias Vorreiter Pedersen
291df97cd9 C++: Also add InitializeDynamicAllocation instruction for NewArrayExpr 2020-03-31 17:06:19 +02:00
Shati Patel
e5ad708390 Merge pull request #3172 from shati-patel/merge-master-docs
Merge "master" into "docs-preparation" branch
2020-03-31 15:58:27 +01:00
Calum Grant
9a5e80667e C#: Address review comments. 2020-03-31 15:21:51 +01:00
Mathias Vorreiter Pedersen
b6f93746bf C++: Accept test output 2020-03-31 16:00:56 +02:00
Geoffrey White
aa13257c1b C++: Correct QLDoc. 2020-03-31 14:37:54 +01:00
Shati Patel
ba1a0da2ab Merge branch 'master' into merge-master-docs 2020-03-31 13:09:18 +01:00
Tom Hvitved
4ca5e3755f C#: Add false-positive test for NullMaybe.ql 2020-03-31 14:06:16 +02:00
Alexander Eyers-Taylor
ca9b892519 Merge pull request #3143 from ginsbach/the
Uniqueness aggregate in handbook and reference
2020-03-31 13:01:20 +01:00
Mathias Vorreiter Pedersen
94f5468504 C++: Accept tests 2020-03-31 13:56:47 +02:00
Mathias Vorreiter Pedersen
bd89ee13d1 C++: Add InitializeDynamicAllocation instruction to NewExpr and NewArrayExpr 2020-03-31 13:56:32 +02:00
Geoffrey White
a75e249112 C++: Autoformat test. 2020-03-31 12:55:45 +01:00
Geoffrey White
18e60fabaf C++: Model operator delete and operator delete[]. 2020-03-31 12:55:44 +01:00
Erik Krogh Kristensen
45797dc729 autoformat 2020-03-31 13:53:00 +02:00
Shati Patel
01ad297eb0 Merge pull request #3170 from shati-patel/21-ql-language
CodeQL docs: Update intros in QL handbook and QL spec
2020-03-31 12:39:37 +01:00
Shati Patel
5bf0a087d0 Update docs/language/ql-handbook/queries.rst
Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2020-03-31 12:25:23 +01:00
Shati Patel
a0158b3917 Update intros in QL handbook 2020-03-31 11:31:41 +01:00
Mathias Vorreiter Pedersen
688464a00f C++: Add testcases with new and accept output 2020-03-31 12:22:07 +02:00
Jonas Jensen
7b7ff1fb3a Merge pull request #3089 from geoffw0/sideeffect
CPP: Add side effect models for strcpy and strcat.
2020-03-31 12:11:04 +02:00
Erik Krogh Kristensen
3784b180d8 changes based on review 2020-03-31 12:07:55 +02:00
Geoffrey White
3b12d1adfd C++: Test getPlacementArgument(). 2020-03-31 11:06:21 +01:00
Geoffrey White
254c877d0a C++: Deduplicate AllocationExprs. 2020-03-31 11:05:50 +01:00
Geoffrey White
259f714d91 C++: Model operator new and operator new[]. 2020-03-31 11:02:52 +01:00
Geoffrey White
ef68bd6bf4 C++: Add a test of direct calls to operator new / operator dedelete. 2020-03-31 11:01:29 +01:00
Geoffrey White
aa49b35d2c C++: Add an explicit test of DeallocationFunction and DeallocationExpr as well. 2020-03-31 10:37:20 +01:00
semmle-qlci
0feb7f87e4 Merge pull request #2761 from erik-krogh/UrlSearch
Approved by asgerf
2020-03-31 09:46:48 +01:00
semmle-qlci
5c920eb625 Merge pull request #3120 from asger-semmle/js/prefer-typescript-file
Approved by esbena
2020-03-31 09:32:14 +01:00
semmle-qlci
73dd4c8686 Merge pull request #3133 from asger-semmle/js/dictionary-taint-step-regression
Approved by esbena
2020-03-31 09:28:55 +01:00
Erik Krogh Kristensen
40fd1825e9 autoformat 2020-03-31 09:08:32 +02:00
Jonas Jensen
93f7c950ea Merge pull request #3152 from dbartol/dbartol/sync-files
Move `sync-identical-files.py` into public repo as `sync-files.py`
2020-03-31 08:31:00 +02:00
Taus
e31143c9f8 Merge pull request #2889 from RasmusWL/python-add-custom-sanitizer-example
Python: Add example for how to write your own sanitizer
2020-03-30 22:59:56 +02:00
Robert Marsh
4bbf4628d4 Merge pull request #3162 from jbj/argHasPostUpdate-cpp
C++: Remove noise from argHasPostUpdate check
2020-03-30 13:20:09 -07:00
Geoffrey White
0cb7d4c82d C++: Add an explicit test of AllocationFunction and AllocationExpr. 2020-03-30 20:28:21 +01:00
semmle-qlci
3027e5d316 Merge pull request #3161 from Semmle/max-schaefer-patch-1
Approved by felicitymay
2020-03-30 19:44:06 +01:00
Erik Krogh Kristensen
7938bc4ed0 improve alert message for js/useless-assignment-to-local 2020-03-30 20:19:50 +02:00
Geoffrey White
b634b59b9c C++: Merge the two allocators tests. 2020-03-30 18:52:12 +01:00
Peter Stöckli
40c3b5468f Fix QHelp/XML syntax 2020-03-30 18:55:14 +02:00
Rasmus Wriedt Larsen
6127d8b8f4 Python: Fixup comment alignment 2020-03-30 18:32:31 +02:00
Rasmus Wriedt Larsen
fad03e77cc Python: Move helper predicate outside of class
otherwise the helper predicate can (and sometimes will) be evaluated once _per_
instance of that class.
2020-03-30 18:31:16 +02:00
Rasmus Wriedt Larsen
663dc24753 Python: Apply suggestion from Taus
rewrote the qldoc to explain it as well.
2020-03-30 18:29:08 +02:00
Jonas Jensen
531ef64c5d C++: Fix other copies of the argHasPostUpdate test 2020-03-30 17:45:53 +02:00
Rasmus Wriedt Larsen
0b4bfed726 Merge pull request #3156 from tausbn/python-autoformat-all-ql-files
Python: Autoformat all `.ql` files.
2020-03-30 16:24:18 +02:00
Rasmus Wriedt Larsen
573494d313 Merge pull request #3096 from tausbn/python-autoformat-almost-everything
Python: Autoformat (almost) all `.qll` files.
2020-03-30 16:19:23 +02:00
Jonas Jensen
dd322be238 C++: Remove noise from argHasPostUpdate check
This consistency check seems to have value for AST data flow, but I've
disabled it on the IR for now.

This commit also includes two unrelated changes that seem to fix a
semantic merge conflict.
2020-03-30 15:51:11 +02:00
Max Schaefer
365751412c Docs: Bump supported Go version.
cf https://github.com/github/codeql-go/pull/39
2020-03-30 14:24:22 +01:00
Geoffrey White
6d6ad4a0ae Merge branch 'master' into sideeffect 2020-03-30 14:16:23 +01:00
Taus Brock-Nannestad
b990fac97b Python: Fix test failures.
How could the tests fail because of autoformatting, you may ask?

The answer is deprecation warnings. These specify the location of the deprecated
entity, and due to autoformatting these moved around.
2020-03-30 13:55:38 +02:00
Taus Brock-Nannestad
2229e34466 Python: Fix outdated link in ImportFailure.qhelp. 2020-03-30 13:14:37 +02:00
semmle-qlci
fce04f0bd0 Merge pull request #3127 from erik-krogh/PromiseTrack
Approved by asgerf
2020-03-30 11:56:33 +01:00
Tom Hvitved
9fa9c10361 Merge pull request #2921 from aschackmull/dataflow/consistency-checks
Java: Add data-flow consistency checks.
2020-03-30 12:47:41 +02:00
Taus Brock-Nannestad
ab4cef53c2 Python: Autoformat one final straggler. 2020-03-30 12:36:43 +02:00
Taus Brock-Nannestad
727cde31c9 Python: Autoformat a few final stragglers. 2020-03-30 12:30:14 +02:00
Taus Brock-Nannestad
6eb9c6f84d Merge branch 'master' into python-autoformat-almost-everything 2020-03-30 12:24:01 +02:00
Asger Feldthaus
a317b87b81 JS: Fix perf issue in DictionaryTaintStep 2020-03-30 11:23:47 +01:00
James Fletcher
675144cd3d Merge pull request #3146 from jf205/tidy-up-docs-prep
CodeQL docs: tidy up 'docs-preparation' branch following pre-migration work
2020-03-30 11:10:28 +01:00
Anders Schack-Mulligen
caf0d1528f Merge pull request #3155 from max-schaefer/add-module-comment
Data flow: Add module doc comment for `TaintTrackingImpl.qll`
2020-03-30 12:07:08 +02:00
Taus Brock-Nannestad
87a9f51c78 Python: Autoformat all .ql files. 2020-03-30 11:59:10 +02:00
James Fletcher
0f0dc3c2ae Update docs/language/learn-ql/python/ql-for-python.rst
Co-Authored-By: Alistair <54933897+hubwriter@users.noreply.github.com>
2020-03-30 10:48:23 +01:00
Max Schaefer
e5e94e3357 Data flow: Add module doc comment for TaintTrackingImpl.qll
Modelled after the correponding comment for `DataFlowImpl.qll`.
2020-03-30 10:35:47 +01:00
Taus
b4fbfa029e Merge pull request #3132 from RasmusWL/python-fix-iterable-unpacking-taint-CP
Python: Fix iterable-unpacking taint CP
2020-03-30 11:22:03 +02:00
Anders Schack-Mulligen
b2769b42ed Merge pull request #3117 from adityasharad/java/jackson-taint-steps
Java: Add taint steps through Jackson serialization methods.
2020-03-30 10:34:56 +02:00
Anders Schack-Mulligen
57c9277601 Merge pull request #3142 from MathiasVP/no-magic-in-parameterThroughFlowCand
Data flow: No magic in returnFlowCallableCand
2020-03-30 10:15:48 +02:00
Dave Bartolomeo
3eef2747d5 Fix LGTM alerts 2020-03-29 03:12:27 -04:00
Dave Bartolomeo
0952064eb3 Move sync-identical-files.py into public repo as sync-files.py
We currently use a script to keep certain duplicate QL files in sync across the repo. For historical reasons, this script has lived in the private repo alongside the rest of CodeQL, even though it's only used for files in the public `ql` repo. This PR moves the script into the public `ql` repo. It is still invoked by Jenkins scripts that live in the private repo during CI, but it can also be invoked directly without having a checkout of the private repo. This is useful for anyone who is modifying the dataflow or IR libraries with only a QL checkout.
2020-03-29 02:59:14 -04:00
Calum Grant
69041bc959 C#: Enable nullability in Autobuilder. 2020-03-27 20:26:38 +00:00
Nick Rolfe
1baf5df342 Merge pull request #3147 from dbartol/dbartol/FloatLiterals
C++: Fix test expectations for complex literals
2020-03-27 18:15:06 +00:00
Robert Brignull
90fad6f762 add code scanning suites 2020-03-27 17:03:23 +00:00
Shati Patel
28e5904079 Merge pull request #3149 from Semmle/jf205-patch-2
Change 'Set Literals' to 'Set literals'
2020-03-27 16:47:58 +00:00
James Fletcher
2c571d3655 Update language.rst 2020-03-27 16:40:48 +00:00
Peter Stöckli
c6688eb349 Fix OpenStream documentation 2020-03-27 17:08:49 +01:00
Peter Stöckli
3de00443ff Review feeback for OpenStream 2020-03-27 17:06:58 +01:00
Rasmus Wriedt Larsen
d55acc38df Python: Constrain execution paths for taint_at_depth
Thanks Taus!
2020-03-27 16:20:08 +01:00
Erik Krogh Kristensen
4864e77430 Merge branch 'master' of git.semmle.com:Semmle/ql into UrlSearch 2020-03-27 15:59:29 +01:00
Philip Ginsbach
a91a5c3db9 "aggregation yields" => "query returns"
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-27 14:50:41 +00:00
Philip Ginsbach
23e4ae3f49 "and hence" => ", so"
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-27 14:50:07 +00:00
Philip Ginsbach
3406ee72ee Update docs/language/ql-handbook/expressions.rst
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-27 14:49:45 +00:00
Philip Ginsbach
811bc01d1e the `expression => <expression>`
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-27 14:49:23 +00:00
Philip Ginsbach
c91c3f24a0 fixed typo "the the"
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-27 14:47:57 +00:00
Dave Bartolomeo
3039aaf4f3 C++: Fix test expectations for complex literals 2020-03-27 10:33:19 -04:00
Shati Patel
0b62a1d980 Merge pull request #3144 from ginsbach/setliteralhandbook
Mention set literals in handbook
2020-03-27 14:25:56 +00:00
Peter Stöckli
5e62a6bebe Move CWE-036 directory to experimental 2020-03-27 15:10:15 +01:00
Peter Stöckli
74fc416a35 Merge branch 'master' into cwe-036 2020-03-27 14:54:41 +01:00
Erik Krogh Kristensen
0ebbd80745 autoformat 2020-03-27 14:54:34 +01:00
Philip Ginsbach
73845923aa Update docs/language/ql-handbook/expressions.rst
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-03-27 13:34:20 +00:00
Philip Ginsbach
90b82a0905 unique in aggregate section 2020-03-27 13:09:35 +00:00
Henning Makholm
875a70c0a3 Merge pull request #3129 from ginsbach/master
Set Literal in QL
2020-03-27 14:02:55 +01:00
Philip Ginsbach
d979bd958b better wording for the unique aggregate 2020-03-27 13:01:50 +00:00
james
a6cfdfe8e3 docs: small change to codeql training landing page 2020-03-27 13:00:26 +00:00
james
b4b1903642 docs: simplify 'learning codeql' landing page 2020-03-27 13:00:26 +00:00
james
76f344638e docs: 'What's new' -> 'Further reading' 2020-03-27 13:00:26 +00:00
james
deb657acdb docs: tidy up 'codeql for x' pages
Manually construct tocs including intro text.
Fix a few intros and titles.
2020-03-27 13:00:00 +00:00
Philip Ginsbach
05be9b82a2 better wording for type compatibilit 2020-03-27 12:56:37 +00:00
Philip Ginsbach
135a288bed Update docs/language/ql-handbook/expressions.rst
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-27 12:55:42 +00:00
semmle-qlci
fad902fc9b Merge pull request #3095 from erik-krogh/MorePerf
Approved by asgerf
2020-03-27 12:51:37 +00:00
semmle-qlci
9b3400337b Merge pull request #3130 from erik-krogh/PreciseSteps
Approved by asgerf
2020-03-27 12:18:28 +00:00
Philip Ginsbach
1b4df6e24c whitespace fix 2020-03-27 11:53:19 +00:00
Philip Ginsbach
8e873f35ac mention set literals in handbook 2020-03-27 11:51:03 +00:00
Philip Ginsbach
f9442211bf unique aggregate in handbook and reference 2020-03-27 11:31:25 +00:00
Mathias Vorreiter Pedersen
7890a322c8 C++/C#/Java: Sync identical files 2020-03-27 11:51:38 +01:00
Mathias Vorreiter Pedersen
9ab8580ca7 Data flow: No magic in parameterThroughFlowCand 2020-03-27 11:51:10 +01:00
Rasmus Wriedt Larsen
8aadb8bd06 Python: Fix iterable-unpacking tests 2020-03-27 11:42:37 +01:00
semmle-qlci
1975a83cdd Merge pull request #3116 from max-schaefer/js/postgres-type-tracking
Approved by asgerf
2020-03-27 09:23:52 +00:00
Erik Krogh Kristensen
58af63d8cc add test case for XSS on url suffix 2020-03-27 10:02:24 +01:00
Erik Krogh Kristensen
d3e1a258fa autoformat 2020-03-27 09:34:56 +01:00
Erik Krogh Kristensen
be11418c77 autoformat 2020-03-27 00:18:41 +01:00
Robert Marsh
968ddc6274 Merge pull request #3137 from jbj/DefaultTaintTracking-argv
C++: Never track flow out of an argv argument
2020-03-26 15:29:52 -07:00
Calum Grant
b94b4b7c91 C#: Fix tests 2020-03-26 20:40:40 +00:00
Calum Grant
8a968dac81 C#: Enable nullability in Semmle.Util 2020-03-26 20:10:21 +00:00
Jonas Jensen
2801941ca2 C++: Never track flow out of an argv argument
This change removes some duplicate results that will otherwise appear
due to https://github.com/Semmle/ql/pull/3123 and possibly
https://github.com/Semmle/ql/pull/2704.
2020-03-26 20:40:16 +01:00
Calum Grant
782f2b5b50 Merge pull request #3073 from hvitved/csharp/null-maybe-fp
C#: Add test for `cs/dereferenced-value-may-be-null`
2020-03-26 18:55:54 +00:00
Dave Bartolomeo
7879dde8b8 Merge pull request #3097 from jbj/detect-conflated-memory
C++: Implement Instruction.isResultConflated
2020-03-26 14:52:47 -04:00
Rasmus Wriedt Larsen
96d1fc8c0b Python: Fix iterable-unpacking taint CP
When running ql/python/ql/src/Security/CWE-079/ReflectedXss.ql against the
database for flask.

Iitially there were 10 million result-tuples for iterable_unpacking_descent.

With this change, we're down to roughly 2100,
2020-03-26 16:42:48 +01:00
Calum Grant
71e0dc087b C#: General code tidy. 2020-03-26 15:35:31 +00:00
Erik Krogh Kristensen
6b507c6933 add urlSuffix support to DomBasedXSS 2020-03-26 15:47:59 +01:00
Erik Krogh Kristensen
a850616927 delete Xss.actual 2020-03-26 15:40:37 +01:00
Erik Krogh Kristensen
e2d2c2341e autoformat and update expected output 2020-03-26 15:38:00 +01:00
Erik Krogh Kristensen
baf50c832c more precise charpreds in taint steps 2020-03-26 15:30:43 +01:00
Philip Ginsbach
71c588a74f information on version support 2020-03-26 14:15:29 +00:00
Tom Hvitved
a8660d446e C#: Fix typo 2020-03-26 14:54:03 +01:00
Philip Ginsbach
f4a1479d33 sentence about semantics 2020-03-26 12:49:09 +00:00
Philip Ginsbach
783cee30c4 mention set literals in the specification 2020-03-26 12:21:38 +00:00
Asger Feldthaus
816968d102 JS: Rename test files to avoid clash 2020-03-26 11:59:57 +00:00
Tom Hvitved
db8d61c3be C#: Remove compiler warning in Remote.qll 2020-03-26 12:26:17 +01:00
Jonas Jensen
4f068685e1 C++: Add AssignExpr + Initializer to lib overview 2020-03-26 10:49:03 +01:00
yo-h
0f70da2258 Merge pull request #3105 from aschackmull/java/postupdate-jump
Java: Fix missing jump step from PostUpdate to capture.
2020-03-25 22:05:30 -04:00
Robert Marsh
e6cdbb9bd2 Merge pull request #3121 from dbartol/dbartol/ir-generate-all-fixup
C++: Late fix for PR feedback
2020-03-25 17:58:01 -07:00
Erik Krogh Kristensen
1cefa12315 update expected output 2020-03-25 23:54:57 +01:00
Erik Krogh Kristensen
8f45c8fe83 use LoadStoreStep for type-tracking promises 2020-03-25 23:54:57 +01:00
Erik Krogh Kristensen
1a2983fe39 support small steps for promise tracking 2020-03-25 23:54:57 +01:00
Erik Krogh Kristensen
00181e059b add tests for type-tracking promises 2020-03-25 23:54:56 +01:00
Erik Krogh Kristensen
9a78d38df0 add a new LoadStoreStep as a StepSummary for TypeTracking 2020-03-25 23:54:56 +01:00
semmle-qlci
e7fd97e72b Merge pull request #3119 from erik-krogh/SockJS
Approved by esbena
2020-03-25 21:36:29 +00:00
Tom Hvitved
95b6f6aee0 C#: Add change note 2020-03-25 20:05:39 +01:00
Tom Hvitved
54677189de C#: Introduce RemoteFlowSink class 2020-03-25 20:05:39 +01:00
Tom Hvitved
142737dc61 C#: Move HtmlSinks from XSS.qll into separate file 2020-03-25 20:05:39 +01:00
Tom Hvitved
fddbce0b7b C#: Move all predefined sources and sinks into security/dataflow/flow{sinks,sources} 2020-03-25 20:05:39 +01:00
Erik Krogh Kristensen
4b0bc6b2b3 autoformat 2020-03-25 19:47:41 +01:00
Dave Bartolomeo
f981ce6be4 Merge pull request #3122 from jbj/getParameter-docs
C++: Improve QLDoc for Function.getParameter
2020-03-25 12:59:28 -04:00
Calum Grant
87970337ae C#: Improvements to buildless extraction, particularly for .NET Core. 2020-03-25 15:27:48 +00:00
Jonas Jensen
bc3bdbb11b C++: Improve QLDoc for Function.getParameter 2020-03-25 15:21:24 +01:00
Dave Bartolomeo
1edd492abf C++: Late fix for PR feedback
I missed this suggestion before I merged the original PR. Fixing it now before I forget.
2020-03-25 10:10:30 -04:00
Asger Feldthaus
ad1e0ec50b JS: Inline variable again 2020-03-25 14:01:33 +00:00
Dave Bartolomeo
376779421d Merge pull request #2975 from rdmarsh2/printir-generate-all
C++/C#: generate IR for funcs excluded in PrintIR
2020-03-25 09:45:02 -04:00
Tom Hvitved
7ac25d2439 C#: Add more tests for cs/information-exposure-through-exception 2020-03-25 14:33:49 +01:00
Asger Feldthaus
54021a1c30 JS: Update old entry point and add a test 2020-03-25 13:24:18 +00:00
Asger Feldthaus
a78f1b864b JS: Fix trailing whitespace 2020-03-25 12:45:48 +00:00
Asger Feldthaus
6c9e35c22e JS: Skip .js files with a same-named .ts file next to it 2020-03-25 12:45:37 +00:00
semmle-qlci
cf5b1f0cd5 Merge pull request #3019 from erik-krogh/ArrayStep
Approved by asgerf
2020-03-25 12:08:44 +00:00
Erik Krogh Kristensen
abcdfe3c53 use LibraryName class for websocket library names 2020-03-25 13:06:21 +01:00
Rasmus Wriedt Larsen
dc9dbf3682 Python: Autoformat 2020-03-25 11:56:18 +01:00
Jonas Jensen
2b2667aef7 Merge remote-tracking branch 'upstream/master' into detect-conflated-memory
Conflicts:
	cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRSanity.qll
	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/test/library-tests/ir/ir/aliased_ssa_sanity.expected
	cpp/ql/test/library-tests/ir/ir/aliased_ssa_sanity_unsound.expected
	cpp/ql/test/library-tests/ir/ir/raw_sanity.expected
	cpp/ql/test/library-tests/ir/ir/unaliased_ssa_sanity.expected
	cpp/ql/test/library-tests/ir/ir/unaliased_ssa_sanity_unsound.expected
	cpp/ql/test/library-tests/ir/ssa/aliased_ssa_sanity.expected
	cpp/ql/test/library-tests/ir/ssa/aliased_ssa_sanity_unsound.expected
	cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_sanity.expected
	cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_sanity_unsound.expected
	cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_sanity.expected
	cpp/ql/test/library-tests/syntax-zoo/raw_sanity.expected
	cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_sanity.expected
	csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRSanity.qll
	csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRSanity.qll
	csharp/ql/test/library-tests/ir/ir/raw_ir_sanity.expected
	csharp/ql/test/library-tests/ir/ir/unaliased_ssa_sanity.expected
2020-03-25 11:55:39 +01:00
Rasmus Wriedt Larsen
12c6997e7b Python: Reduce result set in custom taint sanitizer 2020-03-25 11:55:29 +01:00
Erik Krogh Kristensen
f7faaa634f change-note 2020-03-25 11:37:39 +01:00
semmle-qlci
a413a3254b Merge pull request #3114 from RasmusWL/python-add-fp-for-non-callable
Approved by tausbn
2020-03-25 10:34:50 +00:00
semmle-qlci
ac7c74dcee Merge pull request #3111 from RasmusWL/python-fabric-command-injection
Approved by BekaValentine
2020-03-25 10:07:33 +00:00
Mathias Vorreiter Pedersen
ae076da517 Merge pull request #3112 from dbartol/codeql-c-analysis/34-Bad-Overlap
C++/C#: Fix invalid overlap
2020-03-25 10:40:39 +01:00
Erik Krogh Kristensen
f2b9e2019c remove isRelevant from flowStep 2020-03-25 09:46:07 +01:00
Erik Krogh Kristensen
6f0e507242 outline predicate to fix join-ordering 2020-03-25 09:44:03 +01:00
Erik Krogh Kristensen
3000486b35 add more isRelevant calls 2020-03-25 09:42:24 +01:00
yo-h
116c13eb18 Merge pull request #3106 from aschackmull/java/getstmtbody-type
Java: Sharpen return type of LambdaExpr.getStmtBody().
2020-03-24 19:20:57 -04:00
Erik Krogh Kristensen
1d8e103322 autoformat 2020-03-25 00:19:23 +01:00
yo-h
ac68b62b48 Merge pull request #3115 from aschackmull/java/experimental-dir
Java: Fix directory structure in experimental.
2020-03-24 16:50:28 -04:00
Aditya Sharad
a6e039b284 Java: Add tests for Jackson taint steps.
Add stubs for jackson-databind-2.10.
Based on http://fasterxml.github.io/jackson-databind/javadoc/2.10.
Test taint through Jackson serialization APIs.
2020-03-24 12:59:24 -07:00
Aditya Sharad
7de8b48692 Java: Add taint steps through Jackson serialization methods. 2020-03-24 12:59:14 -07:00
Dave Bartolomeo
2b69cc9738 C#: Make IRConfiguration.qll just forward to the implementation
Just like C++ already does.
2020-03-24 13:33:50 -04:00
Max Schaefer
efbcec09ef JavaScript: Add type tracking to Postgres model. 2020-03-24 17:30:07 +00:00
Anders Schack-Mulligen
75523e4eb8 Java: Fix directory structure in experimental. 2020-03-24 16:47:55 +01:00
Jonas Jensen
8f419d1676 C++: Fix conflated-memory sanity query
I had included `InitializeNonLocal` in the recursion because it made
everything look better in the presence of a bug that's since been fixed.
Taking it out means the sanity test is again aligned with the old
`isChiForAllAliasedMemory`.
2020-03-24 16:46:59 +01:00
Jonas Jensen
4e588869d8 C++: Sync identical files 2020-03-24 16:46:42 +01:00
Dave Bartolomeo
cc76782545 Merge remote-tracking branch 'upstream/master' into codeql-c-analysis/34-Bad-Overlap 2020-03-24 11:38:39 -04:00
semmle-qlci
ce0b72f949 Merge pull request #3093 from erik-krogh/MorePathSinks
Approved by asgerf
2020-03-24 14:26:41 +00:00
Anders Schack-Mulligen
d8edae96df Java: Add test. 2020-03-24 15:24:17 +01:00
Rasmus Wriedt Larsen
05ecfc83f7 Python: Add test-case with swapped decorator order 2020-03-24 14:18:46 +01:00
Jonas Jensen
27832148a9 C++: Phi-node conflation is not about vvars 2020-03-24 13:56:42 +01:00
Jonas Jensen
95a8dcb3fd C++: failing test for non-conflated escaped var 2020-03-24 13:31:08 +01:00
Taus
fe00d1cbf4 Merge pull request #2888 from RasmusWL/python-tarslip-sanitizer
Python: Improve tarslip sanitizer
2020-03-24 12:59:20 +01:00
Rasmus Wriedt Larsen
3ed48aae4c Python: remove leftover arg in test code 2020-03-24 11:49:08 +01:00
Rasmus Wriedt Larsen
5ec0716cb0 Python: Add points-to regression when using @classmethod decorators
Specifically a problem when using a second decorator
2020-03-24 11:39:08 +01:00
Erik Krogh Kristensen
36981f385a Merge branch 'master' of git.semmle.com:Semmle/ql into MorePathSinks 2020-03-24 11:20:33 +01:00
Rasmus Wriedt Larsen
49fa7c8589 Python: update 1.24 changelog 2020-03-24 10:15:36 +01:00
Rasmus Wriedt Larsen
4b8020b98d Python: Autoformat Command.qll 2020-03-24 10:11:57 +01:00
semmle-qlci
4c9a6b73ee Merge pull request #3107 from erik-krogh/FArgs
Approved by esbena
2020-03-24 08:32:56 +00:00
Erik Krogh Kristensen
fa710c5864 Merge remote-tracking branch 'upstream/master' into UrlSearch 2020-03-24 00:23:15 +01:00
Erik Krogh Kristensen
5b4f091257 add test for remote flow sources in WebSockets 2020-03-23 23:58:20 +01:00
Erik Krogh Kristensen
6a1491d83d add SockJS to the existing WebSocket model 2020-03-23 23:56:11 +01:00
Erik Krogh Kristensen
9a18dc32c1 autoformat WebSocket tests 2020-03-23 23:49:26 +01:00
Erik Krogh Kristensen
7b7eddff1e remove previous SockJS implementation, and move example to WebSocket test 2020-03-23 23:45:05 +01:00
Asger F
a1e032bee6 Merge pull request #3098 from kyprizel/master
Experimental SockJS support
2020-03-23 22:39:10 +00:00
yo-h
d315864383 Merge pull request #3108 from aschackmull/java/finalizemethod
Java: Fixup FinalizeMethod definition.
2020-03-23 18:27:57 -04:00
Dave Bartolomeo
bebf89fed5 C++: Accept test diffs
All changes look like real improvements.
2020-03-23 17:20:19 -04:00
kyprizel
dec1b8b070 Update javascript/ql/src/experimental/SockJS/SockJS.qll
Fix comments

Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-03-23 22:59:48 +03:00
kyprizel
b90ff5e84d Update javascript/ql/src/experimental/SockJS/SockJS.qll
do not import specific libs

Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-03-23 22:59:23 +03:00
Jonas Jensen
29c4c8c0b2 C#: Fixup to follow C++ changes 2020-03-23 20:39:43 +01:00
Jonas Jensen
999051d20e C++: QLDoc terminology: object -> mem allocation 2020-03-23 20:32:47 +01:00
Dave Bartolomeo
c5ac357bfc C++/C#: Fix bad overlap sanity failures
`Instruction.getDefinitionOverlap()` depends on `SSAConstruction::getMemoryOperandDefinition()`, which in turn depends on `SSAConstruction::hasMemoryOperandDefinition()`. When the definition in question came from a `Chi` instruction, `hasMemoryOperandDefinition()` incorrectly bound `overlap` to the overlap relationship between the original (non-`Chi`) instruction and the use. The fix is to make use of the `actualDefLocation` parameter to `getDefinitionOrChiInstruction()`, which specifies the location for the result of the `Chi` in that case.
2020-03-23 14:57:41 -04:00
Jonas Jensen
b0d3c9ee6b C++: Fix getExtentOverlap for entire allocation 2020-03-23 19:49:39 +01:00
Dave Bartolomeo
a2741da8e2 C++/C#: Add sanity test for invalid overlap from getDefinitionOverlap()
The result of `getDefinitionOverlap()` should never be `MayPartiallyOverlap`, because if that were the case, we should have inserted as `Chi` instruction and hooked the definition up to that instead.

There are quite a few existing failures.
2020-03-23 14:37:06 -04:00
Rasmus Wriedt Larsen
b567205579 Python: Model fabric v1.x command injection sinks 2020-03-23 17:49:56 +01:00
Rasmus Wriedt Larsen
a57eadaeb6 Python: Model fabric/invoke command injection sinks 2020-03-23 17:33:41 +01:00
Anders Schack-Mulligen
f29f0f418f Dataflow: Exclude flow param-param flow through with identical params. 2020-03-23 17:27:53 +01:00
semmle-qlci
e5590091a0 Merge pull request #3109 from max-schaefer/js/performance-fixes
Approved by asgerf
2020-03-23 16:08:07 +00:00
Rasmus Wriedt Larsen
d475bb998e Python: Add abstract class CommandSink
I'm going to add more in a sec, and listing *all* of them in CommandInjection.ql
started to be silly
2020-03-23 17:04:08 +01:00
Max Schaefer
55e7b22cdf JavaScript: Autoformat. 2020-03-23 14:37:04 +00:00
kyprizel
49e5a22cab Fixed code style for SockJS
also fixed appCreation, thanks to Erik Krogh.
2020-03-23 17:16:17 +03:00
Jonas Jensen
13465921a3 Merge pull request #3092 from dbartol/dbartol/VarArgIR2_ElectricBoogaloo
C++: Better IR for varargs
2020-03-23 14:13:54 +01:00
Erik Krogh Kristensen
833183c706 change note 2020-03-23 14:13:30 +01:00
Erik Krogh Kristensen
7bc7ffffd6 autoformat 2020-03-23 14:10:07 +01:00
Erik Krogh Kristensen
f1e0d37273 Update javascript/ql/test/library-tests/frameworks/Concepts/file-access.js
Co-Authored-By: Asger F <asgerf@github.com>
2020-03-23 14:02:22 +01:00
Max Schaefer
b13e6141a2 JavaScript: Inline promiseStep/4. 2020-03-23 12:01:52 +00:00
Asger F
6c2842bd49 Merge pull request #2919 from asger-semmle/js/property-barriers
JS: Make sanitizers no longer block taint inside an object
2020-03-23 11:43:18 +00:00
Rasmus Wriedt Larsen
dcfc9a8796 Python: TarSlip sanitizer: explain tests with not
It was a bit confusing what was meant before
2020-03-23 12:00:59 +01:00
Anders Schack-Mulligen
4bc0cb0d28 Java: Fixup FinalizeMethod definition. 2020-03-23 11:11:00 +01:00
Erik Krogh Kristensen
2c43d1d731 fix FP in superfluous-trailing-arguments related to Function.arguments 2020-03-23 10:40:35 +01:00
Luke Cartey
9eee16b2d6 Merge pull request #3091 from hvitved/csharp/xpath-injection-more-sinks
C#: Teach XPath injection query about `XPathNavigator`
2020-03-23 09:39:26 +00:00
semmle-qlci
2c7af72f14 Merge pull request #2858 from RasmusWL/python-support-django2
Approved by tausbn
2020-03-23 09:35:46 +00:00
Anders Schack-Mulligen
6d3717cff8 Java: Sharpen return type of LambdaExpr.getStmtBody(). 2020-03-23 10:27:36 +01:00
Anders Schack-Mulligen
c78906500d Java: Fix missing jump step from PostUpdate to capture. 2020-03-23 10:24:25 +01:00
Anders Schack-Mulligen
888c504f55 Merge pull request #2903 from hvitved/dataflow/performance
Data flow: Refactoring + performance improvements
2020-03-23 10:01:20 +01:00
Jonas Jensen
79d5b88e33 C++: Remove redundant case 2020-03-20 19:40:53 +01:00
Eldar T. Zaitov
ee0b65ad39 Added experimental SockJS support 2020-03-20 21:24:16 +03:00
Dave Bartolomeo
fb71f781a0 C++: Fix formatting 2020-03-20 14:23:58 -04:00
Robert Marsh
d529fedbad C++: accept extractor changes to IR 2020-03-20 11:00:54 -07:00
yo-h
16f2957029 Merge pull request #3081 from aschackmull/java/urldecoder-step
Java: Add URLDecoder.decode as taint step.
2020-03-20 13:53:20 -04:00
yo-h
bcda481d4a Merge pull request #3086 from aschackmull/java/apache-base64-taint
Java: Add apache Base64 taint steps.
2020-03-20 13:49:20 -04:00
Jonas Jensen
f6f9afe462 C++: Implement Instruction.isResultConflated
This predicate replaces `isChiForAllAliasedMemory`, which was always
intended to be temporary. A test is added to `IRSanity.qll` to verify
that the new predicate corresponds exactly with (a fixed version of) the
old one.

The implementation of the new predicate,
`Cached::hasConflatedMemoryResult` in `SSAConstruction.qll`, is faster
to compute than the old `isChiForAllAliasedMemory` because it uses
information that's readily available during SSA construction.
2020-03-20 17:57:18 +01:00
Dave Bartolomeo
82e2816915 C++: Fix handling of std::va_list that is used as a function parameter
In the Unix ABI, `std::va_list` is defined as `typedef struct __va_list_tag { ... } va_list[1];`, which means that any `std::va_list` used as a function parameter decays to `struct __va_list_tag*`. Handling this actually made the QL code slightly cleaner. The only tricky bit is that we have to determine what type to use as the actual `va_list` type when loading, storing, or modifying a `std::va_list`. To do this, we look at the type of the argument to the `va_*` macro. A detailed QLDoc comment explains the details.

I added a test case for passing a `va_list` as an argument, and then manipulating that `va_list` in the callee.
2020-03-20 12:53:09 -04:00
Geoffrey White
bb2ce6e5d9 C++: More missing override tags. 2020-03-20 16:23:15 +00:00
Taus Brock-Nannestad
a3bd46d4fe Python: Autoformat remaining .qll. 2020-03-20 16:43:10 +01:00
Taus Brock-Nannestad
6904898a8b Python: Autoformat query-local libs. 2020-03-20 16:42:46 +01:00
Taus Brock-Nannestad
9044ff6959 Python: Autoformat rest of semmle/python. 2020-03-20 16:42:22 +01:00
Taus Brock-Nannestad
810e91ea00 Python: Autoformat semmle/python top-level. 2020-03-20 16:41:45 +01:00
Taus Brock-Nannestad
f406a45ce0 Python: Autoformat web. 2020-03-20 16:38:27 +01:00
Taus Brock-Nannestad
5b121b7723 Python: Autoformat values. 2020-03-20 16:37:06 +01:00
Taus Brock-Nannestad
51f1cf020c Python: Autoformat security. 2020-03-20 16:36:48 +01:00
Taus Brock-Nannestad
4852bb7355 Python: Autoformat pointsto. 2020-03-20 16:36:25 +01:00
Taus Brock-Nannestad
d8b942f922 Python: Autoformat objects. 2020-03-20 16:36:07 +01:00
Taus Brock-Nannestad
165dcd37a1 Python: Autoformat library-tests. 2020-03-20 16:35:37 +01:00
Geoffrey White
ccf5e03fc8 C++: Autoformat. 2020-03-20 15:01:22 +00:00
Geoffrey White
9e117709bc C++: mustwrite = false. 2020-03-20 14:59:57 +00:00
Tom Hvitved
2d90e7daca Autoformat 2020-03-20 09:34:34 +01:00
Erik Krogh Kristensen
f88cc2a977 inline promiseStep predicate 2020-03-20 09:07:52 +01:00
Erik Krogh Kristensen
90a324148d add extra sinks to js/tainted-path 2020-03-20 09:07:39 +01:00
Dave Bartolomeo
bf284514fc C++: Better IR for varargs
This PR changes the IR we generate for functions that accept a variable argument list. Rather than simply using `BuiltInOperationInstruction` to model the various `va_*` macros as mysterious function-like operations, we now model them in more detail. The intent is to enable better alias analysis and taint flow through varargs.

The `va_start` macro now generates a unary `VarArgsStart` instruction that takes the address of the ellipsis pseudo-parameter as its operand, and returns a value of type `std::va_list`. This value is then stored into the actual `std::va_list` variable via a regular `Store`.

The `va_arg` macro now loads the `std::va_list` argument, then emits a `VarArg` instruction on the result. This returns the address of the vararg argument to be loaded. That address is later used as the address operand of a regular `Load` to return the value of the argument. To model the side effect of moving to the next argument, we emit a `NextVarArg` instruction that takes the previous `std::va_list` value and returns an updated one, which is then stored back into the `std::va_list` variable.

The `va_end` macro just emits a `VarArgsEnd` unary instruction that takes the address of the `std::va_list` argument and does nothing, since `va_end` doesn't really do anything on most compiler implementations anyway.

The `va_copy` macro is just modeled as a plain copy.
2020-03-19 19:23:33 -04:00
Mathias Vorreiter Pedersen
67cb8525bf Merge pull request #3082 from dbartol/dbartol/VarArgIR
C++: Model varargs in IR, Part I
2020-03-19 18:05:46 +01:00
Geoffrey White
88193dd389 C++: .expected change (desirable). 2020-03-19 13:32:17 +00:00
Dave Bartolomeo
74f61dc148 C++: Fix formatting 2020-03-19 09:18:32 -04:00
Tom Hvitved
fc74a482a4 C#: More XPath injection sinks 2020-03-19 14:13:35 +01:00
Geoffrey White
b444383ed1 C++: Add 'override' specifiers where I missed them. 2020-03-19 13:09:37 +00:00
Tom Hvitved
0d45700088 C#: Add change note 2020-03-19 13:41:22 +01:00
Tom Hvitved
4b3cf72c1c C#: Teach XPath injection query about XPathNavigator 2020-03-19 13:38:16 +01:00
Tom Hvitved
7f0181ccff C#: Add XPathNavigator test for cs/xml/xpath-injection 2020-03-19 13:37:03 +01:00
semmle-qlci
deb20fc37f Merge pull request #3076 from esbena/js/even-more-mongoose-improvements
Approved by erik-krogh
2020-03-19 12:03:53 +00:00
Max Schaefer
ee62706ad2 JavaScript: Split up a predicate to avoid bad join order. 2020-03-19 11:47:53 +00:00
Max Schaefer
d91e6a4893 JavaScript: Avoid a few bad join orders. 2020-03-19 11:47:53 +00:00
semmle-qlci
2821b01017 Merge pull request #2915 from tausbn/python-add-points-to-for-missing-builtin-return-types
Approved by RasmusWL
2020-03-19 11:02:46 +00:00
Asger Feldthaus
4f42675b35 JS: Autformat 2020-03-19 09:36:27 +00:00
Rasmus Wriedt Larsen
f4e5079dd3 Merge pull request #2991 from BekaValentine/python-objectapi-to-valueapi-unguardednextingenerator
Python: ObjectAPI to ValueAPI: UnguardedNextInGenerator
2020-03-19 10:33:32 +01:00
Asger Feldthaus
3ae33e3c1a JS: Update prototype pollution query 2020-03-18 23:59:25 +00:00
Asger Feldthaus
b6ca4fbee3 JS: Add getDefaultSourceLabel() 2020-03-18 23:52:25 +00:00
Rebecca Valentine
06f0947318 Update python/ql/src/Exceptions/UnguardedNextInGenerator.ql
Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-03-18 14:16:00 -07:00
Rebecca Valentine
9560c804b8 Update python/ql/test/query-tests/Exceptions/generators/test.py
Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-03-18 14:15:49 -07:00
Robert Marsh
59a81d8445 C++: merge from master and accept test changes 2020-03-18 13:47:01 -07:00
Robert Marsh
a30954599d Merge pull request #3085 from jbj/inStaticInitializer-AggregateLiteral
C++: Manual magic in inStaticInitializer
2020-03-18 13:23:04 -07:00
Dave Bartolomeo
30d2b865c6 C++: Fix formatting 2020-03-18 14:06:28 -04:00
Geoffrey White
f32e84b1d0 C++: Autoformat. 2020-03-18 17:24:46 +00:00
Tom Hvitved
937924571c Data flow: Sync files 2020-03-18 18:16:27 +01:00
Tom Hvitved
d0aaaad537 Address review comments 2020-03-18 18:16:11 +01:00
Geoffrey White
2e4e491ce8 Merge branch 'master' into sideeffect 2020-03-18 17:12:14 +00:00
Rasmus Wriedt Larsen
9a0b2b1843 Merge pull request #2989 from BekaValentine/python-objectapi-to-valueapi-incorrectexceptorder
Python: ObjectAPI to ValueAPI: IncorrectExceptOrder
2020-03-18 18:03:25 +01:00
Taus
ae1268f241 Merge branch 'master' into python-add-points-to-for-missing-builtin-return-types 2020-03-18 17:59:17 +01:00
Rasmus Wriedt Larsen
290e33a912 Merge pull request #2922 from tausbn/python-fix-multi-assign-points-to
Python: Fix bug in `multi_assignment_points_to`.
2020-03-18 17:50:37 +01:00
Rasmus Wriedt Larsen
b0303158a5 Merge pull request #3088 from tausbn/python-prepare-autoformatting
Python: Prepare for autoformatting.
2020-03-18 17:48:46 +01:00
Geoffrey White
6cc1c2341c C++: Add some SideEffect models. 2020-03-18 16:42:33 +00:00
Geoffrey White
935b8d96f8 C++: Offset .expected for cleaner diff. 2020-03-18 16:42:33 +00:00
Geoffrey White
0c9466640a C++: Add IR test for strcpy/strcat. 2020-03-18 16:42:25 +00:00
Dave Bartolomeo
0329327f9f C++: Move VarArgs utilities location 2020-03-18 11:24:44 -04:00
Dave Bartolomeo
fed1bce015 C++: Make vararg utilities internal for now. 2020-03-18 11:18:38 -04:00
Dave Bartolomeo
4fce20116e C++: Fix formatting 2020-03-18 09:53:01 -04:00
Dave Bartolomeo
26ea93af58 Merge remote-tracking branch 'upstream/master' into dbartol/VarArgIR 2020-03-18 09:52:21 -04:00
Jonas Jensen
a23077af11 C++: Comments for future maintainers 2020-03-18 14:11:37 +01:00
Taus Brock-Nannestad
57af7b84aa Python: Prepare for autoformatting.
Mostly fixes up a bunch of comments that were made wonky by the autoformatter.
2020-03-18 13:59:38 +01:00
Tom Hvitved
3bd6429072 Data flow: Sync files 2020-03-18 13:28:26 +01:00
Tom Hvitved
321b91209f Address review comments 2020-03-18 13:28:16 +01:00
Asger Feldthaus
7393844699 JS: Update some queries that used data as source 2020-03-18 11:55:13 +00:00
Asger Feldthaus
506ddaf3f4 JS: Add explanation for test failure 2020-03-18 11:55:13 +00:00
Asger Feldthaus
028022158d JS: Add variant of test that passes 2020-03-18 11:55:13 +00:00
Asger Feldthaus
a7e337ab28 JS: Add some lines in test case 2020-03-18 11:55:13 +00:00
Asger Feldthaus
3e68072e38 JS: Accept test case change 2020-03-18 11:55:13 +00:00
Asger Feldthaus
18eea96cf8 JS: Autoformat 2020-03-18 11:55:13 +00:00
Asger Feldthaus
a9901a44e8 JS: Update TaintBarriers/isBarrier test 2020-03-18 11:55:13 +00:00
Asger Feldthaus
de7fbce27b JS: Adjust whitespace in change notes 2020-03-18 11:55:13 +00:00
Asger Feldthaus
0edb765958 JS: Split test case function in two 2020-03-18 11:55:13 +00:00
Asger Feldthaus
4e75fe3977 JS: Update some qldoc comments 2020-03-18 11:55:13 +00:00
Asger Feldthaus
08ad4f785a JS: Tweak other parts of change note for consistency 2020-03-18 11:55:12 +00:00
Asger Feldthaus
ad2b150d05 JS: Add change note 2020-03-18 11:55:12 +00:00
Asger Feldthaus
a195429471 JS: Add test with non-guard sanitizer 2020-03-18 11:55:12 +00:00
Asger Feldthaus
83606e7b60 JS: Dont use data label in taint-tracking configs 2020-03-18 11:55:12 +00:00
Asger Feldthaus
8da0584b12 JS: Add test 2020-03-18 11:55:12 +00:00
Jonas Jensen
f1ad0dafdc Merge pull request #2849 from geoffw0/model-gets
C++: Model for gets
2020-03-18 11:06:23 +01:00
Anders Schack-Mulligen
396678fd55 Java: Add apache Base64 taint steps. 2020-03-18 10:54:40 +01:00
Esben Sparre Andreasen
b1a722fcda JS: typo fix 2020-03-18 10:11:38 +01:00
Esben Sparre Andreasen
12d8177b4b Update javascript/ql/src/semmle/javascript/frameworks/NoSQL.qll
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-03-18 10:12:05 +01:00
Esben Sparre Andreasen
ce3b196b93 Update javascript/ql/src/semmle/javascript/frameworks/NoSQL.qll
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-03-18 10:11:57 +01:00
Esben Sparre Andreasen
b9860d3444 Update javascript/ql/src/semmle/javascript/frameworks/NoSQL.qll
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-03-18 10:11:49 +01:00
Esben Sparre Andreasen
d74c16f86c Update javascript/ql/src/semmle/javascript/frameworks/NoSQL.qll
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-03-18 10:11:36 +01:00
Jonas Jensen
260bfe7b1d C++: Manual magic in inStaticInitializer
Since `runtimeExprInStaticInitializer` only looks at expressions at the
top level of an initializer or directly below some number of top-level
aggregate literals, there is no need for `inStaticInitializer` to
include expressions strictly below those in the AST.

I tested this on Wireshark, which has very large static initializers,
but found no measureable difference in run time. There are some
differences in tuple counts and iteration counts, though:

- `inStaticInitializer` changes from 6,241,153 rows (86 iterations) to
  5,031,617 rows (7 iterations).
- `runtimeExprInStaticInitializer` changes from 386,350 rows to 4,705
  rows.
- `hasDynamicInitialization` has 410 rows both before and after, which
  suggests that this change does not affect results.

Even though there is no impact on this snapshot at this time, things
might look different if/when the restriction on aggregate literals to
100 children is removed in the extractor.
2020-03-18 09:28:45 +01:00
Jonas Jensen
93c6f8f1f7 Merge pull request #3056 from dbartol/dbartol/static-locals
C++: Model dynamic initialization of static local variables in IR
2020-03-18 08:16:21 +01:00
Dave Bartolomeo
309ccf3daf C++: Factor out common code to avoid recursion 2020-03-17 18:44:29 -04:00
Dave Bartolomeo
772324fafa C++: Add comment with IR for dynamic init of static var 2020-03-17 18:44:00 -04:00
Dave Bartolomeo
709757f7f2 Merge remote-tracking branch 'upstream/master' into dbartol/static-locals 2020-03-17 18:35:13 -04:00
Taus
46567a5842 Merge pull request #3029 from BekaValentine/python-objectapi-to-valueapi-handles
Python: ObjectAPI to ValueAPI: Handles
2020-03-17 22:37:27 +01:00
Rebecca Valentine
f351916418 Merge branch 'master' into testmerge 2020-03-17 12:32:45 -07:00
Taus
ca26feefbf Merge pull request #2978 from BekaValentine/python-objectapi-to-valueapi-illegalexceptionhandlertype
Python: ObjectAPI to ValueAPI: IllegalExceptionHandlerType
2020-03-17 17:56:34 +01:00
Rebecca Valentine
a7a64952e2 Python: ObjectAPI.qll: Fixes docstring 2020-03-17 09:48:54 -07:00
Robert Marsh
84a74f406a Merge pull request #3002 from theopolis/cpp-linux-drop-privileges-outoforder
CPP: Add query for CWE-273 that detects out-of-order setuid
2020-03-17 09:10:51 -07:00
Robert Marsh
3a66b04e7a C#: add debug switch to IRConfiguration 2020-03-17 08:51:00 -07:00
Dave Bartolomeo
9cc3cda58e C++: Model varargs in IR, Part I
This change introduces a new synthesized `IRVariable` in every varargs function. This variable represents the entire set of arguments passed to the ellipsis by the caller. We give it an opaque type big enough hold all of the arguments passed by the largest vararg call in the database. It is treated just like any other parameter. It is initialized the same, it has indirect buffers, etc.

I had to introduce a couple new APIs to `Call` and `Function`. The QLDoc comments should explain these. I added tests for these new APIs as well.

The next step will be to change the IR generation for the `va_*` macros to manipulate the ellipsis parameter.
2020-03-17 11:11:48 -04:00
Tom Hvitved
2e8bd5ccba Data flow: Sync files 2020-03-17 15:16:12 +01:00
Tom Hvitved
0645940a5c Address review comments 2020-03-17 15:16:01 +01:00
semmle-qlci
8792d0d248 Merge pull request #3070 from erik-krogh/DataPerf
Approved by asgerf
2020-03-17 13:47:09 +00:00
semmle-qlci
fa08258c14 Merge pull request #3036 from erik-krogh/CustomTrack
Approved by asgerf
2020-03-17 13:44:51 +00:00
semmle-qlci
ea46873bfe Merge pull request #3065 from erik-krogh/PathSinks
Approved by esbena
2020-03-17 13:00:00 +00:00
Pavel Avgustinov
1472bf0c11 Merge pull request #3078 from jbj/contributing-supported-2
Docs: refactor guidelines for new queries
2020-03-17 12:46:28 +00:00
Erik Krogh Kristensen
9403026fff add change note 2020-03-17 11:48:02 +01:00
Erik Krogh Kristensen
1dfe9e9c2a changes based on review 2020-03-17 11:28:29 +01:00
Erik Krogh Kristensen
9a3176d3cc Apply suggestions from code review
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-03-17 11:26:35 +01:00
Esben Sparre Andreasen
380f66cb19 JS: rename Mongoose::CommonInterfase -> Mongoose::InvokeNode 2020-03-17 11:25:05 +01:00
Erik Krogh Kristensen
095d4d711a change import to an absolute import to fix warning 2020-03-17 11:21:46 +01:00
James Fletcher
55f9034712 Merge pull request #3080 from jf205/migration-tidy-links
CodeQL docs: tidy up a few links
2020-03-17 09:42:21 +00:00
James Fletcher
07e52d3b96 Merge pull request #3055 from jf205/codeql-migration-2162
CodeQL docs: update titles and small content changes (CodeQL queries)
2020-03-17 09:21:49 +00:00
Anders Schack-Mulligen
9c9e302a73 Java: Add URLDecoder.decode as taint step. 2020-03-17 10:19:02 +01:00
james
d615c58060 docs: tidy up a few links 2020-03-17 09:06:32 +00:00
Erik Krogh Kristensen
d7b69fcfea autoformat 2020-03-17 09:52:08 +01:00
Jonas Jensen
9899d46999 Docs: refactor guidelines for new queries 2020-03-17 08:24:03 +01:00
Robert Marsh
de2d23b432 C++/C#: autoformat 2020-03-16 17:25:53 -07:00
Rebecca Valentine
ff6e0ce35c Python: UnguardedNextInGenerator.ql: Excludes next with default value 2020-03-16 17:08:06 -07:00
Rebecca Valentine
68c455cd97 Python: IncorrectExceptOrder.ql: Autoformats w/ new QL indentation 2020-03-16 16:52:48 -07:00
Rebecca Valentine
c7a2925620 Python: Exceptions.qll: Clean up handleObject again 2020-03-16 14:52:51 -07:00
Rebecca Valentine
34ab4efeda Python: ObjectAPI.qll: getOrigin now returns a CFG 2020-03-16 14:52:23 -07:00
Rebecca Valentine
45e47b92a0 Python: IllegalExceptionHandlerType.ql: Autoformats 2020-03-16 14:48:05 -07:00
james
d35d440624 docs: address review comments 2020-03-16 21:39:17 +00:00
Esben Sparre Andreasen
7dc80664e6 Merge pull request #3045 from Semmle/esbena-patch-2
JS: loosen qldoc for `barrierGuardIsRelevant`
2020-03-16 22:28:22 +01:00
Esben Sparre Andreasen
b75486bb58 JS: refactor NoSQL::Mongoose. Introduce Mongoose::CommonInterface 2020-03-16 22:12:30 +01:00
Esben Sparre Andreasen
833d1b1ab0 JS: fixup mongoose test 2020-03-16 22:11:22 +01:00
Esben Sparre Andreasen
9d9926fdbf JS: model Mongoose Document for additional js/nosql-injection sinks 2020-03-16 22:11:22 +01:00
Esben Sparre Andreasen
55ab519fbe JS: add Mongoose Document tests 2020-03-16 22:11:22 +01:00
Esben Sparre Andreasen
dc27a8f52c JS: model mongoose Model on createConnection.<model/models> 2020-03-16 22:11:22 +01:00
Esben Sparre Andreasen
730396df12 JS: add Mongoose createConnection tests 2020-03-16 22:11:22 +01:00
Rebecca Valentine
5d55db116b Python: Exceptions.qll: Updates handledObject to use getOrigin 2020-03-16 11:24:55 -07:00
Rebecca Valentine
787b80f9ae Python: ObjectAPI.qll: Adds getOrigin predicate 2020-03-16 11:24:22 -07:00
Erik Krogh Kristensen
7145a57db3 refactor StepSummary into an internal .qll 2020-03-16 17:52:04 +01:00
Jonas Jensen
b7dc26e27d Merge pull request #3072 from geoffw0/gezero2
C++: Improvement to cpp/unsigned-comparison-zero
2020-03-16 17:00:38 +01:00
Geoffrey White
44c66a3b09 C++: Fixup test .expected files after merge. 2020-03-16 15:45:29 +00:00
Erik Krogh Kristensen
cd6fe8115d Update javascript/ql/src/semmle/javascript/Promises.qll
Co-Authored-By: Asger F <asgerf@github.com>
2020-03-16 16:27:50 +01:00
Geoffrey White
034f7cc948 Merge branch 'master' into model-gets 2020-03-16 15:12:36 +00:00
Calum Grant
945418869d Merge pull request #3022 from hvitved/csharp/autobuild/dotnet-clean-try
C#: Ignore `dotnet clean` exit code in autobuilder
2020-03-16 15:10:32 +00:00
Taus Brock-Nannestad
c724b17368 Python: Fix up regression comment. 2020-03-16 16:01:05 +01:00
Tom Hvitved
fb2b239db7 C#: Add test for cs/dereferenced-value-may-be-null 2020-03-16 15:38:29 +01:00
Geoffrey White
40db92bfd1 C++: Change note. 2020-03-16 13:22:00 +00:00
Geoffrey White
2cee756587 C++: Support the mirror case with <=. 2020-03-16 13:22:00 +00:00
Geoffrey White
3c96b09d47 C++: Behaviour preserving transform. 2020-03-16 13:22:00 +00:00
Geoffrey White
dcf2f7f19c C++: Add some test cases for the mirror case, with <=. 2020-03-16 13:22:00 +00:00
Geoffrey White
3d8633f701 C++: Additional test cases for the recursive bit of UnsignedGEZero. 2020-03-16 13:22:00 +00:00
Nick Rolfe
17c57dcb4c Merge pull request #2971 from matt-gretton-dann/codeql-c-extractor/40-spaceship
C++20 Add DB Support for the <=> operator
2020-03-16 12:07:58 +00:00
semmle-qlci
eb7d8092a6 Merge pull request #3064 from asger-semmle/js/typescript-semantic-errors
Approved by erik-krogh
2020-03-16 11:57:55 +00:00
Taus Brock-Nannestad
dda32abd6a Python: Fix test result for pruning test. 2020-03-16 12:55:12 +01:00
Taus Brock-Nannestad
5579dfb976 Python: Fix comment based on review. 2020-03-16 12:49:46 +01:00
Taus Brock-Nannestad
81f6877727 Python: Fix up tests. 2020-03-16 12:48:41 +01:00
james
42b6c116aa docs: open-source -> open source 2020-03-16 11:47:16 +00:00
james
b7f87225d9 docs: update links following titles changes 2020-03-16 11:47:16 +00:00
james
764303acb5 docs: rework 'CodeQL queries' landing page 2020-03-16 11:47:16 +00:00
james
ff07f3d3b7 docs: 'About CodeQL queries' content updates 2020-03-16 11:47:16 +00:00
james
6721495160 docs: retitle locations 2020-03-16 11:47:16 +00:00
james
8055e91a5c docs: update titles and intros (writing codeql queries) 2020-03-16 11:42:16 +00:00
Taus Brock-Nannestad
2d8f3bb033 Python: Use TUnknown instead of TUnknownInstance. 2020-03-16 11:34:54 +01:00
Erik Krogh Kristensen
f2548aa3b1 add more models for file related sinks and sources 2020-03-16 11:07:23 +01:00
Erik Krogh Kristensen
557b642a8e add isRelevant check on flowStep predicate 2020-03-16 11:01:20 +01:00
Matthew Gretton-Dann
3465c96c12 C++: Update DB Stats 2020-03-16 09:58:02 +00:00
Matthew Gretton-Dann
b325bce4c6 C++: Add upgrade script 2020-03-16 09:58:02 +00:00
Matthew Gretton-Dann
06accfe72b C++: Add support for the spaceship operator 2020-03-16 09:58:02 +00:00
Matthew Gretton-Dann
c5b3df1eb2 C++: Update expression precedences
The spaceship (<=>) operator adds a new row to the C++ precendence
table.  In preparation for that shift the necessary precedences up one
to create a suitable hole.

Note: In investigations I belive precedence 14 was not used.  However,
in order to make review easier I have kept that gap.
2020-03-16 09:54:59 +00:00
Jonas Jensen
5b20133415 Merge pull request #3067 from theopolis/cpp-additional-commandexec-apis
Add execve to CommandExecution
2020-03-16 10:33:20 +01:00
Ted Reed
429b07a95d Add execve to CommandExecution 2020-03-15 20:35:46 -04:00
semmle-qlci
1d4dd2b2f7 Merge pull request #3057 from esbena/js/infer-this-as-exports
Approved by asgerf
2020-03-15 12:55:12 +00:00
Asger Feldthaus
b2f008ea9e JS: Dont report TypeScript diagnostics by default 2020-03-15 12:06:08 +00:00
semmle-qlci
7e093a8e5c Merge pull request #3041 from erik-krogh/JQueryAjax
Approved by esbena
2020-03-14 22:31:59 +00:00
semmle-qlci
ff03478ae8 Merge pull request #3049 from asger-semmle/js/fix-cyclic-join
Approved by erik-krogh
2020-03-14 16:19:25 +00:00
Erik Krogh Kristensen
486efbab77 refactor based on review 2020-03-14 14:53:38 +01:00
Erik Krogh Kristensen
4f39c28741 Merge branch 'master' of git.semmle.com:Semmle/ql into CustomTrack 2020-03-14 14:37:52 +01:00
semmle-qlci
20cae302fd Merge pull request #3054 from erik-krogh/NoDeferred
Approved by asgerf
2020-03-14 13:36:16 +00:00
Esben Sparre Andreasen
4d6aa20990 Merge pull request #3004 from esbena/js/additional-mongodb-and-mongoose-injection-sinks
JS: Mongoose and MongoDB improvements
2020-03-14 12:31:43 +01:00
Robert Marsh
e9459992a1 Merge pull request #3061 from MathiasVP/fix-constant-comparison
C++: Fix getValue in SimpleRangeAnalysis
2020-03-13 11:13:22 -07:00
Geoffrey White
cecbdae3e1 C++: Change note. 2020-03-13 17:58:31 +00:00
Mathias Vorreiter Pedersen
09984a4068 C++: The extractor already provides the getValue result when the variable is a local variable. Thus we can simplify the QL code. 2020-03-13 17:57:01 +01:00
Mathias Vorreiter Pedersen
e1942bbee1 C++: Fix false positives 2020-03-13 17:09:57 +01:00
Mathias Vorreiter Pedersen
cc25298f67 C++: Demonstrate false positives when a const variable is initialized in a parameter list 2020-03-13 17:00:54 +01:00
Felicity Chapman
8b8104a338 Merge pull request #3059 from felicitymay/2166-part-2-python
Update link text for remaining links to Python topics
2020-03-13 15:40:24 +00:00
Esben Sparre Andreasen
2fac7434df JS: infer this to be module.exports in node modules 2020-03-13 14:10:35 +01:00
Esben Sparre Andreasen
ae8d38236b JS: add some tests for this 2020-03-13 14:09:23 +01:00
Tom Hvitved
f935f5eaca Data flow: Sync files 2020-03-13 13:58:05 +01:00
Tom Hvitved
17e904f0f6 Data flow: Refactoring + performance improvements
- Introduce `ReadTaintNode` and `TaintStoreNode` to simplify logic for taint
  getters and taint setters, respectively.
- `nodeCandFwd2`: Restrict `stored` column after a read, based on what it might
  be before a store of the same field.
- `nodeCand2`: Restrict `read` column (renamed from `stored`) after a store, based
  on what it might be after a read of the same field.
- Move big step predicates into a `LocalFlowBigStep` module.
- Define predicates by dispatch in `AccessPath[Front]` class.
- `flowCandFwd0`: Restrict `apf` column after a read, as it should be able to match
  a Boolean `read` column from `nodeCand2`.
- `flowFwd0`: Restrict columns `ap` and `apf` after a read, by introducing a
  `flowConsCandFwd` predicate (similar to what is done in the previous pruning steps).
- `flowFwd0`: Restrict columns `ap` and `apf` after a store, by introducing a
  `flowConsCand` predicate (similar to what is done in the previous pruning steps).
2020-03-13 13:58:05 +01:00
Anders Schack-Mulligen
9fc75f1f92 Merge pull request #2850 from SpaceWhite/CWE-094
ScriptEngine java code injection
2020-03-13 13:43:09 +01:00
Anders Schack-Mulligen
2a2484ee0f Merge pull request #2800 from SpaceWhite/CWE-643
CWE-643 XPathInjection on java
2020-03-13 13:40:17 +01:00
Dave Bartolomeo
11ab2d6848 C++: Fix formatting 2020-03-13 08:21:25 -04:00
semmle-qlci
25b9fcfafd Merge pull request #3058 from asger-semmle/js/may-receive-argument-fix
Approved by max-schaefer
2020-03-13 11:49:49 +00:00
Felicity Chapman
d7f37056a6 Merge pull request #3042 from felicitymay/merge-123-master-2
Merge rc/1.23 into master
2020-03-13 11:18:43 +00:00
Dave Bartolomeo
9922958bf1 C++: Fix failed tests
Added a new `StaticLocalVariable` class, which made several other pieces of the original change a bit cleaner.

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

Added a test case for static local variables with constructors.

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

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

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

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

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

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

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

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

For unused imports, we were getting a result for `typing.py` when run under
Python 3.7.3. To prevent this import from being considered, I've set the maximum
import depth to `0`.
2020-03-12 18:19:53 +01:00
Felicity Chapman
8c931bfc66 Remove information about COBOL analysis 2020-03-12 16:37:29 +00:00
Asger Feldthaus
2bdf26a8f1 JS: Remove unneeded forwarding method 2020-03-12 15:48:47 +00:00
Asger Feldthaus
788c0f9037 JS: Refactor metadata class a bit 2020-03-12 15:45:22 +00:00
Geoffrey White
f4a1b41094 C++: Correct hasUpperBoundsCheck. 2020-03-12 15:45:01 +00:00
Geoffrey White
26ed560bd7 C++: Add new test cases. 2020-03-12 15:45:01 +00:00
Geoffrey White
263e51f72e C++: Clean up the test. 2020-03-12 15:45:00 +00:00
Erik Krogh Kristensen
799c3eb06c remove model of Deferred 2020-03-12 16:38:20 +01:00
Asger Feldthaus
ddab13ab44 JS: Add a comment 2020-03-12 15:29:51 +00:00
Anders Schack-Mulligen
99c55b6edb Java: Add taint steps for java.util.Queue methods. 2020-03-12 15:02:06 +01:00
Taus
099997088a Merge pull request #3005 from RasmusWL/python-modernise-string-taint
Python: Modernise StringKind files
2020-03-12 15:01:18 +01:00
Erik Krogh Kristensen
59d2d6d4fd autoformat 2020-03-12 14:48:16 +01:00
Asger Feldthaus
4391b70b5f JS: Fix perf issue in mayReceiveArgument 2020-03-12 13:45:34 +00:00
Jonas Jensen
917b984909 Merge pull request #3050 from geoffw0/mismatching_placement_new
C++: Fix mismatching new/free FP in template code.
2020-03-12 12:42:29 +01:00
SpaceWhite
300aee39be nit: add dot to qhelp 2020-03-12 20:38:03 +09:00
SpaceWhite
bb1ea94c54 Nit: Fix qhelp and ql autoformat 2020-03-12 20:35:01 +09:00
SpaceWhite
822bfcd36c Nit: fix qhelp 2020-03-12 20:25:23 +09:00
Taus Brock-Nannestad
4b5a20d21b Merge branch 'master' into python-add-points-to-for-missing-builtin-return-types 2020-03-12 11:31:29 +01:00
Erik Krogh Kristensen
172c5ccaca changes based on review 2020-03-12 11:04:33 +01:00
Erik Krogh Kristensen
91bc124f78 autoformat 2020-03-12 10:45:25 +01:00
semmle-qlci
4355f8d2b4 Merge pull request #3023 from erik-krogh/RedundantUpdate
Approved by esbena
2020-03-12 09:34:53 +00:00
Pavel Avgustinov
ecded4c11c Merge pull request #3048 from jbj/desemmlify
Docs: Remove some Semmle references
2020-03-12 09:27:36 +00:00
Robert Marsh
cc99ddfd2c C++/C#: resync 2020-03-11 12:41:26 -07:00
Ted Reed
07605f5161 Formatting and use lower case string matching 2020-03-11 15:00:58 -04:00
Robert Marsh
1878d04852 C++/C#: sync files and update imports 2020-03-11 11:49:11 -07:00
Robert Marsh
0c43a16ac8 C++: restrict dump str generation in aliased_ssa 2020-03-11 11:45:32 -07:00
Geoffrey White
f84c94b5fb C++: Change note. 2020-03-11 18:11:51 +00:00
Geoffrey White
b2c5ce8dbd C++: Exclude code in templates. 2020-03-11 18:11:45 +00:00
Geoffrey White
d454c8457d C++: Test case. 2020-03-11 18:09:09 +00:00
Rasmus Wriedt Larsen
e52fec03f8 Python: Fix code formatting 2020-03-11 18:16:55 +01:00
Shati Patel
80de75515e Merge pull request #3043 from shati-patel/2173-tutorials
CodeQL docs migration prep: Update QL tutorials
2020-03-11 17:07:35 +00:00
Felicity Chapman
02bec9f1e8 Update link text for remaining links to Python topics 2020-03-11 16:13:47 +00:00
Asger Feldthaus
1a1b7d4ee0 JS: Switch to whitelisting allowed properties 2020-03-11 16:09:14 +00:00
Erik Krogh Kristensen
2c18144560 change note 2020-03-11 17:01:41 +01:00
Erik Krogh Kristensen
d32d14f572 model responseText and responseXml on jqXHR objects 2020-03-11 17:00:44 +01:00
Rebecca Valentine
f80e206d33 Merge pull request #3008 from RasmusWL/python-modernise-security-files
Python: modernise remaining security files
2020-03-11 08:56:19 -07:00
Shati Patel
92d82a9dd1 Updates intros 2020-03-11 15:44:39 +00:00
Erik Krogh Kristensen
26d8e33434 Autoformat 2020-03-11 16:42:48 +01:00
Shati Patel
59691a1c6f Apply suggestions from code review
Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-03-11 15:33:54 +00:00
James Fletcher
554981e787 Merge pull request #2869 from jf205/codeql-migration-2163
CodeQL docs: update titles, add intros, and a few content updates
2020-03-11 14:29:56 +00:00
Jonas Jensen
86ad4d0357 Docs: Remove some Semmle references
The only Semmle references now left in the public Markdown files are in
URLs and in legal text. There are also two Semmle references left in
`docs/language/vale-styles/README.md` because I didn't understand them
well enough to change them.
2020-03-11 15:20:15 +01:00
Rasmus Wriedt Larsen
6d72e77cdf Python: Django: Handle Class-based views 2020-03-11 14:44:14 +01:00
Erik Krogh Kristensen
dd261c51f7 add change note 2020-03-11 14:42:57 +01:00
Erik Krogh Kristensen
e88dac3dea remove FP for js/redundant-operation 2020-03-11 14:42:32 +01:00
yo-h
38581663a4 Merge pull request #3047 from aschackmull/java/typeflow-testcase
Java: Add test case to typeflow qltest.
2020-03-11 09:25:36 -04:00
Asger Feldthaus
6645df93ad JS: Blacklist another cyclic property 2020-03-11 13:09:37 +00:00
semmle-qlci
1d5fba85f9 Merge pull request #3034 from esbena/js/sharpen-useless-regexp-character-escape
Approved by asgerf
2020-03-11 12:29:45 +00:00
Ian Lynagh
9265540704 Merge pull request #2911 from matt-gretton-dann/ql-docs/update-supported-languages
QL docs: update supported C/C++ language versions
2020-03-11 12:14:14 +00:00
Anders Schack-Mulligen
e1a0c2d846 Java: Add minor test case to typeflow qltest. 2020-03-11 13:13:19 +01:00
Erik Krogh Kristensen
cb5ef7dbed add basic support for jqXHR with ajax calls 2020-03-11 13:05:41 +01:00
Rasmus Wriedt Larsen
b760b1f1f2 Python: Django: Don't require viewFunction to mark as route
It's very nice to be able to see all the DjangoRoutes even if we don't know the
function that is used to handle the request, at least for debugging.
2020-03-11 12:37:18 +01:00
Alistair
d383c5973e Merge pull request #3046 from hubwriter/remove-gh-variable
docs: Remove GitHub variable
2020-03-11 11:29:19 +00:00
Alistair Christie
d6b666cf8f docs: Remove GitHub variable 2020-03-11 11:03:18 +00:00
Rasmus Wriedt Larsen
2da1503942 Merge branch 'master' into python-support-django2 2020-03-11 11:21:47 +01:00
Erik Krogh Kristensen
b987f2cf29 autoformat 2020-03-11 10:54:20 +01:00
Rasmus Wriedt Larsen
f5a8084a33 Merge pull request #2827 from BekaValentine/objectapi-to-valueapi-expectedmappingforformatstring
Python: ObjectAPI to ValueAPI: ExpectedMappingForFormatString
2020-03-11 10:52:48 +01:00
Rasmus Wriedt Larsen
47cd9c8956 Merge pull request #3038 from BekaValentine/python-objectapi-to-valueapi-deprecatedslicemethod
Python: ObjectAPI to ValueAPI: DeprecatedSliceMethod
2020-03-11 10:51:01 +01:00
Anders Schack-Mulligen
85d6b7c2ed C++: Add tests. 2020-03-11 10:49:21 +01:00
Erik Krogh Kristensen
7f147221f5 refactor to include promise tracking as a core part of type tracking 2020-03-11 10:44:11 +01:00
Anders Schack-Mulligen
a9d76cbe64 Dataflow: Add consistency checks for toString and location. 2020-03-11 10:29:48 +01:00
Mathias Vorreiter Pedersen
f4e8f7a1cc Merge pull request #2970 from jbj/multiple-types-test
C++: Tests for variables with ambiguous types
2020-03-11 09:53:59 +01:00
Erik Krogh Kristensen
fa26ce9f4b update expected output 2020-03-11 09:36:12 +01:00
Esben Sparre Andreasen
4dac835bb0 JS: loosen qldoc for barrierGuardIsRelevant 2020-03-11 07:54:38 +01:00
Shati Patel
327486dc58 Update title and intro for river crossing puzzle 2020-03-11 02:35:21 +00:00
Shati Patel
52ffd91a26 Move "River crossing puzzle" into tutorial folder
- Update links
- Delete "QL etudes" folder
2020-03-11 02:25:56 +00:00
Shati Patel
30e41dd4da Update references to QL tutorials 2020-03-11 02:14:39 +00:00
Shati Patel
8c5580fe5b Reorganize map topic 2020-03-11 02:13:51 +00:00
Shati Patel
fe71cc79ba Add intro to third tutorial 2020-03-11 01:53:47 +00:00
Shati Patel
fdfa2e1aeb Rename third detective tutorial 2020-03-11 01:49:28 +00:00
Shati Patel
570e726ab5 Add intro to second tutorial 2020-03-11 01:46:40 +00:00
Shati Patel
992c61a0a3 Combine and rename second detective tutorial 2020-03-11 01:46:28 +00:00
Shati Patel
d0d34d6762 Add intro to first tutorial 2020-03-11 01:46:28 +00:00
Shati Patel
43347d006c Combine and rename first detective tutorial 2020-03-11 01:46:22 +00:00
Ted Reed
107662fc67 Move Security/CWE/CWE-273 into experimental 2020-03-10 18:58:43 -04:00
Dave Bartolomeo
66fd566b66 Merge pull request #3006 from jbj/ir-no-static-init
C++: IR: Ignore constant static initializers
2020-03-10 15:46:56 -04:00
Alistair
44b9773ace Merge pull request #2866 from hubwriter/alistairs-docs-preparation-1
CodeQL migration: Java topics - change titles & add intros (2164)
2020-03-10 19:23:09 +00:00
Robert Marsh
ba8ebe9f3a C++: accept test changes 2020-03-10 11:41:59 -07:00
Robert Marsh
bba6b23019 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-03-10 11:12:19 -07:00
Dave Bartolomeo
ef194d3332 C++: Accept test output 2020-03-10 13:49:20 -04:00
Felicity Chapman
a567dba109 Merge pull request #2823 from felicitymay/2166-python-pre-migration-tasks
CodeQL: Python topics (2166) - WIP
2020-03-10 17:14:43 +00:00
Felicity Chapman
f1238f1ec9 Update docs/language/learn-ql/python/introduce-libraries-python.rst 2020-03-10 17:11:59 +00:00
Felicity Chapman
9a30df3a6d Merge branch 'rc/1.23' into merge-123-master-2 2020-03-10 17:03:53 +00:00
Erik Krogh Kristensen
13e855910e add more ClientRequest models for JQuery 2020-03-10 17:21:22 +01:00
Jonas Jensen
bf43475ff7 C++: Unroll recursion in inStaticInitializer
This gets rid of some slow recursive magic.

On Wireshark, this improves the timing of the involved predicates from

    m#Variable::runtimeExprInStaticInitializer#b ..................... 3.1s (executed 86 times)
    Variable::runtimeExprInStaticInitializer#b#antijoin_rhs .......... 1.6s
    Variable::runtimeExprInStaticInitializer#b ....................... 985ms (executed 6 times)
    Variable::runtimeExprInStaticInitializer#b#loop_invariant_prefix . 845ms
    #Expr::Expr::getParent_dispred#fbPlus ............................ 3.6s (executed 86 times)
    #Expr::Expr::getParent_dispred#fbPlus_10#join_rhs ................ 988ms

to

    Variable::runtimeExprInStaticInitializer#f#antijoin_rhs . 1.8s
    Variable::runtimeExprInStaticInitializer#f .............. 1.1s (executed 6 times)
    Variable::inStaticInitializer#f ......................... 3.2s (executed 86 times)
2020-03-10 17:07:44 +01:00
Jonas Jensen
5e01b4b858 C++: Share the constant initializer detection
Since this code is shared between the AST CFG and the IR construction,
it seems right to have only one copy. That copy lives on a new class
`StaticStorageDurationVariable`, which may prove useful on its own.
2020-03-10 17:05:22 +01:00
Rebecca Valentine
160f6cbc15 Python: Adds preliminary modernization 2020-03-10 08:51:20 -07:00
Taus
11b5c54a0e Merge pull request #2820 from RasmusWL/python-modernise-statements
Python: modernise Statements/ queries
2020-03-10 16:46:50 +01:00
semmle-qlci
e3fed39f88 Merge pull request #3000 from asger-semmle/js/late-barrier-guards
Approved by erik-krogh
2020-03-10 15:38:35 +00:00
Rebecca Valentine
b36214ae47 Python: Modernizes query and updates expecteds 2020-03-10 08:33:29 -07:00
James Fletcher
5a7a3f7dcb Merge pull request #3035 from jf205/merge-master-docs-preparation
Merge `master` into `docs-preparation`
2020-03-10 15:24:18 +00:00
Felicity Chapman
1a992ba9ed Merge pull request #3037 from felicitymay/1.23/2209-update-links
Replace remaining links to semmle.com in 'docs' directory
2020-03-10 15:22:48 +00:00
Rebecca Valentine
6017197870 Python: Autoformats 2020-03-10 08:08:05 -07:00
Rebecca Valentine
4eb3de2aca Merge branch 'master' into python-objectapi-to-valueapi-signatureoverriddenmethod 2020-03-10 08:06:45 -07:00
semmle-qlci
4c1d76ee9a Merge pull request #2937 from BekaValentine/python-objectapi-to-valueapi-wrongnumberargumentsforformat
Approved by tausbn
2020-03-10 15:04:05 +00:00
Rebecca Valentine
c670f8180f Python: Autoformats 2020-03-10 07:57:55 -07:00
Rebecca Valentine
909e064016 Merge branch 'objectapi-to-valueapi-expectedmappingforformatstring' of github.com:BekaValentine/ql into objectapi-to-valueapi-expectedmappingforformatstring 2020-03-10 07:54:56 -07:00
Rebecca Valentine
1234cb6e0f Python: Incorporates updates from new master 2020-03-10 07:54:28 -07:00
Rebecca Valentine
b7bcf6c3d0 Merge branch 'master' into objectapi-to-valueapi-expectedmappingforformatstring 2020-03-10 07:51:48 -07:00
Rebecca Valentine
c690e2595c Merge pull request #3007 from RasmusWL/python-remove-use-of-deprecated-getvalue
Python: Remove usage of deprecated .getValue()
2020-03-10 07:18:41 -07:00
Taus
ea5aa57151 Merge pull request #3031 from BekaValentine/python-objectapi-to-valueapi-signaturespecialmethods
Python: ObjectAPI to ValueAPI: SignatureSpecialMethods
2020-03-10 14:54:39 +01:00
Rasmus Wriedt Larsen
b1d1974a0f Merge branch 'master' into python-modernise-statements 2020-03-10 14:53:44 +01:00
Taus
dd0ce1c607 Merge pull request #2942 from RasmusWL/pyhton-improve-regex-docs
Python: Add a bit of regex docs
2020-03-10 14:49:31 +01:00
Rasmus Wriedt Larsen
2382b42bbe Python: Rewrite helper predicate has_string_type 2020-03-10 14:47:49 +01:00
Rasmus Wriedt Larsen
f3a10a12a1 Python: Fix typo
Co-Authored-By: Taus <tausbn@gmail.com>
2020-03-10 14:45:33 +01:00
Felicity Chapman
48dcf12760 Replace remaining links to semmle.com in 'docs' directory 2020-03-10 13:22:35 +00:00
Tom Hvitved
bd6c23d165 Merge pull request #3020 from aschackmull/dataflow/type-pruning-bigstep
Dataflow: Fix bug in type pruning.
2020-03-10 14:21:21 +01:00
Erik Krogh Kristensen
62ae484545 autoformat and update expected output 2020-03-10 14:01:40 +01:00
Rasmus Wriedt Larsen
5439059b0d Python: Minor cleanup in regex.qll 2020-03-10 14:00:30 +01:00
semmle-qlci
570f095ae3 Merge pull request #2998 from asger-semmle/js/typescript-memory
Approved by erik-krogh
2020-03-10 12:24:52 +00:00
Felicity Chapman
7d0911d20f Merge pull request #3033 from felicitymay/merge-123-master
Merge rc/1.23 back into master
2020-03-10 12:22:47 +00:00
Esben Sparre Andreasen
5c8800a1c7 JS: make autoformatter happy 2020-03-10 13:11:31 +01:00
james
f9cfa0cb25 Merge branch 'master' into merge-master-docs-preparation 2020-03-10 11:53:38 +00:00
James Fletcher
b1a24705ad Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-03-10 11:39:41 +00:00
Erik Krogh Kristensen
066568ea60 add promise tracking to Files.qll 2020-03-10 12:36:42 +01:00
Erik Krogh Kristensen
a24bc564a4 add extra tests for file-name with promises 2020-03-10 12:35:34 +01:00
Erik Krogh Kristensen
97f2760583 refactor Files.qll to use type-tracking (without tracking anything) 2020-03-10 12:34:20 +01:00
Erik Krogh Kristensen
6110f85748 refactor chrome-remote-interface to use type-tracking promise steps 2020-03-10 12:27:21 +01:00
Esben Sparre Andreasen
5b1b945c35 JS: distinguishes escapes in strings and regular expression literals 2020-03-10 12:26:20 +01:00
Erik Krogh Kristensen
3ddfd7ba73 add extra promise test for chrome-remote-interface 2020-03-10 12:24:16 +01:00
Erik Krogh Kristensen
69d8cf643d add type tracking predicates for promises 2020-03-10 12:23:23 +01:00
Taus
e3160f966f Merge pull request #2932 from RasmusWL/python-re.compile-missing-points-to
Python: Add example of re.compile missing points-to
2020-03-10 11:55:23 +01:00
Anders Schack-Mulligen
e97c72cd5d Dataflow: Adjust imports. 2020-03-10 11:34:09 +01:00
Jonas Jensen
28a9baba36 Merge pull request #3026 from MathiasVP/simplerangeanalysis-const-var-access
C++: Handle constant variable accesses in SimpleRangeAnalysis.qll
2020-03-10 11:22:33 +01:00
Anders Schack-Mulligen
fc87f1eb1b C#: Fix tests. 2020-03-10 10:54:48 +01:00
Rasmus Wriedt Larsen
5e62f54094 Merge pull request #3030 from BekaValentine/python-objectapi-to-valueapi-useimplicitnonereturnvalue
Python: ObjectAPI to ValueAPI: UseImplicitNoneReturnValue
2020-03-10 10:38:06 +01:00
Rasmus Wriedt Larsen
1b8154c139 Merge pull request #2925 from BekaValentine/python-objectapi-to-valueapi-callargs
Python: ObjectAPI to ValueAPI: CallArgs
2020-03-10 10:26:21 +01:00
Esben Sparre Andreasen
3bfda6cd38 JS: refactoring: make separate modules for mongoose Model and Query 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
480be06d86 JS: replace Model class with opaque type tracking predicate 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
dbeb216af0 JS: make use of TypeScript types for mongoose Model and Query 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
0c46e4d1af JS: fixup typetracking usage: t2 -> t2.continue() 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
aae92ad795 JS: add test for DatabaseAccess 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
6b9bd8bd97 JS: adjust tests slightly to also support DatabaseAccess testing 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
7a2faa0b6b JS: add additional mongoose and mongodb js/nosql-injection sinks 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
b6c616efd3 JS: support optional options argument to MongoClient.connect 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
f24f03e1f8 JS: add mongodb .connect tests 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
e61f522f30 JS: bump change notes for mongodb 2020-03-10 09:57:45 +01:00
Esben Sparre Andreasen
21e6e69f22 JS: support mongodb v3 (minimally)
https://github.com/github/codeql-javascript-team/issues/79
2020-03-10 09:57:45 +01:00
Mathias Vorreiter Pedersen
8b467eb9a7 C++: Allow multiple results in getValue 2020-03-10 09:50:28 +01:00
Felicity Chapman
d54a9c9630 Merge branch 'rc/1.23' into merge-123-master 2020-03-10 08:45:22 +00:00
Rebecca Valentine
7ce905a310 Python: Adds preliminary modernization 2020-03-09 19:29:47 -07:00
Rebecca Valentine
bbeefd5747 Python: Modernizes query 2020-03-09 19:21:31 -07:00
Rebecca Valentine
047c328c58 Update python/ql/src/semmle/python/objects/ObjectAPI.qll
Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-03-09 19:20:08 -07:00
Rebecca Valentine
e8708a083f Python: Modernizes query and expecteds 2020-03-09 19:13:54 -07:00
Rebecca Valentine
48e67bca51 Python: Modernizes query 2020-03-09 18:57:42 -07:00
Rebecca Valentine
810efc5ca2 Python: Adds Rasmus's suggestion
Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-03-09 16:21:34 -07:00
Rebecca Valentine
f4f8c6e1e5 Python: Swaps out element_from_tuple 2020-03-09 16:20:22 -07:00
Taus
be09c17367 Merge pull request #2990 from BekaValentine/python-objectapi-to-valueapi-raisingtuple
Python: ObjectAPI to ValueAPI: RaisingTuple
2020-03-10 00:16:12 +01:00
Taus
96e99f55ad Merge pull request #2976 from BekaValentine/python-objectapi-to-valueapi-emptyexcept
Python: ObjectAPI to ValueAPI: EmptyExcept
2020-03-09 23:56:27 +01:00
Taus
b51e2a9e80 Merge pull request #2977 from BekaValentine/python-objectapi-to-valueapi-catchingbaseexception
Python: ObjectAPI to ValueAPI: CatchingBaseException
2020-03-09 22:54:50 +01:00
Mathias Vorreiter Pedersen
1a5282ae21 C++: Add testcase that previously resulted in a false positive 2020-03-09 22:33:59 +01:00
Mathias Vorreiter Pedersen
525a00098e C++: Address review comments 2020-03-09 22:16:05 +01:00
Dave Bartolomeo
9fae2faaeb Merge pull request #2994 from jbj/IRSanity-separate-file
C++: Move InstructionSanity out of Instruction.qll
2020-03-09 16:34:36 -04:00
Rebecca Valentine
c9c469b201 Python: Modernizes queries 2020-03-09 12:52:33 -07:00
Rebecca Valentine
6a1203a60f Python: Adds modernized predicates 2020-03-09 12:52:15 -07:00
Rebecca Valentine
6636f72e07 Python: Moves more predicates over to suffixed form 2020-03-09 11:59:44 -07:00
Rebecca Valentine
6d10c47cba Python: Moves predicates over to suffixed form 2020-03-09 11:56:57 -07:00
Erik Krogh Kristensen
ad52d6446e add test case for tuple-like use 2020-03-09 19:47:05 +01:00
Rebecca Valentine
bf92cee1b1 Python: Updates expected results 2020-03-09 11:16:58 -07:00
Erik Krogh Kristensen
981eef2587 expose arrayFunctionTaintStep in TaintTracking.qll 2020-03-09 17:22:29 +01:00
Erik Krogh Kristensen
509941649c remove redundant qldoc, and change parameter names to better reflect behavior 2020-03-09 17:20:12 +01:00
Erik Krogh Kristensen
a476fc5c3b revert Array.from change 2020-03-09 17:09:31 +01:00
Rasmus Wriedt Larsen
a38fd2d3d1 Python: Use unambiguous name getCallNode 2020-03-09 17:05:00 +01:00
Rasmus Wriedt Larsen
a9674ef6e8 Python: Resolve autoformat ugliness 2020-03-09 16:54:55 +01:00
Erik Krogh Kristensen
68ffd52d4c update expected output 2020-03-09 16:45:10 +01:00
Erik Krogh Kristensen
b4b05696e1 two bugfixes 2020-03-09 16:45:03 +01:00
semmle-qlci
155985c77d Merge pull request #3024 from max-schaefer/js/move-portals-to-experimental
Approved by asgerf
2020-03-09 15:39:36 +00:00
Rasmus Wriedt Larsen
31cfb1689c Python: Fix minor bug in modernisation-rewrite
Obviously the result module shouldn't be a package 🤦 I was confusing
myself, since I wanted to say that `Module::named("Crypto.Cipher")` should be a package :D
2020-03-09 15:49:08 +01:00
Mathias Vorreiter Pedersen
6dee7061a0 C++: Handle constant variable accesses in SimpleRangeAnalysis.qll 2020-03-09 15:44:32 +01:00
Rasmus Wriedt Larsen
0ce8e9180b Python: Remove code that adds taint to unrelated ControlFlowNode
The problem with the deleted code is that it would add flow to what might be an
unrelated ControlFlowNode, which is illustrated in the query below (that gives
results on flask)

from ControlFlowNode arg, CallNode call, CallNode other_call
where
    call.getNode().getAKeyword().getValue() = arg.getNode() and
    not call.getAnArg() = arg and
    other_call.getAnArg() = arg and
    not other_call = call
select call, arg, other_call
2020-03-09 15:27:31 +01:00
Rasmus Wriedt Larsen
cac5d00ca2 Python: Fix string taint tests
The tests in ql/python/ql/test/library-tests/taint/strings/ shows that
ClassValue::str() is not good enough.
2020-03-09 15:10:48 +01:00
Tom Hvitved
6a10516c1e Merge pull request #3021 from aschackmull/dataflow/partial-path-perf
Java/C++/C#: Fix performance issue in partial paths exploration.
2020-03-09 15:04:33 +01:00
Max Schaefer
3c785ecaa7 JavaScript: Move flow summaries to experimental.
Also update description and change note to call out their experimental character more clearly.
2020-03-09 12:57:20 +00:00
Asger F
5a1bf94994 Merge pull request #2987 from asger-semmle/js/urls-not-sensitive-data
JS: Declassify sensitive exprs with special characters
2020-03-09 12:29:47 +00:00
Asger Feldthaus
6c1f98a5ae JS: Update vague variable name 2020-03-09 11:58:38 +00:00
Tom Hvitved
a2269158df C#: Ignore dotnet clean exit code in autobuilder 2020-03-09 12:00:28 +01:00
Calum Grant
250afda7da Merge pull request #2831 from hvitved/csharp/local-function-fresh-label
C#: Generate fresh TRAP ID for local functions
2020-03-09 10:46:45 +00:00
Anders Schack-Mulligen
a2bbacf58d Java/C++/C#: Fix performance issue in partial paths exploration. 2020-03-09 11:30:59 +01:00
Anders Schack-Mulligen
4298a3a931 Java: Add test. 2020-03-09 11:16:59 +01:00
Anders Schack-Mulligen
f491fcd5ae Java/C++/C#: Sync. 2020-03-09 11:05:13 +01:00
Anders Schack-Mulligen
7a74634cfd Java/C++/C#: Simplify. 2020-03-09 11:04:28 +01:00
Anders Schack-Mulligen
cf84a53573 Java/C++/C#: Fix bug in type pruning. 2020-03-09 11:04:24 +01:00
Erik Krogh Kristensen
0f0187d585 move Array.from to ArrayCreationNode 2020-03-09 10:26:21 +01:00
Erik Krogh Kristensen
dc4e361d75 add data-flow steps for arrays 2020-03-09 09:53:08 +01:00
Erik Krogh Kristensen
8e3cf5c9c8 add test for data-flow on arrays 2020-03-09 09:25:17 +01:00
Erik Krogh Kristensen
14740d4ccc move existing array taint stracking into Arrays.qll 2020-03-09 09:20:45 +01:00
Asger Feldthaus
a9a9c14eea JS: Change note 2020-03-07 15:15:13 +00:00
Asger Feldthaus
a1d479e975 JS: Declassify sensitive exprs with special characters 2020-03-07 15:15:13 +00:00
Asger Feldthaus
759631ae56 JS: Raise default memory limit to 2.4G 2020-03-07 15:13:53 +00:00
Asger Feldthaus
c55dcf88d5 JS: Improve error reporting 2020-03-07 15:13:52 +00:00
Asger Feldthaus
549d4e9b57 JS: Do not restart in the middle of a message 2020-03-07 15:13:52 +00:00
Asger Feldthaus
e1657b237b JS: Extract compiler-restarting into a function 2020-03-07 15:13:52 +00:00
Asger Feldthaus
2ef21ea4b8 JS: Only evaluate relevant barrier guards 2020-03-07 15:13:20 +00:00
Asger Feldthaus
fd1a14d3bd JS: Add qldoc to a private predicate 2020-03-07 15:13:20 +00:00
Asger Feldthaus
eed4204e04 JS: Lift some internal members to private top-level 2020-03-07 15:13:20 +00:00
Ted Reed
a425e5fb5c Reduce false positives with small heuristics 2020-03-06 23:12:16 -05:00
SpaceWhite
5e912cbf8e Move directory to experimental 2020-03-07 11:55:32 +09:00
SpaceWhite
8cdc2bb268 Merge branch 'master' into CWE-094 2020-03-07 11:54:31 +09:00
SpaceWhite
b7af1645aa Move directory to experimental 2020-03-07 11:49:33 +09:00
SpaceWhite
2ec107bc2d Merge branch 'master' into CWE-643 2020-03-07 11:47:53 +09:00
Rebecca Valentine
2f3967cf5e Python: Fixes erroneous modernization bug 2020-03-06 18:31:38 -08:00
Rebecca Valentine
3e36c672cf Python: Removes superfluous cast 2020-03-06 13:06:11 -08:00
Rebecca Valentine
7b49c8e6f8 Python: Fixes bug in modernization 2020-03-06 12:47:46 -08:00
Jonas Jensen
0cd3eb7b7e C++: Accept test changes
Some IR inconsistencies are "fixed" because we no longer translate
constant initializers of static locals.
2020-03-06 20:20:47 +01:00
Rasmus Wriedt Larsen
8b2c74a4dd Python: Modernise remaining Security/*.qll files 2020-03-06 17:30:02 +01:00
Rasmus Wriedt Larsen
14957345a3 Python: Fix formatting of isLegalExceptionType 2020-03-06 17:27:50 +01:00
Rasmus Wriedt Larsen
70634fe30e Python: Remove usage of deprecated .getValue() 2020-03-06 16:20:31 +01:00
Felicity Chapman
90a9a6d2ac Update docs/language/learn-ql/python/introduce-libraries-python.rst 2020-03-06 15:13:10 +00:00
Jonas Jensen
cc38abd228 C++: Ignore constant static initializers 2020-03-06 15:05:28 +01:00
Jonas Jensen
02f0b89a0d C++: Test for constant static initializer 2020-03-06 15:05:28 +01:00
Rasmus Wriedt Larsen
2416cac8f4 Python: Modernise StringKind files 2020-03-06 14:45:03 +01:00
Alistair
40e8ccc020 Merge pull request #2879 from hubwriter/alistairs-docs-preparation-csharp
CodeQL migration: C# topics - change titles & add intros (2174)
2020-03-06 13:07:15 +00:00
mc
2c542df576 Merge pull request #2897 from mchammer01/js-migration-work
Code QL pre-migration tasks: update articles relating to CodeQL for JavaScript
2020-03-06 11:31:08 +00:00
mc
3558bb8bc0 Update docs/language/learn-ql/javascript/dataflow-cheat-sheet.rst
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-03-06 10:51:13 +00:00
mc
d777c08fc2 Update docs/language/learn-ql/javascript/type-tracking.rst
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-03-06 10:50:59 +00:00
semmle-qlci
3ae1aada37 Merge pull request #2995 from tausbn/python-fix-nested-sequence-assign-cp
Approved by RasmusWL
2020-03-06 09:43:24 +00:00
mchammer01
0a2ca55374 Merge branch 'js-migration-work' of github.com:mchammer01/ql into js-migration-work 2020-03-06 09:24:01 +00:00
mchammer01
fbe0735a5e pre-migration tasks: address review comments 2020-03-06 09:20:40 +00:00
semmle-qlci
7891f8621e Merge pull request #2982 from esbena/js/request-model-with-chaining
Approved by asgerf
2020-03-06 08:57:42 +00:00
semmle-qlci
ddc2f973d1 Merge pull request #3001 from asger-semmle/js/autoformat
Approved by erik-krogh
2020-03-06 08:53:56 +00:00
mc
e0ceeef4dc Update docs/language/learn-ql/javascript/type-tracking.rst
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-03-06 08:18:07 +00:00
mc
0773bfc2d7 Update docs/language/learn-ql/javascript/introduce-libraries-ts.rst
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-03-06 08:17:52 +00:00
Jonas Jensen
a13f355a85 C++: autoformat fixup 2020-03-06 08:29:46 +01:00
Ted Reed
8e1a7fef30 CPP: Add query for CWE-273 that detects out-of-order setuid 2020-03-05 14:21:32 -05:00
Asger Feldthaus
2c8eae22d1 JS: Autoformat 2020-03-05 16:58:49 +00:00
Taus Brock-Nannestad
2face94fa5 Python: Mitigate CP in nested_sequence_assign.
The problem here was that in the base case, there was no relationship between
`left_parent` and `right_parent`. These could be any two tuples or lists, even
if they were not part of an assignment statement.

To fix this, we add a bit of manual "magic", requiring that both of these
arguments must belong to the left and right-hand sides of the same assignment
statement.

(Note that this is in principle _still_ a gross overapproximation, but since
assignment statements are usually quite restricted in size, I don't expect this
to be a major problem.)
2020-03-05 14:09:50 +01:00
Rasmus Wriedt Larsen
fb1e993c0f Merge pull request #2963 from BekaValentine/python-objectapi-to-valueapi-advancedformatting
Python: ObjectAPI to ValueAPI: AdvancedFormatting
2020-03-05 13:40:02 +01:00
Jonas Jensen
e29f517af2 C++: Move InstructionSanity out of Instruction.qll
Having that module in `Instruction.qll` slowed down the parsing of that
file both humans and the compiler.

This commit moves the `InstructionSanity` module to `IRSanity.qll`
without making any changes to its contents apart from adding some
imports.
2020-03-05 12:11:50 +01:00
mchammer01
162a683075 pre-migration task: update links 2020-03-05 10:33:39 +00:00
Felicity Chapman
62bcc1a512 Merge pull request #2986 from felicitymay/1.23/2210-replace-links-semmle.com
1.23: Update or remove unwanted links
2020-03-05 10:20:35 +00:00
semmle-qlci
0d76c71ed7 Merge pull request #2981 from asger-semmle/js/lower-syntax-error-severity
Approved by max-schaefer
2020-03-05 09:47:56 +00:00
semmle-qlci
98cee5cc1d Merge pull request #2967 from asger-semmle/js/flow-through-prop
Approved by esbena
2020-03-05 09:46:35 +00:00
semmle-qlci
85ee5fc988 Merge pull request #2955 from erik-krogh/BetterHeader
Approved by asgerf
2020-03-05 08:24:43 +00:00
Rebecca Valentine
d535246703 Python: Modernizes query 2020-03-04 17:28:44 -08:00
Rebecca Valentine
646bc29e76 Python: Modernizes query 2020-03-04 17:22:21 -08:00
Rebecca Valentine
b09ab67e75 Python: Modernizes query 2020-03-04 17:10:32 -08:00
semmle-qlci
98034aaa53 Merge pull request #2988 from asger-semmle/js/autoformat-again-again
Approved by esbena
2020-03-04 21:20:52 +00:00
semmle-qlci
c6e3d8df49 Merge pull request #2969 from esbena/js/process-as-event-emitter
Approved by erik-krogh
2020-03-04 20:24:12 +00:00
Asger Feldthaus
53569453ba JS: Autoformat again 2020-03-04 19:28:24 +00:00
Robert Marsh
d9d6960110 Merge pull request #2985 from MathiasVP/bounded-uncontrolled-alloc-size
C++: Add testcase for cpp/uncontrolled-allocation-size
2020-03-04 10:00:43 -08:00
Robert Marsh
80ec5c11b3 Merge pull request #2983 from jbj/definitionReachesRank-perf
C++: IR: faster definitionReachesRank
2020-03-04 09:57:06 -08:00
semmle-qlci
c5d39039bc Merge pull request #2962 from erik-krogh/YetAnotherSanitizer
Approved by asgerf
2020-03-04 15:27:09 +00:00
Asger Feldthaus
c2f7cdce25 JS: Change precision to very-high 2020-03-04 15:06:10 +00:00
Mathias Vorreiter Pedersen
3973a50c9b C++: Add testcase for cpp/uncontrolled-allocation-size 2020-03-04 15:51:14 +01:00
Felicity Chapman
4a415d8ad6 Update or remove unwanted links 2020-03-04 14:18:24 +00:00
Jonas Jensen
6b2fd17f03 C++: IR: faster definitionReachesRank
On Wireshark with 6GB RAM, I've observed `definitionReachesRank` to be
the slowest predicate in the IR. It seems that the implementation was
slow because the optimizer failed to eliminate the common
`reachesRank - 1` subexpression. This led to context being pushed into
the `not`, which got implemented as `MATERIALIZE`. That wouldn't
normally be a disaster, but this is one of the largest predicates in the
IR SSA construction, and iteration 2 was very slow.

Before:

    (1505s) Starting to evaluate predicate SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta/4[1]@93f592 (iteration 1)
    (1535s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    130670697 ~0%     {4} r1 = SCAN project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS I OUTPUT I.<0>, I.<1>, I.<2>, (I.<2> + 1)
    130670697 ~6%     {5} r2 = JOIN r1 WITH SSAConstruction::DefUse::exitRank#fff AS R ON FIRST 2 OUTPUT r1.<0>, r1.<1>, r1.<2>, r1.<3>, R.<2>
    130670697 ~6%     {5} r3 = SELECT r2 ON r2.<3> <= r2.<4>
    130670697 ~0%     {4} r4 = SCAN r3 OUTPUT r3.<0>, r3.<1>, r3.<2>, r3.<3>
                      return r4
    (1535s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 130670697 rows (order for disjuncts: delta=<standard>).

    (1535s) Starting to evaluate predicate SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta/4[2]@866c14 (iteration 2)
    (1626s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    261341394 ~107%     {4} r1 = JOIN SSAConstruction::DefUse::definitionReachesRank#ffff#prev_delta AS L WITH SSAConstruction::DefUse::definitionReachesRank#ffff#join_rhs AS R ON FIRST 3 OUTPUT R.<0>, R.<1>, R.<2>, (1 + L.<3>)
    261341394 ~107%     {4} r2 = r1 AND NOT SSAConstruction::DefUse::definitionReachesRank#ffff#prev AS R(r1.<0>, r1.<1>, r1.<2>, r1.<3>)
    130670697 ~0%       {5} r3 = SCAN r2 OUTPUT r2.<0>, r2.<1>, (r2.<3> - 1), r2.<2>, r2.<3>
    106034590 ~1%       {4} r4 = JOIN r3 WITH project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS R ON FIRST 3 OUTPUT r3.<0>, r3.<1>, r3.<3>, r3.<4>
    106034590           {4} r5 = MATERIALIZE r4 AS antijoin_rhs
    24636107  ~3%       {4} r6 = r2 AND NOT r5(r2.<0>, r2.<1>, r2.<2>, r2.<3>)
    24636107  ~0%       {5} r7 = JOIN r6 WITH SSAConstruction::DefUse::exitRank#fff AS R ON FIRST 2 OUTPUT r6.<0>, r6.<1>, r6.<2>, r6.<3>, R.<2>
    2749441   ~0%       {5} r8 = SELECT r7 ON r7.<3> <= r7.<4>
    2749441   ~4%       {4} r9 = SCAN r8 OUTPUT r8.<0>, r8.<1>, r8.<2>, r8.<3>
                        return r9
    (1626s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 2749441 rows (order for disjuncts: delta=<standard>).

After:

    (12s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    130670697 ~0%     {4} r1 = SCAN project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS I OUTPUT I.<0>, I.<1>, I.<2>, (I.<2> + 1)
                      return r1
    (12s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 130670697 rows (order for disjuncts: delta=<standard>).
    (12s) Starting to evaluate predicate SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta/4[2]@fff64c (iteration 2)
    (34s) Tuple counts for SSAConstruction::DefUse::definitionReachesRank#ffff#cur_delta:
    108784031 ~0%     {4} r1 = SSAConstruction::DefUse::definitionReachesRank#ffff#prev_delta AS L AND NOT SSAConstruction::DefUse::exitRank#fff AS R(L.<0>, L.<1>, L.<3>)
    2749441   ~5%     {4} r2 = r1 AND NOT project#SSAConstruction::DefUse::hasDefinitionAtRank#fffff AS R(r1.<0>, r1.<1>, r1.<3>)
    2749441   ~4%     {4} r3 = SCAN r2 OUTPUT r2.<0>, r2.<1>, r2.<2>, (r2.<3> + 1)
    2749441   ~4%     {4} r4 = r3 AND NOT SSAConstruction::DefUse::definitionReachesRank#ffff#prev AS R(r3.<0>, r3.<1>, r3.<2>, r3.<3>)
                      return r4
    (34s) 			 - SSAConstruction::DefUse::definitionReachesRank#ffff_delta has 2749441 rows (order for disjuncts: delta=<standard>).

Note that the row counts are exactly the same before and after.
2020-03-04 15:00:47 +01:00
Mathias Vorreiter Pedersen
bbcf0b52df Merge pull request #2941 from jbj/Overflow-stmtDominates
C++: Avoid `iDominates*` in Overflow.qll
2020-03-04 12:40:52 +01:00
Esben Sparre Andreasen
db335ae89b JS: add default/chaining for request 2020-03-04 12:36:49 +01:00
Esben Sparre Andreasen
92b3e8c060 JS: add default/chaining tests for request 2020-03-04 12:25:23 +01:00
Mathias Vorreiter Pedersen
b20afa6370 Merge pull request #2979 from jbj/GVN-noinline
C++: pragma[noinline] on GVN charpred
2020-03-04 12:19:27 +01:00
Asger Feldthaus
6f2b05932e JS: Change note 2020-03-04 11:18:12 +00:00
Asger Feldthaus
af0df6c369 JS: Lower severity of js/syntax-error 2020-03-04 11:16:59 +00:00
semmle-qlci
c4b961c8af Merge pull request #2973 from tausbn/python-fix-or-disable-cps
Approved by BekaValentine
2020-03-04 10:36:47 +00:00
Jonas Jensen
60bcbf477a C++: pragma[noinline] on GVN charpred
The charpred of class `GVN` in `ASTValueNumbering.qll` got inlined into
the member predicate `getAnInstruction` and caused a tuple explosion on
Wireshark in the query `StrncpyFlippedArgs.ql`.

I interrupted the predicate after 10 minutes and got these intermediate
tuple counts:

    (5208s) Tuple counts for ASTValueNumbering::GVN::getAnInstruction_dispred#ff:
    8754900909 ~5%          {3} r1 = JOIN ValueNumberingInternal::tvalueNumber#ff_10#join_rhs AS L WITH ValueNumberingInternal::tvalueNumber#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, L.<1>, L.<0>
    4390274632 ~150085%     {2} r2 = JOIN r1 WITH project#SSAConstruction::Cached::getInstructionUnconvertedResultExpression AS R ON FIRST 1 OUTPUT r1.<2>, r1.<1>
                            return r2

After this change, the `getAnInstruction` predicate is itself inlined,
like it should be. The new non-inlined charpred takes 2.1s and has these
tuple counts:

    (2s) Tuple counts for ASTValueNumbering::GVN#f:
    9158442  ~117%     {1} r1 = JOIN project#SSAConstruction::Cached::getInstructionUnconvertedResultExpression AS L WITH ValueNumberingInternal::tvalueNumber#ff@staged_ext AS R ON FIRST 1 OUTPUT R.<1>
                       return r1
2020-03-04 10:34:05 +01:00
Esben Sparre Andreasen
ae43e90a67 JS: model process as an EventEmitter 2020-03-04 09:49:16 +01:00
Rebecca Valentine
2bcd8c8cb8 Python: Moves query over to modernized predicates 2020-03-03 17:05:47 -08:00
Rebecca Valentine
fa59fc607c Python: Adds modernized predicates 2020-03-03 17:05:29 -08:00
Rebecca Valentine
0f26734e9a Python: Moves more predicates over to suffixed form 2020-03-03 17:04:12 -08:00
Rebecca Valentine
a0cf2cbb13 Python: Moves old predicates to suffixed form 2020-03-03 16:53:56 -08:00
Rebecca Valentine
400a0f5741 Python: Adds preliminary modernization 2020-03-03 16:52:12 -08:00
Rebecca Valentine
b33b222db8 Python: Modernizes query 2020-03-03 16:41:52 -08:00
Rebecca Valentine
88daf65854 Python: Removes obsolete predicates 2020-03-03 16:03:27 -08:00
Rebecca Valentine
3bedd5cb58 Python: Adds modernized predicates and moves query over to them 2020-03-03 16:02:25 -08:00
Rebecca Valentine
5fea31eed1 Python: Moves predicates over to suffixed form 2020-03-03 15:55:40 -08:00
Rebecca Valentine
e39a0c9121 Python: Moves non_local_control_flow to new API, and fixes bug in ClassValue implementation 2020-03-03 15:38:35 -08:00
Taus
02ae0fbda6 Merge pull request #2965 from BekaValentine/python-objectapi-to-valueapi-raising
Python: ObjectAPI to ValueAPI: Raising
2020-03-04 00:03:17 +01:00
Rebecca Valentine
ce204ac949 Python: Moves statement out of quantifier that it didnt need to be in 2020-03-03 14:57:30 -08:00
Rebecca Valentine
8e1c089ff3 Python: Removes unused import 2020-03-03 14:38:26 -08:00
Robert Marsh
1e3419fd60 C++/C#: generate IR for funcs excluded in PrintIR
Previously, functions excluded from PrintIR would not have IR
generated. This sometimes affected escacpe analysis of functions that
were printed.
2020-03-03 14:34:08 -08:00
semmle-qlci
6f508bccc1 Merge pull request #2943 from esbena/js/more-fs-modules
Approved by erik-krogh
2020-03-03 21:50:43 +00:00
Taus Brock-Nannestad
48a47e1b54 Python: Fix broken test output. 2020-03-03 19:45:13 +01:00
Taus
8bd4f6d136 Merge pull request #2945 from BekaValentine/python-objectapi-to-valueapi-calltosuperwrongclass
Python: ObjectAPI to ValueAPI: CallToSuperWrongClass
2020-03-03 18:38:58 +01:00
Taus
9068040097 Merge pull request #2964 from BekaValentine/python-objectapi-to-valueapi-notimplemented
Python: ObjectAPI to ValueAPI: NotImplemented
2020-03-03 18:36:14 +01:00
Calum Grant
464a034c7d Merge pull request #2894 from BekaValentine/python-objectapi-to-valueapi-iscomparisons
Python: ObjectAPI to ValueAPI: IsComparisons
2020-03-03 17:25:24 +00:00
Taus Brock-Nannestad
eecace788f Python: Fix or disable CPs introduced by #2700 and #2875. 2020-03-03 18:18:03 +01:00
yo-h
a576f3fa54 Merge pull request #2966 from aschackmull/java/nullness-fp-test
Java: Document a FP for nullness in a test.
2020-03-03 12:04:52 -05:00
Nick Rolfe
c2db3d7984 Merge pull request #2968 from igfoo/unused_types
C++: Update tests following extractor no longer extracting some unused types
2020-03-03 16:03:40 +00:00
Esben Sparre Andreasen
4625217a68 Merge branch 'master' of github.com:Semmle/ql into js/more-fs-modules 2020-03-03 15:07:51 +01:00
Jonas Jensen
30b43b9322 C++: Tests for variables with ambiguous types 2020-03-03 14:45:04 +01:00
Esben Sparre Andreasen
dfa07130b5 JS: add process EventEmitter test 2020-03-03 14:26:03 +01:00
Jonas Jensen
88c74b2a4b Merge pull request #2917 from MathiasVP/inexact-is-chi-for-all-aliased-memory
C++: `isChiForAllAliasedMemory` recursion through inexact Phi operands
2020-03-03 14:25:49 +01:00
Jonas Jensen
4f23acf080 Merge pull request #2957 from MathiasVP/dataflow-dispatch-same-num-args
C++: Only return functions that match arguments in DataFlowDispatch::viableCallable
2020-03-03 14:19:26 +01:00
Anders Schack-Mulligen
4601639bad Java: Document a FP in a test. 2020-03-03 13:39:26 +01:00
Erik Krogh Kristensen
f03c67266a add taint step for replace call that only removes dots 2020-03-03 12:58:06 +01:00
Erik Krogh Kristensen
95819c8731 use RegExpTerm to generalize predicate 2020-03-03 12:34:18 +01:00
Asger Feldthaus
a2042094cf JS: Restrict reachableFromStoreBase 2020-03-03 11:32:23 +00:00
Asger Feldthaus
98524556c3 JS: Add some tests 2020-03-03 11:32:23 +00:00
Erik Krogh Kristensen
622a2fcfdc use regexp term instead of char class 2020-03-03 12:24:13 +01:00
semmle-qlci
57b3e6addf Merge pull request #2958 from erik-krogh/InnerPrefix
Approved by asgerf
2020-03-03 11:10:44 +00:00
Erik Krogh Kristensen
bc13204193 refactor header checks to be based on dominance 2020-03-03 12:04:31 +01:00
semmle-qlci
7f3f629d39 Merge pull request #2913 from asger-semmle/js/prototype-pollution-path
Approved by erik-krogh
2020-03-03 10:29:47 +00:00
semmle-qlci
b3cbf8baa8 Merge pull request #2960 from erik-krogh/OverloadsWithThis
Approved by asgerf
2020-03-03 10:10:00 +00:00
Esben Sparre Andreasen
adddebf039 Merge branch 'master' of github.com:Semmle/ql into js/more-fs-modules 2020-03-03 10:55:16 +01:00
semmle-qlci
e1c5449885 Merge pull request #2867 from erik-krogh/UselessCat
Approved by esbena
2020-03-03 09:10:25 +00:00
Erik Krogh Kristensen
9016f43d80 update expected output 2020-03-03 10:04:57 +01:00
Erik Krogh Kristensen
1781179e25 doc fixes 2020-03-03 09:50:02 +01:00
Erik Krogh Kristensen
c4ebd66b34 fix capitalization of predicate 2020-03-03 09:29:04 +01:00
Rebecca Valentine
2bbe4759ba Python: Removes obsolete predicate 2020-03-02 18:53:06 -08:00
Rebecca Valentine
e481ddf99e Python: Adds modernized predicate and moves queries over to it 2020-03-02 18:52:45 -08:00
Rebecca Valentine
a8ae843059 Python: Removes now obsolete original predicate 2020-03-02 18:46:19 -08:00
Rebecca Valentine
7161ca57c8 Python: Adds modernizations and moves query over to them 2020-03-02 18:45:41 -08:00
Rebecca Valentine
31fc0f2240 Python: Moves library and queries over to the new predicates, removes old ones 2020-03-02 18:08:10 -08:00
Rebecca Valentine
c058e17089 Python: Moves dependent queries to suffixed predicate names 2020-03-02 17:37:11 -08:00
Rebecca Valentine
0dcd52bd87 Python: Moves dependent query over to suffixed predicate names 2020-03-02 17:35:13 -08:00
Ian Lynagh
5b0cb10f9b C++: Update tests following extractor no longer extracting some unused types 2020-03-03 01:30:18 +00:00
Rebecca Valentine
8ee2587997 Python: Moves library predicates to suffixed names 2020-03-02 17:04:32 -08:00
Rebecca Valentine
7930037bb6 Python: Move AdvancedFormatting dependents over to suffixed API 2020-03-02 16:39:02 -08:00
Rebecca Valentine
48bcde8e0f Python: Move objectapi code to suffixed name 2020-03-02 16:31:06 -08:00
Rebecca Valentine
de6ea63fae Python: Adds preliminary modernization. 2020-03-02 15:43:57 -08:00
Erik Krogh Kristensen
d2d5af42bf add IndirectInclusionTest and IndirectEndsWith 2020-03-02 21:42:08 +01:00
Taus
f3b62e106d Merge pull request #2840 from BekaValentine/python-objectapi-to-valueapi-useofapply
Python: ObjectAPI to ValueAPI: UseofApply
2020-03-02 21:40:35 +01:00
Erik Krogh Kristensen
97c16929ca implement getPolarity and forward to inner StartsWith 2020-03-02 21:38:22 +01:00
Erik Krogh Kristensen
53d1cd33f6 support sanitizers that remove all forward slashes 2020-03-02 21:34:40 +01:00
Robert Marsh
0b74d56ed1 Merge pull request #2959 from jbj/getCanonicalQLClass-Variable
C++: Add getCanonicalQLClass overrides in Variable
2020-03-02 12:16:48 -08:00
Erik Krogh Kristensen
46a645c47b Merge pull request #2956 from asger-semmle/js/autoformat-again
JS: Really autoformat everything
2020-03-02 21:16:07 +01:00
Erik Krogh Kristensen
68fb8c52e9 check the type of the this-type, instead of the AST-node 2020-03-02 16:35:16 +01:00
Alistair Christie
e7b58571b6 Make review comment changes 2020-03-02 15:32:03 +00:00
Erik Krogh Kristensen
e0fcc4af6a handle this parameters when finding unreachable overloads 2020-03-02 16:26:00 +01:00
Mathias Vorreiter Pedersen
0b082a4089 C++: Only do argument check for 2020-03-02 16:22:05 +01:00
Alistair Christie
daf5a96935 Make review comment changes 2020-03-02 15:07:30 +00:00
Felicity Chapman
7a2bb120ec Update introductions for feedback 2020-03-02 15:06:18 +00:00
Jonas Jensen
76066afe6a C++: Add getCanonicalQLClass overrides in Variable 2020-03-02 13:49:12 +01:00
Erik Krogh Kristensen
019266e537 change name of Useless cat 2020-03-02 13:06:08 +01:00
Erik Krogh Kristensen
26fd17bf39 recognize utility functions implementing a StartsWith check 2020-03-02 13:00:58 +01:00
Mathias Vorreiter Pedersen
9df7a7a87e Merge branch 'master' into inexact-is-chi-for-all-aliased-memory 2020-03-02 12:34:24 +01:00
Erik Krogh Kristensen
391b6a833c add link to The Useless Use of Cat Award 2020-03-02 12:28:51 +01:00
Alistair Christie
fe9f974353 Merge branch 'master' into alistairs-docs-preparation-1 2020-03-02 11:17:42 +00:00
Mathias Vorreiter Pedersen
20529b4436 C++/C#: Sync identical files 2020-03-02 12:15:54 +01:00
Mathias Vorreiter Pedersen
14d836ba59 C++: should only match those functions that has the same number of parameters as the call has arguments. 2020-03-02 12:15:28 +01:00
Asger Feldthaus
e405a9769c JS: Really autoformat everything 2020-03-02 10:48:33 +00:00
semmle-qlci
228bd73bd2 Merge pull request #2944 from erik-krogh/YetAnotherPrefix
Approved by esbena
2020-03-02 10:07:47 +00:00
Mathias Vorreiter Pedersen
3a3aa75121 Merge pull request #2935 from jbj/MissingEnumCaseInSwitch-perf
C++: Optimize EnumSwitch.getAMissingCase
2020-03-02 10:32:44 +01:00
Erik Krogh Kristensen
c14a485ca7 recognize more HttpResponseSink by restricting the hasNonHtmlHeader check 2020-03-02 10:10:34 +01:00
Anders Schack-Mulligen
b210009eec Merge pull request #2923 from yo-h/java-customizations
Java: add `Customizations.qll`
2020-03-02 09:58:34 +01:00
Jonas Jensen
dab6691eb0 Merge pull request #2900 from dbartol/dbartol/void-buffer
C++: Better fix for `void` type on buffer access
2020-03-02 09:00:15 +01:00
Jonas Jensen
ec85f9f1a1 Merge pull request #2797 from rdmarsh2/rdmarsh/cpp/malloc-alias-locations
C++: Support dynamic memory allocations in IR alias analysis
2020-03-02 08:49:59 +01:00
Jonas Jensen
30b5db3b7f C++: autoformat fixup 2020-03-02 08:48:54 +01:00
Jonas Jensen
bbc57878dd C++: Performance fix for large basic blocks
The code is now quadratic in the number of statements in a basic block,
whereas before it was quadratic in the number of _control-flow nodes_ in
a basic block.
2020-03-02 08:46:58 +01:00
Robert Marsh
28ee756c6a Merge pull request #2934 from geoffw0/add_tests
C++: Test and typos.
2020-02-28 15:12:32 -08:00
Rebecca Valentine
d5f689e041 Adds preliminary modernization 2020-02-28 10:42:27 -08:00
Geoffrey White
c6b0d4bbda C#: Sync identical files. 2020-02-28 17:55:59 +00:00
Geoffrey White
82191102d9 Merge pull request #2930 from jbj/getUnconverted
C++: Add Expr.getUnconverted predicate
2020-02-28 14:25:36 +00:00
Erik Krogh Kristensen
71ff32e930 recognize another prefix check for js/path-injection 2020-02-28 14:55:41 +01:00
Rasmus Wriedt Larsen
ee4190e0d9 Python: Add example if urlsplit(url).path: => missing points-to
I wanted to highlight that it's not the call to `urlsplit` that is a problem, so
that's why I inserted a `check` in-between.
2020-02-28 13:43:10 +01:00
Rasmus Wriedt Larsen
8dd19ca6cd Python: Add example of re.compile missing points-to 2020-02-28 13:41:26 +01:00
Taus Brock-Nannestad
10bacfe8fd Python: Use subscriptUnknown instead of instance check.
Also adds a test for decomposing the unknown value of `a`.
2020-02-28 13:38:54 +01:00
Esben Sparre Andreasen
a589061bee JS: add type-tracking to the fs-module and model the original-fs 2020-02-28 12:54:59 +01:00
Esben Sparre Andreasen
5a3a1c480d JS: add tests for the fs-module and friends 2020-02-28 12:21:10 +01:00
Rasmus Wriedt Larsen
2e7807718f Python: Add a bit of regex docs
and use the canonical way of specifying a ModuleValue
2020-02-28 11:45:39 +01:00
Jonas Jensen
dfe1a7e2f0 C++: Avoid iDominates* in Overflow.qll
The `iDominates` relation is directly on control-flow nodes, and its
transitive closure is far too large. It got compiled into a recursion
rather than `fastTC`, and I've observed that recursion to take about an
hour on a medium-size customer snapshot.

The fix is to check for dominance at the basic-block level.
2020-02-28 10:48:23 +01:00
Geoffrey White
4ca57db553 Merge pull request #2929 from Semmle/rc/1.23
Merge rc/1.23 into master
2020-02-28 09:30:20 +00:00
Erik Krogh Kristensen
5e0ae7b4d0 add end </p> tag 2020-02-28 10:23:03 +01:00
Jonas Jensen
0be13e45f2 Merge remote-tracking branch 'upstream/master' into MissingEnumCaseInSwitch-perf 2020-02-28 09:57:29 +01:00
Erik Krogh Kristensen
ce9cd53bf1 Merge remote-tracking branch 'upstream/master' into UselessCat 2020-02-28 09:56:23 +01:00
Erik Krogh Kristensen
d8a96dd771 change name to suggestion from previous code review 2020-02-28 09:55:15 +01:00
Erik Krogh Kristensen
922779e049 remove double a/an and adjust line lenghts 2020-02-28 09:48:07 +01:00
Erik Krogh Kristensen
17f1974e05 Apply suggestions from code review
Co-Authored-By: mc <42146119+mchammer01@users.noreply.github.com>
2020-02-28 09:43:32 +01:00
semmle-qlci
ec90627a64 Merge pull request #2909 from yo-h/experimental
Approved by aschackmull, jbj, max-schaefer, tausbn
2020-02-28 03:15:58 +00:00
yo-h
f8bf055fe1 Merge pull request #2927 from aschackmull/java/taintgettersetter-tests
Java: Add some more taint-getter-setter tests.
2020-02-27 22:12:25 -05:00
yo-h
7dc5f9446a Merge pull request #2920 from aschackmull/java/typeflow-irrelevant-pruning
Java: Remove some irrelevant bounds from TypeFlow.
2020-02-27 22:10:32 -05:00
Rebecca Valentine
19c1ee5427 Adds preliminary modernization 2020-02-27 15:46:51 -08:00
Rebecca Valentine
9601c41fe5 Update python/ql/src/Expressions/IsComparisons.qll
Co-Authored-By: Taus <tausbn@github.com>
2020-02-27 10:46:07 -08:00
Rebecca Valentine
d19957f09d Puts use_of_apply example back into expressions_test to avoid messing up other tests 2020-02-27 10:44:46 -08:00
Dave Bartolomeo
b0fb16c068 C++/C#: Fix formatting 2020-02-27 13:44:02 -05:00
Robert Marsh
ac517b7428 Merge branch 'master' into rdmarsh/cpp/malloc-alias-locations 2020-02-27 08:55:20 -08:00
Taus Brock-Nannestad
5bbf93241b Python: Add test for tuple unpacking with "complicated" value. 2020-02-27 17:34:32 +01:00
Taus Brock-Nannestad
7a3895d661 Python: Fix points-to for a, b = some_unknown_object.
Also rewrites `multi_assignment_points_to` to be a bit more readable.

I'm not entirely sure that we want an unknown instance of `object` rather than
just `UnknownInternal`. The latter gets filtered out in the characteristic
predicate for `Value`, though, so I opted for the slightly more permissive
variant.
2020-02-27 17:26:54 +01:00
Geoffrey White
729c310eb9 C++: More typos. 2020-02-27 15:49:59 +00:00
Jonas Jensen
d686347315 C++: Optimize EnumSwitch.getAMissingCase
The `cpp/missing-case-in-switch` performed badly on some snapshots, to
the extent where it was as slow as the most expensive IR stages
(example: ChakraCore). This commit makes it faster, removing a
`pragma[noopt]` along the way.

The intermediate tuple counts on a customer codebase drop from 84M to
3M, while the content hash of `getAMissingCase` is the same.

Before:

    (124s) Tuple counts for Stmt::EnumSwitch::getAMissingCase#ff#antijoin_rhs:
    20867789 ~0%       {3} r1 = JOIN Stmt::SwitchStmt::getASwitchCase_dispred#ff AS L WITH Stmt::EnumSwitch::getAMissingCase#ff#shared AS R ON FIRST 1 OUTPUT L.<1>, R.<0>, R.<1>
    20122830 ~0%       {3} r2 = JOIN r1 WITH Stmt::SwitchCase::getExpr_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r1.<1>, r1.<2>
    20122830 ~0%       {3} r3 = JOIN r2 WITH Expr::Expr::getValue_dispred#ff AS R ON FIRST 1 OUTPUT r2.<2>, r2.<1>, R.<1>
    83961918 ~0%       {4} r4 = JOIN r3 WITH Enum::EnumConstant::getInitializer_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r3.<1>, r3.<0>, r3.<2>
    83961918 ~0%       {4} r5 = JOIN r4 WITH initialisers AS R ON FIRST 1 OUTPUT R.<2>, r4.<3>, r4.<1>, r4.<2>
    234348   ~185%     {2} r6 = JOIN r5 WITH Expr::Expr::getValue_dispred#ff AS R ON FIRST 2 OUTPUT r5.<2>, r5.<3>
                       return r6
    ...
    (124s) Tuple counts for Stmt::EnumSwitch::getAMissingCase#ff:
    663127 ~4%     {2} r1 = Stmt::EnumSwitch::getAMissingCase#ff#shared AS L AND NOT Stmt::EnumSwitch::getAMissingCase#ff#antijoin_rhs AS R(L.<0>, L.<1>)
                   return r1
    (124s) Registering Stmt::EnumSwitch::getAMissingCase#ff + [] with content 2060ff326cvhihcsvoph6k9divuv4
    (124s)  >>> Wrote relation Stmt::EnumSwitch::getAMissingCase#ff with 663127 rows and 2 columns.

After:

    (5s) Tuple counts for Stmt::EnumSwitch::getAMissingCase_dispred#ff#antijoin_rhs:
    746029   ~0%       {2} r1 = JOIN Stmt::EnumSwitch::getAMissingCase_dispred#ff#shared AS L WITH Enum::Enum::getAnEnumConstant_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, L.<1>
    3116197  ~2%       {3} r2 = JOIN r1 WITH Enum::EnumConstant::getInitializer_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r1.<1>, r1.<0>
    3116197  ~0%       {3} r3 = JOIN r2 WITH initialisers AS R ON FIRST 1 OUTPUT R.<2>, r2.<1>, r2.<2>
    3116197  ~311%     {3} r4 = JOIN r3 WITH Expr::Expr::getValue_dispred#ff AS R ON FIRST 1 OUTPUT r3.<1>, R.<1>, r3.<2>
    234348   ~185%     {2} r5 = JOIN r4 WITH Stmt::EnumSwitch::matchesValue#ff AS R ON FIRST 2 OUTPUT r4.<0>, r4.<2>
                       return r5
    (5s) Registering Stmt::EnumSwitch::getAMissingCase_dispred#ff#antijoin_rhs + [] with content 173483d71508vl534mvlr1g0ehi12
    (5s)  >>> Wrote relation Stmt::EnumSwitch::getAMissingCase_dispred#ff#antijoin_rhs with 82902 rows and 2 columns.
    (5s) Starting to evaluate predicate Stmt::EnumSwitch::getAMissingCase_dispred#ff/2@ae4c0b
    (5s) Tuple counts for Stmt::EnumSwitch::getAMissingCase_dispred#ff:
    746029 ~2%     {2} r1 = JOIN Stmt::EnumSwitch::getAMissingCase_dispred#ff#shared AS L WITH Enum::Enum::getAnEnumConstant_dispred#ff AS R ON FIRST 1 OUTPUT L.<1>, R.<1>
    663127 ~4%     {2} r2 = r1 AND NOT Stmt::EnumSwitch::getAMissingCase_dispred#ff#antijoin_rhs AS R(r1.<0>, r1.<1>)
                   return r2
    (5s) Registering Stmt::EnumSwitch::getAMissingCase_dispred#ff + [] with content 2060ff326cvhihcsvoph6k9divuv4
    (5s)  >>> Wrote relation Stmt::EnumSwitch::getAMissingCase_dispred#ff with 663127 rows and 2 columns.
2020-02-27 16:27:52 +01:00
Geoffrey White
f8a61ffc4c C++: Expand the test as described in ODASA-640. 2020-02-27 15:26:53 +00:00
Geoffrey White
0a7d9db335 C++: Add example described in ODASA-640. 2020-02-27 15:23:16 +00:00
Geoffrey White
e6d35d314d C++: Fix typo. 2020-02-27 15:23:10 +00:00
Jonas Jensen
c9e56d13f7 C++: Add Expr.getUnconverted predicate
This gets rid of the expensive predicate
`#Cast::Conversion::getExpr_dispred#ffPlus`, I've observed to cause
memory pressure on large databases.
2020-02-27 14:52:42 +01:00
Rasmus Wriedt Larsen
24e9f65a2f Python: Fix documentation of MultiAssignmentDefinition.indexOf
As discussed in person
2020-02-27 14:12:33 +01:00
Anders Schack-Mulligen
67d386b5ba C++/C#: Add synchronization. 2020-02-27 14:10:16 +01:00
Rasmus Wriedt Larsen
4433cc044d Python: Document MultiAssignmentDefinition.indexOf 2020-02-27 13:48:43 +01:00
Asger Feldthaus
52ebe49a0b JS: Flag deep assignments in prototype pollution query 2020-02-27 12:17:55 +00:00
Taus
0da554c701 Merge pull request #2914 from RasmusWL/python-remove-optimize-true-directive
Python: Remove `--optimize: true` from options files
2020-02-27 13:16:59 +01:00
Taus
d9383d0e86 Merge pull request #2902 from RasmusWL/python-use-of-input
Python: Highlight py/use-of-input is for Python 2
2020-02-27 13:15:32 +01:00
Taus
8bd3063d2b Merge pull request #2875 from RasmusWL/python-taint-urlsplit
Python: Add taint for urlsplit
2020-02-27 13:13:47 +01:00
Asger F
b25a4614de Merge pull request #2926 from asger-semmle/js/format-everything
JS: Autoformat everything
2020-02-27 12:11:01 +00:00
Anders Schack-Mulligen
8e2b56cfd0 Java: Include count in messages. 2020-02-27 13:10:42 +01:00
Taus
e09907894d Merge pull request #2817 from BekaValentine/objectapi-to-valueapi-truncateddivision
Python: ObjectAPI to ValueAPI: TruncatedDivision
2020-02-27 12:52:26 +01:00
Erik Krogh Kristensen
a872d7c5c5 add comment about negative optionsArg 2020-02-27 12:42:22 +01:00
Erik Krogh Kristensen
bb911bbbf1 Apply suggestions from code review
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-02-27 12:38:06 +01:00
Anders Schack-Mulligen
33f6392be5 Java: Add some more taint-getter-setter tests. 2020-02-27 10:47:25 +01:00
Asger Feldthaus
fefcf1a7a6 JS: Autoformat everything 2020-02-27 09:41:01 +00:00
Anders Schack-Mulligen
0c30d7cced Java: Update test output. 2020-02-27 10:28:12 +01:00
Erik Krogh Kristensen
9c06c48dc7 Merge pull request #2884 from esbena/js/practically-exploitable-redos
JS: add query js/exploitable-polynomial-redos
2020-02-27 10:19:17 +01:00
Anders Schack-Mulligen
a09e479033 Java: Change relevantNode to a class, and add two more checks. 2020-02-27 10:14:14 +01:00
Esben Sparre Andreasen
1b73cee692 JS: add js/exploitable-polynomial-redos 2020-02-27 08:42:43 +01:00
Rebecca Valentine
fe2bb8fb4b Adds preliminary modernization 2020-02-26 22:01:31 -08:00
Rebecca Valentine
057fed2cb8 Fixes erroneus naming 2020-02-26 21:55:02 -08:00
yo-h
63adc63597 CONTRIBUTING.md: add paragraph on maintaining backwards compatibility 2020-02-26 18:39:23 -05:00
yo-h
aeb8793197 Update docs/experimental.md
Break sentence down into shorter ones, as per review comment.
2020-02-26 18:38:42 -05:00
Robert Marsh
95a762c987 Merge master for submodule update 2020-02-26 13:44:26 -08:00
Robert Marsh
4333fe7905 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-02-26 13:15:27 -08:00
yo-h
62f8bf2b2e Java: add release note for Customizations.qll 2020-02-26 14:36:27 -05:00
yo-h
bd91bc0b29 Java: add Customizations.qll 2020-02-26 13:18:13 -05:00
Rebecca Valentine
b0493458d6 Combine and clean up the test files 2020-02-26 09:04:14 -08:00
Rebecca Valentine
ba1f3c46b8 Removes obsolete asBuiltin predicate 2020-02-26 08:17:45 -08:00
Geoffrey White
427b440389 Merge pull request #2918 from jbj/UnsignedGEZero-recursion
C++: Fix performance of UnsignedGEZero.ql
2020-02-26 15:49:03 +00:00
Taus Brock-Nannestad
5c3109a324 Python: Fix bug in multi_assignment_points_to.
This turned out to be a fairly simple but easy to make bug. When we want to
figure out the value pointed-to in a multi-assignment, we look at the left hand
side to see what value from the right hand side we should assign. Unfortunately,
we accidentally attempted to look up this information in the _left hand side_ of
the assignment, resulting in no points-to information at all. The only thing
needed to fix this was to properly link up the left and right hand sides: using
the left hand side to figure out what index to look at, and then looking up the
points-to information for the corresponding place in the right hand side.
2020-02-26 16:11:43 +01:00
Taus
85f5ad2231 Merge pull request #2904 from RasmusWL/python-http-clients
Python: Model outgoing HTTP client requests
2020-02-26 15:49:41 +01:00
Anders Schack-Mulligen
ce70b86604 Java: Add data-flow consistency checks. 2020-02-26 14:17:07 +01:00
Rasmus Wriedt Larsen
771dfecf6d Python: Add sanitized edges for urlsplit test 2020-02-26 14:10:30 +01:00
Rasmus Wriedt Larsen
0b31cb1716 Python: Show that we have initial taint in urlsplit test 2020-02-26 14:09:02 +01:00
Rasmus Wriedt Larsen
400a8ffae5 Python: Use slightly better name than foobar
I intended to rename before committing, but woops
2020-02-26 14:08:10 +01:00
Anders Schack-Mulligen
508b6050a8 Java: Remove some irrelevant bounds from TypeFlow. 2020-02-26 13:51:25 +01:00
Taus
dce121b565 Merge pull request #2916 from BekaValentine/python-objectapi-to-valueapi-callargsandothers
Python: ObjectAPI to ValueAPI: CallArgs and Others
2020-02-26 12:51:18 +01:00
semmle-qlci
326522c250 Merge pull request #2846 from erik-krogh/CVE481
Approved by asgerf, esbena
2020-02-26 11:16:41 +00:00
Mathias Vorreiter Pedersen
1bee0ffe3b C++: Autoformat 2020-02-26 12:09:21 +01:00
Jonas Jensen
5f6d07dd57 C++: Fix performance of UnsignedGEZero.ql
This query used two fastTC operations that were already somewhat
inefficient on their own but could send the evaluator into an OOM loop
when run in parallel without enough RAM.

The fix is to recurse manually, starting just from the expressions that
are potential candidates for alerts.
2020-02-26 11:32:41 +01:00
Rasmus Wriedt Larsen
4330d4e289 Python: Remove unused import in test 2020-02-26 10:26:30 +01:00
Rasmus Wriedt Larsen
5fae3a8d0a Python: Explain complexity of HTTPConnection.request 2020-02-26 10:26:30 +01:00
Rasmus Wriedt Larsen
b213db03fd Python: Consolidate stdlib http client tests
Move the stdlib tests from test/{2,3}/library-tests/ into /test/library-tests/,
and deal with version by using sys.version_info (results should be the same for
both versions).

six tests were moved from /library-tests/web/client/stdlib => /library-tests/web/client/six
2020-02-26 10:26:30 +01:00
Rasmus Wriedt Larsen
be187bcc0a Python: Make Client::HttpRequest extend ControlFlowNode
Taus poitned out that the reuqest being send off, doesn't *need* to happen on a
CallNode. Someone *could* use a __setattr__ or property :\
2020-02-26 10:26:30 +01:00
Rasmus Wriedt Larsen
e25079acc2 Python: Remove unnecessary cast 2020-02-26 10:26:30 +01:00
Rasmus Wriedt Larsen
cd5399d43e Python: Model outgoing http client requests 2020-02-26 10:26:30 +01:00
Mathias Vorreiter Pedersen
d942a3b54a C++: Change definition of isChiForAllAliasedMemory to recurse through inexact PhiInstructions 2020-02-26 10:21:27 +01:00
yo-h
21dd8757dd Update docs/experimental.md
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-02-25 23:11:29 -05:00
Rebecca Valentine
2fb722b04e Removes the general versions of the query. 2020-02-25 14:55:55 -08:00
Rebecca Valentine
15aeeb1e50 Removes erroneous expected result for py3 2020-02-25 14:54:52 -08:00
Rebecca Valentine
e07a003f75 Swaps overridden_call globally 2020-02-25 11:02:18 -08:00
Rebecca Valentine
50c91b99da Swaps correct_args_if_called_as_method globally 2020-02-25 11:01:51 -08:00
Rebecca Valentine
fb0cae76cf Swaps wrong_args globally 2020-02-25 11:00:39 -08:00
Rebecca Valentine
3a764ade8d Swaps too_many_args globally 2020-02-25 10:59:55 -08:00
Rebecca Valentine
3b0be46377 Swaps too_few_args globally 2020-02-25 10:59:16 -08:00
Rebecca Valentine
2c32a859cc Swaps illegally_named_parameter globally 2020-02-25 10:58:08 -08:00
Rebecca Valentine
4857a947ac Swaps get_function_or_initializer globally 2020-02-25 10:51:40 -08:00
Rebecca Valentine
cf4b7e1270 Swaps arg_count globally 2020-02-25 10:50:30 -08:00
Rebecca Valentine
c2a3af7e67 Adds objectapi suffix to private predicates 2020-02-25 10:48:29 -08:00
Rebecca Valentine
930228acc5 Un-autoformats 2020-02-25 09:52:46 -08:00
Rebecca Valentine
3e53e462d6 changes indents to 4 2020-02-25 09:46:21 -08:00
Rebecca Valentine
04951faf86 autoformat 2020-02-25 09:43:51 -08:00
Taus Brock-Nannestad
1526c86e6d Python: Update test results for ReturnTypes.ql for Python 2. 2020-02-25 17:30:46 +01:00
yo-h
d06caefd8e Address code review comments for experimental.md 2020-02-25 11:17:42 -05:00
Taus Brock-Nannestad
35ada17e2a Python: Use object as default return type for built-ins. 2020-02-25 16:31:40 +01:00
Taus Brock-Nannestad
5813209337 Python: Add tests for missing points-to for built-in methods. 2020-02-25 16:25:41 +01:00
Erik Krogh Kristensen
dc6bfad023 Merge remote-tracking branch 'upstream/master' into CVE481 2020-02-25 16:25:03 +01:00
Taus Brock-Nannestad
887f85cee2 Python: Add test for missing points-to information
To ease the rollout of this test, currently we only report missing points-to
information for nodes that either

- appear as an argument in a call to a function named `check`, or
- appear inside a scope where the first line is annotated with a comment ending
  in "check".

The idea behind the second version is that once we have points-to running at a
level where no node inside a scope that _ought_ to have points-to is missing
this information, we can simply remove all uses of `check(...)` from inside this
scope, and annotate the entire scope with `# check`. Once this has been done for
the entire file, we can then remove all the comments and just require
_everything_ to be checked.

Note that I don't expect all nodes to have the need for points-to information.
For instance, there are nodes representing scope entry and exit, and for these
it doesn't make sense to require that they "point-to" anything. Similarly,
`NameNode` appearing in a "store" (i.e. as the left hand side of an assignment)
do not strictly need to have points-to information, although it might be more
intuitive if they did.

Thus, the `relevant_node` predicate will almost certainly need to be extended to
exclude these kinds of nodes.
2020-02-25 16:07:50 +01:00
Rasmus Wriedt Larsen
f10a86d3ac Python: Remove --optimize: true from options files
Tests will be run with optimizations on by default now.
2020-02-25 15:52:00 +01:00
Rasmus Wriedt Larsen
8f70101572 Python: docs: Use <code> tag consistently in UseofInput.qhelp 2020-02-25 15:40:08 +01:00
mchammer01
0c5216570c pre-migration work: fix typos 2020-02-25 04:50:14 -08:00
Jonas Jensen
db33c360bc Merge pull request #2910 from aschackmull/dataflow/cleanup
Java/C++: Minor dataflow cleanup.
2020-02-25 12:47:10 +01:00
semmle-qlci
03b882381a Merge pull request #2723 from esbena/js/support-path-is-inside
Approved by asgerf
2020-02-25 11:21:24 +00:00
Taus
b453cf8f60 Merge pull request #2906 from RasmusWL/python-add-3-imports-tests
Python: Add Python 3 Imports tests from internal repo
2020-02-25 12:04:16 +01:00
Erik Krogh Kristensen
c83c27cbc4 add extra sanity-check that the output looks good 2020-02-25 11:11:58 +01:00
Erik Krogh Kristensen
8d26f32199 arg -> param 2020-02-25 10:53:07 +01:00
Erik Krogh Kristensen
87d283aa6c add tests for third party command execution libraries (and two small fixes) 2020-02-25 10:50:59 +01:00
Matthew Gretton-Dann
3465d5a0c7 docs: Correct AC5 version 2020-02-25 09:29:18 +00:00
Matthew Gretton-Dann
a48e36e2e1 docs: Update clang/gcc versions supported 2020-02-25 09:28:39 +00:00
Matthew Gretton-Dann
28e9cd7e38 docs: Detail support for C18. 2020-02-25 09:27:42 +00:00
Mathias Vorreiter Pedersen
b9bb2ec0ac Merge pull request #2864 from jbj/DefaultTaintTracking-cached
C++: Cache DefaultTaintTracking
2020-02-25 10:15:43 +01:00
Erik Krogh Kristensen
d540caecdd Apply suggestions from code review
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-02-25 10:04:51 +01:00
Anders Schack-Mulligen
fba8772411 Java/C++: Minor dataflow cleanup. 2020-02-25 09:40:25 +01:00
Asger F
160fc48803 Merge pull request #2896 from asger-semmle/typescript-3.8
TS: Support Typescript 3.8
2020-02-25 08:19:01 +00:00
Esben Sparre Andreasen
5baba62154 JS: model path-is-inside+is-path-inside for js/path-injection 2020-02-24 23:10:15 +01:00
Esben Sparre Andreasen
86b836cd29 JS: add tests for js/path-injection 2020-02-24 23:03:42 +01:00
semmle-qlci
aadb148c1c Merge pull request #2855 from asger-semmle/js/returned-partial-call
Approved by esbena
2020-02-24 21:37:41 +00:00
yo-h
43bcd5b26c Add guidelines for experimental CodeQL queries and libraries 2020-02-24 15:08:31 -05:00
Robert Marsh
ea4ca31fb3 Merge pull request #2907 from geoffw0/argvlocal
C++: Modify the argvlocal tests
2020-02-24 10:55:21 -08:00
Erik Krogh Kristensen
afd6ea2628 small correction in doc + autoformat 2020-02-24 17:54:29 +01:00
Geoffrey White
4af0193c98 C++: Modify the argvlocal tests. 2020-02-24 16:51:47 +00:00
Geoffrey White
9f271949d5 C++: Adjust layout of the argvlocal test. 2020-02-24 15:52:31 +00:00
Anders Schack-Mulligen
67b32796dd Merge pull request #853 from joshhale/tweak-cwe-078-example
doc: remove - from command arguments
2020-02-24 16:15:58 +01:00
Asger F
e665e3c187 Update change-notes/1.24/analysis-javascript.md
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-02-24 15:07:28 +00:00
Geoffrey White
c641a31640 C++: Refine nodeIsBarrierIn using getNodeForSource. 2020-02-24 14:39:31 +00:00
Rasmus Wriedt Larsen
2b997ec94a Python: Add Python 3 Imports tests from internal repo 2020-02-24 15:36:45 +01:00
Asger Feldthaus
6360073da4 JS: Rephrase change note 2020-02-24 14:35:17 +00:00
Rasmus Wriedt Larsen
9d629aef95 Python: Highlight py/use-of-input is for Python 2 2020-02-24 15:13:19 +01:00
Geoffrey White
843b72b11a C++: hasGlobalOrStdName(). 2020-02-24 14:12:19 +00:00
Erik Krogh Kristensen
b20e8520f6 add default message if not pretty printed call can be created 2020-02-24 14:52:08 +01:00
semmle-qlci
317356e591 Merge pull request #2898 from asger-semmle/js/prototype-pollution-isobject-sanitizers
Approved by erik-krogh
2020-02-24 13:35:32 +00:00
Erik Krogh Kristensen
b72404dc99 add change note 2020-02-24 14:07:49 +01:00
Erik Krogh Kristensen
a779ae58a8 add qhelp 2020-02-24 14:03:41 +01:00
Jonas Jensen
2d9df70abc Merge pull request #2887 from MathiasVP/fix-ir-gen-switch
C++: Fix IR generation for switch statements
2020-02-24 13:29:27 +01:00
Erik Krogh Kristensen
fb94af9764 remove the last dependency on PrettyPrinting 2020-02-24 13:18:15 +01:00
Erik Krogh Kristensen
051de247b0 change regexpMatch to regexpFind 2020-02-24 13:11:30 +01:00
Erik Krogh Kristensen
a768e937f0 complete qldoc 2020-02-24 13:08:50 +01:00
Jonas Jensen
ae68878476 C++: Cache DefaultTaintTracking
This should speed up the overall suite, where `DefaultTaintTracking` is
used in several queries.
2020-02-24 13:03:34 +01:00
Erik Krogh Kristensen
473787a426 refactor the getOptionsArg predicate into the SystemCommandExecution class 2020-02-24 12:59:20 +01:00
Geoffrey White
a0e839d3f1 C++: Block duplicate taint results from 'gets' and other functions. 2020-02-24 11:53:22 +00:00
Geoffrey White
06e649fc30 C++: Add support for fgetws. 2020-02-24 11:47:32 +00:00
Geoffrey White
5afebc8418 C++: Autoformat. 2020-02-24 11:40:47 +00:00
Asger Feldthaus
01309d7c2e TS: Add test for named re-export and exportsAs 2020-02-24 11:40:28 +00:00
Asger Feldthaus
78954489fb TS: Fix expected output 2020-02-24 11:40:28 +00:00
Asger Feldthaus
4e1bd9056c TS: Fix javadoc 2020-02-24 11:40:28 +00:00
Asger Feldthaus
05d9e64dab TS: Add change note 2020-02-24 11:40:27 +00:00
Asger Feldthaus
18974bad1c TS: Add upgrade script and stats 2020-02-24 11:40:27 +00:00
Asger Feldthaus
47673c6e21 TS: Disable export analysis for type-only exports 2020-02-24 11:40:27 +00:00
Asger Feldthaus
16c909b433 TS: Add test case for import type * as ns 2020-02-24 11:40:27 +00:00
Asger Feldthaus
260b243c28 TS: Add test case to DeclBeforeUse 2020-02-24 11:40:27 +00:00
Asger Feldthaus
8d58aad0f2 TS: Support type-only import/export 2020-02-24 11:40:27 +00:00
Asger Feldthaus
0351f0b775 TS: Add test and documentation for private fields 2020-02-24 11:40:27 +00:00
Asger Feldthaus
8531c113a1 TS: Fix imports 2020-02-24 11:40:27 +00:00
Asger Feldthaus
9b52acc62a TS: Handle export * as ns 2020-02-24 11:40:27 +00:00
Asger Feldthaus
7f939fe1e4 TS: Update to TypeScript 3.8.2 2020-02-24 11:40:27 +00:00
Geoffrey White
c45bf90e98 Update cpp/ql/src/semmle/code/cpp/models/implementations/Gets.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-02-24 11:36:09 +00:00
Geoffrey White
34b790d601 C++: Change note. 2020-02-24 11:33:27 +00:00
semmle-qlci
94aa77748d Merge pull request #2810 from erik-krogh/CVE74
Approved by asgerf
2020-02-24 11:32:42 +00:00
Geoffrey White
e683f6113d C++: Model 'gets'. 2020-02-24 11:27:35 +00:00
Geoffrey White
8dcd46f9e7 C++: Add a taint test for gets. 2020-02-24 11:25:28 +00:00
Asger Feldthaus
f923b24bc5 JS: Fix test 2020-02-24 11:19:23 +00:00
Erik Krogh Kristensen
75c1852ee4 doc changes from review
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-02-24 11:58:59 +01:00
Mathias Vorreiter Pedersen
ed430ce855 C++/C#: Bind parameter in new case. 2020-02-24 09:12:14 +01:00
Mathias Vorreiter Pedersen
af364e66fc C++/C#: Move sanity check inside InstructionSanity module and accept tests 2020-02-23 20:53:49 +01:00
Peter Stöckli
e81d3ce0b4 Add type for java.net.URL 2020-02-23 12:35:03 +01:00
Dave Bartolomeo
170331b105 C++: Better fix for void type on buffer access
Fixes issue https://github.com/github/codeql-c-analysis-team/issues/20

This change undoes the workaround in https://github.com/Semmle/ql/pull/2736, and replaces it with a fix for the underlying cause. The problem was that the IR construction code for side effects incorrectly assumed that `BufferAccessOpcode` included `SizedBufferAccessOpcode`. I think that was actually a perfectly reasonable assumption to make, so I changed the `Opcode` hierarchy to make it true.
2020-02-21 18:46:32 -07:00
Taus
285be2893c Merge pull request #2893 from BekaValentine/python-objectapi-to-valueapi-unnecessarylambda
Python: ObjectAPI to ValueAPI: UnnecessaryLambda
2020-02-21 22:23:02 +01:00
Taus
e444fb8bfa Merge pull request #2818 from BekaValentine/objectapi-to-valueapi-hashedbutnohash
Python: ObjectAPI to ValueAPI: HashedButNoHash
2020-02-21 22:19:58 +01:00
Rebecca Valentine
14273fc677 Adds missing result to expected file 2020-02-21 11:25:03 -08:00
Peter Stöckli
e1e03e326b Add query documentation header 2020-02-21 18:22:05 +00:00
Peter Stöckli
9de2be8eba Fix whitespace issues in OpenStream.java 2020-02-21 17:13:04 +00:00
Peter Stöckli
b622e2ae06 Java: Calling openStream on URLs created from remote source can lead to local file disclosure. 2020-02-21 17:51:15 +01:00
Rasmus Wriedt Larsen
bfa7553095 Python: urlsplit sanitizer handles in [KNOWN_VALUE] 2020-02-21 16:03:29 +01:00
mchammer01
b4c72f610a pre-migration tasks: start adding intros 2020-02-21 14:51:38 +00:00
Rasmus Wriedt Larsen
798db91f71 Python: Add more urlsplit tests 2020-02-21 15:51:33 +01:00
Erik Krogh Kristensen
44db0f4e5d better printing of the options arg 2020-02-21 15:39:49 +01:00
Asger Feldthaus
d1df251b92 JS: Proto pollution: Add is-plain-object sanitizer 2020-02-21 14:38:33 +00:00
Erik Krogh Kristensen
90e5671d98 Merge branch 'master' of git.semmle.com:Semmle/ql into CVE481 2020-02-21 15:25:07 +01:00
Rasmus Wriedt Larsen
31ff652cb3 Python: Make Sanitizer available for urlsplit taint
It isn't used by default, it has to *actively* be enabled.
2020-02-21 15:18:53 +01:00
Mathias Vorreiter Pedersen
d9753b0ca5 C++/C#: Accept test output after adding sanity check to Instruction.qll 2020-02-21 15:09:53 +01:00
Asger Feldthaus
1ee112a341 JS: Add change note 2020-02-21 13:55:27 +00:00
Asger Feldthaus
a673539c98 JS: Update expected output 2020-02-21 13:51:23 +00:00
Asger Feldthaus
b780bc4d59 JS: Also track into callbacks 2020-02-21 13:51:22 +00:00
Asger Feldthaus
e8e649102f JS: Also propagate out of returns 2020-02-21 13:51:22 +00:00
Asger Feldthaus
8c36b999cc JS: Track flow into calls to bound functions 2020-02-21 13:51:20 +00:00
semmle-qlci
ee5cf95f5b Merge pull request #2892 from asger-semmle/js/field-methods
Approved by esbena
2020-02-21 13:49:42 +00:00
semmle-qlci
e163d8d8c8 Merge pull request #2796 from asger-semmle/js/partial-invoke-receiver
Approved by esbena
2020-02-21 13:48:43 +00:00
Rasmus Wriedt Larsen
083dd4380b Python: Add example for how to write your own sanitizer 2020-02-21 14:28:48 +01:00
Erik Krogh Kristensen
75410e5760 big refactor of UselessUseOfCal 2020-02-21 14:26:42 +01:00
Rasmus Wriedt Larsen
e804e98d60 Python: Update change-notes 2020-02-21 14:08:09 +01:00
Mathias Vorreiter Pedersen
da41cbca06 C#: Add similar fix to translation of switch statements in C# 2020-02-21 13:33:54 +01:00
Rasmus Wriedt Larsen
abbc9293db Merge pull request #2891 from tausbn/python-special-operations
Python: Add AST support for special operations.
2020-02-21 13:16:22 +01:00
semmle-qlci
382e4bc06a Merge pull request #2895 from max-schaefer/js/improve-param-qldoc
Approved by asgerf
2020-02-21 12:01:02 +00:00
mchammer01
6da729c6a6 pre-migration tasks: replace titles 2020-02-21 11:50:37 +00:00
Asger Feldthaus
01fed95fe6 JS: Add change note 2020-02-21 11:49:20 +00:00
Max Schaefer
75495d7aad Update javascript/ql/src/semmle/javascript/Variables.qll
Co-Authored-By: Asger F <asgerf@github.com>
2020-02-21 10:06:32 +00:00
Geoffrey White
ad45a4b079 Merge pull request #2890 from nickrolfe/range_based_for
C++: add more extensive test for desugaring of range-based-for loops
2020-02-21 09:31:34 +00:00
Erik Krogh Kristensen
6ea14532ab small changes based on review 2020-02-21 10:27:57 +01:00
Max Schaefer
fc4afe6eb2 JavaScript: Improve qldoc for Parameter to clarify that it also contains catch-clause parameters. 2020-02-21 09:14:00 +00:00
Anders Schack-Mulligen
771cb754c2 Merge pull request #2822 from hvitved/dataflow/node-cand-simple-call-context
Data flow: Track simple call contexts in `nodeCand[Fwd]1`
2020-02-21 10:02:06 +01:00
Jonas Jensen
1d786abebd Merge pull request #2881 from rdmarsh2/ir-release-note
C++/Docs: release notes for IR taint tracking and GVN
2020-02-21 09:49:16 +01:00
Tom Hvitved
0cc3218115 Merge pull request #2872 from aschackmull/dataflow/pathstep-localflow-join
Java/C++/C#: Improve join-order in pathStep predicate
2020-02-21 09:39:17 +01:00
Rebecca Valentine
2b1d9c8d16 Updates last library difference
I'm not entirely sure if `getLiteralObject` and `getLiteralValue` are equivalent, and there don't see to be library tests for this
2020-02-20 20:20:56 -08:00
Rebecca Valentine
210387a8be Adds bulk of modernizations 2020-02-20 17:32:42 -08:00
Rebecca Valentine
df7f43ee86 Adds modernization 2020-02-20 17:07:56 -08:00
Rebecca Valentine
2f3ea10cf8 Move the query and examples over to 2/query-tests 2020-02-20 16:31:58 -08:00
Rebecca Valentine
376638e9c0 Move query over to Rasmus's API for NumericValue 2020-02-20 16:18:54 -08:00
Rebecca Valentine
ab1fcb32ae autoformats 2020-02-20 16:17:43 -08:00
Rebecca Valentine
5d9d724d43 Removes conflicting NumericValue definition 2020-02-20 16:17:33 -08:00
Rebecca Valentine
28be3b47fc Replaces name-reference to the class with canonical predicate. 2020-02-20 15:41:51 -08:00
Rebecca Valentine
5acd982d59 Swaps ...obj for ...val 2020-02-20 15:41:51 -08:00
Rebecca Valentine
91ea46f5ee Adds test output. 2020-02-20 15:41:51 -08:00
Rebecca Valentine
115495450d Adds test cases. 2020-02-20 15:41:51 -08:00
Rebecca Valentine
96b8d78650 Adds modernized files. 2020-02-20 15:41:51 -08:00
Mathias Vorreiter Pedersen
780010d8f9 C++/C#: Sync identical files 2020-02-20 22:15:06 +01:00
Mathias Vorreiter Pedersen
6c08783158 C++: Accept output 2020-02-20 22:13:37 +01:00
Mathias Vorreiter Pedersen
4545ad0f93 C++: Add sanity check to Instruction.qll 2020-02-20 22:09:02 +01:00
Mathias Vorreiter Pedersen
76e5bd59df C++: Change edge to DefaultEdge 2020-02-20 22:08:16 +01:00
Robert Marsh
7a7444b4e1 Docs: Simplify change note
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-02-20 12:50:52 -08:00
Tom Hvitved
a772b82fea Address review comments 2020-02-20 19:48:49 +01:00
Taus Brock-Nannestad
913db460b2 Python: Add AST support for special operations.
These have the form `$name(arg1, arg2, ...)` and currently have no semantics.
They may be useful for testing purposes, however.
2020-02-20 18:05:37 +01:00
Nick Rolfe
46b226e0c5 C++: add more extensive test for desugaring of range-based-for loops 2020-02-20 16:15:22 +00:00
semmle-qlci
2df3fe8f36 Merge pull request #2883 from asger-semmle/typescript-3.7.5
Approved by erik-krogh
2020-02-20 15:59:36 +00:00
Rasmus Wriedt Larsen
1029f04e76 Python: TarSlip sanitizer: handle not 2020-02-20 16:27:54 +01:00
Rasmus Wriedt Larsen
3c317ed0e6 Python: TarSlip sanitizer: only clear taint on false edge
maybe it was on purpose, will have to investigate FPs when query is good
2020-02-20 16:11:24 +01:00
Rasmus Wriedt Larsen
2d637e1cf7 Python: Add more tarslip examples 2020-02-20 16:09:10 +01:00
Mathias Vorreiter Pedersen
c5f38eecfe C++: Fix IR generation and accept output 2020-02-20 15:37:02 +01:00
Mathias Vorreiter Pedersen
051d574ffd C++: Add switch testcases demonstrating incorrect IR 2020-02-20 15:31:44 +01:00
Erik Krogh Kristensen
924272a7a5 insert placeholder qhelp 2020-02-20 14:35:26 +01:00
Erik Krogh Kristensen
b2ccec28e0 require the file to be non-empty 2020-02-20 14:34:50 +01:00
Erik Krogh Kristensen
b1cbfce50b use SystemCommandExecution and a few small fixes 2020-02-20 14:17:37 +01:00
Felicity Chapman
96f37c910b Apply suggestions from code review 2020-02-20 12:32:18 +00:00
Erik Krogh Kristensen
03e295ef11 Merge branch 'master' of git.semmle.com:Semmle/ql into CVE74 2020-02-20 12:19:32 +01:00
semmle-qlci
f6af5da7f7 Merge pull request #2778 from erik-krogh/FalsySanitizer
Approved by asgerf
2020-02-20 11:17:03 +00:00
Erik Krogh Kristensen
63036aa444 Merge branch 'master' of git.semmle.com:Semmle/ql into CVE74 2020-02-20 12:09:06 +01:00
semmle-qlci
8b277f7226 Merge pull request #2868 from asger-semmle/js/missing-await-void
Approved by max-schaefer
2020-02-20 10:56:47 +00:00
Asger Feldthaus
6448acfa88 TS: Depend on TypeScript 3.7.5 2020-02-20 10:53:17 +00:00
Erik Krogh Kristensen
12c0291dde require that an options object has a known set of properties 2020-02-20 11:35:11 +01:00
Erik Krogh Kristensen
b5ef45e6c2 add isSync predicate to SystemCommandExecution 2020-02-20 11:30:23 +01:00
Erik Krogh Kristensen
a193cb110e support arrow functions in the callbacks 2020-02-20 11:13:39 +01:00
Erik Krogh Kristensen
558beb7255 simplify the output file argument 2020-02-20 10:57:33 +01:00
semmle-qlci
091c6c063c Merge pull request #2856 from esbena/js/fix-RegExp-getPredecessor-getSuccessor
Approved by max-schaefer
2020-02-20 09:50:52 +00:00
Erik Krogh Kristensen
a5fdcb67f9 restricts alerts to the first line 2020-02-20 10:43:41 +01:00
Erik Krogh Kristensen
d4e73df92f remove dead predicate 2020-02-20 10:39:16 +01:00
Jonas Jensen
97035aeb63 Merge pull request #2848 from geoffw0/model-sideeffects
C++: Disambiguate SideEffectFunction QLDoc.
2020-02-20 10:30:53 +01:00
Erik Krogh Kristensen
56f3e431f9 update expected output 2020-02-20 10:28:53 +01:00
Erik Krogh Kristensen
80962803b0 update doc for VarAccessBarrier, and make the class private 2020-02-20 10:09:32 +01:00
Erik Krogh Kristensen
2d437efdfd corrections on qldoc
Co-Authored-By: Asger F <asgerf@github.com>
2020-02-20 09:54:11 +01:00
Robert Marsh
bed6d2b225 Merge branch 'master' into rdmarsh/cpp/malloc-alias-locations 2020-02-19 16:44:13 -08:00
Dave Bartolomeo
4f1a23e248 "Fix" spelling 2020-02-19 15:57:31 -07:00
Dave Bartolomeo
5263222dc2 "Fix" spelling 2020-02-19 15:57:19 -07:00
Robert Marsh
d151c2eeb7 C++: change note for IR-based GVN 2020-02-19 14:39:36 -08:00
Robert Marsh
8ea5739b7a C++: release note for DefaultTaintTracking 2020-02-19 14:32:49 -08:00
Robert Marsh
de66841263 Merge pull request #2873 from geoffw0/fixasttest2
C++: Fix another test that should be working on the AST dataflow.
2020-02-19 14:13:44 -08:00
Robert Marsh
82f2540dde Merge pull request #2871 from geoffw0/fixasttest
C++: Fix a test that should be working on the AST dataflow.
2020-02-19 10:55:13 -08:00
Alistair Christie
eb2fdda6aa C# pre-migration changes: titles & intros 2020-02-19 17:18:29 +00:00
Asger Feldthaus
479770dc07 JS: Recognize class members in more cases 2020-02-19 17:04:41 +00:00
Shati Patel
2aed6fb971 Merge pull request #2878 from jf205/monotonic-aggregates-123
QL handbook: updates for rc/1.23
2020-02-19 16:55:11 +00:00
Shati Patel
38be2672a2 Merge pull request #2877 from jf205/123-mergeback
Merge some rc/1.23 documentation changes into master
2020-02-19 16:47:22 +00:00
james
fc3d30c10b docs: technical feedback
(cherry picked from commit d5ff8f2b8e)
2020-02-19 16:45:48 +00:00
james
100a603a86 docs: expand handbook entry on monotonic aggregates
(cherry picked from commit b32683fc9f)
2020-02-19 16:45:48 +00:00
Felicity Chapman
1da1d92170 Update intro for library overview topic
Based on suggestions from James and Shati
2020-02-19 16:39:29 +00:00
james
6467fa5272 Merge branch 'rc/1.23' into 123-mergeback 2020-02-19 16:36:39 +00:00
Felicity Chapman
552d2edb5b Correction one more mention of tutorials 2020-02-19 16:35:59 +00:00
Felicity Chapman
f8c876176a Apply suggestions from code review
Many thanks for the review suggestions.

Co-Authored-By: Shati Patel <42641846+shati-patel@users.noreply.github.com>
2020-02-19 16:31:15 +00:00
Shati Patel
c5d8aac2ce Merge pull request #2876 from jf205/advanced-ql-123
docs: continue reorganizing 'Advanced QL' (rc/1.23)
2020-02-19 16:29:57 +00:00
Anders Schack-Mulligen
91166431d2 Java/C++/C#: s/Callable/DataFlowCallable/ 2020-02-19 17:23:01 +01:00
james
2bc5d11610 docs: delete advanced-ql section 2020-02-19 16:20:09 +00:00
james
1f84722d2f docs: delete constraining-types.rst
(cherry picked from commit 142106bc99)
2020-02-19 16:12:07 +00:00
james
afbb70af47 docs: remove advanced ql topic about determining specific types
(cherry picked from commit 3d90f6fe71)
2020-02-19 16:12:07 +00:00
james
30913c9e7c docs: add info about using getAQlClass()
(cherry picked from commit 3fb3b9b54a)
2020-02-19 16:12:06 +00:00
Erik Krogh Kristensen
bdab9ee12b change useless cat query to only flag instances that can be re-written to 2020-02-19 16:59:28 +01:00
Jonas Jensen
1d2d8729b8 Merge pull request #2839 from MathiasVP/sync-ir-valuenumbering-internals
C++/C#: Fix sync config file for value numbering sharing
2020-02-19 16:57:16 +01:00
Rasmus Wriedt Larsen
fd270cc02c Python: Add basic taint support for urlsplit/urlparse 2020-02-19 16:31:10 +01:00
Rasmus Wriedt Larsen
4f3149d865 Python: Fix error after merge conflict 2020-02-19 16:27:31 +01:00
Rasmus Wriedt Larsen
74345b1c05 Python: Make library-tests/taint/strings tests more transparent
Following the setup I invented for library-tests/taint/unpacking.

TestStep is still a bit annoying, since the output is not easy to eyeball; but
for now I guess we can live with it :)

I honestly didn't get the point of DistinctStringKinds.ql, other than showing we
can handle multiple taint kinds
2020-02-19 16:24:22 +01:00
Rasmus Wriedt Larsen
e4b83855d9 Python: Autoformat security/strings/External.qll 2020-02-19 16:24:13 +01:00
Tom Hvitved
ddf6b4a342 Merge pull request #2862 from calumgrant/cs/project-rids
C#: Add runtime identifiers to project files
2020-02-19 16:11:10 +01:00
Geoffrey White
89bbb975f9 C++: Effects on tests. 2020-02-19 14:52:49 +00:00
Geoffrey White
4e2a45cd3e C++: Correct SideEffectFunction model for PureStrFunction. 2020-02-19 14:38:43 +00:00
Geoffrey White
22cba0f26e C++: Delete TODO. 2020-02-19 14:38:43 +00:00
Geoffrey White
5f7085937e C++: Improve the SideEffect library QLDoc. 2020-02-19 14:38:43 +00:00
Geoffrey White
c014ca6ed7 C++: Rename some tests for clarity / less emphasis on the AST. 2020-02-19 14:33:57 +00:00
Geoffrey White
3e49e12126 C++ Repair GlobalValueNumbering (AST) test. 2020-02-19 14:28:46 +00:00
Anders Schack-Mulligen
c6016bb08c Java/C++/C#: Improve join-order in pathStep predicate 2020-02-19 14:47:39 +01:00
Rasmus Wriedt Larsen
e7fdfd3d3e Python: Move subprocess.call so super-class detection works
This is a temporary fix!

Added minimal working example (MWE) as a regression, so it's easier to fix the
real problem.

only Python 3 is facing the problem -- and without --max-import-depth=1 the test
times out at 10 minutes :O
2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
d7b803a859 Python: Fix modernisation of py/iteration-string-and-sequence
Introduced a regression, since the old code was:

```
predicate is_a_string_type(ClassObject seqtype) {
    seqtype = theBytesType() and major_version() = 2
    or
    seqtype = theUnicodeType()
}
```

but *now* we're good!
2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
0509228296 Python: Make ModelUsage test language agnostic 2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
87eff7f062 Python: More iterator => iterable renaming 2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
82b29b5698 Python: Recognize shebangs in module usage detection 2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
01f5b3dc63 Python: Add a script that we can't classify usage of 2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
3e7e9636ea Python: Add ModuleValue.{isUsedAsModule, isUsedAsScript}
and a few test cases
2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
b4ab0b55be Python: Modernise Statements/RedundantAssignment 2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
79a4d7e9cc Python: Add some confusing (but valid) property tests 2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
67e9edb820 Python: Add PropertyValue
+ Extend PropertyInternal.getSetter to handle non-decorator
+ Add PropertyInternal.getDeleter

It seems like a bit hacky way to do things, since we're not using the
PropertySetterOrDeleter class at all, but for now I'll leave it be.
2020-02-19 14:12:22 +01:00
Rasmus Wriedt Larsen
e747add485 Python: Descriptor tests fixup (3/3)
Better tests for properties
2020-02-19 14:10:29 +01:00
Rasmus Wriedt Larsen
aed7bfb820 Python: Descriptor tests fixup (2/3)
Test format improved
2020-02-19 14:10:29 +01:00
Rasmus Wriedt Larsen
3f49aeecfe Python: Descriptor tests fixup (1/3) 2020-02-19 14:10:29 +01:00
Rasmus Wriedt Larsen
13568b7b9f Python: Modernise Statements/ queries
Almost. Left out a few things marked with TODO
2020-02-19 14:10:29 +01:00
Rasmus Wriedt Larsen
83d40f167b Python: Update py/ineffectual-statement
e.(StrConst).isDocString() can only hold if e instanceof StrConst, since we have
that condition on the line above, we can safely remove this condition.
2020-02-19 14:05:55 +01:00
Rasmus Wriedt Larsen
6e349eb6e7 Python: Make py/side-effect-in-assert handle example
Also removed parantheses
2020-02-19 14:05:55 +01:00
Rasmus Wriedt Larsen
ae8dbd81f3 Python: Update test-file for py/redundant-assignment
now the test code can be pasted, and actually works ;)
2020-02-19 14:05:55 +01:00
Rasmus Wriedt Larsen
381668871d Python: Autoformat statements 2020-02-19 14:05:55 +01:00
Geoffrey White
df29143b7e C++: Fix a test that should be working on the AST dataflow. 2020-02-19 13:02:24 +00:00
Alistair Christie
fab7955c75 Make small editorial changes 2020-02-19 12:54:58 +00:00
Geoffrey White
c94582a1c0 Merge pull request #2861 from MathiasVP/gvn-use-impl
C++: Import AST GVN module for tests
2020-02-19 11:16:11 +00:00
james
6ff1c99ae3 docs: a few content updates 2020-02-19 11:08:18 +00:00
semmle-qlci
5e0f21a162 Merge pull request #2854 from max-schaefer/js/regexp-bounded-quantifier-fix
Approved by esbena
2020-02-19 10:12:13 +00:00
Mathias Vorreiter Pedersen
59a19679ea C++/C#: Sync identical files after merge 2020-02-19 11:06:00 +01:00
Mathias Vorreiter Pedersen
bbcc1e1c37 Merge branch 'master' into sync-ir-valuenumbering-internals 2020-02-19 10:43:48 +01:00
Mathias Vorreiter Pedersen
3a05a82c1d C++: Accept output 2020-02-19 10:35:03 +01:00
Asger Feldthaus
77105f6572 JS: Do not flag void operands MissingAwait 2020-02-19 09:30:03 +00:00
Mathias Vorreiter Pedersen
246ef694f6 Merge branch 'master' into gvn-use-impl 2020-02-19 10:29:46 +01:00
Erik Krogh Kristensen
344060e139 accept IO redirections as OK 2020-02-19 10:12:24 +01:00
Max Schaefer
4346691cdc JavaScript: Distinguish {lo} and {lo,} in the regular expression parser. 2020-02-19 08:26:14 +00:00
james
d3eb5334b8 docs: update titles, some links, add intros 2020-02-19 07:37:35 +00:00
james
2245d64c52 docs: tidy up ql-for-cpp 2020-02-19 07:09:01 +00:00
Rebecca Valentine
2fa20eb805 Fixes bug introduced by merge of foresight additions. 2020-02-18 21:37:52 -08:00
Rebecca Valentine
7997e1dc98 Merge branch 'master' into objectapi-to-valueapi-expectedmappingforformatstring 2020-02-18 21:33:12 -08:00
Rebecca Valentine
9e3ed214d0 Python: ObjectAPI to ValueAPI: Foresight Additions (#2819)
* Adds the...Type() predicates as foresight modernizations.

* Removes predicates that are not currently ported/portable

* Adds range types

* Update python/ql/src/semmle/python/objects/ObjectAPI.qll

Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>

* Update python/ql/src/semmle/python/objects/ObjectAPI.qll

Co-Authored-By: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>

* Swaps xType for just x, at least when it's new

Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-02-18 21:29:20 -08:00
Rebecca Valentine
810efef9de Adds python3 test 2020-02-18 15:02:47 -08:00
Rebecca Valentine
e55f01d905 Adds new UseofApply test case and results to the Python2 tests dir 2020-02-18 12:12:25 -08:00
Rebecca Valentine
9338d21aaf Removes unnecessary explanation 2020-02-18 11:43:43 -08:00
Rebecca Valentine
4059a99da6 Autoformats the query 2020-02-18 11:43:31 -08:00
Erik Krogh Kristensen
73a7d406a5 add query for useless use of cat 2020-02-18 19:18:45 +01:00
Robert Marsh
ff876aaedf C++: Accept test output with IR enabled 2020-02-18 09:48:21 -08:00
Rebecca Valentine
d0617ef7bc Autoformat 2020-02-18 09:00:31 -08:00
Felicity Chapman
2a5ac2e829 Fix failing Sphinx tests 2020-02-18 16:50:48 +00:00
Robert Marsh
adfe5f30a1 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-02-18 08:42:27 -08:00
Mathias Vorreiter Pedersen
cc4c780573 Merge pull request #2860 from jbj/isInCycle-neighbors
C++: Manual magic for `isInCycle`
2020-02-18 17:41:19 +01:00
Robert Marsh
aaf6926c34 Merge pull request #2851 from jbj/ir-enable-only
C++: Use IR for security.TaintTracking and GVN
2020-02-18 11:37:34 -05:00
Alistair Christie
fdbc74825e Java topics - change titles & add intros 2020-02-18 16:34:55 +00:00
Felicity Chapman
74d93ba704 Tidy up some references 2020-02-18 16:05:01 +00:00
semmle-qlci
ba67faf461 Merge pull request #2863 from shati-patel/master
Approved by felicitymay
2020-02-18 15:56:10 +00:00
Taus
ffbb5d0529 Merge pull request #2739 from RasmusWL/python-modernise-security
Python: modernise Security/ queries
2020-02-18 16:28:53 +01:00
Felicity Chapman
8a44f51fc5 Bring headings more into line with content models 2020-02-18 13:18:02 +00:00
Felicity Chapman
8ab4cebc9b Add reusable for other resources and make 'Further reading' section 2020-02-18 12:16:33 +00:00
Felicity Chapman
38e40622f1 Update topic titles and update map topic as discussed with JF and SP 2020-02-18 12:03:51 +00:00
Calum Grant
c3b88210aa C#: Add runtime idenfitiers to project files. 2020-02-18 11:52:41 +00:00
Mathias Vorreiter Pedersen
4cad5549ee C++: Directly import AST GVN module in tests 2020-02-18 12:21:14 +01:00
Rasmus Wriedt Larsen
1826abcdda Python: Autoformat django/General.qll
Should get into the habbit of doing this, but this time it slipped :P
2020-02-18 11:26:16 +01:00
Rasmus Wriedt Larsen
48c1c598bc Python: Write DjangoRegexRoute in more modern way
That is, assigning to fields instead of repeatedly using helper predicate
2020-02-18 11:25:27 +01:00
Rasmus Wriedt Larsen
ed9aa7dced Python: Write DjangoPathRoute in modern way
That is, assigning to fields instead of repeatedly using helper predicate
2020-02-18 11:24:24 +01:00
Rasmus Wriedt Larsen
5a0babe88b Python: Add support for Django 2.x and 3.x
I changed the django mock to support both 1.x and 2.x routing APIs, which is not
really a nice long term solution.
2020-02-18 11:22:35 +01:00
Erik Krogh Kristensen
e359e1a373 use a barrier directly instead of a barrier guard 2020-02-18 10:57:28 +01:00
Esben Sparre Andreasen
abe7aeef7c Merge pull request #2643 from esbena/js/unsafe-jquery
JS: add query js/unsafe-jquery-plugin
2020-02-18 09:26:14 +01:00
Jonas Jensen
0d239e8bd2 C++: Manual magic for isInCycle
The `isInCycle` predicate would take a long time on Wireshark with 6GB
RAM, sometimes OOMing in the fastTC HOP. Analyzing wireshark with 6GB is
important because that's the standard configuration on our Jenkins
workers. With this commit, I can analyze Wireshark with 6GB on my
laptop.

The `getNonPhiOperandDef` predicate on Wireshark is 34M tuples, while
`getDefIfHasNeighbors` is 11M tuples, and the TC of
`getDefIfHasNeighbors` is 23M tuples (487 MB).
2020-02-18 08:33:43 +01:00
Rebecca Valentine
4178002d59 Merge branch 'master' into python-objectapi-to-valueapi-useofapply 2020-02-17 17:20:00 -08:00
Esben Sparre Andreasen
e8938fb466 JS: introduce RegExpSequence::nextElement and previousElement 2020-02-17 23:20:25 +01:00
Rebecca Valentine
c36c0aeb88 Fixes renaming bug 2020-02-17 12:09:01 -08:00
Rebecca Valentine
13cd8d2435 Fixes expected results bug 2020-02-17 11:47:03 -08:00
Rebecca Valentine
a2c1d5ff45 Moves to higher level API 2020-02-17 11:46:53 -08:00
Rebecca Valentine
c5986c52d3 Renames typeErrorType to typeError 2020-02-17 11:28:39 -08:00
Tom Hvitved
a695b567ec Data flow: Sync files 2020-02-17 19:39:52 +01:00
Tom Hvitved
3a4f52315c Data flow: Track simple call contexts in nodeCand[Fwd]1 2020-02-17 19:37:35 +01:00
semmle-qlci
ecad925101 Merge pull request #2631 from hvitved/dataflow/generalize-flow-summaries
Approved by aschackmull
2020-02-17 18:22:46 +00:00
yo-h
d3b1729864 Merge pull request #2793 from aschackmull/java/format-taint-step
Java: Add String.format as default taint step.
2020-02-17 12:50:12 -05:00
Alexander Eyers-Taylor
c685b348c3 Merge pull request #2837 from jf205/monotonic-aggregates
docs: expand QL book entry on monotonic aggregates
2020-02-17 17:05:54 +00:00
james
d5ff8f2b8e docs: technical feedback 2020-02-17 16:20:31 +00:00
Rasmus Wriedt Larsen
adec76d041 Python: Follow conventions of getASomething
When multiple results are available, we usually name the function
`getAnArgument` or `getASomething`. The support for django copied the way bottle
did things, so this commits cleans up both
2020-02-17 16:55:55 +01:00
Rasmus Wriedt Larsen
362e7aebbb Python: Add HttpRedirectSinks test for django 2020-02-17 16:54:06 +01:00
Rasmus Wriedt Larsen
a3c6472b9b Python: Improve django tests (and prepare for v2 + v3 support) 2020-02-17 16:39:01 +01:00
Tom Hvitved
0e7838aca5 Data flow: Sync files 2020-02-17 15:08:26 +01:00
Tom Hvitved
c7aa31d90a Address review comments 2020-02-17 15:07:53 +01:00
Erik Krogh Kristensen
56e5bd50f6 update expected output 2020-02-17 14:55:08 +01:00
James Fletcher
a3fc2eac9c Merge pull request #2834 from shati-patel/2160-prep-ql-language
Minor update to QL language topics
2020-02-17 13:44:54 +00:00
Anders Schack-Mulligen
cabe627d1e Java: Fix qldoc. 2020-02-17 14:44:12 +01:00
Erik Krogh Kristensen
2885d48ad0 changes based on review 2020-02-17 14:44:10 +01:00
Rasmus Wriedt Larsen
f3ab52b1fe Python: Use StringValue instead of Value::forString 2020-02-17 14:41:32 +01:00
Rasmus Wriedt Larsen
6d5a8e4995 Python: Fix typos 2020-02-17 14:34:22 +01:00
Asger Feldthaus
9249b92d85 JS: Fix typo in comment 2020-02-17 12:48:13 +00:00
Esben Sparre Andreasen
8a9587fc91 JS: fix RegExp::getSuccessor/getPredecessor for sequence end/starts 2020-02-17 13:40:53 +01:00
Erik Krogh Kristensen
d1a58f1d17 Merge remote-tracking branch 'upstream/master' into CVE74 2020-02-17 13:18:52 +01:00
Erik Krogh Kristensen
b07f3d36d8 qldoc on splitPath 2020-02-17 13:17:12 +01:00
Erik Krogh Kristensen
5375604109 calling pop or shift on a SplitPath returns a PosixPath 2020-02-17 13:15:46 +01:00
Shati Patel
c5eec30713 Tidy up QLDoc spec 2020-02-17 12:07:15 +00:00
Shati Patel
2ce1ad1818 Rename "QLDoc specification" to "QLDoc comment specification" 2020-02-17 12:07:15 +00:00
Shati Patel
c846f536c4 Remove numbering 2020-02-17 12:07:15 +00:00
Esben Sparre Andreasen
c5ee436b16 JS: add RegExp::getSuccessor/getPredecessor tests 2020-02-17 13:06:55 +01:00
Erik Krogh Kristensen
3855268201 use RegExpCreationNode 2020-02-17 13:02:47 +01:00
Erik Krogh Kristensen
46cbeb0bc6 add more steps to the SplitPath label 2020-02-17 12:58:27 +01:00
semmle-qlci
23ed2bcc64 Merge pull request #2782 from asger-semmle/js/export-as-ns
Approved by erik-krogh, max-schaefer
2020-02-17 11:22:58 +00:00
Taus
03ae7831ad Merge pull request #2711 from RasmusWL/python-fix-import-deprecated-module
Python: fix alerts for py/import-deprecated-module
2020-02-17 11:46:12 +01:00
Taus
df3ac49c28 Merge pull request #2700 from RasmusWL/python-taint-iterable-unpacking
Python: Handle iterable unpacking in taint tracking
2020-02-17 11:44:25 +01:00
Taus
990d1c1663 Merge pull request #2802 from RasmusWL/python-fix-fp-py/import-own-module
Python: Fix FP for py/import own module
2020-02-17 11:23:11 +01:00
Tom Hvitved
8e325ead91 Add change notes 2020-02-17 11:00:10 +01:00
Tom Hvitved
dcdb5299f0 C#: Update expected test output 2020-02-17 10:52:02 +01:00
Tom Hvitved
7eae5f913c C#: Update data-flow test 2020-02-17 10:45:44 +01:00
Tom Hvitved
28307399f8 Data flow: Sync files 2020-02-17 10:45:35 +01:00
Tom Hvitved
bc6c4744b1 Data flow: Follow-up changes to FlowExploration module 2020-02-17 10:43:26 +01:00
Tom Hvitved
307ac7f0b3 Data flow: Remove UntypedAccessPath again 2020-02-17 10:32:27 +01:00
Jonas Jensen
0aba965a9e C++: Don't mention deprecated class
The language tests were failing because they don't tolerate mentioning a
deprecated class anywhere.
2020-02-16 09:43:25 +01:00
Jonas Jensen
a59c0facee C++: Accept test changes for IR libs
This is for the tests in the ql repo. There are also changed tests in
the internal repo.
2020-02-15 21:12:20 +01:00
Jonas Jensen
f4ba56f0c0 C++: Use IR for security.TaintTracking and GVN 2020-02-15 21:10:29 +01:00
Jonas Jensen
e95ebb25a5 C++: Ensure tainted_diff.ql keeps using old lib
Without this, the test will compare the IR to itself after we enable it.
2020-02-15 21:10:29 +01:00
Jonas Jensen
0628625a76 Merge pull request #2835 from MathiasVP/value-number-perf
C++: Value number performance fix
2020-02-15 20:40:53 +01:00
Mathias Vorreiter Pedersen
8cda847dbc C++: Add TLoadTotalOverlapValueNumber to getKind predicate in AST GVN wrapper 2020-02-15 09:37:45 -07:00
Jonas Jensen
49d2f5a60b C++: autoformat 2020-02-15 09:41:27 +01:00
SpaceWhite
0be6f84387 Add sample 2020-02-15 16:49:33 +09:00
SpaceWhite
1ad7bd9684 add sample code 2020-02-15 16:46:09 +09:00
SpaceWhite
a29ccd674f Initial commit 2020-02-15 16:27:03 +09:00
Dave Bartolomeo
867581df91 Merge pull request #2844 from MathiasVP/value-numbering-performance-fix-2
C++: Ensure that there is just one overlap for an operand in value numbering
2020-02-14 16:40:03 -07:00
Robert Marsh
7abd289d7d C++: reinclude IRType in total load value numbers 2020-02-14 13:34:29 -08:00
Robert Marsh
f3c788d1e9 Merge pull request #2843 from jbj/ValueNumbering-import-order
C++: Change import order for stable cache checksum
2020-02-14 13:34:20 -05:00
Mathias Vorreiter Pedersen
8b8a8cae5b C++/C#: Sync identical files 2020-02-14 16:11:57 +01:00
Mathias Vorreiter Pedersen
4a7b865dc0 C++: Move overlap fix into SSAConstruction 2020-02-14 16:11:00 +01:00
semmle-qlci
8d21692caf Merge pull request #2845 from max-schaefer/js/http2
Approved by esbena
2020-02-14 13:05:48 +00:00
Erik Krogh Kristensen
a6d644bac0 add support for path.normalize(path.realtive(...)) 2020-02-14 13:10:35 +01:00
Erik Krogh Kristensen
94814fa721 fix typos in the test 2020-02-14 13:03:35 +01:00
Nick Rolfe
d2a0037ad0 Merge pull request #2833 from hmakholm/pr/ql-codeql
Don't chain to ./codeql in .codeqlmanifest.json
2020-02-14 11:44:27 +00:00
Erik Krogh Kristensen
d765a33b8d add support for "../" prefixes in sanitizer 2020-02-14 12:36:54 +01:00
Erik Krogh Kristensen
9d61004128 remove redundant constructor on sink 2020-02-14 12:31:12 +01:00
Max Schaefer
ad83a8946c JavaScript: Sort lines in change notes. 2020-02-14 11:15:09 +00:00
Max Schaefer
f181111886 JavaScript: Add model of http2 compatibility API.
Also deprecated the `httpOrHttps` predicate, which was now only used in one place and seemed a little pointless anyway.
2020-02-14 11:14:31 +00:00
Mathias Vorreiter Pedersen
121c5e436d C++: Check that there is only one overlap 2020-02-14 11:13:53 +01:00
Erik Krogh Kristensen
3a146514ce add sanitizer for relative ".." in js/path-injection 2020-02-14 10:51:48 +01:00
Jonas Jensen
928bdbacb0 C++: Change import order for stable cache checksum
Without this fix, running the full LGTM suite would get the IR evaluated
twice. That's because we have multiple IPA types and constructors with
the same name (like `TInstruction` and `MkIRFunction`), and the QL
compiler chooses how to disambiguate those names differently depending
on import order.

I've tested that the IR is only evaluated once now by running the whole
suite on a tiny project (jbj/magicrescue) and looking at the output of

    perl -ne 'print if /^RESULTS IN:/ .. /^\[/ and not /^\[/' runSnapshotQueries-debug.log | sort |uniq -c |sort -n |less
2020-02-14 10:28:52 +01:00
semmle-qlci
da566a4484 Merge pull request #2828 from erik-krogh/CVE24
Approved by esbena
2020-02-14 09:12:48 +00:00
semmle-qlci
769dce511b Merge pull request #2788 from erik-krogh/CVE42-sink
Approved by esbena
2020-02-14 08:00:00 +00:00
Mathias Vorreiter Pedersen
98db6d8fd7 C#: Fix format and sync files 2020-02-14 08:22:25 +01:00
Robert Marsh
b4ff1216cc C++: sync identical files 2020-02-13 17:02:00 -08:00
Aditya Sharad
5e0d640f57 Merge pull request #2841 from BekaValentine/gitignore_vim_swap_files
Adds .gitignore entry for vim swap files.
2020-02-13 16:20:33 -08:00
Robert Marsh
0f58887396 C++: unique value number for filtered instructions
Instructions that are removed from the normal value numbering recursion
because they have a duplicated type or AST element get unique value
numbers rather than going unnumbered. This ensures comparisons of value
numbers using `!=` hold for filtered instructions.
2020-02-13 15:36:42 -08:00
Rebecca Valentine
2ee38f246b Adds .gitignore entry for vim swap files. 2020-02-13 15:23:50 -08:00
Rebecca Valentine
6a04004d94 Adds test cases and qlref. 2020-02-13 14:49:01 -08:00
Rebecca Valentine
b665f54a31 Corrects query to use builtin instead of special 2020-02-13 14:48:46 -08:00
Rebecca Valentine
3b45fbc87c Adds rough modernization. 2020-02-13 14:22:00 -08:00
Mathias Vorreiter Pedersen
d4c6f487bc C++/C#: Fix sync config file for value numbering sharing 2020-02-13 22:32:52 +01:00
Mathias Vorreiter Pedersen
ed7888c612 C++: Sync identical files 2020-02-13 21:50:03 +01:00
Mathias Vorreiter Pedersen
57613d5507 C++: Reintroduce the type in TConstantValueNumber to avoid giving constant with different signed-ness the same value number. Instead filter those with more than one type out. 2020-02-13 21:49:40 +01:00
Dave Bartolomeo
9e1ea01be8 Fix typo 2020-02-13 13:01:09 -07:00
Tom Hvitved
09b1e8b161 C#: Update expected test output 2020-02-13 20:08:11 +01:00
james
b32683fc9f docs: expand handbook entry on monotonic aggregates 2020-02-13 18:06:44 +00:00
Mathias Vorreiter Pedersen
cb510edcf0 C++: Sync up identical files and restore imports 2020-02-13 18:02:56 +01:00
Mathias Vorreiter Pedersen
04c5f1cbb4 C++: Perf fix for value numbering 2020-02-13 18:02:56 +01:00
Jonas Jensen
24396905a5 WIP: Try to reduce ambiguous value numbers
This is not enough to get genome/breakdancer working.
2020-02-13 18:02:56 +01:00
Jonas Jensen
8054cde9fc WIP: Switch on IR 2020-02-13 18:02:56 +01:00
Tom Hvitved
332733a92e Java/C++: Follow-up changes 2020-02-13 16:34:06 +01:00
Tom Hvitved
b5b0c2b8cf Data flow: Sync files 2020-02-13 16:34:06 +01:00
Tom Hvitved
6be2bf8374 Address review comments 2020-02-13 16:34:06 +01:00
James Fletcher
c95f58c30d Merge pull request #2830 from shati-patel/docs-preparation
Merge master into `docs-preparation` branch
2020-02-13 14:59:09 +00:00
Henning Makholm
3ec11a1089 Don't chain to ./codeql in .codeqlmanifest.json
This entry in `.codeqlmanifest.json` was intended to allow
unpacking the CodeQL CLI as a subdirectory of `ql`, and things
would Just Work.

However, it is not necessary anymore because recent releases of
the CLI will search their own directory as a fallback
_independently_ of the parent directory.

On the contrary, removing this link will make internal testing
easier because you then run a test build of the CLI with
`--search-path` pointing to the `ql` checkout without inadvertently
making extractors in a _different_ build that is unpacked there visible.
2020-02-13 15:30:15 +01:00
Erik Krogh Kristensen
897bb4d801 add test for chrome-remote-interface 2020-02-13 15:12:45 +01:00
Erik Krogh Kristensen
1ab5ca4e64 typo in docstring
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-02-13 14:15:28 +01:00
jack1142
e1644dd68b Python: Handle __class_getitem__ in py/not-named-self (#2825)
Fixes #2824
2020-02-13 13:38:36 +01:00
Rasmus Wriedt Larsen
1558cf2eae Python: Fix typo (decent => descent) 2020-02-13 13:35:29 +01:00
Tom Hvitved
8748a1218d C#: Generate fresh TRAP ID for local functions 2020-02-13 13:02:46 +01:00
Taus
dcb41a139c Merge pull request #2780 from RasmusWL/python-clean-qltest-options
Python: clean qltest options files
2020-02-13 12:14:17 +01:00
Erik Krogh Kristensen
7c69ee1aff Merge remote-tracking branch 'upstream/master' into CVE74 2020-02-13 11:09:09 +01:00
Erik Krogh Kristensen
d6afd438ba add model for chrome-remote-interface as a ClientRequest 2020-02-13 10:58:07 +01:00
Geoffrey White
4412cea04a Merge pull request #2821 from jbj/ValueNumbering-var-operand
C++: Fix perf of IR value numbering
2020-02-13 09:11:34 +00:00
Rebecca Valentine
acb3c524dd Updates expected results. 2020-02-12 19:46:43 -08:00
Rebecca Valentine
65cba82c7e Fixes bug w/ use of pointsTo 2020-02-12 19:45:55 -08:00
Rebecca Valentine
bfb720c7f3 Adds range and tuple types 2020-02-12 19:36:03 -08:00
Rebecca Valentine
3ce250b2cf Adds some debugging changes. 2020-02-12 19:29:42 -08:00
Robert Marsh
52b164434d C++: remove accidental commit 2020-02-12 15:23:30 -08:00
Robert Marsh
1d5971f8ec C++: accept test changes from extractor update 2020-02-12 13:29:21 -08:00
Tom Hvitved
89527766be Merge pull request #2744 from calumgrant/cs/local-var-parent
C#: Distinguish between local variables extracted in different compil…
2020-02-12 19:41:29 +01:00
Felicity Chapman
39ba3dedc1 Fix build failure by moving control-flow image 2020-02-12 17:16:31 +00:00
Felicity Chapman
8db3651dfd Add draft introductions and create map topic for Python 2020-02-12 16:38:23 +00:00
Jonas Jensen
2abe416670 Merge pull request #2799 from MathiasVP/missing-flow-in-crement
C++: Fix false negatives for postfix crement expressions
2020-02-12 15:03:48 +01:00
Jonas Jensen
033a4c30ea C++: Fix perf of IR value numbering
On some snapshots, notably ffmpeg, the IR `ValueNumbering` recursion
would generate billions of tuples and eventually run out of space.

It turns out it was fairly common for an `Instruction` to get more than
one `ValueNumber` in the base cases for `VariableAddressInstruction` and
`InitializeParameterInstruction`, and it could also happen in an
instruction with more than one operand of the same `OperandTag`. When a
binary operation was applied to an instruction with `m` value numbers
and another instruction with `n` value numbers, the result would get
`m * n` value numbers. This led to doubly-exponential growth in the
number of value numbers in rare cases.

The underlying reason why a `VariableAddressInstruction` could get
multiple value numbers is that it was keyed on the associated
`IRVariable`, and the `IRVariable` is defined in part by the type of its
underlying `Variable` (or other AST element). If the extractor defines a
variable to have multiple types because of linker ambiguity, this leads
to the creation of multiple `IRVariable`s. That should ideally be solved
in `TIRVariable.qll`, but for now I've put a workaround in
`ValueNumberingInternal.qll` instead.

To remove the problem with instructions having multiple operands, the
construction in `Operand.qll` will now filter out any such operand. It
wasn't enough to apply that filter to the `raw` stage, so I've applied
it to all three stages.
2020-02-12 14:38:41 +01:00
Taus
895f2f74ab Merge branch 'master' into python-clean-qltest-options 2020-02-12 13:44:41 +01:00
Taus
12113e947f Merge pull request #2603 from RasmusWL/python-fix-http-source-sink
Python: Make web libs use HttpRequestTaintSource and HttpResponseTaintSink
2020-02-12 13:42:22 +01:00
Mathias Vorreiter Pedersen
c8be67ce0e C++: Generalize PostfixCrementOperation to CrementOperation to fix false negatives reported by Geoffrey 2020-02-12 13:26:10 +01:00
Taus
de45b1a08e Merge pull request #2767 from RasmusWL/python-six-tests
Python: Update expected six results
2020-02-12 12:53:36 +01:00
Erik Krogh Kristensen
d913654604 Merge remote-tracking branch 'upstream/master' into FalsySanitizer 2020-02-12 10:28:48 +01:00
Tom Hvitved
78380f5d59 Merge pull request #2658 from calumgrant/cs/serialization-check-bypass-type
C#: Fix cs/serialization-check-bypass
2020-02-12 10:26:01 +01:00
Anders Schack-Mulligen
5b7c150f58 Merge pull request #2813 from p-/fix-doc-java-dataflow
Doc: fix sample query in Java data flow documentation
2020-02-12 10:08:05 +01:00
Rebecca Valentine
2270c6c960 Adds modernized files. 2020-02-11 21:45:49 -08:00
Rebecca Valentine
178acc85b9 Adds main modifications. 2020-02-11 21:25:50 -08:00
Robert Marsh
837fe84cec C++/C#: autoformat Opcode.qll 2020-02-11 12:18:45 -08:00
Robert Marsh
f467260815 C++: respond to PR comments. 2020-02-11 12:17:46 -08:00
Robert Marsh
5269fb713f Merge pull request #2812 from geoffw0/nospacezero
C++: Improve NoSpaceForZeroTerminator.ql
2020-02-11 14:37:32 -05:00
Peter Stöckli
ddbec74b67 Doc: fix sample query in Java data flow doc 2020-02-11 20:17:53 +01:00
Mathias Vorreiter Pedersen
1dd5926f41 C++: Generalize new case in adjustedSink to all AssignOperations 2020-02-11 17:15:42 +01:00
Geoffrey White
87781a944b C++: Change note. 2020-02-11 15:25:59 +00:00
Geoffrey White
75a50a1714 C++: Understand formatting function varargs as needing null termination. 2020-02-11 15:25:59 +00:00
Geoffrey White
de8d84dfff C++: Clearer comments in NoSpaceForZeroTerminator.ql. 2020-02-11 15:25:59 +00:00
Geoffrey White
2f290bd528 C++: Additional test cases. 2020-02-11 15:25:59 +00:00
Calum Grant
5838df17c6 Merge pull request #2766 from hvitved/csharp/stackalloc
C#: Extract `stackalloc` information
2020-02-11 15:06:15 +00:00
Rasmus Wriedt Larsen
efedcd26d0 Python: Django tests need --lang=3 2020-02-11 13:16:52 +01:00
Erik Krogh Kristensen
35d8151374 add a few arrary methods to TaintedPath.qll 2020-02-11 12:23:51 +01:00
Tom Hvitved
1948446ad3 Address review comments 2020-02-11 11:56:40 +01:00
Rasmus Wriedt Larsen
1f762841ec Python: In py/import-own-module handle from foo import * 2020-02-11 11:45:48 +01:00
Rasmus Wriedt Larsen
5cc2efef8e Python: Fix FPs for py/import-own-module
Before I added `--max-import-depth=2`, there was a bit of trouble, where it
would alert on `from pkg_ok import foo2` -- since all the `pkg_ok.foo<n>`
modules were missing, I guess the analysis didn't make any assumptions on
whether `foo2` is a module or a regular attribute.
2020-02-11 11:45:48 +01:00
Rasmus Wriedt Larsen
f3f9e340d3 Python: Update tests for py/import-own-module
So I've been thinking a bit about import pkg_ok.foo1 after reading the Python
references for imports of submodules
https://docs.python.org/3/reference/import.html#submodules

> When a submodule is loaded using any mechanism (...) a binding is placed in the
parent module’s namespace to the submodule object. For example, if package spam
has a submodule foo, after importing spam.foo, spam will have an attribute foo
which is bound to the submodule.

That does at least explain what is going on here.

I feel that import pkg_ok.foo1 might be a very contrived example. In principle
it should be an alert, since the module pkg_ok ends up with an import of itself,
but my gut feeling is that in practice it's not a very important piece of code
to give alerts for. if we really care about giving these import related alerts,
we could probably add a new query for this pattern, as it's kind of surprising
that it works when you're just an ordinary python programmer.
2020-02-11 11:45:48 +01:00
Shati Patel
bd94e80271 Merge pull request #2809 from jf205/update-rc123
docs: port some more changes onto rc/1.23
2020-02-11 11:26:36 +01:00
James Fletcher
cb94c95115 Merge pull request #2807 from shati-patel/sphinx-blog
Remove link to blog
2020-02-11 09:16:42 +00:00
Arthur Baars
a460d90434 Remove trailing ; in QL language spec
(cherry picked from commit c91815f44d)
2020-02-11 09:13:30 +00:00
Arthur Baars
b56b10b0d9 Fix typos in QL language spec
(cherry picked from commit c431d47481)
2020-02-11 09:13:30 +00:00
James Fletcher
d8f31068d5 Update docs/language/learn-ql/writing-queries/debugging-queries.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
(cherry picked from commit 47f61f3569)
2020-02-11 09:04:45 +00:00
james
f3d2588dae docs: address review comments
(cherry picked from commit 537739c42d)
2020-02-11 09:04:45 +00:00
james
646670708c docs: move abstract classes topic to handbook
(cherry picked from commit 23d1e06aa4)
2020-02-11 09:04:45 +00:00
james
bcf08649ee docs: delete equivalence topic
(cherry picked from commit e8016a2303)
2020-02-11 09:03:59 +00:00
james
8e6e6d356d docs: move folding predicates topic
(cherry picked from commit fe18c18619)
2020-02-11 09:03:59 +00:00
james
2900dced18 docs: add link to module resolution in ql spec
(cherry picked from commit f2320bbe56)
2020-02-11 09:03:58 +00:00
Jonas Jensen
b9bc21637e Merge pull request #2808 from rdmarsh2/function-with-wrappers
C++: fix cartesian product in FunctionWithWrapper
2020-02-11 09:31:41 +01:00
Robert Marsh
d672f8f863 C++: unflip cause strings in FunctionWithWrapper 2020-02-10 15:57:38 -08:00
Robert Marsh
d09f78db29 C++: fix cartesian product in FunctionWithWrapper 2020-02-10 13:02:58 -08:00
Dave Bartolomeo
405850e02b Merge pull request #2805 from jbj/dataflow-sideeffect-join
C++: IR DataFlowUtil::modelFlow join order fix
2020-02-10 13:04:51 -07:00
Tom Hvitved
96e71c731d C#: Add DB stats for explicitly_sized_array_creation 2020-02-10 20:33:57 +01:00
Tom Hvitved
dc27ee7b9f C#: Add change note 2020-02-10 20:33:57 +01:00
Tom Hvitved
859e6968c1 C#: Add DB upgrade script 2020-02-10 20:32:53 +01:00
Tom Hvitved
bbf082b285 C#: Extract stackalloc information 2020-02-10 20:32:52 +01:00
Tom Hvitved
2b2bb5db80 Merge pull request #2803 from calumgrant/cs/stackalloc-expr
C#: Handle implicitly-typed stackallocs
2020-02-10 20:28:16 +01:00
Robert Marsh
58bba86be4 C++: autoformat 2020-02-10 09:52:23 -08:00
Shati Patel
ce28d0fde7 Remove link to blog 2020-02-10 17:48:44 +00:00
Calum Grant
fb6da0b701 C#: Remove condition around initializer. 2020-02-10 16:17:12 +00:00
Calum Grant
803cb3f4d1 C#: Address review comment
- Flow from expressions with a value is excluded.
2020-02-10 16:02:29 +00:00
Mathias Vorreiter Pedersen
af4a6e4ac6 Merge pull request #2806 from jbj/coversEntireVariable-join
C++: Fix coversEntireVariable perf in AliasedSSA
2020-02-10 16:38:28 +01:00
Mathias Vorreiter Pedersen
bcd84efe8d C++: Add += and friends to adjustedSink 2020-02-10 15:50:52 +01:00
Jonas Jensen
cf1bc693b4 C++: Fix coversEntireVariable perf in AliasedSSA
This predicate got an unfortunate join order, leading to these tuple
counts on ElektraInitiative/libelektra:

    (290s) Tuple counts for AliasedSSA::VariableMemoryLocation::coversEntireVariable_dispred#f:
    57117     ~0%     {3} r1 = SCAN IRType::IRType::getByteSize_dispred#ff AS I OUTPUT 0, (I.<1> * 8), I.<0>
    421445272 ~0%     {3} r2 = JOIN r1 WITH AliasedSSA::VariableMemoryLocation#fffffff_5601#join_rhs AS R ON FIRST 2 OUTPUT R.<3>, r1.<2>, R.<2>
    103282    ~2%     {1} r3 = JOIN r2 WITH AliasConfiguration::Allocation::getIRType_dispred#ff AS R ON FIRST 2 OUTPUT r2.<2>
                      return r3

With this commit, we get these tuple counts instead:

    (0s) Tuple counts for AliasedSSA::VariableMemoryLocation::varIRTypeHasBitRange#bff:
    361874 ~0%     {3} r1 = SCAN AliasedSSA::VariableMemoryLocation#fffffff AS I OUTPUT I.<1>, 0, I.<0>
    361874 ~0%     {3} r2 = JOIN r1 WITH AliasConfiguration::Allocation::getIRType_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, 0, r1.<2>
    361874 ~1%     {3} r3 = JOIN r2 WITH IRType::IRType::getByteSize_dispred#ff AS R ON FIRST 1 OUTPUT r2.<2>, 0, (R.<1> * 8)
                   return r3

    (0s) Tuple counts for AliasedSSA::VariableMemoryLocation::coversEntireVariable_dispred#f:
    103282 ~2%     {1} r1 = JOIN AliasedSSA::VariableMemoryLocation#fffffff_056#join_rhs AS L WITH AliasedSSA::VariableMemoryLocation::varIRTypeHasBitRange#bff AS R ON FIRST 3 OUTPUT L.<0>
    103282 ~2%     {1} r2 = STREAM DEDUP r1
                   return r2
2020-02-10 15:18:34 +01:00
Rasmus Wriedt Larsen
2bffbf0734 Python: Add testcases for py/import-own-module
You can try out:

python2 -c "import pkg_ok; print(pkg_ok.foo1); print(pkg_ok.foo2); print(pkg_ok.foo3); print(pkg_ok.foo4); print(pkg_ok.foo5); print(pkg_ok.Foo3); print(pkg_ok.Foo5); print(pkg_ok.pkg_ok)"

python3 -c "import pkg_ok; print(pkg_ok.foo1); print(pkg_ok.foo2); print(pkg_ok.foo3); print(pkg_ok.foo4); print(pkg_ok.foo5); print(pkg_ok.Foo3); print(pkg_ok.Foo5); print(pkg_ok.pkg_ok)"
2020-02-10 15:16:47 +01:00
Jonas Jensen
47c12817ad C++: IR DataFlowUtil::modelFlow join order fix
We had these tuple counts on ElektraInitiative/libelektra (note that the
`modelFlow` predicate got inlined into
`simpleInstructionLocalFlowStep`):

    (652s) Tuple counts for DataFlowUtil::simpleInstructionLocalFlowStep#ff:
    ...
    19701      ~1%      {4} r27 = JOIN r26 WITH Instruction::SideEffectInstruction::getPrimaryInstruction_dispred#3#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r26.<2>, r26.<1>, r26.<0>
    7908       ~0%      {3} r28 = JOIN r27 WITH SSAConstruction::Cached::getInstructionIndex#ff@staged_ext AS R ON FIRST 2 OUTPUT r27.<0>, r27.<2>, r27.<3>
    4023       ~0%      {3} r29 = JOIN r28 WITH Instruction::WriteSideEffectInstruction#class#ff AS R ON FIRST 1 OUTPUT r28.<1>, r28.<2>, r28.<0>
    ...
    1060807009 ~3%      {3} r34 = JOIN r33 WITH SSAConstruction::Cached::getInstructionIndex#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r33.<1>, r33.<2>
    15670      ~5%      {2} r35 = JOIN r34 WITH Instruction::SideEffectInstruction::getPrimaryInstruction_dispred#3#ff AS R ON FIRST 2 OUTPUT r34.<0>, r34.<2>
    7973       ~0%      {2} r36 = JOIN r35 WITH Instruction::ReadSideEffectInstruction::getSideEffectOperand_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r35.<1>
    ...

In this predicate there are two cases (`WriteSideEffectInstruction` and
`ReadSideEffectInstruction`) where we need to join on both the call and
the argument index of a side effect. It works well enough for the first
case, `WriteSideEffectInstruction`, where the call is joined on before
the index, but it explodes in the second case,
`ReadSideEffectInstruction`, where the index is joined first. To fix the
second case, and to guard against future optimizer accidents in the
first case, this commit changes both of those cases to use a new helper
predicate that makes it possible to join on both columns at once. The
resulting tuple counts are:

    (3s) Tuple counts for DataFlowUtil::simpleInstructionLocalFlowStep#ff:
    ...
    7908    ~0%      {3} r27 = JOIN r26 WITH DataFlowUtil::getSideEffectFor#fff AS R ON FIRST 2 OUTPUT R.<2>, r26.<2>, r26.<0>
    4023    ~0%      {3} r28 = JOIN r27 WITH Instruction::WriteSideEffectInstruction#class#ff AS R ON FIRST 1 OUTPUT r27.<1>, r27.<2>, r27.<0>
    ...
    15670   ~5%      {2} r33 = JOIN r32 WITH DataFlowUtil::getSideEffectFor#fff AS R ON FIRST 2 OUTPUT R.<2>, r32.<2>
    7973    ~0%      {2} r34 = JOIN r33 WITH Instruction::ReadSideEffectInstruction::getSideEffectOperand_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r33.<1>
    ...

The bulge is now limited to a factor of two, and that's just because I
didn't write separate versions of `getSideEffectFor` for
`ReadSideEffectInstruction` and `WriteSideEffectInstruction`.
2020-02-10 15:11:30 +01:00
Erik Krogh Kristensen
67cd303a91 add change note 2020-02-10 13:51:48 +01:00
Mathias Vorreiter Pedersen
99a9d7f676 C++: Simplify 2020-02-10 13:01:40 +01:00
Erik Krogh Kristensen
8e316d2f05 add unary type-tracking predicates 2020-02-10 12:51:09 +01:00
Calum Grant
a95ef31984 C#: Analysis change notes 2020-02-10 11:36:30 +00:00
Calum Grant
5fef77bf44 C#: Handle expressions of typeImplicitStackAllocArrayCreationExpressionSyntax 2020-02-10 11:30:12 +00:00
Mathias Vorreiter Pedersen
6804018a64 C++: Accept output 2020-02-10 11:37:40 +01:00
Mathias Vorreiter Pedersen
522c629441 C++: Move fix to adjustedSink to avoid generating too many instructions 2020-02-10 11:37:26 +01:00
Pavel Avgustinov
09960e0a7d Merge pull request #2791 from aibaars/language-spec-fixes
Fix a few typos in the QL grammar
2020-02-10 10:33:00 +00:00
Erik Krogh Kristensen
0f511c92b4 Merge remote-tracking branch 'upstream/master' into FalsySanitizer 2020-02-10 09:54:58 +01:00
Mathias Vorreiter Pedersen
52bc25b608 C++: Accept output 2020-02-10 08:50:29 +01:00
SpaceWhite
949914e48a Add XPathInjection 2020-02-10 13:48:02 +09:00
Mathias Vorreiter Pedersen
bb30275e2e C++: Fix false negatives for postfix crement expressions 2020-02-09 21:35:07 +01:00
Tom Hvitved
9b699618a8 Data flow: Improve performance of flowFwdStore() 2020-02-09 19:34:04 +01:00
Mathias Vorreiter Pedersen
bcb4759b6a Merge pull request #2795 from agustingianni/master
cpp: Adds a member predicate to get a FunctionAccess from a Function
2020-02-08 10:39:36 +01:00
Robert Marsh
3266a89023 C++: document DynamicAllocationInstruction 2020-02-07 16:56:57 -08:00
Robert Marsh
3ea3519674 C++/C#: sync changes 2020-02-07 16:37:42 -08:00
Robert Marsh
7f69cdfb56 C++: Dynamic allocations in IR alias analysis 2020-02-07 16:37:36 -08:00
Robert Marsh
05c8610bbc C++: tests for alias analysis of malloc 2020-02-07 16:35:58 -08:00
Robert Marsh
68097116b0 C++:autoformat 2020-02-07 15:51:23 -08:00
semmle-qlci
37360e7d93 Merge pull request #2794 from esbena/js/move-EnumeratedPropName
Approved by asgerf
2020-02-07 21:31:37 +00:00
semmle-qlci
76ba48c6fb Merge pull request #2790 from esbena/js/model-send
Approved by asgerf
2020-02-07 21:30:54 +00:00
Robert Marsh
d1d19a7446 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams
Update test expectations
2020-02-07 12:24:05 -08:00
Asger Feldthaus
e4844bfad2 JS: Fix deprecated API usage 2020-02-07 17:17:48 +00:00
Asger Feldthaus
ad10414604 JS: Update expected output of existing test 2020-02-07 16:57:57 +00:00
Agustin Gianni
033eeab41e cpp: Adds a member predicate to get a FunctionAccess from a Function
- Adds a member predicate to get a FunctionAccess from a Function
- Adds QLDoc to getACallToThisFunction.
2020-02-07 16:45:14 +01:00
Erik Krogh Kristensen
06e13cb3a1 Merge branch 'master' of git.semmle.com:Semmle/ql into FalsySanitizer 2020-02-07 16:13:02 +01:00
Erik Krogh Kristensen
c6668da02e expand how indirectCommandArguments are found 2020-02-07 15:00:05 +01:00
Asger Feldthaus
254af4f3a8 JS: Rewrite LodashUnderscore::AnalyzedThisInBoundCallback 2020-02-07 13:58:07 +00:00
Erik Krogh Kristensen
dd9e3d2fec expose TaintTracking::arrayFunctionTaintStep and add a step for "concat" 2020-02-07 14:57:32 +01:00
Asger Feldthaus
fea5a4331d JS: Rewrite React::AnalyzedThisInBoundCallback 2020-02-07 13:55:42 +00:00
Asger Feldthaus
3b28bdbeed JS: Rewrite AnalyzedThisInArrayIterationFunction 2020-02-07 13:55:36 +00:00
Asger Feldthaus
f942e69482 JS: Improve flow through partial invokes 2020-02-07 13:54:14 +00:00
Anders Schack-Mulligen
85adc3be10 Java: Add String.join as default taint step. 2020-02-07 14:43:31 +01:00
Esben Sparre Andreasen
dcdaa96570 JS: remove unused imports 2020-02-07 14:10:50 +01:00
Esben Sparre Andreasen
cb30329b3d JS: make DynamicPropertyAccess.qll from PrototypePollutionUtility.ql 2020-02-07 13:57:52 +01:00
Calum Grant
3c8aeb946a Merge pull request #2729 from hvitved/csharp/assignment-dataflow-node
C#: Add new class `AssignableDefinitionNode` to the data-flow library
2020-02-07 12:53:55 +00:00
Anders Schack-Mulligen
ee3af0a247 Java: Add String.format as default taint step. 2020-02-07 13:43:35 +01:00
Erik Krogh Kristensen
1ece6b9afe update expected output of tests 2020-02-07 12:57:51 +01:00
semmle-qlci
125c6a071c Merge pull request #2787 from asger-semmle/js/lazy-cache-test-case
Approved by esbena
2020-02-07 11:53:04 +00:00
Arthur Baars
c91815f44d Remove trailing ; in QL language spec 2020-02-07 12:47:14 +01:00
Arthur Baars
c431d47481 Fix typos in QL language spec 2020-02-07 12:46:41 +01:00
Esben Sparre Andreasen
736ccb98c2 JS: model the send library for js/path-injection 2020-02-07 12:45:32 +01:00
Shati Patel
4cbf7d2a6d Merge pull request #2789 from jf205/codeql-178
QL language handbook: add link to information about module resolution in QL spec
2020-02-07 12:27:02 +01:00
Tom Hvitved
f30a42ce26 Data flow: Fix bad join-order in TPathNodeSink
Avoids a Cartesian product on nodes:

```
[2020-02-07 11:01:22] (432s) Tuple counts for dom#DataFlowImpl::TPathNodeSink#ff:
                      0          ~0%      {2} r1 = JOIN DataFlowImpl::Configuration::isSource_dispred#ff AS L WITH DataFlowImpl::Configuration::isSink_dispred#ff AS R ON FIRST 2 OUTPUT R.<1>, R.<0>
                      101611     ~0%      {2} r2 = SCAN DataFlowImpl::PathNodeMid#class#ffffff AS I OUTPUT I.<5>, I.<0>
                      3534537047 ~3%      {3} r3 = JOIN r2 WITH DataFlowImpl::Configuration::isSink_dispred#ff AS R ON FIRST 1 OUTPUT r2.<1>, R.<1>, R.<0>
                      251        ~41%     {3} r4 = JOIN r3 WITH project#DataFlowImpl::pathStep#fffff AS R ON FIRST 2 OUTPUT R.<2>, r3.<2>, r3.<1>
                      251        ~50%     {2} r5 = JOIN r4 WITH DataFlowImpl::TNil#ff_1#join_rhs AS R ON FIRST 1 OUTPUT r4.<2>, r4.<1>
                      251        ~50%     {2} r6 = r1 \/ r5
                      323        ~67%     {3} r7 = JOIN r6 WITH DataFlowImpl::flow#ff AS R ON FIRST 1 OUTPUT r6.<1>, r6.<0>, R.<1>
                      288        ~58%     {3} r8 = SELECT r7 ON r7.<2> >= r7.<0>
                      251        ~53%     {3} r9 = SELECT r8 ON r8.<2> <= r8.<0>
                      251        ~50%     {2} r10 = SCAN r9 OUTPUT r9.<1>, r9.<0>
```
2020-02-07 12:08:31 +01:00
Calum Grant
389e6266d9 Merge pull request #2773 from hvitved/csharp/useless-assignment-to-local-default
C#: Remove false positives for `cs/useless-assignment-to-local`
2020-02-07 10:37:19 +00:00
james
f2320bbe56 docs: add link to module resolution in ql spec 2020-02-07 10:26:31 +00:00
Erik Krogh Kristensen
8ea6070120 add indirect command injection sink for a concatenated array 2020-02-07 11:04:34 +01:00
Asger Feldthaus
a2fa6bb41f JS: Add test case for lazy-cache 2020-02-07 09:50:37 +00:00
Jonas Jensen
19286bd82a Merge pull request #2765 from MathiasVP/ir-gvn-ast-wrapper-fixup
C++: Make AST GVN a wrapper for IR-based GVN
2020-02-07 08:49:15 +01:00
semmle-qlci
e05dd352ad Merge pull request #2768 from asger-semmle/js/protopol-packages
Approved by esbena
2020-02-07 07:21:04 +00:00
yo-h
9c3fed7550 Merge pull request #2734 from aschackmull/java/taint-postupdate
Java: Improve taint step modeling to use postupdate nodes.
2020-02-06 21:17:55 -05:00
Robert Marsh
dac4f0fac0 Merge pull request #2763 from jbj/ir-VariableNode
C++: DefaultTaintTracking perf fix for globals
2020-02-06 18:54:14 -05:00
Robert Marsh
2d3a742b7f C++: autoformat and accept test changes 2020-02-06 13:41:00 -08:00
Robert Marsh
692207472a Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-02-06 11:42:30 -08:00
Tom Hvitved
b3af3ad12f Data flow: Fix bad join order in getReturnPosition()
Joining on the enclosing callable before the kind is crucial, as witnessed by this pipeline:

```
[2020-02-06 17:58:21] (1086s) Starting to evaluate predicate DataFlowImplCommon::getReturnPosition#ff/2@83c546
[2020-02-06 18:53:16] (4382s) Tuple counts for DataFlowImplCommon::getReturnPosition#ff:
                      385478      ~1%     {3} r1 = SCAN DataFlowImplCommon::Cached::TReturnPosition0#fff@staged_ext AS I OUTPUT I.<2>, I.<0>, I.<1>
                      385478      ~2%     {3} r2 = JOIN r1 WITH DataFlowImplCommon::Cached::TReturnPosition0#fff_2#join_rhs AS R ON FIRST 1 OUTPUT r1.<2>, r1.<1>, r1.<0>
                      58638116860 ~0%     {3} r3 = JOIN r2 WITH DataFlowImplCommon::ReturnNodeExt::getKind_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r2.<1>, r2.<2>
                      914049      ~0%     {2} r4 = JOIN r3 WITH DataFlowImplCommon::returnNodeGetEnclosingCallable#ff AS R ON FIRST 2 OUTPUT r3.<0>, r3.<2>
                                          return r4
```
2020-02-06 19:06:40 +01:00
Mathias Vorreiter Pedersen
538c2b205d C++: Accept output 2020-02-06 18:44:08 +01:00
Asger Feldthaus
91a5385e7f JS: Add libraries to change note 2020-02-06 14:59:52 +00:00
Asger Feldthaus
a628f787e8 JS: Fix qldoc comment 2020-02-06 14:59:52 +00:00
Asger Feldthaus
f84af74d1d JS: Handle more libraries 2020-02-06 14:59:52 +00:00
Asger Feldthaus
c559ab13e7 JS: Add test and handle parameter with source object 2020-02-06 14:59:52 +00:00
Asger Feldthaus
34a9dce33d JS: Detect property enumeration through for-own 2020-02-06 14:59:52 +00:00
Asger Feldthaus
418f841749 JS: Handle imports through lazy-cache 2020-02-06 14:59:52 +00:00
semmle-qlci
180e9d4731 Merge pull request #2779 from asger-semmle/js/protopol-regression-fix
Approved by esbena
2020-02-06 14:58:19 +00:00
Mathias Vorreiter Pedersen
2017ca8154 C++/C#: Sync identical files 2020-02-06 15:53:23 +01:00
Mathias Vorreiter Pedersen
f02513e376 C++: Exclude UnknownLocation results from getLocation if there is a location that's known 2020-02-06 15:53:22 +01:00
Mathias Vorreiter Pedersen
23ca363b87 C++: Formatting 2020-02-06 15:53:22 +01:00
Mathias Vorreiter Pedersen
98969e3bf9 C++: Accepted ir_gvn output after toString change 2020-02-06 15:53:22 +01:00
Erik Krogh Kristensen
75f23a189d update docstring
Co-Authored-By: Asger F <asgerf@github.com>
2020-02-06 15:53:03 +01:00
Mathias Vorreiter Pedersen
0d181a7101 C++: Add tests and accept output 2020-02-06 15:48:08 +01:00
Erik Krogh Kristensen
2865723059 add test for new barrier 2020-02-06 15:44:33 +01:00
Erik Krogh Kristensen
ade93e66e1 move the if(!x) from DataFLow to TaintTracking 2020-02-06 15:44:22 +01:00
Mathias Vorreiter Pedersen
69e085dda7 C++: Add getDebugString predicate and use it in ValueNumberPropertyProvider 2020-02-06 15:43:57 +01:00
Mathias Vorreiter Pedersen
ef89e3bdb5 C++: Added charpred to ensure that only instructions that have a source representation have a GVN 2020-02-06 15:43:57 +01:00
Mathias Vorreiter Pedersen
63f1d3ded7 C++: Replace rank[1] with min 2020-02-06 15:43:57 +01:00
Mathias Vorreiter Pedersen
2303dac0b7 C++: Implemented getKind to new GVN class and added predicates for obtaining expressions from a GVN 2020-02-06 15:43:57 +01:00
Mathias Vorreiter Pedersen
8041804bac C#: Include TValueNumber in internal files 2020-02-06 15:39:27 +01:00
Robert Marsh
2f91778e7e C++: add IR-based wrapper for value numbering 2020-02-06 15:35:20 +01:00
Robert Marsh
ffaaed0550 C++: separate IR ValueNumber newtype and interface 2020-02-06 15:35:20 +01:00
Asger Feldthaus
75c008eec1 JS: Change note 2020-02-06 14:33:20 +00:00
Asger Feldthaus
7090124a1d JS: Implement type inference through export * as ns 2020-02-06 14:29:35 +00:00
Asger Feldthaus
a252a41459 JS: Rename/deprecate a predicate to loosen its return type 2020-02-06 14:27:23 +00:00
Asger Feldthaus
2b77c7969d JS: Add tests for 'export * as ns' 2020-02-06 14:04:12 +00:00
Asger Feldthaus
f5c805bad1 JS: Move tests into one file 2020-02-06 13:55:29 +00:00
Asger Feldthaus
54c521d41c JS: Fix typo in test query 2020-02-06 13:50:06 +00:00
Rasmus Wriedt Larsen
c0b7dcc019 Python: Remove ignored automatic_locations in qltest options files 2020-02-06 14:28:10 +01:00
Rasmus Wriedt Larsen
397c17c4ff Python: Use --lang=3 in tests
With internal update to qltest it will not actually do something.

- also remove it from the tests that never needed it.
2020-02-06 14:20:59 +01:00
Jonas Jensen
4997aa7428 Merge pull request #2772 from MathiasVP/more-gvn-loads
C++: Better value numbering support for loading fields in IR
2020-02-06 14:15:27 +01:00
Rasmus Wriedt Larsen
cb891a1a49 Python: Clean up six tests
We can't understand the real `six.py` file, so we have some internal plumbing
that enables us to handle six anyway. While updating that, I had a hell of a lot
of trouble with these tests.

What we actually want, is to see that we can understand what the values imported
from six are (i.e., their points-to information). I added a few more, that I
think would be useful. If we can figure out all of these, I don't actually care
if we're doing it by understanding the real `six.py` file, or by some internal
trick.

I verified that we don't get results with the real `six.py` file by disabling
our internal tricks, and putting a copy of six.py just next to test.py.

We used to have an other file that would list all the properties we knew and
their value, but that turned out to be a fragile and annoying test, since the
results differed from which version of python you ran it with (3.5 vs 3.8) and
which machine you ran it on (my machien vs jenkins). I don't care about the
results in this file, and I can certainly not eyeball it to see if it's correct
or not.
2020-02-06 13:50:51 +01:00
Jonas Jensen
2e883ab4b2 Merge pull request #2760 from geoffw0/defaulttainttest3
C++: Emulate old security library's use of predictable more accurately.
2020-02-06 13:47:27 +01:00
semmle-qlci
75bdf42850 Merge pull request #2770 from asger-semmle/js/update-extractor-version-string
Approved by erik-krogh
2020-02-06 12:41:46 +00:00
Erik Krogh Kristensen
1f7dda7fbc add dataflow barrier for if(xrandr) 2020-02-06 12:55:44 +01:00
Anders Schack-Mulligen
aa8ebf4fe1 Merge pull request #2764 from JLLeitschuh/patch-1
Add DefaultFullHttpResponse to Netty Check
2020-02-06 12:19:04 +01:00
Asger Feldthaus
0345c48503 JS: Bump extractor version string 2020-02-06 11:04:59 +00:00
Mathias Vorreiter Pedersen
19e1d82708 Merge pull request #2686 from jbj/ir-crement-load
C++: Move the LoadInstruction from `++` to `e` in `e++`.
2020-02-06 11:53:55 +01:00
Rasmus Wriedt Larsen
d5c6092920 Python: Fix typo (trakcing => tracking) 2020-02-06 11:50:44 +01:00
Asger Feldthaus
38ef07ce73 JS: Fix join ordering 2020-02-06 10:29:05 +00:00
Mathias Vorreiter Pedersen
aaa6233a99 C++/C#: Sync identical files 2020-02-06 11:24:07 +01:00
Mathias Vorreiter Pedersen
527181bb6f C++: Rename CongruentCopyInstructionTotal to LoadTotalOverlapInstruction and extend LoadInstruction instead of CopyInstruction 2020-02-06 11:23:42 +01:00
Geoffrey White
2dfeafac30 C++: Interaction with another PR. 2020-02-06 10:21:55 +00:00
semmle-qlci
90f94e2e54 Merge pull request #2777 from erik-krogh/TaintedPathTests
Approved by esbena
2020-02-06 10:18:24 +00:00
Geoffrey White
851c1134f3 C++: Add 'strlen' back. 2020-02-06 10:17:37 +00:00
Geoffrey White
860d0aa42f C++: Remove single argument functions. 2020-02-06 10:17:37 +00:00
Geoffrey White
539d6716f5 C++: Remove commented entries. 2020-02-06 10:17:37 +00:00
Geoffrey White
d54d7e8410 C++: Post-merge fix. 2020-02-06 10:17:37 +00:00
Geoffrey White
2fddb09a30 C++: New autoformat. 2020-02-06 10:17:37 +00:00
Geoffrey White
95c77ca3c6 C++: Update comment. 2020-02-06 10:17:37 +00:00
Geoffrey White
9c05ffeb3a C++: Emulate old security library's use of predictable more accurately. 2020-02-06 10:17:37 +00:00
Anders Schack-Mulligen
75f7671e75 Java: Fix .expected 2020-02-06 10:27:44 +01:00
Mathias Vorreiter Pedersen
f4bbdee6c2 Merge pull request #2745 from Cornelius-Riemenschneider/cpp-range-analysis
C++: Fix bug in range analysis.
2020-02-06 10:10:06 +01:00
Erik Krogh Kristensen
d8a30c48a3 update expected output of TaintedPath tests 2020-02-06 09:47:15 +01:00
Mathias Vorreiter Pedersen
ba395cf11a C++: Update test annotations and accept output 2020-02-06 09:26:33 +01:00
Mathias Vorreiter Pedersen
cfcf087d3c C++: Add comment explaining buggy value number 2020-02-06 09:26:33 +01:00
Mathias Vorreiter Pedersen
4f2775012a C++/C#: Sync identical files 2020-02-06 09:26:33 +01:00
Mathias Vorreiter Pedersen
5e5bd92cba C++: Accept output 2020-02-06 09:26:33 +01:00
Mathias Vorreiter Pedersen
54f0b4a099 C++: Add more support for load instructions 2020-02-06 09:21:42 +01:00
Mathias Vorreiter Pedersen
687dcb7ad1 C++: Add testcase demonstrating unexpectly different value numbers 2020-02-06 09:21:42 +01:00
Jonas Jensen
91927c9039 Merge remote-tracking branch 'upstream/master' into ir-crement-load
Conflicts:
	cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected
	cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected
	cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected
	cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected
2020-02-06 08:37:09 +01:00
Jonas Jensen
c0417ac161 Merge pull request #2740 from dbartol/dbartol/InitializeNonLocal
C++: Prevent `AliasedVirtualVariable` from overlapping string literals
2020-02-06 08:28:01 +01:00
semmle-qlci
5125dc7939 Merge pull request #2730 from esbena/js/model-path-parse
Approved by asgerf
2020-02-05 21:35:55 +00:00
Dave Bartolomeo
e06f468b59 C++: Fix test expectations after EDG update 2020-02-05 14:34:29 -07:00
Cornelius Riemenschneider
7f7cc7bece Include test output for the fixed test. 2020-02-05 22:33:26 +01:00
Cornelius Riemenschneider
c941348fea Fix test so it actually shows up in the test output. 2020-02-05 22:29:44 +01:00
Dave Bartolomeo
c53f80175f Merge pull request #2750 from Cornelius-Riemenschneider/cpp-range-analysis-casts
C++: Support implicit casts better in range analysis
2020-02-05 13:59:09 -07:00
Jonas Jensen
81b1bd4177 Merge pull request #2769 from aschackmull/java/perf-regression
Java: Improve performance.
2020-02-05 20:15:18 +01:00
Tom Hvitved
69d9d4122a C#: Add change note 2020-02-05 20:12:41 +01:00
Tom Hvitved
85e6b24c49 C#: Remove false positives for cs/useless-assignment-to-local 2020-02-05 20:12:39 +01:00
Tom Hvitved
d9f9fc510f C#: Add more tests for cs/useless-assignment-to-local 2020-02-05 20:11:22 +01:00
Dave Bartolomeo
4c31c038b8 Merge from master 2020-02-05 11:23:14 -07:00
Dave Bartolomeo
4362bdb626 C++: Accept new test output 2020-02-05 10:56:40 -07:00
Dave Bartolomeo
1b6de4b32f C++: Fix formatting 2020-02-05 10:55:49 -07:00
Jonathan Leitschuh
60f2fa9eb9 Update java/ql/src/Security/CWE/CWE-113/NettyResponseSplitting.ql 2020-02-05 12:45:47 -05:00
Jonas Jensen
a0e2d59c01 C++: Add tests for global-var support 2020-02-05 16:31:13 +01:00
Jonas Jensen
f40acc19d2 C++: Use VariableNode in DefaultTaintTracking 2020-02-05 16:29:13 +01:00
Jonas Jensen
6d081a997a C++: Add VariableNode 2020-02-05 16:29:13 +01:00
Jonas Jensen
73e34f1447 C++: Refactor to separate out InstructionNode
This commit prepares the IR data-flow library for having more than one
type of data-flow node.
2020-02-05 16:29:13 +01:00
Jonas Jensen
cdfcee3ae9 Merge remote-tracking branch 'upstream/master' into ir-crement-load
Conflicts:
	cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected
	cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected
2020-02-05 16:13:21 +01:00
Anders Schack-Mulligen
ba86dea657 Java: Improve taint step modeling to use postupdate nodes. 2020-02-05 15:33:29 +01:00
Anders Schack-Mulligen
07482abed7 Java/C++/C#: Sync. 2020-02-05 15:17:20 +01:00
Anders Schack-Mulligen
274919ca08 Java: Fix recent perf regressions. 2020-02-05 15:15:15 +01:00
yo-h
b5f3d776bf Merge pull request #2759 from aschackmull/java/taint-tests
Java: Move some taint tests.
2020-02-05 09:09:43 -05:00
semmle-qlci
163285bee7 Merge pull request #2735 from asger-semmle/prototype-pollution-manual-dataflow
Approved by esbena
2020-02-05 12:52:59 +00:00
Ian Lynagh
67d7e83c17 Merge pull request #2727 from matt-gretton-dann/codeql-c-extractor/7-edg-60-upgrade
Update expected results for changes in Extractor FE
2020-02-05 12:23:02 +00:00
Erik Krogh Kristensen
da28d3b971 add "hash" and "search" to URL taint step 2020-02-05 12:44:10 +01:00
Felicity Chapman
d0e7bfce28 Merge pull request #2738 from aschackmull/java/ldapinjection-changenote
Java: Add change note for LDAP injection query.
2020-02-05 11:29:29 +00:00
semmle-qlci
a5e183bde3 Merge pull request #2619 from asger-semmle/ts-monorepo-deps
Approved by erik-krogh, max-schaefer
2020-02-05 10:57:55 +00:00
semmle-qlci
53763c789f Merge pull request #2741 from esbena/js/split-and-slice-for-tainted-path
Approved by erik-krogh
2020-02-05 10:53:39 +00:00
Jonas Jensen
2928f9e5b2 Merge pull request #2703 from rdmarsh2/connect-ir-dataflow-models
C++: IR dataflow through modeled functions
2020-02-05 11:28:48 +01:00
semmle-qlci
52f34d7178 Merge pull request #2715 from erik-krogh/PrivateFields
Approved by asgerf
2020-02-05 10:20:28 +00:00
Erik Krogh Kristensen
88bb1dc23d bind this in each of the step methods of UrlSearchParamsTaintStep 2020-02-05 10:58:13 +01:00
Erik Krogh Kristensen
30d5eb5a13 update docstrings 2020-02-05 10:53:34 +01:00
Erik Krogh Kristensen
ffc6fddddd update expected test output 2020-02-05 10:52:40 +01:00
Asger F
cf18bd7bb8 Update javascript/ql/src/Security/CWE-400/PrototypePollutionUtility.ql
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-02-05 09:48:16 +00:00
Asger Feldthaus
fd9975db85 JS: Address comments 2020-02-05 09:47:51 +00:00
Esben Sparre Andreasen
f6ad22dd1f Merge pull request #2758 from asger-semmle/js/string-concat-concat
JS: Model concat() calls as string concatenation
2020-02-05 10:41:02 +01:00
Erik Krogh Kristensen
ec9c37075c address review feedback 2020-02-05 10:31:53 +01:00
Erik Krogh Kristensen
35a7e15a2f remove private modifer on isUrlSearchParams 2020-02-05 10:30:31 +01:00
Erik Krogh Kristensen
76aca02752 change the pseudo-property on URL to a two-stage process 2020-02-05 10:27:03 +01:00
Matthew Gretton-Dann
b601908577 CPP: Update for changes in EDG IL. 2020-02-05 09:11:23 +00:00
Matthew Gretton-Dann
1b67f47918 C++: Update with improved location information
EDG 6.0 gives better location in some circumstances changing the results
of these tests for the better.
2020-02-05 09:11:23 +00:00
Matthew Gretton-Dann
cec6646846 C++: Update for EDG 6.0 behaviour change
EDG 6.0 has changed how much information it gives about invalid
expressions.  Changing the output of this test.
2020-02-05 09:11:23 +00:00
Erik Krogh Kristensen
e525cf0959 generalize isAdditionalLoadStoreStep such that it loads and stores different properties 2020-02-05 09:40:16 +01:00
Anders Schack-Mulligen
7d19eb7c05 Java: Add LICENSE.txt 2020-02-05 09:38:16 +01:00
Dave Bartolomeo
73ad2e9658 Merge from master 2020-02-04 18:33:10 -07:00
Dave Bartolomeo
a23d5afc6c C++: Add test case to demonstrate string literl aliasing change
Also fixed a minor bug where we should have been treating `AllNonLocalMemory` as _totally_ overlapping an access to a non-local variable, rather than _partially_ overlapping it. This fix is exhibited both in the new test case and in a couple existing test functions in `ssa.cpp`.
2020-02-04 18:24:08 -07:00
Jonathan Leitschuh
832a4f2e07 Add DefaultFullHttpResponse to Netty Check 2020-02-04 15:40:59 -05:00
Robert Marsh
1576bcfa3f C++: remove unused predicates 2020-02-04 12:08:03 -08:00
Jonas Jensen
c77a921b06 Merge pull request #2695 from rdmarsh2/default-taint-tracking-diff-test
C++: add diff tests for DefaultTaintTracking
2020-02-04 20:57:55 +01:00
Robert Marsh
ac2e89317b C++: autoformat 2020-02-04 10:41:30 -08:00
Robert Marsh
861d5eb86b C++: update tests after merge 2020-02-04 10:29:52 -08:00
Robert Marsh
785d54ac67 Merge branch 'master' into default-taint-tracking-diff-test 2020-02-04 09:50:05 -08:00
Asger Feldthaus
b4df03767d JS: Ignore obvious Array.prototype.concat calls 2020-02-04 16:36:41 +00:00
Asger Feldthaus
db2212e33e TS: Only print number of errors if there were any 2020-02-04 15:31:30 +00:00
Erik Krogh Kristensen
8d37c03209 using pseudo-properties to model URL parsing 2020-02-04 16:30:07 +01:00
Anders Schack-Mulligen
cf815351a9 Java: Elaborate change note. 2020-02-04 16:18:35 +01:00
Asger Feldthaus
3ccdaa94ad JS: Expose argumentPassing as DataFlow::argumentPassingStep 2020-02-04 15:06:45 +00:00
Asger Feldthaus
c185cededf JS: More pruning and more data flow 2020-02-04 15:06:42 +00:00
Tom Hvitved
6e14ba4e56 C++: Follow-up changes 2020-02-04 14:09:12 +01:00
Tom Hvitved
15ee1e37b9 Java: Follow-up changes 2020-02-04 14:09:12 +01:00
Tom Hvitved
c591719df2 Data flow: Sync files 2020-02-04 14:09:12 +01:00
Tom Hvitved
7678cb0349 C#: Remove Public wrapper module from DataFlowImplCommon.qll 2020-02-04 14:09:12 +01:00
Tom Hvitved
fed6dd5324 C#: Generalize data-flow flow-through summaries
The predicate

```
argumentValueFlowsThrough(ArgumentNode arg, OutNode out, CallContext cc)
```

has been generalized to

```
argumentValueFlowsThrough(
  DataFlowCall call, ArgumentNode arg, Node out, ContentOption contentIn,
  ContentOption contentOut
)
```

This enables us to summarize normal flow-through (as before), getters, setters,
as well as getter-setters.
2020-02-04 14:09:12 +01:00
semmle-qlci
4b89eee683 Merge pull request #2757 from max-schaefer/js/resolveMainModule-extensions
Approved by asgerf
2020-02-04 13:07:08 +00:00
Erik Krogh Kristensen
15e26666cd add declaration for private field in syntax error test 2020-02-04 14:05:09 +01:00
Rasmus Wriedt Larsen
de63eb1450 Merge pull request #2592 from tausbn/python-remove-manual-tc-in-ssashortcut
Python: Remove manual TC from `ssaShortCut`.
2020-02-04 14:04:25 +01:00
Anders Schack-Mulligen
2b1723dd88 Java: Move some taint tests. 2020-02-04 13:21:31 +01:00
Tom Hvitved
00fdc70155 Merge pull request #2710 from calumgrant/cs/short-circuit-out
C#: Remove false positive in cs/non-short-circuit
2020-02-04 12:09:17 +01:00
Mathias Vorreiter Pedersen
0276c97b9c Merge pull request #2755 from jbj/BarrierGuard-SSA
C++: Don't use GVN in AST DataFlow BarrierNode
2020-02-04 12:00:12 +01:00
Rasmus Wriedt Larsen
c1d073a54d Python: Add test-cases for py/hardcoded-credentials 2020-02-04 11:42:11 +01:00
Rasmus Wriedt Larsen
2837f987c5 Python: Show how pointsTo handles 0+0 == 0 (2/2) 2020-02-04 11:42:11 +01:00
Rasmus Wriedt Larsen
4231bb1bcf Python: Show how pointsTo handles 0+0 == 0 (1/2) 2020-02-04 11:42:11 +01:00
Rasmus Wriedt Larsen
6b5b28aded Python: Add Value.getABooleanValue and Value.getDefiniteBooleanValue
Replacing `Value.booleanValue`. We wanted to match `Object.booleanValue` that
only gives a result if it is either `true` or `false`, but also wanted to keep
the flexibility to see if the Value _could_ be `true`/`false`. We don't have a
motivating usecase, so let's see if we ever need it :P

+ fix modernisation regression on py/jinja2/autoescape-false
2020-02-04 11:42:11 +01:00
Rasmus Wriedt Larsen
bd1f21fb7a Python: Fix modernisation regression on py/weak-crypto-key
also fixes test code to use the right argument name
2020-02-04 11:42:11 +01:00
Rasmus Wriedt Larsen
e5abfd0196 Python: Modernise Security/ queries 2020-02-04 11:42:11 +01:00
Rasmus Wriedt Larsen
2802ac2e72 Python: Add NumericValue
Since `IntObjectInternal` extends `TInt`, and `TInt` is defined for all
instances of `Builtin.intValue`, and `Builtin.intValue` includes both `int` and
`long`, we don't need to handles Longs in a special manner, as we did in NumericObject.
2020-02-04 11:39:16 +01:00
Asger Feldthaus
bf2c944b4f JS: Model concat() calls as string concatenation 2020-02-04 10:20:37 +00:00
Esben Sparre Andreasen
1ec8fa24b3 JS: reformulate optimization 2020-02-04 10:52:38 +01:00
Esben Sparre Andreasen
8a2c81b41c JS: address review comments about duplicated logic 2020-02-04 10:49:23 +01:00
Max Schaefer
43e4ed1e18 JavaScript: Teach resolveMainModule to try adding extensions. 2020-02-04 09:39:04 +00:00
Max Schaefer
e21c24c60e JavaScript: Add failing test case. 2020-02-04 09:39:04 +00:00
Esben Sparre Andreasen
e1180495f5 JS: optimize a prefix-check 2020-02-04 09:48:56 +01:00
semmle-qlci
bd51ef35b7 Merge pull request #2731 from erik-krogh/CVE527
Approved by esbena
2020-02-04 08:38:26 +00:00
Jonas Jensen
b4385c6e60 C++: Don't use GVN in AST DataFlow BarrierNode
It turns out that the evaluator will evaluate the GVN stage even when no
predicate from it is needed after optimization of the subsequent stages.
The GVN library is expensive to evaluate, and it'll become even more
expensive when we switch its implementation to IR.

This PR disables the use of GVN in `DataFlow::BarrierNode` for the AST
data-flow library, which should improve performance when evaluating a
single data-flow query on a snapshot with no cache. Precision decreases
slightly, leading to a new FP in the qltests.

There is no corresponding change for the IR data-flow library since IR
GVN is not very expensive.
2020-02-04 08:40:36 +01:00
Robert Marsh
eafd7b6045 C++: accept test output 2020-02-03 15:27:34 -08:00
Robert Marsh
677f0f090a Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-02-03 13:06:35 -08:00
Robert Marsh
931c0e982e Merge pull request #2748 from MathiasVP/value-numbering-indirection
C++: Indirection for ValueNumbering
2020-02-03 14:41:58 -05:00
Robert Marsh
f51841ac37 Merge pull request #2736 from jbj/buffer-type-size
C++: Workaround for problem with memcpy flow
2020-02-03 14:31:28 -05:00
Robert Marsh
3bfcf0bf46 Merge branch 'master' into connect-ir-dataflow-models 2020-02-03 11:06:45 -08:00
Cornelius Riemenschneider
36479d3fd6 Support to keep bounds derived on implicit integer casts. 2020-02-03 17:33:06 +01:00
Cornelius Riemenschneider
cf8efbb5a0 Add testcase. 2020-02-03 17:23:24 +01:00
Robert Marsh
2b10cd6228 Merge pull request #2737 from jbj/DefaultTaintTracking-indirect-parameters
C++: Interprocedural indirections in DefaultTaintTracking.qll
2020-02-03 11:12:38 -05:00
Esben Sparre Andreasen
bbd60f52ba JS: add additional flow steps to js/path-injection 2020-02-03 16:36:25 +01:00
Mathias Vorreiter Pedersen
8aae2990d0 C++: Formatting 2020-02-03 16:15:49 +01:00
Mathias Vorreiter Pedersen
a8b3bcb87d C++: Indirection for value numbering 2020-02-03 16:13:32 +01:00
Erik Krogh Kristensen
e3189aaa47 raise syntax error on declaration of private method, and add syntax tests for private fields 2020-02-03 16:00:25 +01:00
semmle-qlci
3a7845e7fc Merge pull request #2653 from erik-krogh/exceptionFPs
Approved by esbena
2020-02-03 14:15:24 +00:00
Rasmus Wriedt Larsen
d30e6d2b69 Python: Value::forString and friends returns StringValue 2020-02-03 14:35:09 +01:00
Rasmus Wriedt Larsen
27a7d09c94 Python: Fix minor problems in security examples 2020-02-03 14:35:09 +01:00
Rasmus Wriedt Larsen
5bc592514a Python: Consistenly use "a user-provided value"
ReflectedXss was the only query that used it with the "a"
2020-02-03 14:35:09 +01:00
Erik Krogh Kristensen
183dd68d6a add qldoc to isPrivateField 2020-02-03 14:23:27 +01:00
Cornelius Riemenschneider
1b68f86d5b Fix bug in CPP range analysis. 2020-02-03 14:16:48 +01:00
Rasmus Wriedt Larsen
cc73352bf6 Merge pull request #2549 from tausbn/python-fix-several-bad-join-orders
Python: Fix several bad join orders.
2020-02-03 13:54:36 +01:00
Calum Grant
be374816c4 C#: Distinguish between local variables extracted in different compilations. 2020-02-03 12:22:49 +00:00
Erik Krogh Kristensen
99d8b48da0 Merge pull request #2712 from asger-semmle/typescript-resolve-imports
TS: Resolve imports using TypeScript
2020-02-03 12:42:17 +01:00
Asger Feldthaus
3c1cbcefa5 TS: Pass virtual source root explicitly to Node.js process 2020-02-03 10:36:36 +00:00
Asger Feldthaus
513854a608 TS: Add upgrade script 2020-02-03 09:32:56 +00:00
Asger Feldthaus
9abf5f06e6 TS: Resolve imports using TypeScript symbols 2020-02-03 09:32:56 +00:00
Asger Feldthaus
abb95135c1 JS: Add UnresolvableImport metric 2020-02-03 09:32:56 +00:00
Erik Krogh Kristensen
5ff958a9cf fix compilation of PrototypePollutionUtility after refactor 2020-02-03 09:39:41 +01:00
Dave Bartolomeo
fd2cafa95f C++: Accept GVN test output 2020-01-31 13:36:14 -07:00
Jonas Jensen
e2da98ae24 C++: Accept autoformat and test changes 2020-01-31 20:58:53 +01:00
Robert Marsh
3e2b0328b7 C++: update test expectations post-merge 2020-01-31 11:48:51 -08:00
Robert Marsh
089dda9090 Merge branch 'buffer-type-size-test' into jbj/buffer-type-size 2020-01-31 11:31:55 -08:00
Robert Marsh
2dd368fd1f C++: add SSA test for void* buffer parameters 2020-01-31 11:31:28 -08:00
Dave Bartolomeo
e27a0fe504 C++: Prevent AliasedVirtualVariable from overlapping string literals
We were hitting a combinatorial explosion in `hasDefinitionAtRank` for functions that contain a large number of string literals. The problem was that every `Chi` instruction for `AliasedVirtualVariable` was treated as a definition of every string literal. We already mark string literals as `isReadOnly()`, but we were allowing `AliasedVirtualVariable` to define read-only locations so that the `AliasedDefinition` instruction would provide the initial definition for all string literals.

To fix this, I've introduced the new `InitializeNonLocal` instruction, which is inserted in the prologue of every function right after `AliasedDefinition`. It provides the initial definition for every non-stack memory location, including read-only locations, but is never written to anywhere else. It is the conterpart of the `AliasedUse` instruction in the function epilogue, which represents the use of all non-stack memory after the function returns. I considered renaming `AliasedUse` to `ReturnNonLocal`, to match the `InitializeXXX`/`ReturnXXX` pattern we already use for parameters and indirections, but held off to avoid unnecessary churn. Any thoughts on whether I should make this name change?

This change has a significant speedup in evaluation time for a few of our troublesome databases:
`attnam/ivan`: 13%
`awslabs/s2n`: 26%
`SinaMostafanejad/OpenRDM`: 7%
`zcoinofficial/zcoin`: 8%
2020-01-31 11:33:46 -07:00
Esben Sparre Andreasen
7f25c1bf47 JS: address doc-review comments 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
c70997febf JS: address review comments for js/unsafe-jquery-plugin 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
eaff78b37e JS: change severity to warning 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
1de1c15919 JS: minor fixups 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
2ad9b843ae JS: fix FP for js/unsafe-jquery-plugin 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
cfd567f01d JS: fix FP for js/unsafe-jquery-plugin 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
9e247921fc JS: add FP tests for js/unsafe-jquery-plugin 2020-01-31 19:33:04 +01:00
Esben Sparre Andreasen
fef918ac13 JS: add query "Unsafe jQuery plugin" 2020-01-31 19:33:04 +01:00
semmle-qlci
d995d5a4a0 Merge pull request #2716 from esbena/js/additional-koa-requests
Approved by erik-krogh
2020-01-31 18:30:42 +00:00
Anders Schack-Mulligen
7647d94068 Java: Add change note for LDAP injection query. 2020-01-31 16:48:35 +01:00
Anders Schack-Mulligen
3b81c3b95c Merge pull request #2651 from ggolawski/java-ldap-injection
Java LDAP Injection (CWE-90)
2020-01-31 16:43:52 +01:00
Geoffrey White
c24651c4f8 Merge pull request #2728 from alexet/remove-recursion
CPP: Avoid uncessary recursion in printf.qll
2020-01-31 15:38:25 +00:00
Jonas Jensen
83f807f182 C++: Interprocedural indirection taint tracking
As a temporary workaround in the `DefaultTaintTracking` library, we
funnel flow across calls by conflating pointer and object both at the
caller and the callee.

The three cases in `adjustedSink` were deleted because they are now
covered by the one case for `ReadSideEffectInstruction` in
`instructionTaintStep`.

When enabling `DefaultTaintTracking`, this commit on top of #2736 has
the effect effect of recovering two lost results:

    --- a/cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/OverflowDestination.expected
    +++ b/cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/OverflowDestination.expected
    @@ -1,2 +1,4 @@
     | overflowdestination.cpp:30:2:30:8 | call to strncpy | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
     | overflowdestination.cpp:46:2:46:7 | call to memcpy | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
    +| overflowdestination.cpp:53:2:53:7 | call to memcpy | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
    +| overflowdestination.cpp:64:2:64:7 | call to memcpy | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |

In the internal repo, we recover one lost result. Additionally, there
are two queries that gain an extra source for an existing sink. I'll
classify that as noise. The new results look like this:

    foo(argv); // this `argv` is a new source for the sink in `bar`
    bar(argv); // this `argv` is the existing source for the sink in `bar`
2020-01-31 16:28:45 +01:00
Jonas Jensen
a1aed1ad93 C++: Workaround for problem with memcpy flow
The type of the source argument to `memcpy` is `void *`, and somehow
that meant that the copied object itself got type `void`. Since that has
size 0, the SSA construction did not model it as reading from the last
write.

This is probably not the right fix, but maybe it's good enough for now.
The right fix would ensure that the type reported by
`hasOperandMemoryAccess` is `UnknownType`.

When `DefaultTaintTracking.qll` is enabled, this commit has the effect
of restoring a lost results:

    --- a/cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/OverflowDestination.expected
    +++ b/cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/OverflowDestination.expected
    @@ -1 +1,2 @@
     | overflowdestination.cpp:30:2:30:8 | call to strncpy | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
    +| overflowdestination.cpp:46:2:46:7 | call to memcpy | To avoid overflow, this operation should be bounded by destination-buffer size, not source-buffer size. |
2020-01-31 16:04:43 +01:00
Erik Krogh Kristensen
84be6e1286 update docString on getAnAliasedSourceNode 2020-01-31 15:38:19 +01:00
Erik Krogh Kristensen
32bcb18cdf add pragma[inline] to getAnAliasedSourceNode 2020-01-31 15:35:38 +01:00
Erik Krogh Kristensen
72114a48f5 rename getASourceAccess to getAnAliasedSourceNode 2020-01-31 15:34:58 +01:00
Rasmus Wriedt Larsen
2648e34f1a Python: Autoformat security 2020-01-31 14:49:18 +01:00
Tom Hvitved
c31f0e955d C#: Add more flow-through data-flow tests 2020-01-31 13:48:08 +01:00
alexet
cd688367c7 CPP: Avoid uncessary recursion 2020-01-31 12:47:03 +00:00
Rasmus Wriedt Larsen
72fddaf5ed Merge pull request #2733 from tausbn/python-add-stringvalue
Python: Extend `Value` API.
2020-01-31 13:12:14 +01:00
Erik Krogh Kristensen
e6d46b9279 add test for new prefix check on TaintedPath 2020-01-31 12:35:03 +01:00
Taus Brock-Nannestad
ba2bbf1788 Python: Extend Value API.
Adds

- `StringValue` as a new class,
- `Value::booleanValue` which returns the boolean interpretation of the given
  value, and
- `ClassValue::str` which returns the value of the `str` class, depending on the
  Python version.
2020-01-31 12:33:02 +01:00
Erik Krogh Kristensen
b6611b1fb3 add "slice" as a recognized prefix method in ClientSideUrlRedirectCustomizations.qll 2020-01-31 12:24:12 +01:00
Max Schaefer
7855a0b657 Merge pull request #2732 from aschackmull/java/upgrades-qlpack
Java: Add qlpack.yml in upgrades.
2020-01-31 10:53:50 +00:00
Anders Schack-Mulligen
18a8c2b220 Java: Add qlpack.yml in upgrades. 2020-01-31 11:39:46 +01:00
Erik Krogh Kristensen
279c584bb8 fix FP in js/path-injection by recognizing more prefix checks 2020-01-31 11:03:11 +01:00
semmle-qlci
f8d0b4e602 Merge pull request #2618 from erik-krogh/ExceptionalPromise
Approved by asgerf
2020-01-31 07:59:09 +00:00
Robert Marsh
83d611de11 C++: don't conflate pointers in data flow 2020-01-30 16:18:24 -08:00
yo-h
7ca7bdfc46 Merge pull request #2725 from aschackmull/java/sqlinjection-number-barrier
Java: Add java.lang.Number as a sanitizer for SQL injection.
2020-01-30 18:25:24 -05:00
yo-h
b542b08c95 Merge pull request #2726 from aschackmull/java/outputstream-write-taint
Java: Improve taint for OutputStream.write and InputStream.read.
2020-01-30 18:24:00 -05:00
yo-h
563be9f817 Merge pull request #2719 from aschackmull/java/deprecate-parexpr
Java: Deprecate ParExpr
2020-01-30 18:23:13 -05:00
Grzegorz Golawski
3fd8d9eb5c Rename CWE-90 into CWE-090 2020-01-30 22:33:20 +01:00
Grzegorz Golawski
db55ec250a Rename CWE-90 to CWE-090 2020-01-30 22:32:36 +01:00
ggolawski
d065ebddde Merge pull request #3 from aschackmull/java/pr-2651-unittest
Java: Add unit test for ldap injection.
2020-01-30 22:23:20 +01:00
Robert Marsh
209a30688a Merge pull request #2718 from jbj/DefaultTaintTracking-isUserInput
C++: Fix mapping of sources from Expr to Node
2020-01-30 16:22:48 -05:00
Esben Sparre Andreasen
5f1317fa2d JS: model path.parse and its ponyfill package: "path-parse" 2020-01-30 21:26:18 +01:00
Esben Sparre Andreasen
5b5f52979d JS: add uniform support for path, path.posix and path.win32 2020-01-30 21:26:18 +01:00
Tom Hvitved
fdda514a51 C#: Add new class AssignableDefinitionNode to the data-flow library 2020-01-30 20:27:57 +01:00
Robert Marsh
4617940eee Merge branch 'master' into connect-ir-dataflow-models 2020-01-30 08:49:42 -08:00
Robert Marsh
b2a87f64eb Merge pull request #2696 from dbartol/dbartol/Indirections
C++/C#: Alias analysis of indirect parameters
2020-01-30 11:43:26 -05:00
Anders Schack-Mulligen
2a0a568cbb Java: Remove duplicate class. 2020-01-30 17:04:35 +01:00
yo-h
dd517a433a Merge pull request #2671 from aschackmull/java/null-flow
Java: Allow null literals as sources in data flow.
2020-01-30 09:47:46 -05:00
Erik Krogh Kristensen
8fc273b9ec update expected output 2020-01-30 15:19:27 +01:00
Taus
b89273402d Merge pull request #2701 from RasmusWL/python-modernise-metrics
Python: modernise import related queries
2020-01-30 14:37:39 +01:00
Anders Schack-Mulligen
9bea581a23 Java: Improve taint for OutputStream.write and InputStream.read. 2020-01-30 14:29:56 +01:00
semmle-qlci
3158b8401a Merge pull request #2705 from erik-krogh/CVE75
Approved by asgerf
2020-01-30 13:07:05 +00:00
semmle-qlci
120b50f497 Merge pull request #2708 from asger-semmle/js/react-flow-through-imports
Approved by esbena
2020-01-30 13:05:07 +00:00
Erik Krogh Kristensen
162c19c348 changes based on review 2020-01-30 14:04:04 +01:00
Asger F
b88cc50cdb Apply suggestions from code review
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2020-01-30 12:42:58 +00:00
Asger Feldthaus
1bf8165098 TS: Other review comments 2020-01-30 12:41:02 +00:00
Asger Feldthaus
92dbfb2858 JS: Handle LGTM_WORKSPACE and fix emptiness check 2020-01-30 12:31:25 +00:00
Asger Feldthaus
141d4bfb70 TS: Handle multiple slashes in scope name 2020-01-30 12:28:16 +00:00
Anders Schack-Mulligen
a167577551 Java: Add java.lang.Number as a sanitizer for SQL injection. 2020-01-30 12:01:36 +01:00
Jonas Jensen
d0ac846cac Merge pull request #2721 from aschackmull/java/taintgetter-changenote
Java/C++/C#: Add change note for taint-getters.
2020-01-30 11:42:37 +01:00
Jonas Jensen
148e87c61d C++: Put AliasedSSA.qll in new qlformat style 2020-01-30 11:38:16 +01:00
Anders Schack-Mulligen
ea3d7b1b2f Java: Adjust stubs and unit test. 2020-01-30 11:27:33 +01:00
Erik Krogh Kristensen
7637ebcc03 Merge remote-tracking branch 'upstream/master' into exceptionFPs 2020-01-30 10:56:41 +01:00
Anders Schack-Mulligen
d8b842298c Java: Autoformat. 2020-01-30 10:54:54 +01:00
Anders Schack-Mulligen
843fd37c75 Java: Add change note. 2020-01-30 10:52:16 +01:00
Anders Schack-Mulligen
75c549baa1 Java: Deprecate ParExpr. 2020-01-30 10:52:16 +01:00
Anders Schack-Mulligen
b7a8d0e903 Apply suggestions from code review
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-01-30 10:41:13 +01:00
Jonas Jensen
f0f752844e Merge remote-tracking branch 'upstream/master' into dbartol/Indirections
Conflicts:
	cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll
	csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll
2020-01-30 10:26:44 +01:00
Jonas Jensen
036e16af8b Merge remote-tracking branch 'upstream/master' into ir-crement-load
Conflicts:
	cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll
2020-01-30 09:07:30 +01:00
Jonas Jensen
c4d2163321 Merge pull request #2673 from aschackmull/ql/autoformat-comparisonterm
Java/C++/C#: Autoformat comparison terms
2020-01-30 08:47:50 +01:00
Robert Marsh
71d87be773 C++: add flow through partial loads in DTT 2020-01-29 17:51:42 -08:00
Dave Bartolomeo
790cbf0d6b C#: Fix bad merge 2020-01-29 17:32:15 -07:00
Dave Bartolomeo
6249446ba0 Merge remote-tracking branch 'upstream/master' into dbartol/Indirections 2020-01-29 17:29:44 -07:00
Robert Marsh
1472101613 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-01-29 14:44:29 -08:00
Robert Marsh
74ea9bcdf4 C++: fix merge issue 2020-01-29 14:37:41 -08:00
Robert Marsh
1a458aa450 C++: IR dataflow edges through outparams 2020-01-29 14:37:41 -08:00
Dave Bartolomeo
46c414b53f C++: Document regular expressions in InlineExpectationsTest 2020-01-29 13:24:55 -07:00
Dave Bartolomeo
1277881294 C++: Document InlineExpectationsTest 2020-01-29 13:07:34 -07:00
Esben Sparre Andreasen
31743c42e5 Update javascript/ql/src/semmle/javascript/frameworks/Koa.qll
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-01-29 20:28:29 +01:00
ggolawski
ebd2b932e8 Update java/ql/src/Security/CWE/CWE-90/LdapInjection.qhelp
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-01-29 20:05:20 +01:00
Robert Marsh
37570c7750 Merge pull request #2676 from jbj/dataflow-partial-chi
C++: data flow through partial chi operands where type is known
2020-01-29 13:44:06 -05:00
Jonas Jensen
52d2bebd1c C++: Taint through most partial chi operands
This changes the flow to be taint rather than data flow, and it extends
it to include chi instructions with unknown type as long as they're not
for the `AliasedVirtualVariable`.

We're losing three good test results because these tests are not
affected by `DefaultTaintTracking.qll`. The taint step added here can
later be ported to `TaintTrackingUtil.qll` to recover these results, but
we probably want a better API than transitive-closure search through
instructions before doing that.
2020-01-29 18:02:03 +01:00
Geoffrey White
f673791fe8 Merge pull request #2717 from jbj/DefaultTaintTracking-memcpy
C++: Add taint from gets through memcpy
2020-01-29 16:28:45 +00:00
Mathias Vorreiter Pedersen
bbb0e212e3 Merge pull request #2720 from jbj/taint-diff-import
C++: Always use the old library for the diff test
2020-01-29 17:20:31 +01:00
Calum Grant
7caae01ad1 C#: Exclude fields that are created 2020-01-29 15:47:12 +00:00
Anders Schack-Mulligen
2039ec37e5 Java/C++/C#: Add change note for taint-getters. 2020-01-29 16:26:23 +01:00
Tom Hvitved
474815bf57 Merge pull request #2660 from calumgrant/cs/release-notes
C#: Add release notes and precisions to queries
2020-01-29 16:05:45 +01:00
Jonas Jensen
0436caecdc C++: Always use the old library for the diff test
This change ensures that the diff test will show the difference between
the old and the new library even after we switch the default
implementation of `security.TaintTracking` to be the new one.
2020-01-29 16:03:35 +01:00
Jonas Jensen
4a77f2b53c Merge remote-tracking branch 'upstream/master' into ir-crement-load
Update test output to fix semantic merge conflict.
2020-01-29 15:56:05 +01:00
Jonas Jensen
9b651ea92c C++: Fix mapping of sources from Expr to Node
The code contained the remains of how `isUserInput` in `Security.qll`
used to be ported to IR. It's wrong to use that port since many queries
call `userInput` directly to get the "cause" string.
2020-01-29 15:50:08 +01:00
Jonas Jensen
7bed6ad63b C++: Add taint from gets through memcpy 2020-01-29 15:42:43 +01:00
Esben Sparre Andreasen
a6d3afd817 JS: support additional Koa request sources 2020-01-29 14:49:01 +01:00
Esben Sparre Andreasen
d4d910b681 JS: add koa test 2020-01-29 14:41:23 +01:00
Jonas Jensen
d7e8ea7cc5 Merge pull request #2641 from marcrepo/master
Documentation update for Issue #2623
2020-01-29 13:37:00 +01:00
Jonas Jensen
386e8e87d1 Merge pull request #2645 from geoffw0/typo
CPP: Fix typo.
2020-01-29 13:35:55 +01:00
Anders Schack-Mulligen
743b612d0d Javascript/Python: Sync XML.qll 2020-01-29 13:31:25 +01:00
Anders Schack-Mulligen
0d4b2e4bf7 C#/C++: Autoformat post rebase. 2020-01-29 13:16:46 +01:00
Anders Schack-Mulligen
726a873c3e C#: Autoformat. 2020-01-29 13:15:00 +01:00
Anders Schack-Mulligen
96e4a57edd C++: Autoformat. 2020-01-29 13:11:50 +01:00
Erik Krogh Kristensen
b8834ffcad add support for private fields in classes 2020-01-29 13:10:45 +01:00
Jonas Jensen
02cb8e9cc7 Merge remote-tracking branch 'upstream/master' into dataflow-partial-chi
Conflicts:
	cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
	cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/tainted.expected
2020-01-29 13:03:40 +01:00
Calum Grant
c0379cc3f1 C#: Address review comment: an SQL 2020-01-29 11:46:28 +00:00
Calum Grant
aff0a7534c Update change-notes/1.24/analysis-csharp.md
Fix indentation

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2020-01-29 11:44:17 +00:00
Anders Schack-Mulligen
9b7a728609 Java: Autoformat. 2020-01-29 12:16:25 +01:00
semmle-qlci
fb90c2ba52 Merge pull request #2681 from asger-semmle/csrf-only-session-cookie-access
Approved by erik-krogh, max-schaefer
2020-01-29 10:46:48 +00:00
Anders Schack-Mulligen
9391058363 Java: Add unit test for ldap injection. 2020-01-29 11:37:33 +01:00
Jonas Jensen
27b5902258 Merge pull request #2707 from geoffw0/taint-format
C++: Add TaintFunction model to FormattingFunction
2020-01-29 08:20:34 +01:00
Grzegorz Golawski
bbcfbd7a28 Apply suggestion from code review 2020-01-28 22:34:01 +01:00
Robert Marsh
9504da54d1 Merge pull request #2713 from MathiasVP/dynamic-cast-taint-propagation
C++: Taint propagation through dynamic_cast
2020-01-28 15:09:49 -05:00
Dave Bartolomeo
60a0eff4d7 Merge remote-tracking branch 'upstream/master' into dbartol/Indirections 2020-01-28 12:06:43 -07:00
yo-h
97069a7988 Merge pull request #2683 from aschackmull/java/lshift32
Java: Add new query for large left shifts and bugfix ConstantExpAppearsNonConstant.
2020-01-28 13:30:26 -05:00
Dave Bartolomeo
542579de7f C++: Accept dataflow test changes due to new alias analysis 2020-01-28 10:58:27 -07:00
Dave Bartolomeo
dda32359fa C++: Accept IR dump test results changes due to new alias analysis 2020-01-28 10:58:05 -07:00
Dave Bartolomeo
7013bc6bf4 C++: Update escape analysis tests to new API 2020-01-28 10:57:07 -07:00
Dave Bartolomeo
bb9485d548 C++: Update points_to tests to use new framework 2020-01-28 10:56:49 -07:00
Dave Bartolomeo
af9d90cf46 C++: New test framework that allows expected results as comments in source code 2020-01-28 10:56:13 -07:00
Dave Bartolomeo
d12b140921 C++/C#: Update shared file list 2020-01-28 10:55:38 -07:00
Dave Bartolomeo
976b564b68 C++: Update AliasedSSA to use Allocation instead of IRVariable
This introduces a new type of `MemoryLocation`: `EntireAllocationMemoryLocation`, representing an entire contiguous allocation whose size is not known. This is used to model the memory accesses on `InitializeIndirection` and `ReturnIndirection`.
2020-01-28 10:55:24 -07:00
Dave Bartolomeo
165a45d9b5 C++/C#: Update SimpleSSA to use Allocation instead of IRVariable 2020-01-28 10:53:18 -07:00
Dave Bartolomeo
1bbc875442 C++/C#: Parameterize alias analysis based on AliasConfiguration
Instead of tracking `IRVariable`s directly, alias analysis now tracks instances of the `Allocation` type provided by its `Configuration` parameter. For unaliased SSA, an `Allocation` is just an `IRAutomaticVariable`. For aliased SSA, an `Allocation` is either an `IRVariable` or the memory pointed to by an indirect parameter.
2020-01-28 10:51:21 -07:00
Dave Bartolomeo
b15dd82732 C++/C#: Share alias analysis between C++ and C# 2020-01-28 10:47:37 -07:00
Dave Bartolomeo
1b1fded535 C++/C#: Add new MemoryAccessKind to represent entire allocation 2020-01-28 10:41:53 -07:00
Mathias Vorreiter Pedersen
67d29e31cc C#: Sync identical files 2020-01-28 17:52:45 +01:00
Mathias Vorreiter Pedersen
c1091a03d0 C++: Accept output 2020-01-28 17:38:35 +01:00
Mathias Vorreiter Pedersen
46ce228bce C++: Add instruction for CheckedConvertOrNull and handle it in alias analysis and data flow 2020-01-28 17:36:17 +01:00
Mathias Vorreiter Pedersen
928b0c50d2 C++: Add test demonstrating false negative when using dynamic_cast 2020-01-28 17:31:53 +01:00
Rasmus Wriedt Larsen
4ca72de4cd Python: Fix recommended module for deprecated posixfile
$ python2 -W default -c 'import posixfile'
-c:1: DeprecationWarning: The posixfile module is deprecated; fcntl.lockf() provides better locking

https://docs.python.org/2.7/library/posixfile.html
2020-01-28 16:44:47 +01:00
Rasmus Wriedt Larsen
6c7cddf258 Python: py/import-deprecated-module handle backwards compatible code 2020-01-28 16:36:47 +01:00
Rasmus Wriedt Larsen
e92d6c0459 Python: Stop py/import-deprecated-module from double alerting
This changes the location from the import statement, to the actual expression
2020-01-28 16:15:46 +01:00
Rasmus Wriedt Larsen
7949acc3ef Python: Autoformat 2020-01-28 16:15:21 +01:00
Rasmus Wriedt Larsen
194228850a Python: Add tests for py/import-deprecated-module 2020-01-28 16:15:21 +01:00
Calum Grant
6b377d7ad4 C#: Analysis change notes 2020-01-28 14:59:25 +00:00
Geoffrey White
fc1816cbd7 C++: Update change note. 2020-01-28 14:53:18 +00:00
Geoffrey White
f02ffcbbd2 C++: Modify ParameterIndex to account for varargs. 2020-01-28 14:53:18 +00:00
Geoffrey White
d66f608d41 C++: Taint from FormattingFunction varargs. 2020-01-28 14:53:18 +00:00
Geoffrey White
8b215c155e C++: Correct a few test comments. 2020-01-28 14:51:46 +00:00
Geoffrey White
b1f66ae825 C++: Fix warnings. 2020-01-28 14:51:46 +00:00
yo-h
95d138bf00 Merge pull request #2659 from aschackmull/java/remove-parexpr
Java: Update dbscheme for ParExpr removal.
2020-01-28 09:50:06 -05:00
Erik Krogh Kristensen
aea365c424 adjust API naming 2020-01-28 15:09:31 +01:00
Calum Grant
0b3821c828 C#: Remove false positive for out params 2020-01-28 13:59:33 +00:00
Jonas Jensen
24a50fceef Merge pull request #2709 from MathiasVP/ql-tests-taint-tracking-fixup
C++: Fix annotations in testcase file
2020-01-28 14:52:55 +01:00
Erik Krogh Kristensen
cb16116b4d adjust type-tracking on custom EventEmitters 2020-01-28 14:00:26 +01:00
Mathias Vorreiter Pedersen
287af2bdec C++: Fix annotations in testcase file 2020-01-28 13:51:36 +01:00
Asger F
701d9989be Apply suggestions from code review
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-01-28 12:46:51 +00:00
Asger F
310dd05185 Update javascript/ql/src/Security/CWE-352/MissingCsrfMiddleware.ql
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-01-28 12:46:34 +00:00
Geoffrey White
01dc3661b7 C++: Autoformat. 2020-01-28 12:17:56 +00:00
Rasmus Wriedt Larsen
c25782d6da Python: For web tests, use more precise name HttpResponseSinks
Since there are also HttpRedirectTaintSink, using HttpSink is confusing
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
46f4b74134 Python: Fix tornado lib: a redirect is not a http response 2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
ee382bb2ea Python: Fix typo (reques => request) 2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
9bc72450a0 Python: Temporarily disable falcon HttpSinks test
I will fix this in an other PR
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
9b2ca0c9c7 Python: Update web libraries to use HttpSources and HttpSinks 2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
2cdbae08b6 Python: Don't make duplicate sink for Tornado handler
`self.write(...)` would be treated as *both* TornadoConnectionWrite and
TornadoHttpRequestHandlerWrite
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
effa4548ab Python: Add toString to TurboGears HttpResponseTaintSinks
Naming these were a bit hard, but better than generic "Taint Sink"
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
6b87458c2e Python: Add explicit tests for HttpSources and HttpSinks
Some of the tests currently fail, since they can't reproduce the old tests
results (since the sinks/sources defined in the library code are not
HttpResponseTaintSink/HttpRequestTaintSource)
2020-01-28 13:06:48 +01:00
Rasmus Wriedt Larsen
b36a6aa5b5 Python: Remove unused variable from exists expression 2020-01-28 13:05:25 +01:00
Rasmus Wriedt Larsen
0a1c91fbb8 Python: Autoformat web tests QL files 2020-01-28 13:05:25 +01:00
Calum Grant
f23438ea65 C#: Add test showing false positive 2020-01-28 11:48:59 +00:00
semmle-qlci
5ab6457370 Merge pull request #2699 from asger-semmle/js/callback-doc-typo
Approved by max-schaefer
2020-01-28 11:00:49 +00:00
Jonas Jensen
23030aa324 Merge pull request #2706 from MathiasVP/ql-tests-taint-tracking
Ql tests for virtual dispatch taint tracking
2020-01-28 11:56:10 +01:00
Asger Feldthaus
b306571d52 JS: Type-track react component factories 2020-01-28 10:22:04 +00:00
Mathias Vorreiter Pedersen
611d9553dd C++: Fix formatting 2020-01-28 10:22:33 +01:00
Anders Schack-Mulligen
0b3c90b526 Java: Fix whitespace query. 2020-01-28 10:15:48 +01:00
Anders Schack-Mulligen
34e6679afd Java: Add upgrade script. 2020-01-28 10:15:48 +01:00
Anders Schack-Mulligen
f8805ebb24 Java: Update 2 queries. 2020-01-28 10:15:48 +01:00
Anders Schack-Mulligen
4bd332ddca Java: Add Expr.isParenthesized, adjust VarAccess.toString, and fix tests. 2020-01-28 10:15:48 +01:00
Anders Schack-Mulligen
597d8e7d94 Java: Update dbscheme for ParExpr removal. 2020-01-28 10:15:48 +01:00
Anders Schack-Mulligen
dc7e8ad2ff Java: Reword help according to review comment. 2020-01-28 10:13:35 +01:00
Anders Schack-Mulligen
a99a6f79cd Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-01-28 10:13:35 +01:00
Anders Schack-Mulligen
4cb28d9b1d Java: Add new query for large left shifts and bugfix ConstantExpAppearsNonConstant. 2020-01-28 10:13:34 +01:00
Mathias Vorreiter Pedersen
130911ad44 C++: Accept new output in already existing test 2020-01-28 10:00:52 +01:00
Mathias Vorreiter Pedersen
fd79e7991d C++: Add tests demonstrating differences between AST virtual dispatch analysis and IR virtual dispatch analysis 2020-01-28 10:00:21 +01:00
Geoffrey White
1ddabee1b8 C++: Change note. 2020-01-28 08:46:46 +00:00
Geoffrey White
30580e97dc C++: Add a TaintFunction model to FormattingFunction. 2020-01-28 08:46:46 +00:00
Geoffrey White
1d46971bb7 C++: Add an ArrayFunction model to FormattingFunction. 2020-01-28 08:46:46 +00:00
Geoffrey White
06f5720cd5 C++: Add taint tests of formatting functions. 2020-01-28 08:46:46 +00:00
Erik Krogh Kristensen
082967a629 add EventEmitter models for net.createServer() and respjs. 2020-01-28 09:38:38 +01:00
Erik Krogh Kristensen
a2e54b1477 add support for this references in classes that extend EventEmitter 2020-01-28 09:37:54 +01:00
yo-h
8c00671f24 Merge pull request #2698 from aschackmull/java/changenote-csrf-query
Java: Add change note for java/spring-disabled-csrf-protection.
2020-01-27 21:09:15 -05:00
Robert Marsh
1b9e375341 C++: Move getACallArgumentOrIndirection 2020-01-27 16:44:41 -08:00
Robert Marsh
fd807d46d6 C++: IR dataflow through modeled functions 2020-01-27 16:38:07 -08:00
Robert Marsh
a9bcc1dcc6 Merge pull request #2667 from dbartol/dbartol/NoEscape
C++/C#: Make escape analysis unsound by default
2020-01-27 19:17:33 -05:00
Robert Marsh
c7975e83a7 Merge pull request #2657 from jbj/DefaultTaintTracking-models
C++: wire up models library to DefaultTaintTracking
2020-01-27 17:41:54 -05:00
Grzegorz Golawski
7b2192d2e3 Apply suggestion from code review 2020-01-27 22:34:15 +01:00
ggolawski
408c49a61c Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-01-27 22:31:51 +01:00
Dave Bartolomeo
7df3cf4c23 C++: Accept more test output after merge 2020-01-27 13:48:43 -07:00
Dave Bartolomeo
3b3502060b Merge remote-tracking branch 'upstream/master' into dbartol/NoEscape 2020-01-27 13:29:18 -07:00
Robert Marsh
79a72a3496 Merge pull request #2680 from geoffw0/modelstrndup
CPP: Model strndup.
2020-01-27 15:19:52 -05:00
Dave Bartolomeo
40952f85a9 C++: Accept test diffs 2020-01-27 10:31:18 -07:00
Robert Marsh
4d743d2bce Merge pull request #2692 from jbj/pure-string-read
C++: Model that string functions read their buffer
2020-01-27 11:40:03 -05:00
Anders Schack-Mulligen
3745388069 Merge pull request #2602 from chrisgavin/suspicious-date-format
Java: Add a query for suspicious date format patterns.
2020-01-27 16:29:48 +01:00
Rasmus Wriedt Larsen
d67577e66c Python: Modernise import related queries
Except for Metrics/Dependencies/ExternalDependenciesSourceLinks.ql, since it is
rather tricky :D
2020-01-27 16:01:25 +01:00
Rasmus Wriedt Larsen
647b9cdcb0 Python: Autoformat query 2020-01-27 16:01:24 +01:00
Rasmus Wriedt Larsen
081d66eaa3 Python: Recognize taint for extended iterable unpacking 2020-01-27 15:28:53 +01:00
Rasmus Wriedt Larsen
1b670354b2 Python: Add tests for extended iterable unpacking 2020-01-27 15:24:55 +01:00
Geoffrey White
4778914154 CPP: Repair flow. 2020-01-27 14:08:03 +00:00
Geoffrey White
d9f6895602 CPP: 'sometimes copying' is considered data flow. 2020-01-27 14:07:39 +00:00
Rasmus Wriedt Larsen
781024d679 Python: Recognize taint for iterable unpacking 2020-01-27 14:43:07 +01:00
Rasmus Wriedt Larsen
a3f1f4cb87 Python: Add iterable unpacking tests 2020-01-27 14:43:07 +01:00
Rasmus Wriedt Larsen
fa48fb04f5 Python: Recognize nested tuple/list assignment
Now we recognize `[(x,y)] = [(1,2)]` -- in itself not a widely used idiom, but
more of a warmup excersize for me
2020-01-27 14:42:54 +01:00
Rasmus Wriedt Larsen
9763ec71fe Python: Add tests for nested assignment 2020-01-27 14:39:34 +01:00
Jonas Jensen
0e3ed2dfa6 C++: Remove test for unrelated issue
The issue for that test is being tested and fixed on PR #2686. Adding a
test here will cause a semantic merge conflict.
2020-01-27 14:25:28 +01:00
Rasmus Wriedt Larsen
9502756874 Python: Autoformat dataflow files 2020-01-27 13:07:01 +01:00
Asger Feldthaus
3d567eb889 JS: Close an unterminated code block 2020-01-27 12:03:58 +00:00
Chris Gavin
484333b192 Java: Update help and description of java/suspicious-date-format. 2020-01-27 11:57:59 +00:00
Chris Gavin
0e8d435ca1 Java: Add a test for java/suspicious-date-format. 2020-01-27 11:57:59 +00:00
Chris Gavin
708890add3 Java: Add a change note for java/suspicious-date-format. 2020-01-27 11:57:56 +00:00
Chris Gavin
88146295f9 Java: Add a query for suspicious date format patterns. 2020-01-27 11:57:18 +00:00
Anders Schack-Mulligen
efe8981129 Java: Add change note for java/spring-disabled-csrf-protection. 2020-01-27 11:33:31 +01:00
Anders Schack-Mulligen
816a8d1f9e Merge pull request #2586 from ggolawski/spring_disable_csrf
Add check for disabled CSRF protection in Spring
2020-01-27 11:32:39 +01:00
Geoffrey White
2c7e2c4506 CPP: Not in std namespace. 2020-01-27 10:20:56 +00:00
Rasmus Wriedt Larsen
1ce77ff600 Merge pull request #2507 from tausbn/python-fix-infinite-tuple-tostring
Python: Fix divergence in tuple `toString`.
2020-01-27 11:14:44 +01:00
semmle-qlci
8a6de11268 Merge pull request #2689 from erik-krogh/LastEventEmitters
Approved by esbena
2020-01-27 08:55:33 +00:00
semmle-qlci
7d9956e3f3 Merge pull request #2675 from erik-krogh/WebSocket
Approved by esbena
2020-01-27 08:40:37 +00:00
Dave Bartolomeo
6988241b09 Merge from master 2020-01-26 16:38:48 -07:00
Dave Bartolomeo
708e83546f C++: Remove acceidentally added tests 2020-01-26 16:20:27 -07:00
Robert Marsh
959ce3b355 C++: add diff tests for DefaultTaintTracking 2020-01-24 13:46:11 -08:00
Jonas Jensen
fb6ad5274f C++: Accept test changes 2020-01-24 22:28:20 +01:00
Robert Marsh
0180672dc0 Merge pull request #2687 from jbj/DefaultTaintTracking-asExpr
C++: Use asExpr, not getConvertedResultExpression
2020-01-24 15:42:58 -05:00
Taus Brock-Nannestad
3cebffe820 Python: Fix divergence in tuple toString.
Our definition of `toString` for the internal tuple objects we create during the
points-to analysis may have been a _tad_ too ambitious. In particular, it can
easily lead to non-termination, e.g. using the following piece of code:

```python
x = ()
while True:
    x = (x, x)
```

This commit cuts off the infinite recursion by replacing _nested_ tuples with
the string "...". In particular this means even non-recursive tuples will be cut
off at that point, so that the following tuples

```python
(1, "2")
((3, 4), [5, 6])
(1, 2, 3, 4, 5)
```

Get the following string representations.

```
"(int 1, '2', )"
"(..., List, )"
"(int 1, int 2, int 3, 2 more...)"
```
2020-01-24 17:08:56 +01:00
Mathias Vorreiter Pedersen
d26cf12c3a Merge pull request #2688 from geoffw0/move-taint-test
C++: Add the security taint test (previously internal).
2020-01-24 15:58:20 +01:00
Jonas Jensen
b290c7b47a C++: Model that string functions read their buffer 2020-01-24 15:53:38 +01:00
semmle-qlci
b3eada829a Merge pull request #2690 from erik-krogh/MoreEvents2
Approved by asgerf
2020-01-24 14:47:04 +00:00
Taus
5a2dfd40af Merge pull request #2639 from RasmusWL/python-improve-dict-taint
Python: Improve tests for tainted collections
2020-01-24 15:06:01 +01:00
Erik Krogh Kristensen
8492f6031f reuse existing type-tracking for classes 2020-01-24 13:36:32 +01:00
Anders Schack-Mulligen
98d527c44c Merge pull request #2685 from esbena/java/sharpen-maven-non-ssl
java: sharpen java/maven/non-https-url to allow localhost URLs
2020-01-24 13:19:26 +01:00
Erik Krogh Kristensen
0b55aed626 use the EventEmitter registration methods instead of just "on" 2020-01-24 13:06:00 +01:00
Erik Krogh Kristensen
148ec9aad0 fix typos
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2020-01-24 12:36:03 +01:00
Geoffrey White
af903fc30c C++: Add the security taint test (previously internal). 2020-01-24 11:28:51 +00:00
Jonas Jensen
ee0648bb57 Merge pull request #2684 from geoffw0/rearrange-tests
CPP: Test cleanup
2020-01-24 11:57:58 +01:00
Asger Feldthaus
7fa0fea253 TS: Address comments in guessMainFile 2020-01-24 10:11:53 +00:00
Asger Feldthaus
1f647223e0 TS: Move definition of mainStr 2020-01-24 10:02:06 +00:00
Esben Sparre Andreasen
8deefd60a7 java: fixup whitespace/tabs in test 2020-01-24 11:01:38 +01:00
Asger Feldthaus
9ed77585a7 Merge branch 'ts-monorepo-deps' of github.com:asger-semmle/ql into ts-monorepo-deps 2020-01-24 09:58:35 +00:00
Asger F
5448bffede Update javascript/extractor/lib/typescript/src/main.ts
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-01-24 09:58:27 +00:00
Asger Feldthaus
3ca5a3dbe4 TS: Document nodeModulesRex 2020-01-24 09:57:40 +00:00
Asger Feldthaus
804aef507f TS: Remove unneeded alias PackageLocationMap 2020-01-24 09:51:03 +00:00
Asger Feldthaus
542ce816dc TS: Simplify string equality check 2020-01-24 09:49:11 +00:00
Asger Feldthaus
fc04e06456 TS: Allow .js extensions in cross package imports 2020-01-24 09:48:43 +00:00
Jonas Jensen
6606b2e18a C++: autoformat fixup 2020-01-24 10:48:03 +01:00
Asger Feldthaus
b98db62e82 JS: Recognize req.user a cookie access 2020-01-24 09:44:20 +00:00
Geoffrey White
912260b3aa C++: Autoformat tests. 2020-01-24 09:43:58 +00:00
Rasmus Wriedt Larsen
5778764a48 Python: Stop using deprecated getName in collections taint test 2020-01-24 10:32:17 +01:00
Rasmus Wriedt Larsen
3db551d6bc Python: Use variables in collection-taint test
They are not tainted in assignment, only in use.

I also adopted an attempt at a better test-setup, where it's easy to see if
everything is the way you hoped for, instead of browsing through 100 of lines of
taint-step output :P
2020-01-24 10:32:17 +01:00
Erik Krogh Kristensen
c0af3780c4 adjust the ReceiveNode docstrings 2020-01-24 10:06:28 +01:00
Jonas Jensen
5eeb5c6e67 C++: Use asExpr, not getConvertedResultExpression
We designed the IR's `DataFlow::Node.asExpr` very carefully so that it's
suitable for taint tracking, but then we didn't use it in
`DefaultTaintTracking.qll`. This meant that the sources in
`ArithmeticWithExtremeValues.ql` didn't get associated with any
`Instruction` and thus didn't propagate anywhere.

With this commit, the mapping of `Expr`-based sources to IR data-flow
nodes uses `asExpr`.
2020-01-24 09:42:26 +01:00
Tom Hvitved
cfbdf21d1b Merge pull request #2682 from calumgrant/cs/format-trap-floats
C#: Fix outputting floats to the trap file
2020-01-24 09:13:18 +01:00
Jonas Jensen
9a45c5570d C++: Move Load from AssignmentOperation to its LHS
This is analogous to what was done for `CrementOperation`.
2020-01-24 09:09:31 +01:00
Jonas Jensen
53b1068a9f C++: Unshare code between assignment types
This commit undoes the code sharing between `TranslatedAssignExpr` (`=`)
and `TranslatedAssignOperation` (`+=`, `<<=`, ...). In the next commit,
when we change how the `Load` works on the LHS of
`TranslatedAssignOperation`, these classes will become so different that
sharing is no longer helpful.
2020-01-24 09:04:09 +01:00
Jonas Jensen
c5950d2c9d C++: IR: Result of x in x++ is now the Load
Previously, the `Load` would be associated with the `CrementOperation`
rather than its operand, which gave surprising results when mapping
taint sinks back to `Expr`.

The changes in `raw_ir.expected` are to add `Copy` operations on the
`x++` in code like `y = x++`. This is now needed because the result that
`x++` would otherwise have (the Load) no longer belongs to the `++`
expression. Copies are inserted to ensure that all expressions are
associated with an `Instruction` result.

The changes in `*aliased_ssa_ir.expected` appear to be just wobble.
2020-01-24 09:02:50 +01:00
Esben Sparre Andreasen
57b3a55b48 java: sharpen java/maven/non-https-url to allow localhost URLs 2020-01-24 08:51:54 +01:00
Esben Sparre Andreasen
a5558809f4 java: add more tests for java/maven/non-https-url 2020-01-24 08:49:59 +01:00
Grzegorz Golawski
968c18d208 Query to detect LDAP injections in Java
Refactoring according to review comments.
2020-01-23 22:51:10 +01:00
Erik Krogh Kristensen
2044b4bc82 changes based on review 2020-01-23 20:29:06 +01:00
yo-h
eb6f8da080 Merge pull request #2679 from aschackmull/java/remove-depr-flow-fwd-back
Java/C++/C#: Remove the deprecated hasFlowForward/hasFlowBackward.
2020-01-23 14:10:28 -05:00
yo-h
50320c7828 Merge pull request #2628 from aschackmull/java/no-adhoc-testclass
Java: Replace ad-hoc TestClass detection.
2020-01-23 14:09:11 -05:00
Geoffrey White
795afa8160 CPP: Better location for the StackVariableReachability test. 2020-01-23 17:32:07 +00:00
Geoffrey White
b693ef51e2 C++: Put a little bit of content in the StackVariableReachability test. 2020-01-23 17:25:26 +00:00
Jonas Jensen
ed3ed5f1b6 C++: Test to show lack of flow to crement operands 2020-01-23 17:42:51 +01:00
Geoffrey White
f16870f8c6 CPP: Autoformat. 2020-01-23 16:20:18 +00:00
Asger Feldthaus
852b90a6c9 TS: Be compatible with odasa/qltest 2020-01-23 16:13:53 +00:00
Calum Grant
35bc78d666 C#: Fix outputting floats to the trap file. In some locales, the extractor output invalid floating point values to the trap file. 2020-01-23 15:43:25 +00:00
Asger Feldthaus
a68bb9ffd1 JS: Ignore calls and csrf/captcha access 2020-01-23 15:32:05 +00:00
Asger Feldthaus
b1ec3e1bf2 JS: Add test and dont check predecessors 2020-01-23 14:59:03 +00:00
Jonas Jensen
33070cc16d Merge pull request #2678 from MathiasVP/union-access-global-virtual-dispatch
C++: IR virtual dispatch through union field access
2020-01-23 15:32:31 +01:00
Asger Feldthaus
406c6eb981 JS: Sharpen missing CSRF middleware query 2020-01-23 14:22:49 +00:00
Geoffrey White
edf2b54813 CPP: Model strndup. 2020-01-23 13:46:57 +00:00
Anders Schack-Mulligen
e7f7c7370a Java/C++/C#: Remove the deprecated hasFlowForward/hasFlowBackward. 2020-01-23 14:05:18 +01:00
Taus
0627fadbff Merge pull request #2669 from RasmusWL/python-modernise-resources
Python: modernise Resources/ queries
2020-01-23 13:43:33 +01:00
Taus
618a35bb7c Merge pull request #2664 from RasmusWL/python-fix-redirect-example
Python: Remove unused variable in example for py/url-redirection
2020-01-23 13:42:00 +01:00
Taus
d06e86f54d Merge pull request #2662 from RasmusWL/python-taint-on-eq-test
Python: Only clear taint on constant comparison in if
2020-01-23 13:41:40 +01:00
Taus
ef7eafa849 Merge pull request #2644 from RasmusWL/python-add-deprecated-keyword
Python: Add deprecated keyword to deprecated functions
2020-01-23 13:41:15 +01:00
Asger Feldthaus
dc30dcf1f8 TS: Only require SCRATCH_DIR when installing dependencies 2020-01-23 12:39:19 +00:00
Mathias Vorreiter Pedersen
5fd1c6fedb C++: Remove parameter from predicate for some tiny performance benefits 2020-01-23 13:29:48 +01:00
Jonas Jensen
8a0089a875 Merge pull request #2672 from geoffw0/qualifierflow
CPP: Support taint flow in and out of qualifiers
2020-01-23 13:17:17 +01:00
Anders Schack-Mulligen
0bbe571064 Update change-notes/1.24/analysis-java.md
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2020-01-23 13:13:51 +01:00
Geoffrey White
166be063a9 C++: Rename test of the now un-deprecated StackVariableReachability. 2020-01-23 11:06:24 +00:00
Geoffrey White
0c4eabca98 C++: Merge two tests of UnusedStaticFunctions from the library-tests into the existing test in query-test. 2020-01-23 11:05:47 +00:00
Geoffrey White
f40a37cae2 C++: Move a test from library-tests to query-tests. 2020-01-23 11:05:47 +00:00
Geoffrey White
fcdb20d1fc C++: Move the SuspiciousCallToStrncat test to the expected location. 2020-01-23 11:05:46 +00:00
Geoffrey White
f4f0f6d93e C++: Merge the StrncpyFlippedArgs tests. 2020-01-23 11:05:46 +00:00
Geoffrey White
3aa66f5aca C++: Merge the OverflowStatic tests. 2020-01-23 11:05:46 +00:00
Rasmus Wriedt Larsen
95f78e74d0 Merge pull request #2674 from tausbn/python-modernise-web-libraries
Python: Modernise remaining web libraries.
2020-01-23 12:01:02 +01:00
Geoffrey White
6743d6d6e5 C#: sync-indentical-files. 2020-01-23 10:22:36 +00:00
Anders Schack-Mulligen
fd141917c7 Java: Add change note. 2020-01-23 11:08:35 +01:00
Geoffrey White
ccf268d048 CPP: Autoformat. 2020-01-23 10:07:21 +00:00
Tom Hvitved
7e042da4f5 Merge pull request #2665 from calumgrant/cs/zipslip-alert
C#: ZipSlip query reports alert at source
2020-01-23 11:05:57 +01:00
Mathias Vorreiter Pedersen
77531294bf C++: Accepted output on tests 2020-01-23 10:20:10 +01:00
Mathias Vorreiter Pedersen
9412ec7f4f C++: Added union field flow for globals 2020-01-23 10:17:36 +01:00
Mathias Vorreiter Pedersen
256ae2fda6 C++: Add test demonstrating a flow not detected 2020-01-23 10:16:24 +01:00
Jonas Jensen
ceeb9ab718 Merge pull request #2622 from MathiasVP/implicit-function-declaration
C++: Add 'implicit function declaration' query
2020-01-23 09:23:44 +01:00
yo-h
9d70358ec4 Merge pull request #2640 from aschackmull/java/nullness-fp-tests
Java: Document two FPs with unit tests.
2020-01-22 16:28:30 -05:00
yo-h
9a939534c7 Merge pull request #2670 from aschackmull/java/remove-parityanalysis
Java: Remove the deprecated ParityAnalysis.
2020-01-22 16:22:34 -05:00
Grzegorz Golawski
bed6a9886f Query to detect LDAP injections in Java
Autoformat
2020-01-22 21:42:47 +01:00
Grzegorz Golawski
5596944926 Add check for disabled CSRF protection in Spring
Fix help and correct formatting.
2020-01-22 21:27:34 +01:00
James Fletcher
f1749b3990 Merge pull request #2654 from calumgrant/cs/null-dereference
C#: Improvements to cs/dereferenced-value-may-be-null
2020-01-22 20:15:20 +00:00
Geoffrey White
1867d58034 CPP: Allow flow to return value. 2020-01-22 16:25:40 +00:00
Geoffrey White
704bfe7184 CPP: Support taint flow from qualifiers. 2020-01-22 16:22:29 +00:00
Geoffrey White
e6daf3b7ee CPP: Support taint flow to qualifiers. 2020-01-22 16:16:31 +00:00
Jonas Jensen
7376daf16e C++: Some data flow through partial chi operands 2020-01-22 17:14:32 +01:00
Geoffrey White
974994ed49 CPP: Slight rearrange. 2020-01-22 16:11:51 +00:00
Geoffrey White
1a6f7febe7 CPP: Add tests of taint through qualifiers. 2020-01-22 16:11:13 +00:00
Jonas Jensen
adc557fd66 C++: Reformat a predicate
This allows adding a multi-line case without the auto-formatting changes
becoming too disruptive.
2020-01-22 16:50:25 +01:00
Jonas Jensen
3827411095 Merge branch 'dbartol/NoEscape' into HEAD 2020-01-22 16:21:24 +01:00
Asger Feldthaus
7e8fb1428e TS: Support tsconfig.json extending from ./node_modules 2020-01-22 15:03:03 +00:00
Taus Brock-Nannestad
0924a973de Python: Modernise remaining web libraries. 2020-01-22 15:27:29 +01:00
Calum Grant
a868456628 C#: Address review comments 2020-01-22 14:21:12 +00:00
Erik Krogh Kristensen
6345e9bde1 add change note 2020-01-22 15:14:10 +01:00
Erik Krogh Kristensen
b526a2ea0f implement a model of WebSocket and ws based on the EventEmitter model 2020-01-22 14:46:53 +01:00
semmle-qlci
007b0795ec Merge pull request #2636 from erik-krogh/NewSocketIO
Approved by esbena
2020-01-22 13:46:11 +00:00
Rasmus Wriedt Larsen
772538ff46 Python: Move tests of collection-taint to own dir 2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
df8be438bb Python: Show that list(tainted_string) works 2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
0da78f216a Python: Show that e, f, g = tainted_list doesn't work 2020-01-22 14:24:50 +01:00
Rasmus Wriedt Larsen
a55c13e61c Python: Improve tests for StringDictKind taint
+ show we handle dict.values()
+ show we don't handle dict.items()
2020-01-22 14:24:50 +01:00
Jonas Jensen
66914e52c6 C++: accept test changes 2020-01-22 14:08:05 +01:00
Jonas Jensen
5ae1e2c4e8 C++: Autoformat 2020-01-22 14:07:55 +01:00
Rasmus Wriedt Larsen
7d9f1f08ee Python: Autoformat 2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
12bb05522a Python: Make py/weak-cryptographic-algorithm a path-problem
and stop using deprecated hasFlow
2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
c5091f1ce7 Python: Make py/hardcoded-credentials a path-problem
and stop using deprecated hasFlow
2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
96d5703f2c Python: Remove use of deprecated methods 2020-01-22 13:45:14 +01:00
Rasmus Wriedt Larsen
e6425bb4cf Python: Add deprecated keyword to deprecated functions 2020-01-22 13:45:14 +01:00
Jonas Jensen
6cdca29aa6 C++: Flow through read side effects
Until we have better tracking of indirections, these flow rules conflate
pointers and their contents.
2020-01-22 13:27:10 +01:00
Jonas Jensen
c24bceddcd C++: Add ReadSideEffectInstruction to IR
There was already a `WriteSideEffectInstruction` class that served as a
superclass for all the specific write side effects. This new class
serves the same purpose for read side effects.
2020-01-22 13:27:10 +01:00
Jonas Jensen
2aaf41a0d8 C++: Test lack of flow through read side effect 2020-01-22 13:27:10 +01:00
semmle-qlci
bc88c41e0b Merge pull request #2668 from erik-krogh/MoreEvents
Approved by esbena
2020-01-22 11:57:11 +00:00
Erik Krogh Kristensen
1228d506b4 update change notes to reflect that library models have improved 2020-01-22 12:52:45 +01:00
Asger Feldthaus
5719b44fa5 TS: Add some documentation 2020-01-22 11:47:02 +00:00
Asger Feldthaus
a220268ad8 TS: Install deps under scratch dir 2020-01-22 11:47:02 +00:00
Asger Feldthaus
303bac9710 TS: Guess main file location 2020-01-22 11:25:24 +00:00
Tom Hvitved
d5daee4450 Merge pull request #2661 from aschackmull/java/remove-dataflowlocation
Java/C++/C#: Remove DataFlowLocation as it's no longer needed.
2020-01-22 12:11:24 +01:00
Anders Schack-Mulligen
b92203a87f Java: Allow null literals as sources in data flow. 2020-01-22 12:04:42 +01:00
Asger Feldthaus
21eecc4c9c JS: Make return type class for installDependencies() 2020-01-22 10:52:38 +00:00
Asger Feldthaus
71b540755d TS: Print TypeScript semantic errors in log 2020-01-22 10:52:37 +00:00
Asger Feldthaus
dde0f868b3 TS: Handle monorepos by rewriting package.json 2020-01-22 10:52:37 +00:00
Anders Schack-Mulligen
cf004ac9d8 Java: Remove the deprecated ParityAnalysis. 2020-01-22 11:45:18 +01:00
Rasmus Wriedt Larsen
aeaaab6437 Python: Modernise Resources/ queries 2020-01-22 11:20:31 +01:00
Rasmus Wriedt Larsen
47b932d6ce Python: Autoformat Resources/ queries 2020-01-22 11:20:28 +01:00
Erik Krogh Kristensen
5063e3820d update expected output 2020-01-22 11:18:47 +01:00
Erik Krogh Kristensen
750e9786f6 add change note for EventEmitter 2020-01-22 10:31:38 +01:00
Dave Bartolomeo
9d35ff73c4 C++/C#: Make escape analysis unsound by default
When building SSA, we'll be assuming that stack variables do not escape, at least until we improve our alias analysis. I've added a new `IREscapeAnalysisConfiguration` class to allow the query to control this, and a new `UseSoundEscapeAnalysis.qll` module that can be imported to switch to the sound escape analysis. I've cloned the existing IR and SSA tests to have both sound and unsound versions. There were relatively few diffs in the IR dump tests, and the sanity tests still give the same results after one change described below.

Assuming that stack variables do not escape exposed an existing bug where we do not emit an `Uninitialized` instruction for the temporary variables used by `return` statements and `throw` expressions, even if the initializer is a constructor call or array initializer. I've refactored the code for handling elements that initialize a variable to share a common base class. I added a test case for returning an object initialized by constructor call, and ensured that the IR diffs for the existing `throw` test cases are correct.
2020-01-22 00:15:30 -07:00
Grzegorz Golawski
c5a974788b Add check for disabled CSRF protection in Spring
Fix the help according to review comments.
2020-01-21 21:54:36 +01:00
Robert Marsh
c79d7acbfc Merge pull request #2656 from jbj/asDefiningArgument
C++: Add DataFlow::Node.asDefiningArgument in IR
2020-01-21 15:42:57 -05:00
Erik Krogh Kristensen
8370699344 add support for creating a promise with another resolved promise, e.g: Promise.resolve(otherPromise) 2020-01-21 20:11:27 +01:00
Erik Krogh Kristensen
8679132624 copy data from both callbacks in Promise data-flow 2020-01-21 18:00:06 +01:00
Erik Krogh Kristensen
86477a2249 changes based on review 2020-01-21 16:45:53 +01:00
Calum Grant
3d460aeb44 C#: ZipSlip query reports alert at source 2020-01-21 15:17:06 +00:00
Erik Krogh Kristensen
fe0b6a86d7 add data-flow steps for when Promise handlers return other promises 2020-01-21 16:15:18 +01:00
Erik Krogh Kristensen
d8b25ef5a2 add data-flow steps for resolved promises using pseudo-properties 2020-01-21 15:52:50 +01:00
Erik Krogh Kristensen
6648e2751f remove use of .getAlocalSource() i custom load/store test 2020-01-21 15:49:42 +01:00
Rasmus Wriedt Larsen
422658bbdb Python: Remove unused variable in example for py/url-redirection 2020-01-21 15:45:05 +01:00
Rasmus Wriedt Larsen
bbe93f43d3 Python: Only comparison with constant will clear taint
tainted = SOURCE
    if tainted == tainted:
        SINK(tainted) # unsafe

before, in the body of the if statement, `tainted` was not tainted
2020-01-21 15:25:57 +01:00
Rasmus Wriedt Larsen
1498145415 Python: Highlight that any comparison will clear taint 2020-01-21 15:24:56 +01:00
Anders Schack-Mulligen
9cc0d3d1f4 Java/C++/C#: Remove DataFlowLocation as it's no longer needed. 2020-01-21 15:08:39 +01:00
Calum Grant
6692e61fa2 C#: Analysis change notes 2020-01-21 13:55:32 +00:00
Calum Grant
be68b6f938 C#: Add precision to queries 2020-01-21 13:24:48 +00:00
Jonas Jensen
84811f66a2 C++: autoformat 2020-01-21 13:21:16 +01:00
Erik Krogh Kristensen
569ee8fc8d add support for subclasses of EventEmitter 2020-01-21 12:08:50 +01:00
Jonas Jensen
6d46e4d946 C++: Wire up models to DefaultTaintTracking
This adds support for arg-to-arg and arg-to-return taint.
2020-01-21 12:04:45 +01:00
Jonas Jensen
fa00e96ba8 C++: Test IR taint through library functions 2020-01-21 12:03:43 +01:00
Jonas Jensen
5ac56c2e3a C++: Add DataFlow::Node.asDefiningArgument in IR 2020-01-21 11:52:06 +01:00
Geoffrey White
80997a3323 Merge pull request #2655 from Semmle/jbj-patch-1
C++: Fix typo in MallocSizeExpr
2020-01-21 09:44:41 +00:00
Jonas Jensen
cdcd3ed748 Merge pull request #2647 from geoffw0/modelpure
CPP: Improve strlen model
2020-01-21 09:42:10 +01:00
Jonas Jensen
0568ed6451 C++: Fix typo in MallocSizeExpr
The first argument is index 0, not 1.
2020-01-21 09:09:49 +01:00
Mathias Vorreiter Pedersen
c9cc459baf C++: Rename .qlhelp to .qhelp 2020-01-20 21:17:53 +01:00
Mathias Vorreiter Pedersen
fddd3660ab C++: Fix formatting in example 2020-01-20 16:05:16 +01:00
Geoffrey White
4f02183dc2 CPP: Re-layout test. 2020-01-20 15:00:09 +00:00
Geoffrey White
2133fbd155 CPP: Fix the nulltermination test. 2020-01-20 14:55:52 +00:00
Erik Krogh Kristensen
026092559c changes based on review 2020-01-20 15:53:58 +01:00
Calum Grant
86fa7e5c38 C#: Analysis change notes 2020-01-20 14:37:28 +00:00
Calum Grant
9d7c9e0ba4 C#: Default parameter values are maybe null
C#: Update test output
2020-01-20 14:37:20 +00:00
Geoffrey White
952b9e1581 CPP: Use hasGlobalName where appropriate. 2020-01-20 14:24:38 +00:00
Erik Krogh Kristensen
6494649125 fix a number of FPs in js/exception-xss 2020-01-20 15:11:57 +01:00
Erik Krogh Kristensen
5c6134db99 a bit of self-review and an auto-format 2020-01-20 14:55:49 +01:00
Erik Krogh Kristensen
ad813ef86c add flowsTo to the use of isAdditionalLoadStep 2020-01-20 14:16:29 +01:00
Mathias Vorreiter Pedersen
13fc8741d4 C++: Include malloc example in qlhelp 2020-01-20 13:28:00 +01:00
Geoffrey White
79811fcccd Merge pull request #2642 from jbj/TaintTracking-indirection
C++: Indirection for security.TaintTracking impl
2020-01-20 12:25:51 +00:00
Geoffrey White
5a20e85598 Merge pull request #2638 from jbj/ir-dispatch
C++ IR: Support for global virtual dispatch
2020-01-20 12:04:09 +00:00
Calum Grant
631b4248b5 C#: Add a nullness test 2020-01-20 11:13:31 +00:00
Mathias Vorreiter Pedersen
a43131a987 C++: Fix formatting 2020-01-20 11:39:48 +01:00
Jonas Jensen
391b80eac4 C++: Show virtual inheritance problem in vdispatch 2020-01-20 11:17:44 +01:00
Jonas Jensen
2a0fc31b68 C++: Comment and rename getSrc -> getDispatchValue
Better clarity was requested in the PR review.
2020-01-20 11:03:03 +01:00
Erik Krogh Kristensen
ffbd0f6632 update expected test output 2020-01-20 09:56:40 +01:00
Erik Krogh Kristensen
b3b132c66d Merge remote-tracking branch 'upstream/master' into ExceptionalPromise 2020-01-20 09:20:09 +01:00
Jonas Jensen
742bd1c6ad Merge pull request #2648 from rdmarsh2/getMemoryOperandDefinition-perf
C++: Performance fix for getMemoryOperandDefinition
2020-01-20 08:49:55 +01:00
Grzegorz Golawski
00ee3d2549 Query to detect LDAP injections in Java
Cleanup
2020-01-18 20:21:38 +01:00
Grzegorz Golawski
95723b08e1 Query to detect LDAP injections in Java
Add help
2020-01-18 19:01:35 +01:00
Grzegorz Golawski
8cec46342f Query to detect LDAP injections in Java
Refactoring
2020-01-18 17:14:22 +01:00
Jonas Jensen
d3a1856793 Merge pull request #2646 from geoffw0/modelinet
CPP: Fix a mistake in Inet.qll.
2020-01-17 22:53:43 +01:00
Geoffrey White
97c346285e CPP: Change note. 2020-01-17 18:56:21 +00:00
Geoffrey White
fcea3693f9 CPP: Remove now redundant special cases. 2020-01-17 18:56:21 +00:00
Geoffrey White
200545d88c CPP: Add detail to the model. 2020-01-17 18:56:21 +00:00
Geoffrey White
77a3778eef CPP: Add some strlen variants to the PureStrFunction model. 2020-01-17 18:56:21 +00:00
Jonas Jensen
3632d51abc Merge pull request #2635 from geoffw0/modelstrdup
CPP: Model strdup
2020-01-17 19:26:26 +01:00
Geoffrey White
803da339a1 CPP: Fix a mistake in Inet.qll. 2020-01-17 17:44:42 +00:00
Geoffrey White
e4139fe427 Apply suggestions from code review
Additional corrections.

Co-Authored-By: Dave Bartolomeo <dbartol@github.com>
2020-01-17 17:20:37 +00:00
Geoffrey White
7dbda22a29 CPP: Update change note. 2020-01-17 16:19:39 +00:00
Geoffrey White
839fd8f848 CPP: Fix typo. 2020-01-17 16:10:41 +00:00
Robert Marsh
bd98427c5a C++: sync files 2020-01-17 08:05:40 -08:00
Robert Marsh
bbf191e857 C++: fix join order in hasMemoryOperandDefinition 2020-01-17 08:05:40 -08:00
Robert Marsh
d91bc4ba72 C++: pull out hasMemoryOperandDefinition (slow) 2020-01-17 08:05:26 -08:00
Dave Bartolomeo
c7e62b4a35 Merge pull request #2613 from rdmarsh2/getPhiOperandDefinition-perf-2
C++: performance fixes for getPhiOperandDefinition
2020-01-17 09:01:33 -07:00
Mathias Vorreiter Pedersen
cd644ca5f2 Merge branch 'implicit-function-declaration' of github.com:MathiasVP/ql into implicit-function-declaration 2020-01-17 14:52:23 +01:00
Mathias Vorreiter Pedersen
303c6aa5b7 C++: Added query to suites and change-notes 2020-01-17 14:51:40 +01:00
Mathias Vorreiter Pedersen
4fc325f794 C++: Raise query to warning-high 2020-01-17 13:59:25 +01:00
Mathias Vorreiter Pedersen
aaf2679bf7 Remove incorrect html tag
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-01-17 13:52:38 +01:00
Mathias Vorreiter Pedersen
e79c0820ef Fix reference
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-01-17 13:51:14 +01:00
Erik Krogh Kristensen
a25c5d7090 outlining a predicate to give hints about join ordering 2020-01-17 13:42:08 +01:00
Jonas Jensen
53e10e4c7f Merge pull request #2634 from MathiasVP/overrideable-taint-sources
C++: Overrideable taint sources in DefaultTaintTracking
2020-01-17 13:01:03 +01:00
Mathias Vorreiter Pedersen
9e71e7f2ef C++: Added .qlhelp file 2020-01-17 12:58:10 +01:00
Erik Krogh Kristensen
6ad62e32e0 copyPropertyStep works interprocedurally 2020-01-17 12:24:29 +01:00
Jonas Jensen
d19c77d473 C++: Indirection for security.TaintTracking impl
This change should make it easier to switch to the IR-based
`DefaultTaintTracking` code without getting a large and conflict-prone
diff.
2020-01-17 12:04:53 +01:00
Marc Waldman
dbe51e070f Merge pull request #2 from marcrepo/patch-2
Documentation update for Issue #2623
2020-01-17 04:55:34 -05:00
Marc Waldman
a9b6b2c4cd Merge pull request #1 from marcrepo/patch-1
Removed word "file" from description (see Issue 2623)
2020-01-17 04:55:06 -05:00
Marc Waldman
0d409b2d69 Documentation update for Issue #2623
Changes based on Issue #2623 - DescriptorNeverClosed.ql identifies only sockets (not file handles)
2020-01-17 04:46:10 -05:00
Marc Waldman
140051cc9a Removed word "file" from description (see Issue 2623)
This pull request is in reference to Issue #2623 - "DescriptorNeverClosed.ql identifies only sockets (not file handles)"
2020-01-17 04:38:15 -05:00
Anders Schack-Mulligen
2dca188288 Java: Document two FPs with unit tests. 2020-01-17 09:57:11 +01:00
Jonas Jensen
5d08a0e338 Merge pull request #2558 from MathiasVP/ast-classes-should-not-be-abstract
C++: Ast classes should not be abstract
2020-01-17 08:47:55 +01:00
Mathias Vorreiter Pedersen
e4def730fd C++: Fix alert message 2020-01-16 21:30:14 +01:00
Geoffrey White
3c41ed56a1 CPP: Support taint to return value derefs instead. 2020-01-16 18:15:21 +00:00
semmle-qlci
8dff8e77e1 Merge pull request #2637 from hvitved/csharp/non-assigned-fields-bad-magic
Approved by calumgrant
2020-01-16 15:44:25 +00:00
Robert Marsh
e0406190a1 Merge branch 'master' into getPhiOperandDefinition-perf-2 2020-01-16 07:23:59 -08:00
Robert Marsh
c942da524c C++/C#: Sync 2020-01-16 07:16:57 -08:00
Robert Marsh
1b5d33023e C++: actually fix Chi total operands 2020-01-16 07:15:08 -08:00
Mathias Vorreiter Pedersen
c1fcf78f16 C++: Fold predicate sameLocation 2020-01-16 16:14:55 +01:00
Erik Krogh Kristensen
06e898f53b only use .getALocalSource in copyPropertyStep 2020-01-16 16:04:45 +01:00
Mathias Vorreiter Pedersen
04ef4d102d C++: Remove unnecessary testcase 2020-01-16 15:10:37 +01:00
Jonas Jensen
f4d0c5e905 C++ IR: Support for global virtual dispatch
The IR data flow library now supports virtual dispatch with a library
that's similar to `security.TaintTracking`. In particular, it should
have the same performance characteristics. The main difference is that
non-recursive callers of `flowsFrom` now pass `_` instead of `true` for
`boolean allowFromArg`. This change allows flow through `return` to
actually work.
2020-01-16 14:51:28 +01:00
Erik Krogh Kristensen
9998059d59 add pragma to fix performance (same issue as in #2512) 2020-01-16 14:16:04 +01:00
semmle-qlci
4efc418e2c Merge pull request #2617 from asger-semmle/prototype-pollution-utility
Approved by esbena, mchammer01
2020-01-16 13:02:07 +00:00
Tom Hvitved
f4c255cb62 C#: Fix bad magic optimization in NonAssignedFields.ql 2020-01-16 12:31:14 +01:00
Geoffrey White
f4aba14d3a CPP: Change note. 2020-01-16 11:08:19 +00:00
Geoffrey White
ef47563139 CPP: Support flow of pointed-to things through function calls. 2020-01-16 11:08:19 +00:00
Mathias Vorreiter Pedersen
87c59e0017 C++: Overrideable taint sources in DefaultTaintTracking 2020-01-16 11:10:43 +01:00
Erik Krogh Kristensen
4e880e2f96 implement SocketIO on top of the EventEmitter model 2020-01-16 11:02:36 +01:00
Asger F
7a1d068f1c Update javascript/ql/src/Security/CWE-400/PrototypePollutionUtility.qhelp
Co-Authored-By: mc <42146119+mchammer01@users.noreply.github.com>
2020-01-16 09:47:18 +00:00
Mathias Vorreiter Pedersen
603b1c26a7 Merge branch 'master' into ast-classes-should-not-be-abstract 2020-01-16 10:16:03 +01:00
semmle-qlci
8128d23b6e Merge pull request #2505 from erik-krogh/EventEmitter
Approved by esbena, max-schaefer
2020-01-16 08:47:38 +00:00
semmle-qlci
18879386bf Merge pull request #2627 from asger-semmle/js-useless-expression-trycatch
Approved by esbena
2020-01-16 08:40:57 +00:00
Dave Bartolomeo
48301e1187 Merge pull request #2594 from rdmarsh2/ir-overlappingVariableMemoryLocations
C++: compute overlap on irvars with vvar indexes
2020-01-15 13:06:33 -07:00
Tom Hvitved
e5abaa79ae Merge pull request #2585 from calumgrant/cs/serialization-check-bypass
C#: Improvements to cs/serialization-check-bypass
2020-01-15 20:40:51 +01:00
Geoffrey White
04af2ace94 CPP: Add DataFlow to strdup. 2020-01-15 19:18:37 +00:00
Geoffrey White
9b5be995d2 CPP: Split Strdup model into it's own class and file. 2020-01-15 18:38:33 +00:00
Geoffrey White
ce389ca791 CPP: Add tests for strdup. 2020-01-15 18:26:24 +00:00
Robert Marsh
a91f10fe40 Merge pull request #2629 from dbartol/dbartol/missing-vvars
C++/C#: Fix missing virtual variables
2020-01-15 08:32:43 -08:00
Calum Grant
6790028d4c C#: Use guards library 2020-01-15 15:46:19 +00:00
Erik Krogh Kristensen
a76ab39a39 no longer need for .getALocalSource() in custom load/store 2020-01-15 16:00:57 +01:00
Erik Krogh Kristensen
e08fc08337 don't use pseudo-properties for resolved promise data-flow 2020-01-15 14:56:58 +01:00
Erik Krogh Kristensen
830100d2ed support interprocedural flow with custom load/store steps 2020-01-15 14:23:17 +01:00
Asger Feldthaus
7141f15858 JS: Add change note 2020-01-15 11:49:57 +00:00
Asger Feldthaus
6d9306366c JS: ignore useless-expr in first stmt in try block 2020-01-15 11:49:23 +00:00
Tom Hvitved
f7278d36e1 Merge pull request #2498 from aschackmull/java/taint-getter
Java/C++/C#: Add support for taint-getter/setter summaries in data flow.
2020-01-15 09:55:19 +01:00
Dave Bartolomeo
e60f902c36 C++/C#: Fix missing virtual variables
The aliased SSA code was assuming that, for every automatic variable, there would be at least one memory access that reads or writes the entire variable. We've encountered a couple cases where that isn't true due to extractor issues. As a workaround, we now always create the `VariableMemoryLocation` for every local variable.

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

Along the way, I had to fix a perf issue in the PrintIR code. When determining the ID of a result based on line number, we were considering all `Instruction`s generated for a particular line, regardless of whether they were all in the same `IRFunction`. In addition, the predicate had what appeared to be a bad join order that made it take forever on large snapshots. I've scoped it down to just consider `Instruction`s in the same function, and outlined that predicate to fix the join order issue. This causes some numbering changes, but they're for the better. I don't think there was actually any nondeterminism there before, but now the numbering won't depend on the number of instantiations of a template, either.
2020-01-14 17:57:15 -07:00
Grzegorz Golawski
b7325232d7 Query to detect LDAP injections in Java
Consider DNs as injection points as well
Add more taint steps
2020-01-14 23:07:21 +01:00
Robert Marsh
42be28b211 C++: autoformat 2020-01-14 13:17:57 -08:00
Robert Marsh
5a5832b7de Merge pull request #2569 from jbj/ir-total-chi-flow
C++: IR data flow through total chi operands
2020-01-14 12:47:58 -08:00
Erik Krogh Kristensen
d09bce5cd7 custom load/store steps to implement promise flow 2020-01-14 21:37:55 +01:00
Geoffrey White
170981ef41 CPP: Change note. 2020-01-14 14:36:44 +00:00
Geoffrey White
e8139c0f31 CPP: Autoformat. 2020-01-14 14:35:58 +00:00
Geoffrey White
2fa846d1a6 CPP: Correct test. 2020-01-14 14:33:43 +00:00
Geoffrey White
d98d80b07d CPP: Improve locations for AV Rule 114.ql. 2020-01-14 14:33:43 +00:00
Anders Schack-Mulligen
a6526c60cb Java: Replace ad-hoc TestClass detection. 2020-01-14 14:26:22 +01:00
semmle-qlci
3c4749be88 Merge pull request #2624 from asger-semmle/js-duplicate-alert-strict-mode
Approved by max-schaefer
2020-01-14 11:59:45 +00:00
Anders Schack-Mulligen
241b8a05e4 Java/C++/C#: Address review comment. 2020-01-14 11:59:55 +01:00
Asger Feldthaus
2245882441 JS: Add change note and fix cwe tags 2020-01-14 10:53:40 +00:00
Asger Feldthaus
d76859b7df JS: Address review comments 2020-01-14 10:53:00 +00:00
Asger F
2c05ee8ab8 JS: Add regression test 2020-01-14 10:53:00 +00:00
Asger F
9bd3c4a11c JS: Add sanitizer for "in" exprs 2020-01-14 10:53:00 +00:00
Asger Feldthaus
7ac30e2289 JS: Add test for rephinement nodes 2020-01-14 10:53:00 +00:00
Asger F
a447645c10 JS: Add test with typeof on value 2020-01-14 10:52:59 +00:00
Asger F
bd9405ab84 JS: Guard against more FPs 2020-01-14 10:52:59 +00:00
Asger F
738123d3f5 JS: More sanitizers 2020-01-14 10:52:59 +00:00
Asger F
f7543aec95 JS: Support Reflect.ownKeys 2020-01-14 10:52:59 +00:00
Asger F
8af233307a JS: Support enumeration through Object.entries 2020-01-14 10:52:59 +00:00
Asger F
ac2f0a8e11 JS: Do not require flow from key -> rhs 2020-01-14 10:52:59 +00:00
Asger F
96bf9db200 JS: Add another test and more barriers 2020-01-14 10:52:59 +00:00
Asger F
bc7871078a JS: Fix FPs from Object.create(null) 2020-01-14 10:52:59 +00:00
Asger F
c889420dd3 JS: Add qhelp samples to test suite 2020-01-14 10:52:59 +00:00
Asger F
654f145772 JS: Add PrototypePollutionUtility query 2020-01-14 10:52:59 +00:00
Asger F
52cec25035 JS: Build access paths for array accesses 2020-01-14 10:52:59 +00:00
Tom Hvitved
5a4be67d81 Merge pull request #2597 from calumgrant/cs/multiline-alert-suppression
C#: Alert suppression through single-line /* */ style comments
2020-01-14 10:35:11 +01:00
Asger Feldthaus
73e60a7400 JS: Ignore strict-mode-call-stack-introspection for expr stmts 2020-01-13 16:03:03 +00:00
Anders Schack-Mulligen
041bcc5812 Java/C++/C#: Small perf improvement and simplification. 2020-01-13 17:00:56 +01:00
Jonas Jensen
b8ee5a63db Merge pull request #2614 from geoffw0/arithun
CPP: Speed up ArithmeticUncontrolled.ql
2020-01-13 15:25:12 +01:00
Jonas Jensen
3183893a98 Merge pull request #2530 from geoffw0/hiddenqueries2
CPP: Speed up nullCheckAssert in InconsistentCheckReturnNull.ql.
2020-01-13 15:23:55 +01:00
Mathias Vorreiter Pedersen
1bc3829a72 C++: Use newly created library versions of the 'Underspecified Functions' queries in new ImplicitFunctionDeclaration query 2020-01-13 14:01:01 +01:00
Mathias Vorreiter Pedersen
acb106be44 C++: Fix formatting 2020-01-13 13:20:23 +01:00
semmle-qlci
40de391490 Merge pull request #2616 from asger-semmle/promise-missing-await-change-note
Approved by mchammer01
2020-01-13 12:03:11 +00:00
Asger F
6c4da30a64 Update change-notes/1.24/analysis-javascript.md
Co-Authored-By: mc <42146119+mchammer01@users.noreply.github.com>
2020-01-13 11:05:03 +00:00
Mathias Vorreiter Pedersen
394a864b0a C++: Factored the body of TooManyArguments.ql out into a library file 2020-01-13 11:44:58 +01:00
Mathias Vorreiter Pedersen
6cff36b9c9 C++: Factored the body of TooFewArguments.ql out into a library file 2020-01-13 11:36:22 +01:00
Mathias Vorreiter Pedersen
e2244d41f5 C++: Factored the body of MistypedFunctionArguments.ql out into a library file 2020-01-13 11:34:01 +01:00
Anders Schack-Mulligen
183fd91a01 Merge pull request #2615 from yo-h/java-add-change-note
Java: add change note for `java/maven/non-https-url`
2020-01-13 09:54:48 +01:00
Grzegorz Golawski
3e86dd1182 Query to detect LDAP injections in Java
Apache LDAP API sink
2020-01-12 20:19:25 +01:00
Mathias Vorreiter Pedersen
c9439df914 C++: Added query that detects implicit function declarations 2020-01-12 16:28:30 +01:00
Grzegorz Golawski
c01aa3d2ee Query to detect LDAP injections in Java
Spring LDAP sink
2020-01-12 13:28:29 +01:00
Grzegorz Golawski
7570fa9137 Query to detect LDAP injections in Java
JNDI and UnboundID sinks
JNDI, UnboundID and Spring LDAP sanitizers
2020-01-11 21:55:54 +01:00
Erik Krogh Kristensen
c50de3a7e8 update expected output of tests 2020-01-10 17:49:24 +01:00
Erik Krogh Kristensen
1619a98bc8 make the default registration/dispatch extend DataFlow::InvokeNode 2020-01-10 17:40:16 +01:00
yo-h
bf8ef42c1a Java: add change note for java/maven/non-https-url 2020-01-10 11:03:48 -05:00
Taus
cfb84be7b1 Merge pull request #2540 from RasmusWL/python-modernise-variables-queries
Python: modernise variables queries
2020-01-10 14:45:12 +01:00
Geoffrey White
9176529799 Merge pull request #2599 from MathiasVP/assign-where-compare-meant-false-positives
Assign where compare meant false positives
2020-01-10 13:39:39 +00:00
Erik Krogh Kristensen
ec5896abba add additional data-flow edges to data-flow related to promises 2020-01-10 14:12:53 +01:00
Mathias Vorreiter Pedersen
111f1dbd19 Merge branch 'assign-where-compare-meant-false-positives' of github.com:MathiasVP/ql into assign-where-compare-meant-false-positives 2020-01-10 13:14:00 +01:00
Mathias Vorreiter Pedersen
f80c13abd7 C++: Fixed incorrect comments in testcases 2020-01-10 12:24:43 +01:00
Asger Feldthaus
18db551e10 JS: Add change note for js/missing-await 2020-01-10 11:10:57 +00:00
Mathias Vorreiter Pedersen
f181753c35 Typo fix
Co-Authored-By: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2020-01-10 11:49:03 +01:00
Mathias Vorreiter Pedersen
21c99d1827 Typo fix
Co-Authored-By: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2020-01-10 11:46:14 +01:00
Anders Schack-Mulligen
ad92d6fe0f Merge pull request #2607 from yo-h/java-alert-suppression-block-comment
Java: allow single-line `/* ... */` comments for alert suppression
2020-01-10 11:05:23 +01:00
yo-h
7ffa517803 Merge pull request #2584 from aschackmull/java/nonnull-final-field
Java: Include non-null final fields in clearlyNotNull.
2020-01-09 18:48:45 -05:00
Robert Marsh
d2b225790a C++: fix chi instr oeprands to chi instrs 2020-01-09 11:48:18 -08:00
Erik Krogh Kristensen
87bbbd643c changes based on review feedback 2020-01-09 16:18:32 +01:00
Erik Krogh Kristensen
af8b36b750 Merge remote-tracking branch 'upstream/master' into EventEmitter 2020-01-09 15:09:43 +01:00
Geoffrey White
1d615d311c CPP: Autoformat. 2020-01-09 13:48:58 +00:00
Geoffrey White
f6f7df4e8f CPP: Speed up nullCheckAssert in InconsistentCheckReturnNull.ql. 2020-01-09 13:48:13 +00:00
Geoffrey White
50c0ec1cb1 CPP: Optimize isRandValue. 2020-01-09 12:12:00 +00:00
semmle-qlci
f1f69ef85d Merge pull request #2589 from esbena/js/ignore-duplicate-params-for-empty-functions
Approved by erik-krogh
2020-01-09 11:58:04 +00:00
Robert Marsh
5007fd2aa8 C++: Autoformat and sync 2020-01-08 12:49:51 -08:00
Robert Marsh
e416d75f6f C++: add noopt on getPhiOperandDefinition 2020-01-08 11:36:57 -08:00
Jonas Jensen
8acbb3bfb9 C++: Further simplify a bit
This changes tuple counts!?
2020-01-08 11:36:50 -08:00
Jonas Jensen
5072201b7e C++: Fix join order 2020-01-08 11:36:40 -08:00
Jonas Jensen
838720bef0 C++: de-inline getDefinitionOrChiInstruction
Still has bad join order
2020-01-08 11:36:34 -08:00
Jonas Jensen
3d2cc7bbce C++: make hasPhiOperandDefinition feasible 2020-01-08 11:36:14 -08:00
Jonas Jensen
55f157e06d C++: Fix overlappingVariableMemoryLocations perf
The `overlappingVariableMemoryLocations` predicate was a helper
predicate introduced to fix a join-order issue in
`overlappingIRVariableMemoryLocations`. Unfortunately it caused a
performance issue of its own because it could grow too large. On the
small project (38MB zip) awslabs/s2n there were 181M rows in
`overlappingVariableMemoryLocations`, and it took 134s to evaluate.

The fix is to collapse the two predicates into one and fix join ordering
by including an extra column in the predicates being joined.

In addition, some parameters were reordered to avoid the overhead of
auto-generated `join_rhs` predicates.

Tuple counts of `overlappingVariableMemoryLocations` before:

    623285    ~176%     {2} r1 = JOIN AliasedSSA::isCoveredOffset#fff_120#join_rhs AS L WITH AliasedSSA::isCoveredOffset#fff_120#join_rhs AS R ON FIRST 2 OUTPUT L.<2>, R.<2>
    119138    ~3%       {2} r2 = SCAN AliasedSSA::VariableMemoryLocation::getVirtualVariable_dispred#ff AS I OUTPUT I.<1>, I.<0>
    172192346 ~0%       {2} r3 = JOIN r2 WITH AliasedSSA::hasUnknownOffset#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r2.<1>
    172815631 ~0%       {2} r4 = r1 \/ r3
    172192346 ~0%       {2} r5 = JOIN r2 WITH AliasedSSA::hasUnknownOffset#ff_10#join_rhs AS R ON FIRST 1 OUTPUT r2.<1>, R.<1>
    345007977 ~87%      {2} r6 = r4 \/ r5
                        return r6

Tuple counts of `overlappingIRVariableMemoryLocations` after:

    117021 ~134%     {2} r1 = JOIN AliasedSSA::isCoveredOffset#ffff AS L WITH AliasedSSA::isCoveredOffset#ffff AS R ON FIRST 3 OUTPUT L.<3>, R.<3>
    201486 ~1%       {2} r2 = JOIN AliasedSSA::hasUnknownOffset#fff AS L WITH AliasedSSA::hasVariableAndVirtualVariable#fff AS R ON FIRST 2 OUTPUT L.<2>, R.<2>
    318507 ~26%      {2} r3 = r1 \/ r2
    201486 ~3%       {2} r4 = JOIN AliasedSSA::hasUnknownOffset#fff AS L WITH AliasedSSA::hasVariableAndVirtualVariable#fff AS R ON FIRST 2 OUTPUT R.<2>, L.<2>
    519993 ~92%      {2} r5 = r3 \/ r4
                     return r5
2020-01-08 11:07:20 -08:00
Robert Marsh
9b361f1701 Merge pull request #2601 from dbartol/dbartol/OpcodeProperties
C++: Consolidate opcode properties onto `Opcode` class
2020-01-08 11:05:41 -08:00
Geoffrey White
cf5dd85944 Merge pull request #2577 from MathiasVP/multiplication-overflow-not-possible-due-to-type-width
Multiplication overflow not possible due to type width
2020-01-08 17:18:33 +00:00
shati-patel
ad0ad3a3e4 Merge pull request #2612 from jf205/recent-changes
CodeQL docs: port recent fixes to rc/1.23
2020-01-08 16:36:27 +00:00
james
2407eb103a docs: fix list
(cherry picked from commit 618a3f91d8)
2020-01-08 16:16:39 +00:00
Rasmus Wriedt Larsen
cdcca630f3 docs: remove extra comma in dataflow articles
(cherry picked from commit e882060839)
2020-01-08 16:16:39 +00:00
Rasmus Wriedt Larsen
24e551905e docs: Fix Python taint tracking links
at some point we moved security/TaintTracking.qll to dataflow/TaintTracking.qll

(cherry picked from commit f44ce7d647)
2020-01-08 16:16:39 +00:00
james
97d3d1fca3 docs: fix ast node link
(cherry picked from commit cff5df0779)
2020-01-08 16:16:39 +00:00
shati-patel
3cfc7d2e54 Merge pull request #2611 from jf205/mergeback-123
Merge rc/1.23 into master
2020-01-08 16:12:47 +00:00
Dave Bartolomeo
6c8de44800 Merge pull request #2604 from geoffw0/returnthis
CPP: Exclude template classes from cpp/assignment-does-not-return-this
2020-01-08 09:12:22 -07:00
james
490e13060c Merge branch 'rc/1.23' into mergeback-123 2020-01-08 16:00:19 +00:00
shati-patel
e103527d32 Merge pull request #2610 from jf205/python-link
docs: fix link in Python topic
2020-01-08 15:48:37 +00:00
james
cff5df0779 docs: fix ast node link 2020-01-08 15:30:04 +00:00
Max Schaefer
308da0774d Merge pull request #2525 from asger-semmle/promise-missing-await
JS: New query: missing await
2020-01-08 15:29:45 +00:00
Max Schaefer
de15ecf47b Merge pull request #2593 from asger-semmle/regexp-always-matches
JS: Add RegExpAlwaysMatches query
2020-01-08 15:21:39 +00:00
James Fletcher
8e700081f1 Merge pull request #2609 from RasmusWL/doc-fix-python-taint-links
docs: Fix Python taint tracking links
2020-01-08 15:21:07 +00:00
Rasmus Wriedt Larsen
f44ce7d647 docs: Fix Python taint tracking links
at some point we moved security/TaintTracking.qll to dataflow/TaintTracking.qll
2020-01-08 16:10:27 +01:00
yo-h
1078424f79 Java: allow single-line /* ... */ comments for alert suppression 2020-01-08 09:19:25 -05:00
shati-patel
9b4f6af007 Merge pull request #2605 from RasmusWL/small-doc-fix
docs: remove extra comma in dataflow articles
2020-01-08 14:01:41 +00:00
Rasmus Wriedt Larsen
e882060839 docs: remove extra comma in dataflow articles 2020-01-08 14:53:31 +01:00
Geoffrey White
b6e1f35ff6 CPP: Generalize the fix to all template code. 2020-01-08 13:36:59 +00:00
Geoffrey White
8044fefb1f CPP: Change note. 2020-01-08 13:19:11 +00:00
Geoffrey White
527d29ba23 CPP: Exclude template classes from the query. 2020-01-08 13:16:38 +00:00
Geoffrey White
d527dbe47a CPP: Add test case. 2020-01-08 13:13:06 +00:00
Asger Feldthaus
775e63d9c0 JS: Fix qhelp validation error 2020-01-08 10:38:10 +00:00
Asger F
ef79023e52 Update javascript/ql/src/Expressions/MissingAwait.qhelp
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2020-01-08 10:23:30 +00:00
Tom Hvitved
85f6e5fe22 Merge pull request #2450 from calumgrant/cs/expr-nullability
C#: Expression nullability
2020-01-08 09:50:03 +01:00
Mathias Vorreiter Pedersen
100ace532f C++: Fixed handling of false negative. Query now supports global variables 2020-01-07 22:57:21 +01:00
Mathias Vorreiter Pedersen
db08076fed C++: Fixed false negative 2020-01-07 22:20:04 +01:00
Mathias Vorreiter Pedersen
229da0a9c0 C++: Add testcase demonstrating false negative 2020-01-07 22:12:34 +01:00
Dave Bartolomeo
690d23d15e C++: Fix formatting 2020-01-07 13:23:36 -07:00
Dave Bartolomeo
9df37399f8 C++: Consolidate opcode properties onto Opcode class
Previously, we had several predicates on `Instruction` and `Operand` whose values were determined solely by the opcode of the instruction. For large snapshots, this meant that we would populate large tables mapping each of the millions of `Instruction`s to the appropriate value, times three (once for each IR flavor).

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

Even ignoring the modest performance benefit, having these properties defined on `Opcode` seems like a better organization than having them on `Instruction` and `Operand`.
2020-01-07 13:17:27 -07:00
Calum Grant
bc1b2c3ead C#: Address review comment 2020-01-07 18:39:52 +00:00
Calum Grant
d0d7ed620c C#: Update comments in test file to reflect fixed test output. 2020-01-07 18:39:52 +00:00
Calum Grant
359dea2c2b C#: Fixed test output. 2020-01-07 18:39:52 +00:00
Calum Grant
bcd8dca780 C#: When creating conditionally accessed expressions, use the typeinfo from the conditional expression to ensure correct flow state and type nullability. 2020-01-07 18:39:51 +00:00
Calum Grant
85c9459b35 C#: Add more tests showing incorrect extraction. 2020-01-07 18:39:51 +00:00
Calum Grant
10181e93e2 C#: Update QLtest output 2020-01-07 18:39:51 +00:00
Calum Grant
a1bedf2e06 C#: Use expression flow state to determine non-null guards 2020-01-07 18:39:51 +00:00
Calum Grant
2eb29224e8 C#: Update guards tests. 2020-01-07 18:39:51 +00:00
Calum Grant
ecb22f1379 C#: Fix typo in dbscheme. 2020-01-07 18:39:51 +00:00
Calum Grant
f67240a316 C#: Analysis change notes 2020-01-07 18:39:51 +00:00
Calum Grant
1036640e24 C#: Update db stats 2020-01-07 18:38:58 +00:00
Calum Grant
4e710e9685 C#: DB upgrade script 2020-01-07 18:38:58 +00:00
Calum Grant
8db46bc8ec C#: More tests for nullable flow state. 2020-01-07 18:38:58 +00:00
Calum Grant
6c9ebaba0b C#: Populate expression type nullability and nullable flow state. 2020-01-07 18:38:58 +00:00
Calum Grant
0327b83958 C#: Update nullability tests. 2020-01-07 18:38:58 +00:00
Dave Bartolomeo
3072e9c7da Merge pull request #2598 from geoffw0/av114_asm
CPP: Exclude functions containing asm from cpp/missing-return
2020-01-07 09:04:14 -07:00
Mathias Vorreiter Pedersen
633c42ced0 C++: Removed comment 2020-01-07 14:41:37 +01:00
Anders Schack-Mulligen
d918cb1f6f Merge pull request #2550 from JLLeitschuh/task/JLL/improve_netty_response_splitting_detection
Add io.netty.handler.codec.http.DefaultHttpResponse to Netty Response Splitting Detection
2020-01-07 14:28:01 +01:00
Mathias Vorreiter Pedersen
d9f931da3c C++: Fix false positives 2020-01-07 14:16:50 +01:00
Mathias Vorreiter Pedersen
6bbe2c48bf C++: Add testcase demonstrating false positive 2020-01-07 14:13:34 +01:00
Geoffrey White
c584ceb2f4 CPP: Change note. 2020-01-07 12:46:07 +00:00
Geoffrey White
72b4792391 CPP: Exception for AsmStmts. 2020-01-07 12:46:07 +00:00
Geoffrey White
0a85637fef CPP: Add a test. 2020-01-07 12:46:07 +00:00
Mathias Vorreiter Pedersen
9a841636dc C++: Fix false positive 2020-01-07 13:22:07 +01:00
Mathias Vorreiter Pedersen
faa9d83567 C++: Add testcase demonstrating false positive 2020-01-07 13:18:38 +01:00
Mathias Vorreiter Pedersen
bdd0589223 C++: Fix false positive 2020-01-07 13:16:47 +01:00
Calum Grant
d8f5450b67 C#: Alert suppression comments can be in C89-style comments 2020-01-07 11:52:52 +00:00
Mathias Vorreiter Pedersen
428e357488 C++: Add testcase demonstrating false positive 2020-01-07 11:41:48 +01:00
semmle-qlci
0e16969e15 Merge pull request #2591 from max-schaefer/js/fix-16
Approved by asgerf
2020-01-07 10:36:19 +00:00
Asger Feldthaus
d55d5cc4ed JS: Address comments from doc review 2020-01-07 10:27:46 +00:00
Asger Feldthaus
66a16d21a9 JS: Fix buggy test cases 2020-01-07 10:19:09 +00:00
Asger Feldthaus
2d534163d0 JS: Add test for empty regex 2020-01-07 10:10:29 +00:00
Asger Feldthaus
9f6e04887b JS: Fix FP from word boundaries 2020-01-07 10:09:17 +00:00
Tom Hvitved
5552c2e912 Merge pull request #2563 from calumgrant/cs/tuple-expr
C#: Handle tuple expressions
2020-01-07 09:31:17 +01:00
Robert Marsh
367d13c0ad Merge pull request #2570 from jbj/ir-overlappingVariableMemoryLocations
C++: Fix overlappingVariableMemoryLocations perf
2020-01-06 10:57:48 -08:00
Robert Marsh
ba9741f552 C++: compute overlap on irvars with vvar indexes 2020-01-06 09:14:03 -08:00
Anders Schack-Mulligen
9ba169b346 Java: Fix bad join-order. 2020-01-06 16:52:06 +01:00
Calum Grant
c145e32625 C#: Tests for multiline alert suppression comments 2020-01-06 15:45:00 +00:00
Asger F
b604be5cfb Apply suggestions from code review
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2020-01-06 14:44:02 +00:00
Asger Feldthaus
4c25d84b6e JS: Fix and expand test cases 2020-01-06 14:43:29 +00:00
Tom Hvitved
ed2125969e Merge pull request #2568 from calumgrant/cs/assignment-to-_
C#: Remove FP in useless assignment to _
2020-01-06 15:39:45 +01:00
Max Schaefer
9160fbf106 Merge pull request #2435 from asger-semmle/phi-edge-barrier-guards
JS: Phi edge barrier guards
2020-01-06 14:14:18 +00:00
semmle-qlci
f48e4bc2a0 Merge pull request #2580 from asger-semmle/typescript-unbounded-recursion
Approved by max-schaefer
2020-01-06 14:00:55 +00:00
semmle-qlci
0c0073fb02 Merge pull request #2582 from asger-semmle/spurious-css-import
Approved by max-schaefer
2020-01-06 14:00:08 +00:00
semmle-qlci
7e9b5b1036 Merge pull request #2590 from asger-semmle/ts-install-deps-unverbose
Approved by max-schaefer
2020-01-06 13:57:43 +00:00
Asger F
9928762769 JS: Add RegExpAlwaysMatches query 2020-01-06 13:48:02 +00:00
Mathias Vorreiter Pedersen
9ed1510a8c C++: Improved query precision using SimpleRangeAnalysis 2020-01-06 14:16:52 +01:00
semmle-qlci
39531c6516 Merge pull request #2574 from max-schaefer/js/fix-17
Approved by erik-krogh
2020-01-06 12:43:56 +00:00
Taus Brock-Nannestad
851d692996 Python: Remove manual TC from ssaShortCut.
This caused a massive slowdown on certain snapshots.
2020-01-06 13:40:52 +01:00
Rasmus Wriedt Larsen
5d01cb7c28 Python: Fix bad QL-rewriting
Original code:

exists(Expr e, For forloop | forloop = loop and e.pointsTo(_, _, capturing) |
    not loop.contains(e)
)

The new version will preserve the same semantics. The problem with the first
rewrite was that `not loop.(For).somethingMore` would hold for any AstNode that
was not a For
2020-01-06 13:30:37 +01:00
Asger F
79f8d02019 JS: Add change note 2020-01-06 11:38:13 +00:00
Asger F
4d25bfc038 JS: Fix copy pasta 2020-01-06 11:37:21 +00:00
Asger F
142c83f38f JS: Add negative dominance test 2020-01-06 11:37:21 +00:00
Asger F
aa6572b5c8 JS: Sanitize phi edges from barrier guards 2020-01-06 11:37:21 +00:00
Asger F
0b04f0d8f7 JS: Add test case for phi input 2020-01-06 11:37:20 +00:00
Max Schaefer
9391d36699 JavaScript: Teach extractor to tolerate assignment patterns in AST.
Our database representation of ASTs does not use assignment patterns, instead encoding the relevant information directly in the associated function/loop/assignment. We convert from an AST with assignment patterns to one without during parsing, so the extractor does not expect any assignment patterns to be present in the AST.

Due to a bug in the parser, this can currently happen for malformed programs. While we should fix that bug once it gets fixed in Acorn, it also makes sense for the extractor to be more robust, so this PR teaches the `ASTExtractor` pass to raise a parse error when it encounters an assignment pattern, and all other passes to simply ignore them.
2020-01-06 11:31:36 +00:00
Asger F
a3481b3713 TS: Do not pass --verbose to yarn 2020-01-06 11:18:58 +00:00
semmle-qlci
48deb30756 Merge pull request #2573 from max-schaefer/js/generalise-alert-suppression
Approved by asgerf
2020-01-06 10:43:17 +00:00
Rasmus Wriedt Larsen
9b0b0c338f Python: Cleanup overrides tests 2020-01-06 10:55:37 +01:00
Mathias Vorreiter Pedersen
7b5dd56009 C++: Added .stats file 2020-01-06 09:45:58 +01:00
semmle-qlci
5dcc5b3b1e Merge pull request #2581 from erik-krogh/FlowUselessExpr
Approved by max-schaefer
2020-01-06 08:33:36 +00:00
Esben Sparre Andreasen
9279bfc8a2 JS: add test case for arrow functions with duplicate parameter names 2020-01-06 09:21:36 +01:00
Esben Sparre Andreasen
96748ca32e JS: sharpen js/duplicate-parameter-name 2020-01-06 08:51:00 +01:00
Esben Sparre Andreasen
5718fbd98a JS: update test 2020-01-06 08:33:38 +01:00
Grzegorz Golawski
4ce25c045d Simplify the query 2020-01-05 22:05:00 +01:00
Grzegorz Golawski
ab49397bb8 Add check for disabled CSRF protection in Spring 2020-01-03 21:52:50 +01:00
Calum Grant
41b4d70504 C#: Refactor, improve documentation and add tests for cs/serialization-check-bypass 2020-01-03 18:46:39 +00:00
shati-patel
9b9d7121e8 Merge pull request #2583 from jf205/advanced-ql
CodeQL documentation: reorganize 'Advanced QL' topics
2020-01-03 16:02:28 +00:00
James Fletcher
47f61f3569 Update docs/language/learn-ql/writing-queries/debugging-queries.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2020-01-03 15:55:14 +00:00
james
537739c42d docs: address review comments 2020-01-03 15:31:31 +00:00
Anders Schack-Mulligen
e74aa33f9d Java: Include non-null final fields in clearlyNotNull. 2020-01-03 16:24:54 +01:00
Asger F
503bcdc5d7 JS: Dont capitalize Promise in prose 2020-01-03 14:16:31 +00:00
Asger F
3c601fce74 Apply suggestions from code review
Co-Authored-By: Erik Krogh Kristensen <erik-krogh@github.com>
2020-01-03 14:15:52 +00:00
Asger F
30a8769dad JS: Add more bad promise contexts 2020-01-03 14:12:55 +00:00
Mathias Vorreiter Pedersen
e926966e73 C++: Added more tests 2020-01-03 14:08:12 +01:00
Mathias Vorreiter Pedersen
cea78879b2 C++: Rename variables in tests to reflect their types 2020-01-03 14:07:19 +01:00
semmle-qlci
dc7863ce29 Merge pull request #2579 from asger-semmle/typescript-trace-resolution
Approved by max-schaefer
2020-01-03 12:57:43 +00:00
Jonathan Leitschuh
0e2c5db7b1 Netty Response Splitting use CompileTimeConstantExpr
Co-Authored-By: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2020-01-03 07:51:55 -05:00
james
23d1e06aa4 docs: move abstract classes topic to handbook 2020-01-03 12:07:01 +00:00
james
e8016a2303 docs: delete equivalence topic 2020-01-03 12:07:01 +00:00
james
fe18c18619 docs: move folding predicates topic 2020-01-03 12:06:55 +00:00
Asger F
4772798d7b JS: do not resolve arbitrary extensions to JavaScript files 2020-01-03 11:37:51 +00:00
Asger F
c5f73cb868 JS: Add test showing spurious .css import 2020-01-03 10:59:10 +00:00
semmle-qlci
29be46169a Merge pull request #2576 from asger-semmle/typescript-cyclic-prop-fallthroughnode
Approved by max-schaefer
2020-01-03 10:50:05 +00:00
Asger F
f31d47c66e TS: explain test case 2020-01-03 10:48:15 +00:00
Asger F
36546ce7fe TS: Print warning when bailing out of symbol type 2020-01-03 10:45:18 +00:00
Erik Krogh Kristensen
c22d3d0b3a add test for block-level flow type annotations 2020-01-03 11:07:35 +01:00
semmle-qlci
06d812a6ff Merge pull request #2556 from erik-krogh/RegexpVoidCxt
Approved by max-schaefer
2020-01-03 08:38:56 +00:00
Asger F
3a4771c29c TS: Wrap getTypeOfSymbolAtLocation in try/catch 2020-01-02 16:55:17 +00:00
Asger F
202746e92d TS: Guard getTypeAtLocation with try/catch 2020-01-02 16:31:23 +00:00
Asger F
0388e9ca0c TS: Add regression test 2020-01-02 16:28:49 +00:00
shati-patel
564013d188 Merge pull request #2578 from jf205/ql-spec-fixes
QL spec: fix bullet list in 'Aggregations' section
2020-01-02 15:55:49 +00:00
james
618a3f91d8 docs: fix list 2020-01-02 15:48:57 +00:00
Asger F
2ca0e7d232 TS: Disable output from tracing 2020-01-02 15:38:10 +00:00
Asger F
8f478f7caf TS: Add test with traceResolution: true 2020-01-02 15:04:30 +00:00
Mathias Vorreiter Pedersen
7dbb191531 C++: Improve query precision 2020-01-02 15:53:22 +01:00
Mathias Vorreiter Pedersen
cfb839a8f9 C++: Add test demonstrating the false positive 2020-01-02 15:48:01 +01:00
James Fletcher
f48b8fef20 Merge pull request #2575 from shati-patel/qlhb/bindingset
QL HB: Add bindingset example
2020-01-02 14:46:21 +00:00
shati-patel
f38ae3c677 QL HB: Reword description
Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2020-01-02 14:41:58 +00:00
Shati Patel
94d55e90b0 QL HB: Use "real" example 2020-01-02 14:25:44 +00:00
Asger F
bcf1533e71 TS: Blacklist cyclic property fallthroughFlowNode 2020-01-02 14:13:48 +00:00
Anders Schack-Mulligen
7e987c570f Merge pull request #2413 from JLLeitschuh/feature/JLL/maven_insecure_artifact_resolution
Java: Use of HTTP/FTP to download/upload Maven artifacts
2020-01-02 14:47:30 +01:00
Shati Patel
b68f9f7e00 QL HB: Add bindingset example 2020-01-02 13:06:17 +00:00
Max Schaefer
8d1ad5c5f3 JavaScript: Alert suppression through single-line /* */ style comments. 2020-01-02 10:45:20 +00:00
Erik Krogh Kristensen
d1a77d6993 refactor isInterpretedAsRegExp to directly work on a DataFlow node 2020-01-02 11:18:14 +01:00
Max Schaefer
de02bb4a0d JavaScript: Prevent joining on configuration in onPath. 2020-01-02 09:49:09 +00:00
Max Schaefer
2a55ba5d4f JavaScript: Fix join order in PathNode.getASuccessor. 2020-01-02 09:48:57 +00:00
Jonas Jensen
4830e43b3e C++: Fix overlappingVariableMemoryLocations perf
The `overlappingVariableMemoryLocations` predicate was a helper
predicate introduced to fix a join-order issue in
`overlappingIRVariableMemoryLocations`. Unfortunately it caused a
performance issue of its own because it could grow too large. On the
small project (38MB zip) awslabs/s2n there were 181M rows in
`overlappingVariableMemoryLocations`, and it took 134s to evaluate.

The fix is to collapse the two predicates into one and fix join ordering
by including an extra column in the predicates being joined.

In addition, some parameters were reordered to avoid the overhead of
auto-generated `join_rhs` predicates.

Tuple counts of `overlappingVariableMemoryLocations` before:

    623285    ~176%     {2} r1 = JOIN AliasedSSA::isCoveredOffset#fff_120#join_rhs AS L WITH AliasedSSA::isCoveredOffset#fff_120#join_rhs AS R ON FIRST 2 OUTPUT L.<2>, R.<2>
    119138    ~3%       {2} r2 = SCAN AliasedSSA::VariableMemoryLocation::getVirtualVariable_dispred#ff AS I OUTPUT I.<1>, I.<0>
    172192346 ~0%       {2} r3 = JOIN r2 WITH AliasedSSA::hasUnknownOffset#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r2.<1>
    172815631 ~0%       {2} r4 = r1 \/ r3
    172192346 ~0%       {2} r5 = JOIN r2 WITH AliasedSSA::hasUnknownOffset#ff_10#join_rhs AS R ON FIRST 1 OUTPUT r2.<1>, R.<1>
    345007977 ~87%      {2} r6 = r4 \/ r5
                        return r6

Tuple counts of `overlappingIRVariableMemoryLocations` after:

    117021 ~134%     {2} r1 = JOIN AliasedSSA::isCoveredOffset#ffff AS L WITH AliasedSSA::isCoveredOffset#ffff AS R ON FIRST 3 OUTPUT L.<3>, R.<3>
    201486 ~1%       {2} r2 = JOIN AliasedSSA::hasUnknownOffset#fff AS L WITH AliasedSSA::hasVariableAndVirtualVariable#fff AS R ON FIRST 2 OUTPUT L.<2>, R.<2>
    318507 ~26%      {2} r3 = r1 \/ r2
    201486 ~3%       {2} r4 = JOIN AliasedSSA::hasUnknownOffset#fff AS L WITH AliasedSSA::hasVariableAndVirtualVariable#fff AS R ON FIRST 2 OUTPUT R.<2>, L.<2>
    519993 ~92%      {2} r5 = r3 \/ r4
                     return r5
2019-12-27 16:06:24 +01:00
Calum Grant
68f42a6f47 C#: Analysis change notes 2019-12-27 12:07:26 +00:00
Calum Grant
3db900b183 C#: Remove false positive and update test output
C#: Mark results as GOOD
2019-12-27 12:07:19 +00:00
Calum Grant
fd0225ca59 C#: Add test 2019-12-27 11:44:39 +00:00
Jonas Jensen
618bf2e29e C++: IR data flow through total chi operands 2019-12-27 11:44:41 +01:00
Jonas Jensen
64c79bf9e1 C++: Deprecate UninitializedNode in IR data flow
It's not used outside of tests, and it's not useful. It will break the
tests when we start allowing flow through chi nodes.
2019-12-27 11:21:33 +01:00
Calum Grant
0f178be12e C#: Update change notes. 2019-12-23 15:29:20 +00:00
Calum Grant
a059c13f6c C#: Add test for tuple expressions. 2019-12-23 15:18:28 +00:00
Calum Grant
63afb30797 C#: Tests for tuple expressions. 2019-12-23 15:18:21 +00:00
Calum Grant
e83b159bf8 C#: Handle TupleType expression. 2019-12-23 15:18:21 +00:00
Calum Grant
ad764b1dc6 C#: Update .gitignore 2019-12-23 14:31:54 +00:00
Mathias Vorreiter Pedersen
c9fe3e4d2d C++: Updated upgrade script 2019-12-23 14:13:12 +01:00
Mathias Vorreiter Pedersen
bb282f403e Fix comments
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-12-23 12:37:18 +01:00
Mathias Vorreiter Pedersen
11a545e08e C++: Removed abstract classes from binary and assignment operations 2019-12-23 11:52:12 +01:00
Mathias Vorreiter Pedersen
6998336fb9 C++: Format .dbscheme file 2019-12-23 10:57:38 +01:00
Mathias Vorreiter Pedersen
46421efcef C++: Rename crement operations 2019-12-23 10:41:14 +01:00
Mathias Vorreiter Pedersen
1b29e6c082 Remove @prefix_crement_oper_expr and @postfix_crement_oper_expr clauses
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-12-23 10:28:35 +01:00
Jonas Jensen
7e84453ec9 Merge pull request #2542 from geoffw0/datetime
C++: Sort through the leap year and japanese era queries
2019-12-23 10:13:12 +01:00
semmle-qlci
f921cf7d01 Merge pull request #2512 from erik-krogh/moarExceptions
Approved by esbena, max-schaefer
2019-12-20 20:31:50 +00:00
Dave Bartolomeo
5b5d2f2b67 Merge pull request #2154 from rdmarsh2/rdmarsh/cpp/ir-callee-side-effects
C++: add InitializeIndirection for pointer params
2019-12-20 13:13:54 -07:00
Mathias Vorreiter Pedersen
cb22702908 C++: Added update script 2019-12-20 18:38:14 +01:00
Mathias Vorreiter Pedersen
006c8bb0cd C++: Remove abstract classes from unary operations 2019-12-20 18:38:09 +01:00
Rasmus Wriedt Larsen
92e272cc03 Python: Address comments for modernising Variables/ 2019-12-20 15:58:51 +01:00
Rasmus Wriedt Larsen
b8a9a353b8 Python: Autoformat Variables/* 2019-12-20 15:08:20 +01:00
Rasmus Wriedt Larsen
25ab0ed20f Python: Modernise Variables/MonkeyPatched.qll 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
994ad197c4 Python: Add Module::builtinModule() 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
58bb16e5dd Python: Modernise Variables/Undefined.qll 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
34f9135492 Python: Modernise py/unused-parameter 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
15bc4cd090 Python: Add override helpers to Value classes 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
aba3ac7b66 Python: Modernise py/uninitialized-local-variable 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
697a006ef2 Python: Modernise py/undefined-global-variable 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
5faa7e7127 Python: Add ModuleValue::hasCompleteExportInfo 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
3ffea599f1 Python: Rewrite casts for py/undefined-global-variable 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
81e27aab8d Python: Modernise py/unused-loop-variable 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
8f7ba0a06d Python: Modernise py/local-shadows-global 2019-12-20 15:05:49 +01:00
Rasmus Wriedt Larsen
9f4088413a Python: Modernise py/local-shadows-builtin
+ moved `scope instanceof Function` so it makes more sense :)
2019-12-20 15:05:49 +01:00
yo-h
cc7f98e0f6 Merge pull request #2555 from hvitved/csharp/xml-sync
C#: Sync `XML.qll` with other languages
2019-12-20 09:03:55 -05:00
Jonas Jensen
de55a6846f Merge pull request #2204 from alexet/cache-to-string
Cache the computation of core toString predicates for cpp c# and java.
2019-12-20 14:54:46 +01:00
Tom Hvitved
665d38647d Merge pull request #2557 from calumgrant/cs/extractor-label-catch
C# extractor: Catch exceptions when generating trap
2019-12-20 13:09:21 +01:00
Erik Krogh Kristensen
a0b5aa5ae4 more precise heuristic to identify allowed call targets 2019-12-20 10:51:39 +01:00
Jonas Jensen
18d4772508 Merge pull request #2463 from geoffw0/overflowcalc
CPP: Allocation and Deallocation libraries
2019-12-19 21:27:42 +01:00
Jonas Jensen
939979ddef Merge branch 'master' into overflowcalc 2019-12-19 14:12:00 +01:00
Jonas Jensen
a13748f484 Merge pull request #2259 from rdmarsh2/rdmarsh/cpp/default-taint-tracking-sources
C++: move sources into DefaultTaintTracking.qll
2019-12-19 14:09:41 +01:00
Jonas Jensen
4fffaabab9 Merge pull request #2551 from MathiasVP/argument-suppresion-c89-style
C++: Alert suppression through single-line /* */ style comments
2019-12-19 13:19:49 +01:00
Calum Grant
3c76346635 C#: WIP Adding exception handlers.
C#: Improve robustness by catching and logging exceptions when generating trap IDs.
2019-12-19 11:28:05 +00:00
Erik Krogh Kristensen
15d74b7d03 remove FP from js/regexpinjection where no regexp was constructed 2019-12-19 10:47:03 +01:00
Tom Hvitved
29cd6a9e30 Sync XML.qll 2019-12-19 10:29:30 +01:00
Tom Hvitved
1b6bd7a0fa C#: Update XML.qll for backwards compatibility 2019-12-19 10:27:59 +01:00
Tom Hvitved
82c368e13e C#: Sync XML.qll with other languages 2019-12-19 10:26:08 +01:00
James Fletcher
5a6a2e8a68 Merge pull request #2547 from shati-patel/ql/tutorial
QL tutorials: Update formatting and style
2019-12-19 09:06:08 +00:00
Mathias Vorreiter Pedersen
30822f1d98 C++: Alert suppresion through single-line /* */ style comments 2019-12-19 09:10:09 +01:00
Robert Marsh
33067c8e31 Merge pull request #2519 from jbj/ir-backedge-notc
C++: Get rid of a fastTC and noopt in IR
2019-12-18 14:20:43 -08:00
Jonas Jensen
e7283afa3e Merge pull request #2531 from dbartol/dbartol/MissingToString
C++: Fix `toString()` predicates that don't hold
2019-12-18 19:09:48 +01:00
semmle-qlci
339066ce04 Merge pull request #2552 from erik-krogh/ImportMeta
Approved by max-schaefer
2019-12-18 15:38:58 +00:00
Jonathan Leitschuh
75939afe9c Update java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.qhelp
Co-Authored-By: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2019-12-18 09:53:36 -05:00
Erik Krogh Kristensen
0611dc3f60 move change notes to extractor-javascript.md 2019-12-18 14:21:43 +01:00
Taus
52d231c219 Merge pull request #2469 from RasmusWL/python-modernise-twisted-library
Python: modernise twisted library
2019-12-18 13:55:50 +01:00
Taus
eb6feeeaf8 Merge pull request #2482 from RasmusWL/python-include-zope-web-tests
Python: include zope web tests from internal repo
2019-12-18 13:55:23 +01:00
Rasmus Wriedt Larsen
48f873e3d9 Python: Add getAReturnedNode to PythonFunctionValue 2019-12-18 12:00:43 +01:00
Erik Krogh Kristensen
43e9d11f75 inline definition of importIdentifier 2019-12-18 11:43:10 +01:00
Erik Krogh Kristensen
76d4db2552 changes based on review 2019-12-18 11:39:46 +01:00
Erik Krogh Kristensen
807664e545 add change note 2019-12-18 11:35:16 +01:00
Erik Krogh Kristensen
4fdfa51e44 add support for import.meta expressions in JavaScript 2019-12-18 10:45:54 +01:00
Rasmus Wriedt Larsen
582ef6cec9 Python: Restructure logic in Twisted.qll 2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
9942c3fd8b Python: Autoformat twisted library 2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
ac55e6aba6 Python: Modernise twisted library 2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
4e3c183676 Python: Adapt twisted tests so they pass 2019-12-18 10:42:39 +01:00
Rasmus Wriedt Larsen
6011cb74f8 Python: Add twisted tests from internal repo 2019-12-18 10:42:39 +01:00
Anders Schack-Mulligen
2443f10823 C#: Update .expected file. 2019-12-18 10:40:18 +01:00
Jonas Jensen
367827a2ef Merge pull request #2541 from max-schaefer/unify-xml-qlls
C++/Java/JavaScript/Python: Unify XML libraries.
2019-12-18 10:35:34 +01:00
Jonas Jensen
66d49a4a8a Merge pull request #2546 from MathiasVP/arguments-source-qltest
C++: Added test for 333d0a69
2019-12-18 09:11:11 +01:00
Robert Marsh
e209ed961a Merge branch 'master' into rdmarsh/cpp/ir-callee-side-effects 2019-12-17 15:11:02 -08:00
Robert Marsh
93ace5be35 C++: remove Chi node flow in DefaultTaintTracking 2019-12-17 14:23:11 -08:00
semmle-qlci
8ad11b98d0 Merge pull request #2538 from hvitved/csharp/missing-to-string
Approved by calumgrant
2019-12-17 19:23:47 +00:00
Dave Bartolomeo
240823019a Merge remote-tracking branch 'upstream/master' into dbartol/MissingToString 2019-12-17 11:50:36 -07:00
Geoffrey White
ab0be19cc5 C++: Autoformat. 2019-12-17 17:51:55 +00:00
Jonathan Leitschuh
b218374772 Add io.netty.handler.codec.http.DefaultHttpResponse to Netty Response Splitting Detection
Related: #2185
Related: https://github.com/github/security-lab/issues/22
2019-12-17 12:12:04 -05:00
Robert Marsh
7468facb34 C++: autoformat more 2019-12-17 09:06:52 -08:00
Rasmus Wriedt Larsen
8b5d6ae2cf Python: Modernise zope web tests 2019-12-17 17:42:03 +01:00
Rasmus Wriedt Larsen
e257ba40c4 Python: Make zope web tests pass 2019-12-17 17:42:03 +01:00
Erik Krogh Kristensen
2e5b7273ab changes based on review feedback. 2019-12-17 17:30:05 +01:00
Taus Brock-Nannestad
1d94f6d303 Python: Fix several bad join orders.
Performance on `taers232c/GAMADV-X` (which exhibited pathological behaviour in
the most recent dist upgrade) went from ~670s to ~313s on
`py/hardcoded-credentials`.

There are still a few tuple counts in the 10-100 million range, but this commit
takes care of all of the ones that numbered in the billions. (A single tuple
count in the 100-1000 million range remains, but it appears to be less critical,
taking only two seconds to calculate.)
2019-12-17 17:19:49 +01:00
Geoffrey White
eaf00c6683 C++: Fix override related warning. 2019-12-17 15:39:29 +00:00
Erik Krogh Kristensen
0a8a2ecc61 make EventEmitter classses non final, and add a comment about extending EventEmitter::Range 2019-12-17 16:37:03 +01:00
Erik Krogh Kristensen
fed9302996 uppercase E in Electron
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-17 16:29:55 +01:00
Geoffrey White
9986206dc6 C++: Placement new does not necessarily require a delete. 2019-12-17 15:28:21 +00:00
Erik Krogh Kristensen
bf56797ad7 update expected output of tests 2019-12-17 16:27:55 +01:00
Erik Krogh Kristensen
f140820511 fix FP related to block-level flow type annotations 2019-12-17 16:10:20 +01:00
Shati Patel
6a1d0b016c QL tutorials: Update formatting and style 2019-12-17 14:59:50 +00:00
Anders Schack-Mulligen
0880b57372 Merge pull request #1 from hvitved/csharp/no-ternary-cond-taint-tracking
C#: No taint-tracking steps for ternary conditionals
2019-12-17 15:29:24 +01:00
Mathias Vorreiter Pedersen
1d3ee71f73 C++: Added test for 333d0a69 2019-12-17 13:54:41 +01:00
Tom Hvitved
9dde1ce76a C#: No taint-tracking steps for ternary conditionals
Ternary conditionals `b ? x : y` mistakenly had taint-tracking steps from both
`b`, `x`, and `y` to the conditional expression itself. Flow from `b` was not
intented, and flow from `x` and `y` is already part of ordinary data flow.
2019-12-17 13:53:39 +01:00
James Fletcher
a974bccd62 Merge pull request #2545 from shati-patel/update-ql4e
Docs: Update mention of "QL for Eclipse"
2019-12-17 12:39:31 +00:00
shati-patel
8143333928 Docs: Update mention of "QL for Eclipse" 2019-12-17 12:33:01 +00:00
Erik Krogh Kristensen
9dd7d1c6d7 changes based on review feedback 2019-12-17 13:19:53 +01:00
Erik Krogh Kristensen
f9ddd5891a minor documentation fixes
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-17 13:05:20 +01:00
Geoffrey White
a5e10a7ae2 C++: More change notes. 2019-12-17 11:56:23 +00:00
Geoffrey White
520ff39349 C++: Update MemoryMayNotBeFreed.ql similarly. 2019-12-17 11:56:23 +00:00
Geoffrey White
9a944a947a C++: Update MemoryNeverFreed.ql to exclude alloca (and use the new allocation model directly). 2019-12-17 11:10:03 +00:00
Geoffrey White
a8c31c6590 C++: Add AllocationFunction/AllocationExpr.requiresDealloc(). 2019-12-17 11:07:08 +00:00
Anders Schack-Mulligen
ca08097b56 Java/C++/C#: Fix Java Content.getType and getContainerType to match C# and fix C# tests. 2019-12-17 11:51:58 +01:00
Geoffrey White
b2e2db1e5c CPP: Autoformat. 2019-12-17 10:39:52 +00:00
Geoffrey White
19835cd11d C++: Change note. 2019-12-17 10:27:13 +00:00
Max Schaefer
81f51e4e2b Ensure that XML libraries for C++, Java, JavaScript and Python stay in sync. 2019-12-17 10:15:43 +00:00
Max Schaefer
09ee106333 Java/JavaScript: Add two deprecated predicates to XML.qll.
This makes XML.qll identical across C++, Java, JavaScript and Python.
2019-12-17 10:15:43 +00:00
Max Schaefer
a17b615ae5 C++/Python: Deprecate XMLFile.getPath and XMLFile.getFolder.
Both can be expressed using predicates inherited from `File`.
2019-12-17 10:15:43 +00:00
Max Schaefer
47c1fc7358 C++/Python: Fix XMLFile.getPath and XMLFile.getFolder.
Previously, the former returned the file's stem (that is, basename without extension), and the latter never held.
2019-12-17 10:15:43 +00:00
Max Schaefer
bf30f9cdd2 Python: Remove use of deprecated predicate. 2019-12-17 10:15:43 +00:00
Max Schaefer
bccdf59631 C++: Remove an unecessary unresolveElement.
As far as I can see, `@file` is not a `@usertype`, so this shouldn't be needed.
2019-12-17 10:15:43 +00:00
Max Schaefer
ef453db225 Python: Adjust XMLParent.getName to match other languages. 2019-12-17 10:15:43 +00:00
Max Schaefer
3068a89ab2 Python: Adjust implementation of allCharactersString to match other languages. 2019-12-17 10:15:43 +00:00
Max Schaefer
923e36ba4f C++/Java/JavaScript/Python: Make qldoc consistent. 2019-12-17 10:15:43 +00:00
Max Schaefer
a2fe678464 C++/Java/JavaScript/Python: Unify imports in XML.qll. 2019-12-17 10:15:43 +00:00
Max Schaefer
49abffa477 Python: Autoformat XML.qll. 2019-12-17 10:15:43 +00:00
Geoffrey White
4d3fa3ac1d C++: Demote UnsafeArrayForDaysOfYear.ql. 2019-12-17 10:14:24 +00:00
Geoffrey White
c1be4c78af C++: Add tags to the leap year + japanese era queries. 2019-12-17 10:14:20 +00:00
Geoffrey White
6d516e0192 C++: Make some implementations in DatTime.qll more robust (and cope with 'const'). 2019-12-17 10:14:08 +00:00
Jonas Jensen
9193a81e1a Merge pull request #2534 from geoffw0/xml
C++: Fix characteristic predicate of `XMLParent`.
2019-12-17 10:57:40 +01:00
Max Schaefer
45d0e5971f Merge pull request #2535 from RasmusWL/python-fix-xml-charpred
Python: Fix characteristic predicate of `XMLParent`
2019-12-17 07:17:42 +00:00
yo-h
69a2632806 Merge pull request #2341 from aschackmull/java/cached-tostring-perf-fixes
Java: Fix a number of performance issues when toString is cached.
2019-12-16 22:01:35 -05:00
yo-h
f418086992 Merge pull request #2529 from aschackmull/java/xmlparent-charpred
Java: Fix characteristic predicate of `XMLParent`.
2019-12-16 21:56:03 -05:00
Robert Marsh
fdaa06ce92 C++:autoformat 2019-12-16 12:54:31 -08:00
Robert Marsh
3c9d7953b6 Merge branch 'master' into rdmarsh/cpp/default-taint-tracking-sources 2019-12-16 11:49:22 -08:00
Tom Hvitved
f1193d084b C#: Add missing toString() relations 2019-12-16 19:38:46 +01:00
Dave Bartolomeo
60c40adf31 C++: Fix formatting 2019-12-16 10:00:54 -07:00
Anders Schack-Mulligen
a97e7bd3b2 Java/C++/C#: Some review fixes. 2019-12-16 16:17:19 +01:00
Anders Schack-Mulligen
0eacadb309 C#: Fix unit test. 2019-12-16 16:17:19 +01:00
Anders Schack-Mulligen
a1a875e3e1 Java/C++/C#: Fix autoformat. 2019-12-16 16:15:48 +01:00
Anders Schack-Mulligen
02068ecdcd Java/C++/C#: Sync. 2019-12-16 16:15:48 +01:00
Anders Schack-Mulligen
bca79cd4d6 Java/C++/C#: Add support for taint-getter/setter summaries. 2019-12-16 16:15:48 +01:00
Rasmus Wriedt Larsen
cd1a3e9bf0 Merge pull request #2537 from tausbn/action-disable-labeler
Actions: Disable labeler action.
2019-12-16 16:04:54 +01:00
Geoffrey White
25dc2ad273 C++: Support '__builtin_alloca'. 2019-12-16 14:19:33 +00:00
Geoffrey White
acca39bfc7 C++: Repair following merge. 2019-12-16 14:12:32 +00:00
James Fletcher
05ad7777cb Merge pull request #2536 from shati-patel/docs/ql4e
Docs: Update references to QL for Eclipse
2019-12-16 14:10:56 +00:00
Geoffrey White
0da826f0c3 Merge branch 'master' into overflowcalc 2019-12-16 13:48:38 +00:00
Erik Krogh Kristensen
8f17db6670 changes based on review feedback 2019-12-16 14:43:29 +01:00
Jonas Jensen
8b1892d900 Merge pull request #2533 from m00nbsd/master
Add NetBSD/Solaris allocation functions.
2019-12-16 14:42:12 +01:00
Geoffrey White
0a1fa08488 Update cpp/ql/test/library-tests/files/Files.ql
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-16 13:38:36 +00:00
Calum Grant
a5b2549f6f Merge pull request #2514 from hvitved/csharp/code-contracts
C#: Recognize Code Contract assertions
2019-12-16 13:00:01 +00:00
Taus Brock-Nannestad
d5d6093e75 Actions: Disable labeler action.
I've left the `labeler.yml` configuration file, in case this ever starts working
properly with forks.
2019-12-16 13:53:00 +01:00
Erik Krogh Kristensen
7c931452d9 autoformat 2019-12-16 13:45:42 +01:00
Rasmus Wriedt Larsen
6a73479ea3 Python: Modernise py/loop-variable-capture 2019-12-16 13:36:59 +01:00
Rasmus Wriedt Larsen
9004a8e71f Python: Fix characteristic predicate of XMLParent
Like in https://github.com/Semmle/ql/pull/2520
2019-12-16 13:32:28 +01:00
Erik Krogh Kristensen
3ca3fa7e9e add quotes on code in documentation
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2019-12-16 13:32:01 +01:00
Shati Patel
1ff5a8e8e2 Docs: Update references to QL for Eclipse 2019-12-16 12:28:39 +00:00
Geoffrey White
f990634481 C++: Fix the XMLParent Constructor. 2019-12-16 11:07:16 +00:00
Geoffrey White
a6407f00a7 C++: Extend the files test to cover the issue with XMLParent. 2019-12-16 11:07:12 +00:00
Geoffrey White
c4c1dfa2b9 C++: Modernize the files tests. 2019-12-16 11:07:07 +00:00
Jonas Jensen
5cea452123 Merge pull request #2491 from rdmarsh2/rdmarsh/cpp/ir-taintedIncludingGlobalVars
C++: handle global vars in DefaultTaintTracking
2019-12-16 11:00:34 +01:00
m00nbsd
f7484171c9 Add NetBSD/Solaris allocation functions.
* kmem_{z}alloc is used by Solaris and NetBSD
 * pool_{cache_}get is used by NetBSD
2019-12-16 10:32:18 +01:00
Erik Krogh Kristensen
c19d8ecb73 refactorizations and preparations for SocketIO implementation 2019-12-16 10:13:27 +01:00
Erik Krogh Kristensen
8c0b6f26da Merge remote-tracking branch 'upstream/master' into moarExceptions 2019-12-16 08:35:45 +01:00
Erik Krogh Kristensen
904976c7ac update tests after removing control-flow checks from error-callbacks 2019-12-16 08:30:21 +01:00
Jonas Jensen
648c19978a Merge pull request #2528 from geoffw0/hiddenqueries
CPP: Resolve some hidden queries
2019-12-14 09:39:13 +01:00
Dave Bartolomeo
914288d3c5 C++: Fix toString() predicates that don't hold 2019-12-13 17:06:05 -07:00
Erik Krogh Kristensen
1efe2ba167 inline ifStmt field 2019-12-13 19:00:54 +01:00
Geoffrey White
91af51cf46 CPP: Change note. 2019-12-13 16:58:37 +00:00
Jonathan Leitschuh
d24d1a11d0 Merge pull request #1 from aschackmull/java/cwe-829-qltest
Java: Add .expected file to qltest.
2019-12-13 10:55:17 -05:00
Anders Schack-Mulligen
13f12c5332 Java: Fix characteristic predicate of XMLParent. 2019-12-13 15:20:52 +01:00
Anders Schack-Mulligen
f88623ccb4 Java: Add .expected file to qltest. 2019-12-13 14:34:29 +01:00
semmle-qlci
9b6c394ac7 Merge pull request #2520 from max-schaefer/js/fix-2517
Approved by esbena
2019-12-13 12:59:37 +00:00
Erik Krogh Kristensen
3b2cc4674e autoformat 2019-12-13 11:44:52 +01:00
Erik Krogh Kristensen
e164f46330 changes based on review feedback 2019-12-13 11:44:31 +01:00
Geoffrey White
d1530ddef9 CPP: Reduce precision of ClassesWithManyFields.ql. 2019-12-13 08:40:59 +00:00
Geoffrey White
49b5d9283f CPP: Reduce precision of FeatureEnvy.ql. 2019-12-13 08:40:59 +00:00
Geoffrey White
896ec9de72 CPP: Reduce precision of InappropriateIntimacy.ql. 2019-12-13 08:40:58 +00:00
Geoffrey White
acb011de04 CPP: Reduce precision of JapaneseEraDate.ql. 2019-12-13 08:40:58 +00:00
Felicity Chapman
54a7b89b99 Merge pull request #2526 from yo-h/java-change-note-netty
Java: add change note for `java/netty-http-response-splitting`
2019-12-13 08:12:01 +00:00
Jonas Jensen
12c11d079b Merge pull request #2523 from jf205/mergeback-123-ql
Mergeback 1.23 -> master
2019-12-13 09:08:27 +01:00
Robert Marsh
53988b4b6c Merge pull request #2527 from Semmle/fix-labeler-yaml-escaping
Actions: Fix broken escaping in PR labeller action.
2019-12-12 16:00:17 -08:00
Taus
c1b5389d96 Actions: Fix broken escaping in PR labeler action.
TL;DR: YAML escaping is complicated. I think this should fix the problems.
2019-12-12 22:24:23 +01:00
yo-h
32f146fbca Java: add change note for java/netty-http-response-splitting 2019-12-12 14:31:06 -05:00
Jonathan Leitschuh
0c2da8af40 Update java/ql/src/Security/CWE/CWE-829/InsecureDependencyResolution.ql 2019-12-12 14:10:11 -05:00
Robert Marsh
57d891e3b4 C++: autoformat 2019-12-12 11:03:18 -08:00
Asger F
45524d8b19 JS: Add to correctness-core suite 2019-12-12 16:05:05 +00:00
Asger F
e8f0e3811a JS: Replace backticks with <code> 2019-12-12 15:52:09 +00:00
Asger F
eb82b17f16 JS: QHelp and a bit of qldoc 2019-12-12 15:40:41 +00:00
Rasmus Wriedt Larsen
43301505f5 Merge pull request #2521 from tausbn/automatically-label-pull-requests
Actions: Automatically add language-specific labels to pull requests.
2019-12-12 15:35:51 +00:00
Taus Brock-Nannestad
2fec0d0294 Escape labels with potentially problematic characters. 2019-12-12 16:29:04 +01:00
Erik Krogh Kristensen
f35dc5d274 Merge remote-tracking branch 'upstream/master' into moarExceptions 2019-12-12 16:13:52 +01:00
Erik Krogh Kristensen
17358606cb change callback to rely on an behavior heuristic rather than a naming heuristic 2019-12-12 16:12:37 +01:00
Asger F
f398247d2f JS: Step through rephinements in getImmediatePredecessor 2019-12-12 15:11:25 +00:00
Asger F
a30f991b5e JS: Add query for missing await 2019-12-12 15:11:25 +00:00
james
f6029bd55c Merge branch 'rc/1.23' into mergeback-123-ql 2019-12-12 15:05:28 +00:00
Geoffrey White
73446ea610 Merge pull request #2511 from jbj/isInCycle-raw-only
C++: Compute isInCycle only for raw IR
2019-12-12 14:22:00 +00:00
Erik Krogh Kristensen
08d0cb795b revert the introduction of getEnclosingCall 2019-12-12 15:14:02 +01:00
Taus Brock-Nannestad
51315217ff Add documentation label to docs/**/*. 2019-12-12 15:10:21 +01:00
Taus Brock-Nannestad
558c0a440e Actions: Automatically add language-specific labels to pull requests. 2019-12-12 14:42:45 +01:00
Rasmus Wriedt Larsen
e3b502085b Merge pull request #2515 from tausbn/python-fix-bad-join-order-in-statement-no-effect
Python: Fix bad join order in `py/ineffectual-statement`.
2019-12-12 13:41:18 +00:00
Max Schaefer
dfeca63677 JavaScript: Fix characteristic predicate of XMLParent.
The database type `@xmlparent` is defined a bit too loosely in that it includes all of `@file`, not just XML files. Fixing that would involve fiddling with the extractor/dbscheme, so I have opted to fix it at the QL level instead.
2019-12-12 12:38:29 +00:00
Jonas Jensen
fd48dcf63e C++: Get rid of a fastTC and noopt in IR
The `getAChild*` fastTC was causing OOM on a `make allyesconfig` Linux
database with 8GB RAM, and I've observed it to be slow on other
databases too.
2019-12-12 09:31:39 +01:00
Tom Hvitved
374b0c063e C#: Autoformat 2019-12-11 20:36:54 +01:00
Erik Krogh Kristensen
e818f4c08b refactored some duplicated methods into the abstract class, and specialized the type of emitter in NodeJS EventEmitter dispatch/registration 2019-12-11 18:25:03 +01:00
Taus Brock-Nannestad
d5cc42e34c Python: Fix bad join order in py/ineffectual-statement.
This used to take 30s on `cpython`.
```
Tuple counts for StatementNoEffect::side_effecting_binary#f:
46522     ~0%     {2} r1 = ClassObject::ClassObject::hasAttribute_dispred#fb AS L AND NOT StatementNoEffect::side_effecting_binary#f#antijoin_rhs AS R(L.<0>, L.<1>)
46522     ~2%     {2} r2 = SCAN r1 OUTPUT r1.<1>, r1.<0>
950960    ~2%     {2} r3 = JOIN r2 WITH Operations::Operator::getSpecialMethodName_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r2.<1>
950960    ~2%     {2} r4 = JOIN r3 WITH py_operators AS R ON FIRST 1 OUTPUT R.<2>, r3.<1>
950960    ~0%     {3} r5 = JOIN r4 WITH AstGenerated::BinaryExpr_::getLeft_dispred#ff AS R ON FIRST 1 OUTPUT R.<1>, r4.<1>, r4.<0>
122934382 ~0%     {2} r6 = JOIN r2 WITH Operations::Cmpop::getSpecialMethodName_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r2.<1>
122934382 ~3%     {3} r7 = JOIN r6 WITH project#Operations::Compare::compares_dispred#ffff#3_201#join_rhs AS R ON FIRST 1 OUTPUT R.<2>, r6.<1>, R.<1>
123885342 ~3%     {3} r8 = r5 \/ r7
300       ~8%     {1} r9 = JOIN r8 WITH project#Exprs::Expr::refersTo_dispred#ffff AS R ON FIRST 2 OUTPUT r8.<2>
                  return r9
```
With this commit, it takes a few milliseconds.
2019-12-11 17:58:30 +01:00
semmle-qlci
3d8c35e523 Merge pull request #2509 from asger-semmle/typescript-full-json
Approved by max-schaefer
2019-12-11 16:31:26 +00:00
Tom Hvitved
78f63a3679 C#: Add change note 2019-12-11 16:57:35 +01:00
Tom Hvitved
b7484e63ee C#: Recognize Code Contract assertions 2019-12-11 16:54:42 +01:00
Tom Hvitved
5429448eeb C#: Add tests for Code Contracts 2019-12-11 16:51:42 +01:00
shati-patel
f2d1e534c9 Merge pull request #1914 from jf205/query-debugging
docs: make a start on query debugging topic
2019-12-11 14:31:55 +00:00
James Fletcher
ff4a604119 Update docs/language/learn-ql/writing-queries/debugging-queries.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-12-11 14:29:10 +00:00
Erik Krogh Kristensen
f537e28389 add pragma to internalBlocks predicate to fix performance 2019-12-11 15:19:30 +01:00
James Fletcher
b2db72d336 Apply suggestions from code review
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-12-11 14:13:56 +00:00
James Fletcher
2ce1c2bfee Apply suggestions from code review
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-11 12:44:35 +00:00
james
d6202da876 docs: address max's comments 2019-12-11 12:25:35 +00:00
James Fletcher
61576caede Apply suggestions from code review
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-11 12:20:38 +00:00
Asger F
063abb5cbc TS: Avoid name clash between tsconfig.json and type table 2019-12-11 12:15:44 +00:00
semmle-qlci
cb8e5fa3fc Merge pull request #2411 from asger-semmle/regexp-sanitizer-guards
Approved by esbena, max-schaefer
2019-12-11 12:00:21 +00:00
james
d56c02b1b7 docs: start work on debugging queries topic 2019-12-11 10:42:54 +00:00
Erik Krogh Kristensen
62512dd3e9 expand the js/exception-xss to handle more types of exceptional flow 2019-12-11 10:43:50 +01:00
Jonas Jensen
5a8407749f C#: autoformat fixup 2019-12-11 09:10:23 +01:00
yo-h
837b1e2f9b Merge pull request #2501 from hmakholm/test-extractors
Prepare for `codeql test`:
2019-12-10 16:49:14 -05:00
Calum Grant
3e0045f435 Merge pull request #2308 from hvitved/csharp/dataflow/types
C#: Type-based pruning for data flow
2019-12-10 20:16:20 +00:00
Geoffrey White
5ecfaed6b1 Merge pull request #2510 from jbj/getTempVariable-perf
C++: Fix getTempVariable join order in IR
2019-12-10 16:06:52 +00:00
Jonas Jensen
66876d0f63 C++: Compute isInCycle only for raw IR
On wireshark/wireshark, `isInCycle` ran into a low-memory loop on the
`aliased_ssa` stage. It shouldn't be necessary to detect cycles after
the `raw` stage, so this commit moves cycle detection into the
`Construction` modules and makes it a no-op in `SSAConstruction.qll`.
2019-12-10 16:03:39 +01:00
Erik Krogh Kristensen
267c4c07ed refactor EventEmitter model to use the ::Range pattern 2019-12-10 15:54:14 +01:00
Tom Hvitved
abcb6b8aab C#: Type-based pruning for data flow 2019-12-10 15:48:48 +01:00
Tom Hvitved
54088248a1 C#: Use source declarations in field flow 2019-12-10 15:46:31 +01:00
Tom Hvitved
a344707baa C#: Add more data flow tests
Add tests that exhibit missing type pruning.
2019-12-10 15:46:31 +01:00
Tom Hvitved
78ddb37a8c C#: Track type information in data flow
This commit adds type information to data flow paths, by mapping node types onto
the smaller set of GVN types, and implementing `ppReprType()`.

The effect is a mere change in `DataFlow::PathNode::toString()`; no type-based
pruning is done yet.
2019-12-10 15:46:28 +01:00
Erik Krogh Kristensen
c4fd80d12b some review feedback 2019-12-10 14:53:01 +01:00
Jonas Jensen
7c151644f5 C++: Fix getTempVariable join order in IR
This join order seems to have broken so it took forever on
wireshark/wireshark.
2019-12-10 13:43:36 +01:00
Erik Krogh Kristensen
e5d465da9a documentation fixes from @max-schaefer
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-10 12:01:51 +01:00
Erik Krogh Kristensen
59bafab6c3 update test to not use private class 2019-12-10 10:39:01 +01:00
Erik Krogh Kristensen
72cf14989a update expected output of test 2019-12-10 10:33:37 +01:00
Jonathan Leitschuh
229622459c Update InsecureDependencyResolution with code review comments 2019-12-09 20:37:53 -05:00
Jonathan Leitschuh
f341234edb Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
Co-Authored-By: yo-h <55373593+yo-h@users.noreply.github.com>
2019-12-09 19:17:23 -05:00
Robert Marsh
18e7eff43c C++: autoformat 2019-12-09 13:47:38 -08:00
Robert Marsh
b9f8c39fe2 C++: respond to PR comments 2019-12-09 10:55:56 -08:00
Geoffrey White
1c2f36930d Merge pull request #2504 from jbj/1.23-legacy-suites
C++: Add new queries in 1.23 to legacy suites
2019-12-09 16:02:42 +00:00
Jonas Jensen
9bbebfc01f C++: Add new queries to C suite too 2019-12-09 17:00:33 +01:00
Erik Krogh Kristensen
60a825cf66 fix tabs and spaces 2019-12-09 16:06:17 +01:00
Jonas Jensen
ff7b6e2ce7 C++: Add new queries in 1.23 to legacy suites
I didn't add `JapaneseEraDate.ql` since it's not displayed on LGTM by
default.
2019-12-09 15:36:51 +01:00
Erik Krogh Kristensen
110302678c add model for EventEmitter in NodeJS, and base the Electron::IPC model on top of the new EventEmitter model 2019-12-09 14:27:35 +01:00
Calum Grant
3049bf2c85 Merge pull request #2358 from cldrn/ASPNetPagesValidateRequest
Adds CodeQL query to check for Pages with disabled built-in validation
2019-12-09 13:05:03 +00:00
shati-patel
bc2e15c133 Merge pull request #2503 from jf205/support-notes
CodeQL support docs: remove some full stops
2019-12-09 12:32:16 +00:00
james
07f35e8b58 docs: remove some full stops 2019-12-09 12:26:53 +00:00
James Fletcher
61d4a87aa4 Merge pull request #2499 from felicitymay/1.23/update-supported-versions
Update supported versions for 1.23 release
2019-12-09 12:23:59 +00:00
Tom Hvitved
c562d6757c Merge pull request #2500 from shati-patel/typo
Fix typos
2019-12-09 13:06:39 +01:00
Tom Hvitved
25265bddc7 Merge pull request #2494 from calumgrant/cs/roslyn-3.4
C#: Upgrade Roslyn to 3.4
2019-12-09 12:21:30 +01:00
Henning Makholm
073563a19b Python tests: explicitly specify --lang2 for python2 tests
This allows them to work with the `LegacyQltLanguage.PYTHON3` extraction recipe.
2019-12-07 02:38:02 +01:00
Henning Makholm
baacc6f66b Java tests: add queries.xml
The `queries.xml` file defines which extractor the `codeql test` runner will use
to extract databases for the tests. In the future one will be able to write this
information in `qlpack.yml`, but we can't do that immediately because the
_existing_ CodeQL tooling would  refuse to parse  a `qlpack.yml` that has
the new field in it.
2019-12-07 02:38:02 +01:00
Henning Makholm
66b3c7cf07 JS tests: add queries.xml
The `queries.xml` file defines which extractor the `codeql test` runner will use
to extract databases for the tests. In the future one will be able to write this
information in `qlpack.yml`, but we can't do that immediately because the
_existing_ CodeQL tooling would refuse to parse a `qlpack.yml` that has the new
field in it.

Adding a queries.xml file means that the normalization of file names in the test
output changes even with the old QLTest, so there are a number of consequential
updates of expected output files.
2019-12-07 02:38:02 +01:00
yo-h
ed97be459f Merge pull request #2454 from aschackmull/java/explicit-mul-zero
Java: Allow explicit zero multiplication in java/evaluation-to-constant.
2019-12-06 18:13:43 -05:00
Shati Patel
f40b1b570c Fix typo 2019-12-06 15:56:01 +00:00
Felicity Chapman
e59d65e67f Update supported versions for 1.23 release 2019-12-06 15:41:18 +00:00
Jonas Jensen
0012fef504 Merge pull request #2497 from hvitved/csharp/remove-cp
C#: Remove a Cartesian product
2019-12-06 13:58:33 +00:00
Calum Grant
964f2f25dc Merge pull request #2462 from hvitved/csharp/localvars-refactor
C#: Handle tuple patterns in `is` expressions
2019-12-06 12:59:14 +00:00
Calum Grant
4b0a149704 C#: Update qltest output. 2019-12-06 12:41:20 +00:00
Calum Grant
5e6b7be5b8 C#: Update nullability tests. 2019-12-06 12:41:20 +00:00
Calum Grant
5f6527a183 C#: Compare symbols using SymbolEqualityComparer. 2019-12-06 12:41:20 +00:00
Calum Grant
ca195e9340 C#: Update project files to Roslyn 3.4 2019-12-06 12:41:20 +00:00
shati-patel
a5274ad5f2 Merge pull request #2496 from jf205/jf-mergeback-123
Merge rc/1.23 into master
2019-12-06 12:24:07 +00:00
Asger F
abec4badb5 Apply suggestions from code review
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-06 11:53:09 +00:00
Asger F
344f0b4995 Fix typo in qldoc
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-06 11:53:09 +00:00
Asger F
c1da83bf6c Fix typo in qldoc
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-12-06 11:53:09 +00:00
Asger F
2acd616e6f JS: Review comments 2019-12-06 11:53:06 +00:00
Anders Schack-Mulligen
5a2ed9fd81 Java: Add change note. 2019-12-06 11:50:27 +00:00
Asger F
bbb6dad726 JS: Update koa testcase 2019-12-06 11:49:59 +00:00
Asger F
b407de01f8 JS: Update TaintBarriers test 2019-12-06 11:49:59 +00:00
Asger F
a6e75259d6 JS: More fine-grained regexp-based sanitizer guards 2019-12-06 11:49:59 +00:00
Asger F
ad6e949bad JS: Introduce RegExpCreationNode 2019-12-06 11:49:59 +00:00
Asger F
4354945c26 JS: Factor out recognition of RegExp flags 2019-12-06 11:49:59 +00:00
Luke Cartey
b940f3e637 Merge pull request #2461 from jf205/codeql-172
CodeQL training: update QL4E links and provide database instructions
2019-12-06 11:15:49 +00:00
Tom Hvitved
3a95cd5e9c C#: Remove a Cartesian product 2019-12-06 10:42:59 +00:00
james
67eea44678 Merge branch 'rc/1.23' into jf-mergeback-123 2019-12-06 09:16:39 +00:00
Geoffrey White
a3efcf66a6 Merge pull request #2495 from hmakholm/pr/update-c-test
C++ tests: generalize arguments tests
2019-12-06 09:10:17 +00:00
Henning Makholm
6bdf186d1e C tests: generalize arguments tests
With the coming `codeql test` support, the `predefined_macros` file will not
necessarily be located under a `tools` directory. Change the test to hide more
of its actual path, so it will work in both cases.
2019-12-06 01:21:17 +01:00
Tom Hvitved
3e93aa9787 C#: Address review comments
- Undo split of `localvars` relation.
- Properly extract tuple declarations in `is` expressions.
2019-12-05 22:31:38 +00:00
Robert Marsh
28fb3d606a C++: add fread and printf alias models 2019-12-05 12:14:33 -08:00
Robert Marsh
52a74718da C++: Move sources into DefaultTaintTracking 2019-12-05 12:14:25 -08:00
Robert Marsh
39b400ca69 C++: Add DefinitionByReferenceNode to IR dataflow 2019-12-05 11:56:57 -08:00
Calum Grant
59ce8842bb Merge branch 'master' of git.semmle.com:Semmle/ql into ASPNetPagesValidateRequest
# Conflicts:
#	change-notes/1.24/analysis-csharp.md
2019-12-05 15:58:47 +00:00
Felicity Chapman
fa8e5e6793 Merge pull request #2489 from jf205/deprecate-cobol-master
Supported languages: update COBOL info
2019-12-05 15:08:53 +00:00
Robert Marsh
055c1d0efa Merge pull request #2488 from geoffw0/speedup2
CPP: Speed up SensitiveExprs.qll
2019-12-04 14:09:32 -08:00
Robert Marsh
420a0bb74c C++: handle namespace vars in DefautlTaintTracking 2019-12-04 13:16:12 -08:00
Robert Marsh
ec95197d6d Merge pull request #2451 from dbartol/dbartol/May-Must
C++/C#: Consistent handling of "may" vs. "must" memory accesses
2019-12-04 12:32:53 -08:00
Dave Bartolomeo
cbb6797ca8 Merge from master and resolve conflicts 2019-12-04 10:14:52 -07:00
Calum Grant
73c8888361 Merge pull request #2356 from cldrn/ASPNetRequestValidationMode
Adds CodeQL query to check for insecure RequestValidationMode in ASP.NET
2019-12-04 17:02:08 +00:00
shati-patel
ad2da41af8 Merge pull request #2493 from jf205/deprecate-cobol
Learning CodeQL docs: add COBOL notes and remove links (rc/1.23)
2019-12-04 16:46:51 +00:00
shati-patel
343385bd2e Merge pull request #2492 from Semmle/revert-2487-deprecate-cobol
Revert "Learning CodeQL docs: add COBOL notes and remove links"
2019-12-04 16:41:00 +00:00
james
40920b162c docs: delete link to query console 2019-12-04 16:36:44 +00:00
james
ad32d9140b docs: increase trainig project version number 2019-12-04 16:36:44 +00:00
james
fe3a908317 docs: add cobol notes 2019-12-04 16:36:44 +00:00
James Fletcher
d47f08488f Revert "Learning CodeQL docs: add COBOL notes and remove links" 2019-12-04 16:34:00 +00:00
Dave Bartolomeo
50dc5e2ba3 Merge pull request #2438 from rdmarsh2/rdmarsh/ir-line-number-ids
C++/C#: use line numbers for instruction IDs
2019-12-03 18:48:28 -08:00
Robert Marsh
d99a90bfea C++: handle global vars in DefaultTaintTracking 2019-12-03 16:08:43 -08:00
Robert Marsh
722cc91eae C++: make getLineRank private 2019-12-03 10:53:08 -08:00
Jonas Jensen
57917bec17 Merge pull request #2480 from hvitved/dataflow/performance-tweaks
Data flow: Various performance tweaks
2019-12-03 18:44:11 +01:00
Calum Grant
db30947e54 Merge pull request #2490 from felicitymay/1.23/SD-4095-finalize-change-notes-csharp
1.23/sd 4095 finalize change notes csharp
2019-12-03 17:38:09 +00:00
Felicity Chapman
37e9ff1197 Merge pull request #2487 from jf205/deprecate-cobol
Learning CodeQL docs: add COBOL notes and remove links
2019-12-03 17:31:44 +00:00
Calum Grant
8018db3f66 Merge pull request #2474 from hvitved/csharp/dispatch-perf
C#: Improve performance of dispatch library
2019-12-03 15:47:43 +00:00
james
971db7126b docs: delete link to query console 2019-12-03 14:37:33 +00:00
Geoffrey White
8ddf877756 CPP: Autoformat. 2019-12-03 12:17:37 +00:00
james
f602c78242 docs: update cobol info 2019-12-03 11:58:30 +00:00
james
a560b6caa5 docs: increase trainig project version number 2019-12-03 10:57:12 +00:00
Geoffrey White
cc43e1116b CPP: Do the logic at the target, rather than the access, as there are likely fewer. 2019-12-03 10:52:40 +00:00
james
25e779913f docs: add cobol notes 2019-12-03 10:52:06 +00:00
Geoffrey White
20eb39d37e CPP: Bypass some of the complexity in 'toString'. 2019-12-03 10:44:59 +00:00
Geoffrey White
6e6c1693f4 CPP: Speed up SensitiveExprs.qll 'suspicious' and 'nonSuspicious' mechanism. 2019-12-03 10:43:36 +00:00
Geoffrey White
b752a6c8ed Merge pull request #2381 from jbj/StackVariable
C++: Add StackVariable class, preferred over LocalScopeVariable
2019-12-03 10:35:16 +00:00
Geoffrey White
2faae4dcb1 CPP: Autoformat. 2019-12-03 09:00:43 +00:00
semmle-qlci
cfcd18b411 Merge pull request #2429 from erik-krogh/typeAheadSink
Approved by esbena
2019-12-03 08:07:25 +00:00
Robert Marsh
1b802c7e18 C#: accept test change 2019-12-02 13:59:19 -08:00
Paulino Calderon
5fd0662264 Update csharp/ql/src/Security Features/CWE-016/ASPNetPagesValidateRequest.qhelp
Fixes typo

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-12-02 16:44:39 -05:00
Paulino Calderon
24b2471533 Update change-notes/1.24/analysis-csharp.md
tag update

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-12-02 16:44:25 -05:00
Paulino Calderon
9576e2a698 Update csharp/ql/src/Security Features/CWE-016/ASPNetPagesValidateRequest.qhelp
Adds missing code tags

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-12-02 16:43:51 -05:00
Dave Bartolomeo
acc3d23877 Clarify comment 2019-12-02 11:53:43 -08:00
Dave Bartolomeo
48e92e2399 Merge pull request #2481 from calumgrant/cs/fix-ir-types
C#: Fix some IR types that didn't compile.
2019-12-02 09:42:33 -08:00
Henning Makholm
e441e432ff Merge pull request #2484 from asger-semmle/typescript-codeql-env-var
JS: Make extractor aware of CodeQL env vars
2019-12-02 18:36:45 +01:00
Asger F
f162749044 Merge pull request #2418 from max-schaefer/js/file-locatable
JavaScript: Make `File` not extend `Locatable` anymore.
2019-12-02 16:15:14 +00:00
Asger F
f988e9004f JS: Autoformat FileExtractor.java 2019-12-02 16:06:37 +00:00
Asger F
c931beb853 TS: Make AutoBuild aware of CodeQL env vars 2019-12-02 16:06:27 +00:00
Anders Schack-Mulligen
2f8e92571a Merge pull request #2483 from hmakholm/pr/move-test
remove java test EmptyInterface
2019-12-02 16:18:08 +01:00
Henning Makholm
95c26a51af remove java test EmptyInterface
This is a test of an internal query for the Semmle repository. It cannot
run against the public QL repository alone, and therefore should not be
tested here.

https://git.semmle.com/Semmle/code/pull/35690 adds the test back to the
internal repo.
2019-12-02 15:29:42 +01:00
Rasmus Wriedt Larsen
387ab52855 Python: Add zope web tests from internal repo 2019-12-02 14:38:03 +01:00
Calum Grant
c05263ca98 C#: Fix some IR types that didn't compile. 2019-12-02 13:27:58 +00:00
Tom Hvitved
b3990c5a1d Data flow: Revert reordering changes in flowStore and flowRead 2019-12-02 14:25:59 +01:00
Tom Hvitved
5baa133e6c Data flow: Sync files 2019-12-02 13:41:17 +01:00
Max Schaefer
ec2ba735de JavaScript: Update Dependencies library to not rely on Files being Locatable.
Previously, we would consider an HTML file to be a dependent of all scripts embedded in it. Now we instead consider each JavaScript toplevel inside the HTML file to be a dependent, which is more sensible anyway.
2019-12-02 12:40:49 +00:00
Tom Hvitved
b1245eeac8 Data flow: Various performance tweaks 2019-12-02 13:38:10 +01:00
Nick Rolfe
d293418672 Merge pull request #2478 from jbj/mergeback-20191202
Mergeback from rc/1.23 to master
2019-12-02 12:28:20 +00:00
Calum Grant
fcd13dc595 Merge remote-tracking branch 'upstream/master' into ASPNetRequestValidationMode
# Conflicts:
#	change-notes/1.24/analysis-csharp.md
2019-12-02 12:03:11 +00:00
Erik Krogh Kristensen
ea9d6189de update expected test outpu 2019-12-02 12:52:39 +01:00
semmle-qlci
ceb9fff70c Merge pull request #2479 from max-schaefer/localTaintStep
Approved by asgerf
2019-12-02 11:35:43 +00:00
semmle-qlci
dc7a0c1b91 Merge pull request #2442 from hvitved/csharp/dataflow/conversion-operator
Approved by calumgrant
2019-12-02 11:01:35 +00:00
Max Schaefer
aeda2d68f8 JavaScript: Introduce localTaintStep predicate.
It's sometimes useful for exploratory queries, and the other languages have it as well.
2019-12-02 09:43:08 +00:00
Jonas Jensen
5b24b1efc3 Merge remote-tracking branch 'upstream/rc/1.23' into mergeback-20191202
Conflicts solved:
	javascript/extractor/src/com/semmle/js/extractor/Main.java
	javascript/ql/test/query-tests/Statements/UseOfReturnlessFunction/tst.js
2019-12-02 09:57:34 +01:00
Erik Krogh Kristensen
c6c1ebe81a Merge remote-tracking branch 'upstream/master' into typeAheadSink 2019-12-02 08:41:49 +01:00
Paulino Calderon
8026925a3a Update csharp/ql/src/Security Features/CWE-016/ASPNetRequestValidationMode.ql
Added missing quotes.

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-11-29 22:39:50 -05:00
Paulino Calderon
879d34d24d Update csharp/ql/src/Security Features/CWE-016/ASPNetRequestValidationMode.qhelp
Missing comma.

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-11-29 22:39:29 -05:00
Paulino Calderon
22964cba74 Update csharp/ql/src/Security Features/CWE-016/ASPNetRequestValidationMode.qhelp
Rephrasing.

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-11-29 22:39:04 -05:00
Paulino Calderon
a2dfd551f6 Update csharp/ql/src/Security Features/CWE-016/ASPNetRequestValidationMode.qhelp
built in to built-in

Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-11-29 22:38:42 -05:00
Tom Hvitved
c845a1ba91 C#: Improve performance of dispatch library 2019-11-29 15:32:00 +01:00
Jonas Jensen
4494d61e56 Merge pull request #2473 from aschackmull/java/field-flow-rev-read
Java/C++/C#: Bugfix for field flow through reverse read.
2019-11-29 14:45:12 +01:00
Calum Grant
a4251f67a2 C#: Analysis change notes. 2019-11-29 10:32:04 +00:00
Calum Grant
30a2620a8c C#: Tidy up docs, query metadata and add tests. 2019-11-29 10:31:58 +00:00
Tom Hvitved
a062d7d41c C#: Add regression test 2019-11-29 10:10:24 +01:00
Max Schaefer
f958916c76 Merge pull request #2330 from erik-krogh/exceptionXss
JS: Added query for detecting XSS that happens through an exception
2019-11-29 09:04:45 +00:00
semmle-qlci
a40ad9f276 Merge pull request #2456 from felicitymay/1.23/SD-4095-finalize-change-notes-js
Approved by erik-krogh, max-schaefer
2019-11-29 08:59:29 +00:00
Anders Schack-Mulligen
333d0a69d2 Java/C++/C#: Bugfix for field flow through reverse read. 2019-11-29 09:38:24 +01:00
Geoffrey White
3477c4a8fb Update cpp/ql/src/semmle/code/cpp/commons/Alloc.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-28 17:30:36 +00:00
Geoffrey White
aae9f88413 CPP: Model 'alloca'. 2019-11-28 17:27:37 +00:00
semmle-qlci
73e08eba43 Merge pull request #2468 from max-schaefer/js/regexp-predecessor
Approved by asgerf
2019-11-28 16:57:31 +00:00
Jonas Jensen
763b18cd11 Merge remote-tracking branch 'upstream/master' into StackVariable
Conflicts:
      change-notes/1.24/analysis-cpp.md
      cpp/ql/src/Security/CWE/CWE-131/NoSpaceForZeroTerminator.ql
2019-11-28 17:51:20 +01:00
Jonas Jensen
d816701e07 Revert "C++: Use StackVariable in Nullness.qll"
It looks like allowing statics in `Nullness.qll` is fine since it's a
"may be null" analysis rather than a "must be null" analysis.

This reverts commit f5b9837e19.
2019-11-28 17:44:42 +01:00
Jonas Jensen
d22df24cab Merge pull request #2467 from geoffw0/speedup1
CPP: Speed up isCompiledAsC.
2019-11-28 17:31:27 +01:00
semmle-qlci
198b3b34a3 Merge pull request #2432 from asger-semmle/install-typescript-deps
Approved by max-schaefer
2019-11-28 16:08:46 +00:00
Max Schaefer
7487c79271 JavaScript: Add missing qldoc. 2019-11-28 15:54:52 +00:00
Max Schaefer
47cbf0bf88 JavaScript: Override Locatable.getLocation() for @files. 2019-11-28 15:54:03 +00:00
Max Schaefer
a788bf87a0 JavaScript: Fix RegExpTerm.getPredecessor and getSuccessor.
These were originally meant to give you the term that is textually matched right before/right after the receiver. When I introduced support for lookbehinds, I changed the behaviour to give you the term that is _operationally_ matched before/after the receiver (remember that lookbehinds are implemented by reverse-matching).

However, I think that's rarely ever what you want, and is wrong for the only two uses of these predicates, where it's the textual matching order that we are after, not the operational order.

Consequently, I've changed the semantics back and updated the comments to hopefully clarify the intention.
2019-11-28 15:14:50 +00:00
Tom Hvitved
04cecc04dd C#: Update EntityFrameworkCore test 2019-11-28 15:28:50 +01:00
Paulino Calderon
eeffd7cf8d Adds CodeQL query to check for Pages validateRequest directive 2019-11-28 14:22:08 +00:00
Tom Hvitved
af453d081e C#: Only track taint through conversion operators defined in libraries 2019-11-28 15:21:04 +01:00
semmle-qlci
d59ea3d53c Merge pull request #2466 from esbena/js/fix-mjs-check
Approved by asgerf
2019-11-28 13:37:43 +00:00
Taus
20513561a0 Merge pull request #2459 from RasmusWL/python-modernise-TurboGears-library
Python: modernise TurboGears library
2019-11-28 14:36:01 +01:00
Tom Hvitved
ba4fb82a08 C#: Add DB upgrade script 2019-11-28 14:30:21 +01:00
Tom Hvitved
b79fc87961 C#: Split up localvars database relation into two relations 2019-11-28 14:30:21 +01:00
semmle-qlci
2b0eef3b14 Merge pull request #2448 from tausbn/python-use-import-python-consistently
Approved by RasmusWL
2019-11-28 12:47:00 +00:00
Geoffrey White
b1c992e85f CPP: Speed up isCompiledAsC (x3). 2019-11-28 11:28:38 +00:00
Esben Sparre Andreasen
4e0dfce427 JS: cache charpred for NodeJS::Require 2019-11-28 08:10:25 +01:00
Esben Sparre Andreasen
d909653a6b JS: simplify charpred for NodeJS::Require 2019-11-28 08:10:25 +01:00
Calum Grant
5833b15f0e C#: Analysis change notes. 2019-11-27 17:30:02 +00:00
Calum Grant
d001c3c2d2 C#: Restructure files. 2019-11-27 17:29:53 +00:00
Calum Grant
c906a8238d C#: Edit qhelp for cs/insecure-request-validation-mode 2019-11-27 16:37:37 +00:00
Calum Grant
4b19f3b6a4 C#: Whitespace edit and edit query metadata. 2019-11-27 16:37:37 +00:00
Paulino Calderon
6f346c6676 Adds CodeQL query to check for insecure RequestValidationMode in ASP.NET 2019-11-27 16:37:37 +00:00
james
931cc73d1e docs: add brief instructions for using databases in VS Code 2019-11-27 15:05:50 +00:00
james
24857e5616 docs: update or remove other uses of QL4E 2019-11-27 15:05:08 +00:00
Erik Krogh Kristensen
d212394058 update expected output 2019-11-27 15:21:47 +01:00
Erik Krogh Kristensen
34e44e89fd Merge remote-tracking branch 'upstream/master' into typeAheadSink 2019-11-27 15:19:06 +01:00
Rasmus Wriedt Larsen
44cc9dd0be Python: Add TurboGears templating example 2019-11-27 15:07:32 +01:00
Rasmus Wriedt Larsen
b526421072 Python: Autoformat TurboGears library 2019-11-27 14:19:51 +01:00
Rasmus Wriedt Larsen
9ef270fc92 Python: Modernise TurboGears library 2019-11-27 14:19:04 +01:00
Tom Hvitved
ce16bc553a C#: Autoformat 2019-11-27 13:47:24 +01:00
Erik Krogh Kristensen
9351cd44e4 Merge remote-tracking branch 'githubsemmle/master' into HEAD 2019-11-27 13:45:59 +01:00
Felicity Chapman
4070992273 Fix sort order 2019-11-27 12:38:39 +00:00
Felicity Chapman
587dd54a3c Minor text changes 2019-11-27 12:38:38 +00:00
semmle-qlci
a2827e9503 Merge pull request #2362 from erik-krogh/promiseAll
Approved by max-schaefer
2019-11-27 12:35:04 +00:00
Erik Krogh Kristensen
bafd57d7d5 refactor classes in typeahead.js model 2019-11-27 13:33:38 +01:00
Rasmus Wriedt Larsen
3e5e14a14b Merge pull request #2431 from tausbn/python-cyclic-import-future-annotations
Python: Account for non-evaluation of annotations in cyclic imports.
2019-11-27 13:31:53 +01:00
james
3782d1b6e4 docs: update links on opening slide 2019-11-27 12:28:57 +00:00
Erik Krogh Kristensen
4f75986274 update test to not use private classes 2019-11-27 12:59:10 +01:00
Felicity Chapman
eaf68e86e0 Merge pull request #2443 from tausbn/python-finalise-change-notes
Python: Update change note for 1.23.
2019-11-27 11:51:04 +00:00
Taus Brock-Nannestad
b503cdb9d4 Python: Final change note fixes.
- `false positives` becomes `false positive results`
- Items are listed alphabetically.
- Query IDs are listed.

Also, some of the queries had the wrong name (query message rather than the
actual query name). These have been fixed.
2019-11-27 12:10:28 +01:00
semmle-qlci
4916bed9cd Merge pull request #2433 from asger-semmle/import-js-file
Approved by max-schaefer
2019-11-27 10:55:59 +00:00
semmle-qlci
9ca4f6aecb Merge pull request #2392 from asger-semmle/window-name-flow
Approved by max-schaefer
2019-11-27 10:55:26 +00:00
semmle-qlci
793988afe4 Merge pull request #2344 from asger-semmle/element-pattern-prop-read
Approved by max-schaefer
2019-11-27 10:54:46 +00:00
Taus
8372039205 Apply suggestions from documentation review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2019-11-27 11:50:37 +01:00
Anders Schack-Mulligen
2c3a6d7359 Java: Allow explicit zero multiplication in java/evaluation-to-constant. 2019-11-27 11:49:43 +01:00
Erik Krogh Kristensen
967ecbad24 Merge remote-tracking branch 'upstream/master' into promiseAll 2019-11-27 11:28:37 +01:00
Felicity Chapman
38f6f05f12 Merge pull request #2452 from yo-h/docs-query-metadata-precision-fix
Documentation: fix invalid `@precision` value
2019-11-27 10:26:49 +00:00
Erik Krogh Kristensen
e27a69960d update description 2019-11-27 11:17:19 +01:00
Erik Krogh Kristensen
42fbcbf007 update expected test output 2019-11-27 11:14:04 +01:00
Erik Krogh Kristensen
60f7a7a274 changes based on review feedback 2019-11-27 11:11:49 +01:00
Erik Krogh Kristensen
6d63d75d87 remove superfluous line break
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2019-11-27 10:52:01 +01:00
Tom Hvitved
39aaa38486 C#: Update EntityFramework test 2019-11-27 10:28:12 +01:00
Anders Schack-Mulligen
3d0e3aa1fd Java: Fix a number of performance issues when toString is cached. 2019-11-27 09:06:15 +01:00
Anders Schack-Mulligen
42b51d4ebb Merge pull request #2449 from felicitymay/1.23/SD-4095-finalize-change-notes-java2
Update data-flow note to match that for C/C++
2019-11-27 08:50:31 +01:00
Asger F
6eb2c26ea4 TS: Pass --no-default-rc and --non-interactive to yarn 2019-11-27 06:42:03 +00:00
Asger F
605c8834c6 JS: Avoid redundant window.name sources 2019-11-27 06:15:12 +00:00
semmle-qlci
380a5fc166 Merge pull request #2444 from esbena/js/flow-spread-prop-types
Approved by max-schaefer
2019-11-26 22:42:23 +00:00
yo-h
8a8b795696 Merge pull request #2447 from aschackmull/java/cache-perf
Java: Improve performance by normalizing import order to reduce cache invalidation.
2019-11-26 16:26:53 -05:00
Dave Bartolomeo
aa6bd07971 Merge remote-tracking branch 'upstream/master' into dbartol/May-Must 2019-11-26 14:07:13 -07:00
Robert Marsh
e368d5dda0 C++: simplify getDisplayOrderInBlock 2019-11-26 16:02:30 -05:00
Jonas Jensen
c05cc77a91 Merge pull request #2421 from dbartol/dbartol/IndirectAlias
C++/C#: Cleanup in preparation for indirect alias analysis
2019-11-26 21:59:17 +01:00
Erik Krogh Kristensen
9b608e9ec4 simplify multiple parameter selection 2019-11-26 21:07:37 +01:00
Dave Bartolomeo
f3b4140948 C++/C#: Consistent handling of "may" vs. "must" memory accesses
In the IR, some memory accesses are "must" accesses (the entire memory location is always read or written), and some are "may" accesses (some, all, or none of the bits in the location are written). We previously had to special case specific "may" accesses in a few places. This change regularizes our handling of "may" accesses.

The `MemoryAccessKind` enumeration now describes only the extent of the access (the set of locations potentially accessed), but does not distinguish "must" from "may". The new predicates `Operand.hasMayMemoryAccess()` and `Instruction.hasResultMayMemoryAccess()` hold when the access is a "may" access.

Unaliased SSA now correctly ignores variables that are ever accessed via a "may" access.

Aliased SSA now distinguishes `MemoryLocation`s for "may" and "must" accesses. I've refactored `getOverlap()` into the core `getExtentOverlap()`, which considers only the extent, but not the "may" vs. "must", and `getOverlap()`, which tweaks the result of `getExtentOverlap()` based on "may" vs. "must" and read-only locations.

When determining the overlap between a `Phi` operand and its definition, we now use the result of the defining `Chi` instruction, if one exists. This gives exact definitions for `Phi` operands for virtual variables.
2019-11-26 12:13:07 -07:00
yo-h
2eea94c3dc Documentation: fix invalid @precision value 2019-11-26 14:11:54 -05:00
Felicity Chapman
403565bb06 Update data-flow note to match that for C/C++ 2019-11-26 18:07:51 +00:00
Felicity Chapman
3b7ab8f734 Update shared data-flow note to match that for C/C++ 2019-11-26 18:02:09 +00:00
Jonas Jensen
95bceae915 Merge pull request #2434 from felicitymay/1.23/SD-4095-finalize-change-notes-cpp
1.23: SD-4095 finalize change notes for C/C++
2019-11-26 18:56:22 +01:00
Dave Bartolomeo
4e1ee7a998 C++/C#: Fix formatting 2019-11-26 10:48:24 -07:00
Felicity Chapman
4f6660887c Update shared data-flow note for feedback 2019-11-26 16:41:30 +00:00
Taus Brock-Nannestad
118275e948 Python: Use import python consistently in all queries. 2019-11-26 17:37:09 +01:00
Anders Schack-Mulligen
deb6a6e5c6 Java: Improve performance by normalizing import order to reduce cache invalidation. 2019-11-26 17:20:01 +01:00
Taus
e585f1ba85 Merge pull request #1332 from lcartey/python/change-kind
Python: Update filter queries to have appropriate kind
2019-11-26 17:15:38 +01:00
Erik Krogh Kristensen
b5a57986c6 small changes based on review feedback 2019-11-26 15:57:31 +01:00
Esben Sparre Andreasen
9ffe03bcce JS: support additional Flow syntax: ... in object types 2019-11-26 15:24:27 +01:00
Erik Krogh Kristensen
7b262fa9cf update expected output 2019-11-26 14:39:09 +01:00
Erik Krogh Kristensen
5a0cabb039 Merge remote-tracking branch 'upstream/master' into typeAheadSink 2019-11-26 14:37:40 +01:00
Erik Krogh Kristensen
ace484a519 change the typeahead.js model to be semantically correct 2019-11-26 14:35:13 +01:00
Taus Brock-Nannestad
35e3e3d2a1 Python: Update change note for 1.23. 2019-11-26 13:58:22 +01:00
Tom Hvitved
355c4f7154 C#: Add change note 2019-11-26 13:54:19 +01:00
Tom Hvitved
71e958eabc C#: Add taint-tracking steps through conversion operator calls 2019-11-26 13:53:50 +01:00
Tom Hvitved
acb069f69b C#: Add data flow tests for conversion operators 2019-11-26 13:53:17 +01:00
Erik Krogh Kristensen
4a94c49d37 changes based on review feedback 2019-11-26 13:40:48 +01:00
Jonas Jensen
b1745f588c Merge pull request #2402 from geoffw0/nospace
CPP: Make NoSpaceForZeroTerminator.ql more conservative.
2019-11-26 13:36:05 +01:00
Erik Krogh Kristensen
97718bf1d4 the callback function can both be the second and third argument 2019-11-26 13:00:00 +01:00
semmle-qlci
3d5d178b19 Merge pull request #2439 from erik-krogh/useOfReturnlessFunctionHotfix
Approved by max-schaefer
2019-11-26 11:56:57 +00:00
Erik Krogh Kristensen
b06acd1ed0 add change note 2019-11-26 12:52:41 +01:00
Erik Krogh Kristensen
0f948339af add change note 2019-11-26 11:23:30 +01:00
Erik Krogh Kristensen
b6106f9638 keep the ResolvedPromiseDefinition class as a subclass of PromiseCreationCall 2019-11-26 11:16:59 +01:00
Erik Krogh Kristensen
f284b3a2bb Merge remote-tracking branch 'upstream/master' into exceptionXss 2019-11-26 10:54:04 +01:00
Erik Krogh Kristensen
7ee12a3420 change doc based on review feedback 2019-11-26 10:48:24 +01:00
Anders Schack-Mulligen
18e1708036 Merge pull request #2412 from Cornelius-Riemenschneider/nullness-corr-cond
Java: Nullness library: track instanceof expressions in correlated conditions
2019-11-26 10:33:34 +01:00
Erik Krogh Kristensen
fed2675f76 remove FP in use-of-returnless-function FP related to calls to super() 2019-11-26 10:17:04 +01:00
Erik Krogh Kristensen
89dac23969 remove 3 FP sources from use-of-returnless-function 2019-11-26 10:16:18 +01:00
semmle-qlci
fb44aa18bd Merge pull request #2428 from erik-krogh/useOfReturnlessFunctionSuperCalls
Approved by max-schaefer
2019-11-26 09:14:08 +00:00
semmle-qlci
cf92022c89 Merge pull request #2420 from erik-krogh/safeStringSink
Approved by asgerf
2019-11-26 08:09:05 +00:00
Robert Marsh
60b384a6e5 C++/C#: use line numbers for instruction IDs
This should reduce the number of merge conflicts in the IR tests resulting
from instruction ID changes due to inserting or removing instructions
2019-11-25 18:27:59 -05:00
yo-h
1a07f215ad Merge pull request #2436 from felicitymay/1.23/SD-4095-finalize-change-notes-java
1.23: SD-4095 finalize change notes for Java
2019-11-25 18:19:25 -05:00
Calum Grant
113df4ea1d Merge pull request #2278 from hvitved/csharp/autobuilder/shared-compilation
C#: Only set `UseSharedCompilation=false` in autobuilder when needed
2019-11-25 18:37:09 +00:00
Dave Bartolomeo
7d48220a76 C++/C#: Make QLDoc conform to style guide 2019-11-25 11:26:45 -07:00
Dave Bartolomeo
44c1c5a7ab C++: Update points_to.ql test to use new bit offset format 2019-11-25 11:13:02 -07:00
Dave Bartolomeo
521fbb125e C++/C#: Fix formatting 2019-11-25 11:12:23 -07:00
Felicity Chapman
775ed381e1 Update to clarify status of one new query 2019-11-25 17:35:01 +00:00
Asger F
e3e15a6015 JS: Rephrase change note 2019-11-25 17:20:42 +00:00
Asger F
df97ab2cb8 TS: Add INDEX prefix to env variables 2019-11-25 17:10:00 +00:00
Asger F
2508da7971 JS: Add change note 2019-11-25 17:01:32 +00:00
Asger F
7e515aeb72 TS: Verify yarn installation 2019-11-25 16:22:21 +00:00
Cornelius Riemenschneider
37f162106a Fix formatting of file. 2019-11-25 17:04:38 +01:00
Tom Hvitved
fede9aed04 Merge pull request #2355 from cldrn/AspNetMaxRequestLength
CodeQL query to check for insecure MaxLengthRequest values in ASP.NET applications
2019-11-25 17:02:22 +01:00
Felicity Chapman
87fca1fde6 Remove backticks from 'struct' 2019-11-25 15:56:29 +00:00
Tom Hvitved
07e18c88a8 C#: Address review comments 2019-11-25 16:51:09 +01:00
Felicity Chapman
49bdf7ed1c Fix table sort order 2019-11-25 15:36:58 +00:00
Felicity Chapman
f75b61e2f0 Minor text changes 2019-11-25 15:36:37 +00:00
semmle-qlci
d58a6b02bf Merge pull request #2396 from hvitved/dataflow/erased-type-class
Approved by aschackmull, jbj
2019-11-25 15:22:13 +00:00
Felicity Chapman
f5bf877671 Fix table sort order 2019-11-25 15:18:30 +00:00
Felicity Chapman
dc258f13e3 Minor text changes 2019-11-25 15:17:02 +00:00
Geoffrey White
1d26d4c5e4 Merge pull request #2404 from jbj/signed-overflow-macro
C++: Fix SignedOverflowCheck.ql performance
2019-11-25 15:15:57 +00:00
Asger F
e5ba80b18c JS: Add test 2019-11-25 15:05:33 +00:00
Asger F
82b35a116c JS: Handle .js import of .ts file 2019-11-25 14:58:12 +00:00
Asger F
b306eeeb6e TS: Option to install dependencies 2019-11-25 14:42:17 +00:00
Dave Bartolomeo
4a21123107 Merge pull request #2427 from jbj/comparison-with-wider-type-notc
C++: Stricter loop-variant check
2019-11-25 07:38:02 -07:00
Taus Brock-Nannestad
036e0f75c8 Python: Account for non-evaluation of annotations in cyclic imports.
Should fix #2426.

Essentially, we disregard expressions used inside annotations, if these
annotations occur in a file that has `from __future__ import annotations`, as
this prevents the annotations from being evaluated.
2019-11-25 15:32:52 +01:00
Felicity Chapman
419c1c6311 Fix table sort order 2019-11-25 14:29:13 +00:00
Cornelius Riemenschneider
3368169df8 Address review. 2019-11-25 14:54:50 +01:00
Erik Krogh Kristensen
9bd6363521 Merge remote-tracking branch 'upstream/master' into promiseAll 2019-11-25 14:34:58 +01:00
Tom Hvitved
795959ef8d C#: Update expected test output 2019-11-25 13:41:12 +01:00
Tom Hvitved
71fd5379c9 C#: Remove tabs from qhelp file 2019-11-25 13:40:44 +01:00
Felicity Chapman
b5a88586ab Minor text changes to C# notes 2019-11-25 12:39:54 +00:00
shati-patel
9b5437c91e Merge pull request #2318 from rdmarsh2/rdmarsh/docs/cpp/taint-tracking-sanitizer-example
C++/Docs: add example based on NtohlArrayNoBound
2019-11-25 12:24:01 +00:00
Rasmus Wriedt Larsen
0f91139055 Merge pull request #2419 from tausbn/python-fix-use-of-input-fp
Python: Fix false positive for `py/use-of-input`.
2019-11-25 12:08:39 +01:00
Erik Krogh Kristensen
4efc71b7a2 remove FP in use-of-returnless-function FP related to calls to super() 2019-11-25 11:48:16 +01:00
Tom Hvitved
a26efdf4c1 Java/C++/C#: Rename DataFlowErasedType back to DataFlowType 2019-11-25 11:43:58 +01:00
Jonas Jensen
5ee19c5a66 C++: Stricter loop-variant check
The `loopVariant` predicate in `ComparisonWithWiderType.ql` is intended
to identify loop counters, but it was too much of a stretch to apply it
to any subexpression of the small side of the comparison.

This change fixes two false positives on arvidn/libtorrent and many
others seen in the wild (on Linux, CoreCLR, ffmpeg, ...).
2019-11-25 11:31:41 +01:00
Erik Krogh Kristensen
c7235bb372 add sources and sinks for typeahead.js 2019-11-25 10:46:54 +01:00
Jonas Jensen
8f3998915b Merge pull request #2376 from geoffw0/qhelpms2
CPP: Recommendations and examples for TlsSettingsMisconfiguration.qhelp and UseOfDeprecatedHardCodedProtocol.qhelp
2019-11-25 08:17:32 +01:00
Rebecca Valentine
a8204385c3 Adds fix for __init_subclass__ bug. (#2390)
* Adds fix for __init_subclass__ bug.

* Adds test case.

* Move test on name.

I think it makes more sense here, alongside the other "special" method names.
2019-11-24 12:18:17 +01:00
Dave Bartolomeo
eda47bfc51 C++: Add SSA sanity tests to IR tests 2019-11-22 16:10:51 -07:00
Dave Bartolomeo
bd78f68975 C++/C#: Fix formatting 2019-11-22 16:08:49 -07:00
Dave Bartolomeo
df21835759 C++/C#: Refactor some integer constant code
Make `bitsToBytesAndBits` omit the leftover bits if zero.
2019-11-22 13:23:00 -07:00
Dave Bartolomeo
51ff262cbc C++/C#: Add IR SSA sanity tests 2019-11-22 13:16:05 -07:00
Dave Bartolomeo
bc48c25690 C++/C#: Make IRVariable and its derived classes non-abstract 2019-11-22 12:13:39 -07:00
Dave Bartolomeo
12daa76b70 C++: Make duplicateOperand query report function name 2019-11-22 11:00:01 -07:00
Geoffrey White
cdbe920067 CPP: Remove second overview paragraph. 2019-11-22 16:22:08 +00:00
Geoffrey White
5a346c357b Update cpp/ql/src/Likely Bugs/Protocols/UseOfDeprecatedHardcodedProtocolGood.cpp
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-22 16:21:24 +00:00
Geoffrey White
0c07fa44a1 Update cpp/ql/src/Likely Bugs/Protocols/UseOfDeprecatedHardcodedProtocol.qhelp
Co-Authored-By: Alistair <54933897+hubwriter@users.noreply.github.com>
2019-11-22 16:21:05 +00:00
Geoffrey White
ac1010872b Update cpp/ql/src/Likely Bugs/Protocols/UseOfDeprecatedHardcodedProtocol.qhelp
Co-Authored-By: Alistair <54933897+hubwriter@users.noreply.github.com>
2019-11-22 16:20:54 +00:00
Geoffrey White
e274e01432 CPP: More consistency. 2019-11-22 16:08:00 +00:00
Geoffrey White
d4f75c1c2a CPP: Consistency. 2019-11-22 16:07:59 +00:00
Geoffrey White
384cf4b233 CPP: Recommendation and example for UseOfDeprecatedHardcodedProtocol.qhelp. 2019-11-22 16:07:59 +00:00
Geoffrey White
8fc59ebac4 CPP: I believe these BUG labels were incorrect. 2019-11-22 16:07:59 +00:00
Geoffrey White
21d8264d80 CPP: Fix typo. 2019-11-22 16:07:59 +00:00
Geoffrey White
a1b603e73c CPP: Add the examples to the test. 2019-11-22 16:07:59 +00:00
Geoffrey White
3cd545d186 CPP: Recommendation and example for TlsSettingsMisconfiguration.qhelp. 2019-11-22 16:07:59 +00:00
Geoffrey White
794a3deba9 CPP: Break up a long sentence in query description. 2019-11-22 16:07:59 +00:00
Taus Brock-Nannestad
67647bda66 Python: Fix false positive for py/use-of-input.
Fixes #1969.

The points-to analysis does not know that the assignment `input = raw_input`
cannot fail under Python 2, and so there are two possible values that `input`
could point-to after exiting the exception handler: the built-in `input`, or the
built-in `raw_input`. In the latter case we do not want to report the alert, and
so adding a check that the given function does not point-to the built-in
`raw_input` suffices.
2019-11-22 16:46:20 +01:00
Geoffrey White
6fc415485b CPP: Autoformat. 2019-11-22 15:34:51 +00:00
Geoffrey White
c73d3ebbb6 CPP: Pre-autoformat. 2019-11-22 15:34:50 +00:00
Geoffrey White
1d233f2f9e CPP: Change notes for the queries. 2019-11-22 15:27:08 +00:00
Geoffrey White
62008597d4 CPP: Change notes for the library. 2019-11-22 15:27:08 +00:00
Geoffrey White
3895a7e1f0 CPP: Queries: Improve NoSpaceForZeroTerminator query. 2019-11-22 15:27:08 +00:00
Geoffrey White
3c9432d7b7 CPP: Queries: Improve OverflowCalculated query. 2019-11-22 15:19:00 +00:00
Geoffrey White
1e7bd9e987 CPP: Queries: Similar dataflow simplification in OverflowCalculated.ql to that made recently in NoSpaceForZeroTerminator.ql. 2019-11-22 15:19:00 +00:00
Geoffrey White
1fa30306dc CPP: Libraries: Separate deallocation libraries. 2019-11-22 15:18:59 +00:00
Geoffrey White
a51da53013 CPP: Libraries: Split into interface and implementation. 2019-11-22 15:18:59 +00:00
Geoffrey White
356356f71b CPP: Libraries: Overridable classes. 2019-11-22 15:18:59 +00:00
Geoffrey White
0d01ea66c6 CPP: Libraries: Move interfaces into the models directory. 2019-11-22 15:18:59 +00:00
Geoffrey White
64ed97b584 CPP: Libraries: Add FreeFunction and DeallocationExpr to malloc.qll. 2019-11-22 15:18:59 +00:00
Geoffrey White
5dab91cb51 CPP: Libraries: Update uses of the Alloc.qll library. 2019-11-22 15:18:59 +00:00
Geoffrey White
376ef2fc8e CPP: Libraries: Add MallocFunction and AllocationExpr to malloc.qll. 2019-11-22 15:18:59 +00:00
Geoffrey White
5f798314d1 CPP: Tests: NoSpaceForZeroTerminator test cases for calloc and realloc. 2019-11-22 15:18:59 +00:00
Geoffrey White
a2c0532a84 CPP: Tests: CWE-120 test cases for calloc, realloc and new. 2019-11-22 15:16:32 +00:00
Geoffrey White
d67ea4d768 CPP: Tests: AV Rule 79 test cases for calloc, realloc and new. 2019-11-22 15:16:32 +00:00
Geoffrey White
7190dd2ef4 CPP: Tests: Rearrange a test prior to changes. 2019-11-22 15:16:32 +00:00
Geoffrey White
5014432472 CPP: Tests: Add a test of NewArrayExpr.getAllocatedType() and NewArrayExpr.getExtent(). 2019-11-22 15:16:32 +00:00
Geoffrey White
d6cbc674b6 CPP: Autoformat. 2019-11-22 15:13:06 +00:00
Geoffrey White
bbe6a1aa76 CPP: Additional test case. 2019-11-22 15:13:05 +00:00
Jonas Jensen
eb0b0d1e7f C++: Fix remaining FP on MAME
This should fix a FP in libretro/mame2003-plus-libretro.
2019-11-22 16:05:17 +01:00
Erik Krogh Kristensen
9fc20cd9b0 add change note 2019-11-22 15:58:00 +01:00
Erik Krogh Kristensen
7d825af9a3 Added an XSS sink for Handlebars.SafeString 2019-11-22 15:56:21 +01:00
semmle-qlci
5c3c8eb35d Merge pull request #2406 from erik-krogh/returnlessFp
Approved by asgerf
2019-11-22 13:06:03 +00:00
Erik Krogh Kristensen
f40d79271d cleanup module imports and update expected outputs 2019-11-22 13:55:47 +01:00
Erik Krogh Kristensen
85b22536d0 adjust formatting 2019-11-22 13:36:16 +01:00
Esben Sparre Andreasen
5d34806e50 Merge pull request #2379 from asger-semmle/typescript-fixes
TS: A bunch of TypeScript fixes
2019-11-22 13:31:30 +01:00
Max Schaefer
6fbaa7a5ea JavaScript: Make File not extend Locatable anymore.
Files have strange `:0:0:0:0` locations for... reasons. This makes the predicates inherited from `Locatable` meaningless. A particularly bad case is `getNumLines()`, which will always return one. The right predicate to use is, of course, `getNumberOfLines()`, which is defined in `File` itself.
2019-11-22 11:57:06 +00:00
Calum Grant
846600e855 Merge pull request #2410 from shati-patel/fix-heading
C# change notes: Remove duplicated heading
2019-11-22 11:52:53 +00:00
semmle-qlci
ec9b65ee61 Merge pull request #2369 from max-schaefer/js/odasa-8179
Approved by esbena
2019-11-22 11:26:54 +00:00
Cornelius Riemenschneider
0e7a08201f Address review by Anders. 2019-11-22 12:19:06 +01:00
Rasmus Wriedt Larsen
46b6e6d722 Merge pull request #2409 from tausbn/python-typing-forward-reference-fp
Python: Support forward references inside return type annotations.
2019-11-22 11:18:04 +01:00
Rasmus Wriedt Larsen
536c211a73 Merge pull request #2401 from tausbn/python-fix-non-iterable-class-confusion-fp
Python: Fix false positive in `py/non-iterator-in-for-loop`
2019-11-22 11:15:16 +01:00
Geoffrey White
9471134064 Merge pull request #2417 from jbj/enclosing-reeval
C++: Prevent cached stages from being re-evaluated
2019-11-22 09:55:01 +00:00
Max Schaefer
a3a46bfdc2 JavaScript: Add change note. 2019-11-22 09:27:14 +00:00
Max Schaefer
83f5b614e9 JavaScript: Switch detection of callback-based string replacement to data flow. 2019-11-22 09:24:34 +00:00
Max Schaefer
1951461f55 JavaScript: Simplify DoubleEscaping.
Undo previous work on generalising the concept of a replacement, which did not work out.
2019-11-22 09:24:34 +00:00
Max Schaefer
ff002a7af4 JavaScript: Whitelist more harmless incomplete escapes. 2019-11-22 09:24:34 +00:00
Max Schaefer
659cc812fe JavaScript: Rephrase two predicates to help the optimiser. 2019-11-22 09:24:34 +00:00
Max Schaefer
db3eaa23ef JavaScript: Introduce modelling of String.prototype.replace and use it in two queries. 2019-11-22 09:24:34 +00:00
Max Schaefer
f43e843b20 JavaScript: Introduce class RegExpLiteralNode. 2019-11-22 09:24:34 +00:00
Max Schaefer
12ea81af9c JavaScript: Move getAMatchedConstant(RegExpTerm) into the library. 2019-11-22 09:24:34 +00:00
Max Schaefer
a5a5debdc7 JavaScript: Move getStringValue(RegExpLiteral) into the library. 2019-11-22 09:24:34 +00:00
Max Schaefer
0edb70f373 JavaScript: Deal with escape-unescape-escape (and similar) chains. 2019-11-22 09:24:34 +00:00
Max Schaefer
cb54618a5d JavaScript: Deal with (un-)escaping on captured variables. 2019-11-22 09:24:34 +00:00
Max Schaefer
61aa075e8d JavaScript: Fix regexes for escaping schemes. 2019-11-22 09:24:34 +00:00
Max Schaefer
4f899a9b0d JavaScript: Recognize string escaping using .replace with a callback. 2019-11-22 09:24:34 +00:00
Max Schaefer
5dcf55e113 JavaScript: Refactor DoubleEscaping.ql. 2019-11-22 09:24:34 +00:00
Jonas Jensen
bd4fa10ffb C++: Tie macro exclusion to <, not +
This fixes a failing qltest and makes the exclusion similar to what's in
`PointerOverflow.ql`. It's possible we should exclude based on both `+`
and `<`, but we can revisit that if false positives show up.
2019-11-22 09:20:00 +01:00
Jonas Jensen
ca1b91aab2 Merge pull request #2414 from dbartol/dbartol/FixWarnings
C++/C#: Fix QL compilation warnings/errors
2019-11-22 09:14:33 +01:00
Jonas Jensen
0e4ed1cbbf C++: Prevent cached stages from being re-evaluated
Before this change, evaluating `cpp/constant-comparison` followed by
`cpp/signed-overflow-check` would result in re-evaluation of almost all
the cached stages they share: CFG, basic blocks, SSA, and range
analysis. The same effect could be seen on `cpp/bad-strncpy-size`, which
also uses the GVN library.
2019-11-22 08:45:49 +01:00
semmle-qlci
62859d140d Merge pull request #2394 from esbena/js/support-getDerivedFromError
Approved by max-schaefer
2019-11-22 07:45:45 +00:00
semmle-qlci
2c623372b6 Merge pull request #2405 from esbena/js/another-bind-model
Approved by asgerf
2019-11-22 07:35:58 +00:00
Robert Marsh
a5e6b83dbd Merge pull request #2400 from jbj/1.23-changenote
C++: Tweak 1.23 change note
2019-11-21 13:53:28 -08:00
Robert Marsh
05aebeff79 Merge branch 'master' into rdmarsh/cpp/ir-callee-side-effects 2019-11-21 13:45:31 -08:00
Dave Bartolomeo
fb67d3eae4 C++: Fix override errors in MagicDraw.qll 2019-11-21 13:18:45 -07:00
Dave Bartolomeo
27cc6b1e4f C++/C#: Fix compilation error in PrintSSA.qll
We were privately importing `semmle.code.<lang>.ir.internal.Overlap`, but `PrintSSA.qll` was depending on it being public. This is made a little more complicated by the presence of cross-langage pyrameterized modules.
2019-11-21 13:18:25 -07:00
Jonathan Leitschuh
21193bd780 Java: Use of HTTP/FTP to download/upload Maven artifacts
This adds a security alert for the use of HTTP or FTP to download or upload
artifacts using Maven.
2019-11-21 13:35:29 -05:00
Cornelius Riemenschneider
5d4b6c3a8c Nullness: Track correlated conditions of equality tests of variables. 2019-11-21 19:24:40 +01:00
Cornelius Riemenschneider
92f32a12d8 Add tests for nullness tracking by comparing variables. 2019-11-21 19:23:39 +01:00
Robert Marsh
dbe885fd38 Merge pull request #1926 from jbj/ir-dataflow-toString
C++: DataFlow::Node.toString consistency
2019-11-21 10:20:35 -08:00
Geoffrey White
676e8a2c2e Merge pull request #2399 from jbj/ExprHasNoEffect-templates
C++: Suppress ExprHasNoEffect on template code
2019-11-21 18:01:41 +00:00
Cornelius Riemenschneider
3e5324e772 More precise Nullness tracking by taking correlated instanceof expressions into account.
Fixes #2238.
2019-11-21 18:38:27 +01:00
Cornelius Riemenschneider
d8aae1c126 Add tests to track nullness by instanceof checks. 2019-11-21 18:38:27 +01:00
Erik Krogh Kristensen
94e9c0203d add test for exceptional taint-flow 2019-11-21 17:16:13 +01:00
shati-patel
b6a05399da C# change notes: Remove duplicated heading 2019-11-21 16:08:44 +00:00
semmle-qlci
8cca9b05ea Merge pull request #2393 from max-schaefer/js/improve-incomplete-sanitization-docs
Approved by mchammer01
2019-11-21 16:04:19 +00:00
Asger F
ec8ced7963 TS: Fix a typos and leftover todo 2019-11-21 15:39:37 +00:00
Asger F
01ab8f07eb TS: Fix a crash when allowJs: true was set 2019-11-21 15:39:37 +00:00
Asger F
7d558d165a JS: Update extractor version string 2019-11-21 15:39:37 +00:00
Asger F
33a44de47d TS: Add upgrade script 2019-11-21 15:39:37 +00:00
Asger F
2c916cb4f3 TS: Update stats 2019-11-21 15:39:37 +00:00
Asger F
dd50d29827 TS: Fix crash in case of missing type roots 2019-11-21 15:39:37 +00:00
Asger F
4a885cbf92 TS: Expose optional parameters at syntax level 2019-11-21 15:39:37 +00:00
Asger F
b6b8213e13 TS: Handle rest parameters in call signatures 2019-11-21 15:39:37 +00:00
Asger F
f2c3d734ea TS: Update some more tests 2019-11-21 15:39:37 +00:00
Asger F
0c41d6910f TS: Pass tsconfig options correctly 2019-11-21 15:39:37 +00:00
Asger F
23f8d27447 TS: Simplify debugging 2019-11-21 15:39:37 +00:00
Asger F
8205a59688 TS: Unfold aliases in Type.unfold() 2019-11-21 15:39:37 +00:00
Asger F
e25ee182a0 TS: Extract type alias relation 2019-11-21 15:39:37 +00:00
Asger F
f11dc11ade TS: Fix type of RHS of TypeAliasDeclaration 2019-11-21 15:39:37 +00:00
Asger F
a3aef1e4e0 TS: Update TypeAlias test 2019-11-21 15:39:37 +00:00
Taus Brock-Nannestad
033524ce63 Python: Support forward references inside return type annotations.
Should fix #2407.

Also allows for the string containing the forward reference to appear inside a
subexpression of the type annotation.
2019-11-21 15:37:32 +01:00
James Fletcher
0b274e5b23 Merge pull request #2386 from shati-patel/docs/demos
QL docs: Update links to blog/demos
2019-11-21 13:53:05 +00:00
Erik Krogh Kristensen
42a0a62e4c remove 3 FP sources from use-of-returnless-function 2019-11-21 14:27:04 +01:00
Jonas Jensen
f98cd673fd C++: Autoformat 2019-11-21 14:02:53 +01:00
Esben Sparre Andreasen
edb94db6ef JS: add change notes 2019-11-21 13:20:08 +01:00
Esben Sparre Andreasen
03c83c9c9d JS: model React's getDerivedStateFromError 2019-11-21 13:18:43 +01:00
Esben Sparre Andreasen
23d29a80db JS: improve comment syntax 2019-11-21 13:16:40 +01:00
Esben Sparre Andreasen
6328a0a8b9 JS: improve FP filter for js/unbound-event-handler-receiver 2019-11-21 13:13:40 +01:00
Taus Brock-Nannestad
9fda4ab480 Python: Fix false positive in py/non-iterator-in-for-loop
Should fix #1833, #2137, and #2187.

Internally, comprehensions are (at present) elaborated into local functions and
iterators as described in [PEP-289](https://www.python.org/dev/peps/pep-0289/).
That is, something like:

```
g = (x**2 for x in range(10))
```

becomes something akin to

```
def __gen(exp):
    for x in exp:
        yield x**2
g = __gen(iter(range(10)))
```

In the context of the top-level of a class, this means `__gen` looks as if it is
a method of the class, and in particular `exp` looks like it's the `self`
argument of this method, which leads the points-to analysis to think that `exp`
is an instance of the surrounding class itself.

The fix in this case is pretty simple: we look for occurrences of `exp` (in fact
called `.0` internally -- carefully chosen to _not_ be a valid Python
identifier) and explicitly exclude this parameter from being classified as a
`self` parameter.
2019-11-21 11:49:29 +01:00
Rasmus Wriedt Larsen
53576a4781 Merge pull request #2397 from tausbn/python-make-tostrings-visible
Python: Add `toString` information for all classes without such.
2019-11-21 11:46:22 +01:00
Jonas Jensen
7f26f078eb C++: Fix isFromMacroDefinition join order
This fixes the performance of `SignedOverflowCheck.ql` on
jluttine/suitesparse.
2019-11-21 11:01:50 +01:00
Jonas Jensen
82499b035b C++: Use isFromMacroDefinition for exclusion
The `SignedOverflowCheck.ql` query was very slow on certain snapshots
(jluttine/suitesparse and Chromium) due to bad magic in
`MacroInvocation::getAnAffectedElement_dispred#fb`. This commit doesn't
fix the bad magic but changes the exclusion mechanism to use a predicate
where we can better control the magic and optimization.

The query should also give more good results due to this new exclusion
mechanism, which is the same one used in its sibling,
`PointerOverflow.ql`.
2019-11-21 10:40:36 +01:00
Robert Marsh
15f50e6a38 Update docs/language/learn-ql/cpp/dataflow.rst
Co-Authored-By: James Fletcher <42464962+jf205@users.noreply.github.com>
2019-11-20 15:44:29 -08:00
Robert Marsh
34593701b2 Merge branch 'master' into rdmarsh/cpp/ir-callee-side-effects 2019-11-20 10:03:32 -08:00
Geoffrey White
403899ecbc Merge pull request #2391 from jbj/CompareWhereAssignMeant-decltype
C++: Fix FP for expression SFINAE with decltype
2019-11-20 17:34:09 +00:00
Geoffrey White
5c855fc925 CPP: Change note. 2019-11-20 15:34:41 +00:00
Geoffrey White
2212c47db2 CPP: Use dataflow more consistently. 2019-11-20 15:34:40 +00:00
Geoffrey White
e6ea705ff2 CPP: Switch from a blacklist to whitelist approach for determining null termination. 2019-11-20 15:34:38 +00:00
Jonas Jensen
6616eb852e C++: Mention flow through fields 2019-11-20 16:25:13 +01:00
Geoffrey White
fbd9d9bdab CPP: Add a test case involving the std::string constructor. 2019-11-20 15:20:21 +00:00
Jonas Jensen
ff96e3a8ea C++: Also suppress ExprHasNoEffect in declspec etc 2019-11-20 15:44:39 +01:00
Jonas Jensen
4ad8995440 C++: Group all the 1.23 data flow changes 2019-11-20 15:34:49 +01:00
Jonas Jensen
a48f347db9 C++: Don't mention predicate hasStdName
This predicate was removed before #1585 was merged, but we forgot to
remove it from the change note.
2019-11-20 15:33:32 +01:00
Geoffrey White
6fc9cc5952 CPP: Add a test case using 'new'. 2019-11-20 14:27:19 +00:00
Geoffrey White
57c7a87af9 CPP: Add tests with different proof of zero-termination. 2019-11-20 14:27:19 +00:00
Geoffrey White
3c9fe91581 CPP: Add proof of zero-termination to tests. 2019-11-20 14:27:19 +00:00
Jonas Jensen
b325427d29 C++: Suppress ExprHasNoEffect on template code 2019-11-20 15:12:25 +01:00
Taus Brock-Nannestad
c525ab325f Python: Add toString information for all classes without such.
Having `toString()` defined to be `none()` is a major headache when debugging,
as `toString`-less results are silently elided. This PR puts dummy `toString`s
in place of the `none()`s.

(I am mostly creating this to see if it impacts our tests and/or the
performance. If not, we may as well merge it.)
2019-11-20 14:47:20 +01:00
semmle-qlci
77c869f528 Merge pull request #2220 from erik-krogh/processEnvTaint
Approved by esbena, max-schaefer
2019-11-20 13:16:43 +00:00
Tom Hvitved
acc7d5298d Data flow: Sync files 2019-11-20 14:10:02 +01:00
Tom Hvitved
6c0dbcfca2 Java/C++: Add DataFlowErasedType aliases 2019-11-20 14:09:53 +01:00
Tom Hvitved
d0b4653e32 C#: Introduce DataFlowErasedType 2019-11-20 14:09:46 +01:00
Max Schaefer
cb20de8070 JavaScript: Add a warning to IncompleteSanitization help.
Sanitizing away multi-character strings using regular expressions is tricky business, and we should probably warn about it.
2019-11-20 11:57:50 +00:00
Jonas Jensen
4dafa16572 C++: Fix FP on unevaluated code
This fixes false positives on tenzir/vast.
2019-11-20 10:42:36 +01:00
Geoffrey White
9cf819929d Merge pull request #2383 from jbj/field-isStatic
C++: Don't check if a Field is static
2019-11-20 09:05:03 +00:00
Robert Marsh
53709deb9d Merge pull request #2342 from jbj/overflow-doc-fixes
C++: Signed Overflow Check qhelp improvements
2019-11-19 15:37:52 -08:00
Paulino Calderon
63884c1a86 Mixed spaces and tabs 2019-11-19 13:06:55 -05:00
Paulino Calderon
85eda8c978 Brings security tests from other PRs 2019-11-19 13:04:19 -05:00
Paulino Calderon
96a02aba3f Adds quotes on name and additional info tags 2019-11-19 12:39:10 -05:00
semmle-qlci
51a51d7e0c Merge pull request #2387 from max-schaefer/js/incomplete-dotdot-sanitization
Approved by asger-semmle
2019-11-19 16:39:35 +00:00
Jonas Jensen
a1af96e521 C++: Reproduce a reported FP 2019-11-19 16:17:49 +01:00
Shati Patel
49c2398bda QL docs: Update links to blog/demos 2019-11-19 15:06:26 +00:00
Max Schaefer
5565be14fc JavaScript: Teach IncompleteSanitization to flag incomplete path sanitizers. 2019-11-19 15:06:16 +00:00
Erik Krogh Kristensen
1ba777a45d remove deep taint of objects 2019-11-19 15:50:50 +01:00
Erik Krogh Kristensen
c2b48eb546 rename getExceptionalNode to getExceptionTarget 2019-11-19 15:32:17 +01:00
Jonas Jensen
c41114334f Merge remote-tracking branch 'upstream/master' into ir-dataflow-toString
Solved conflicts in `*.expected` by re-running the tests.
2019-11-19 14:27:27 +01:00
Erik Krogh Kristensen
d8a5554666 update doc on getExceptionalNode 2019-11-19 14:10:35 +01:00
Erik Krogh Kristensen
abd58ba905 rename 'getThrowsToNode' to 'getExceptionalNode' 2019-11-19 14:08:36 +01:00
Erik Krogh Kristensen
9fa7393d56 add support for try-statements with no catch block 2019-11-19 13:37:35 +01:00
Rasmus Wriedt Larsen
b39bcde31c Merge pull request #2375 from tausbn/python-fix-mutable-value-type-coercion-fp
Python: Don't report mutable parameters that are in fact immutable.
2019-11-19 13:26:23 +01:00
Jonas Jensen
fbf2ef8625 C++: Don't check if a Field is static
A `Field` in the C++ QL libraries can't be static, but I'd for some
reason written two checks for `Field`s being static in the data-flow
library.
2019-11-19 13:20:21 +01:00
Rasmus Wriedt Larsen
231414ceaf Merge pull request #2374 from tausbn/python-fix-mappingproxytype-fp
Python: Fix non-container FP relating to `MappingProxyType`.
2019-11-19 13:13:26 +01:00
Jonas Jensen
b43cbeb17f Merge pull request #2372 from geoffw0/qhelpms
CPP: Improve TlsSettingsMisconfiguration qhelp
2019-11-19 13:05:52 +01:00
Erik Krogh Kristensen
0a428a8f44 typo
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2019-11-19 13:05:13 +01:00
Jonas Jensen
466f7fe6b2 C++: Use <ol> for recommendations 2019-11-19 12:57:02 +01:00
Erik Krogh Kristensen
2f08ee9faf fix typo
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-19 12:53:50 +01:00
James Fletcher
c73ae5399d Merge pull request #2380 from shati-patel/docs/blog-links
Docs: Update links from blog to security lab
2019-11-19 11:09:13 +00:00
Shati Patel
820a11294d Docs: Update links from blog to security lab 2019-11-19 10:54:19 +00:00
Jonas Jensen
0731309b1e C++: Change note for StackVariable 2019-11-19 11:44:03 +01:00
Jonas Jensen
4d97534308 C++: Deprecate LocalScopeVariableReachability 2019-11-19 11:43:41 +01:00
Jonas Jensen
1498499994 C++: Relax type in two tests 2019-11-19 11:31:34 +01:00
Jonas Jensen
f5b9837e19 C++: Use StackVariable in Nullness.qll
This might cause fewer variables to be analysed because not every use of
`LocalScopeVariable` was constrained by the def-use library. Hopefully
this leads to an improved nullness analysis since it avoids treating
`static T *x = nullptr;` the same as `static T *x; x = nullptr;`.
2019-11-19 11:31:34 +01:00
Jonas Jensen
140575ee71 C++: Use StackVariable where SSA/def-use are used
These changes should not affect semantics since these uses of
`LocalScopeVariable` were already constrained to stack variables by
their use of SSA or def-use.
2019-11-19 11:31:34 +01:00
Jonas Jensen
6f9ec0409e C++: Use StackVariable in code that uses RangeSSA 2019-11-19 11:31:33 +01:00
Jonas Jensen
29f66ff095 C++: Use StackVariable, remove not v.isStatic()
In these files it was possible to remove calls to `isStatic` by
switching from `LocalScopeVariable` to `StackVariable`. This changes
semantics, hopefully for the better, to treat `thread_local` locals the
same as `static` locals.
2019-11-19 11:30:59 +01:00
Jonas Jensen
e57f98ca64 C++: Use StackVariable in def-use libraries
Most of the implementation was already in terms of
`SemanticStackVariable`, so not much should have changed.
2019-11-19 11:30:59 +01:00
Jonas Jensen
95a333d28c C++: Use StackVariable in SSA libraries
This means we'll no longer get SSA definitions for thread-local
local-scope variables.
2019-11-19 11:30:59 +01:00
Jonas Jensen
c1ed908834 C++: Use StackVariableReachability
This library is a drop-in replacement for
`LocalScopeVariableReachability`, so no changes are expected.
2019-11-19 11:30:59 +01:00
Jonas Jensen
01ca63ae92 C++: Bring back StackVariableReachability.qll
This is now a copy of `LocalScopeVariableReachability.qll`, just with
`s/LocalScopeVariable/StackVariable/g`. It can be used as a drop-in
replacement since the `LocalScopeVariableReachability.qll` library
implementation was already restricted to `SemanticStackVariable`.
2019-11-19 11:30:59 +01:00
Jonas Jensen
8110039e0a C++: Bring back the StackVariable QL class
The new `StackVariable` class actually denotes what its name suggests.
2019-11-19 11:23:34 +01:00
Erik Krogh Kristensen
d4f42d872a change change-note to target 1.24 instead of 1.23 2019-11-19 11:10:34 +01:00
Taus
4c700882b6 Merge pull request #2190 from RasmusWL/python-modernise-tornado-library
Python: modernise tornado library
2019-11-19 09:36:30 +01:00
Erik Krogh Kristensen
de8ed3f508 update test code 2019-11-19 09:04:30 +01:00
Erik Krogh Kristensen
91674f681b refactoring to remove duplicated code and simplify the ExceptionXss query 2019-11-19 08:54:51 +01:00
Robert Marsh
ae47eab727 C++: autoformat 2019-11-18 15:36:08 -08:00
yh-semmle
3d837542e8 Merge pull request #2373 from aschackmull/java/changenote-update
Java: Update change note to cover #2304 and #2346.
2019-11-18 12:14:07 -05:00
Taus Brock-Nannestad
3491d90b1e Python: Apply auto-format. 2019-11-18 16:50:32 +01:00
Taus Brock-Nannestad
1385f3c018 Python: Fix non-container FP relating to MappingProxyType.
Fixes #2307.

Also modernises the query to use the `Value` API.
2019-11-18 16:50:32 +01:00
Taus Brock-Nannestad
3c47394b7a Python: Apply auto-format. 2019-11-18 16:28:54 +01:00
Taus Brock-Nannestad
cac261858c Python: Don't report mutable parameters that are in fact immutable.
Fixes #1832.

In the taint sink, we add an additional check that the given control-flow node
can indeed point to a value that is mutable. This takes care of the guard on the
type.

If and when we get around to adding configurations for all of the taint
analyses, we may want to implement this as a barrier instead, pruning any steps
that go through a type test where the type is not mutable.
2019-11-18 16:18:44 +01:00
Calum Grant
b9d1c38753 Merge pull request #2371 from max-schaefer/rc/1.23
Merge rc/1.23 into master
2019-11-18 14:15:31 +00:00
semmle-qlci
ed4657c201 Merge pull request #2340 from hvitved/csharp/nunit-assertions
Approved by calumgrant
2019-11-18 13:02:49 +00:00
Nick Rolfe
9828315b6e Merge pull request #2033 from ian-semmle/edg
C++: Changes following EDG upgrade
2019-11-18 12:46:11 +00:00
Erik Krogh Kristensen
853c86685b remove some false positives 2019-11-18 13:32:47 +01:00
James Fletcher
e6574cc259 Merge pull request #2370 from shati-patel/docs/readme
Docs: Update readme in docs folder (cherry-pick from master)
2019-11-18 12:29:41 +00:00
Anders Schack-Mulligen
645cc99383 Java: Update change note to cover #2304 and #2346. 2019-11-18 13:26:50 +01:00
Geoffrey White
ff15c01ab9 CPP: Comma. 2019-11-18 11:51:54 +00:00
semmle-qlci
34f4b11416 Merge pull request #2368 from asger-semmle/regexp-max-length
Approved by max-schaefer
2019-11-18 11:49:46 +00:00
Geoffrey White
9a53706e87 CPP: Reword TlsSettingsMisconfiguration.qhelp. 2019-11-18 11:49:28 +00:00
Geoffrey White
2789c2dbac CPP: Fix typos. 2019-11-18 11:48:13 +00:00
James Fletcher
21832a8550 Merge pull request #2350 from shati-patel/docs/vscode
Docs: Update links to new products
2019-11-18 11:14:53 +00:00
Tom Hvitved
3d1ce55642 C#: Address review comments 2019-11-18 10:53:02 +01:00
shati-patel
08c91b05ac Docs: Update readme in docs folder 2019-11-18 09:38:53 +00:00
Shati Patel
d6a673c91a Docs: Update links to new products 2019-11-18 09:34:00 +00:00
Asger F
c02863842c JS: Raise limit to 1000 2019-11-18 08:33:26 +00:00
Jonas Jensen
74ca0e428d Merge pull request #2334 from rdmarsh2/rdmarsh/cpp/reword-pointeroverflow-qhelp
C++: simplify PointerOverflow.qhelp
2019-11-18 08:37:19 +01:00
Asger F
6f15eff954 JS: Cap length of extracted string 2019-11-17 23:06:47 +00:00
Erik Krogh Kristensen
5a6958a1cd add promise aggregators 2019-11-17 11:22:29 +01:00
Erik Krogh Kristensen
b3e88cdf31 refactored multiple implementations of getEnclosingTryStmt into a single predicate 2019-11-17 09:50:41 +01:00
Erik Krogh Kristensen
1b81526691 Merge remote-tracking branch 'upstream/master' into exceptionXss 2019-11-17 09:29:54 +01:00
Erik Krogh Kristensen
525da97dd4 changes based on review feedback 2019-11-17 09:24:00 +01:00
Erik Krogh Kristensen
3b9847e075 apply suggestions from max
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-17 09:01:48 +01:00
Paulino Calderon
56c12adab7 Adds check for insecure MaxLengthRequest values 2019-11-16 14:21:39 -05:00
Erik Krogh Kristensen
a59a414e0b update expected output 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
8ff515a58d address review feedback on MaskingReplacer 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
4ec2070e48 remove property reads on process.env as a taint step, and add a barrier for masking replace calls 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
052a331395 rename ProcessEnvLabel to PartiallySensitiveMap 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
2bd48db8cd refactor isSanitizerEdge in clear-text-logging 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
92dc759cf9 remove type cast, and fix expected test results 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
850278c62f some changes based on review. And change to only flag unknown reads of process.env 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
68c30aaef3 add flowlabels to js/clear-text-logging 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
14e4decffa changes based on review feedback. No flow-labels yet 2019-11-16 15:20:42 +01:00
Erik Krogh Kristensen
1766f6a6d8 simplify global var "process"
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2019-11-16 15:20:41 +01:00
Erik Krogh Kristensen
e1039d3a56 change note 2019-11-16 15:20:41 +01:00
Erik Krogh Kristensen
297c71a64b add process.env as source for js/clear-text-logging 2019-11-16 15:20:41 +01:00
Erik Krogh Kristensen
b12e255fd8 add indirect calls to logging methods as logging methods 2019-11-16 15:20:41 +01:00
shati-patel
e7705b0a1a Merge pull request #2348 from hmakholm/pr/point-to-vsc
README.md: Don't speak of QL4E anymore
2019-11-15 20:24:17 +00:00
Robert Marsh
180a3c9f26 C++: accept test changes 2019-11-15 11:01:18 -08:00
Robert Marsh
85314c42a9 Update cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-15 10:38:58 -08:00
Henning Makholm
3e9757caf6 Update README.md
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-11-15 19:31:07 +01:00
James Fletcher
351cb46bb9 Merge pull request #2349 from shati-patel/docs/readme
Docs: Update readme in docs folder
2019-11-15 16:52:52 +00:00
Erik Krogh Kristensen
ddd217628f Merge pull request #2347 from esbena/js/fix-mjs-check
JS: fix the check for an "mjs" extension on an extensionless file
2019-11-15 17:39:10 +01:00
shati-patel
37931f2bcf Docs: Update readme in docs folder 2019-11-15 16:26:43 +00:00
yh-semmle
de65f023d6 Merge pull request #2167 from aschackmull/java/dataflow-out-of-arg-refactor
Java/C++/C#: Refactor dataflow to simplify return flow.
2019-11-15 11:10:06 -05:00
Tom Hvitved
c95db9e6f8 Merge pull request #2331 from calumgrant/cs/default-interface-methods
C#: Tests for default interface methods
2019-11-15 16:36:47 +01:00
Henning Makholm
a44c004ca3 README.md: Don't speak of QL4E anymore 2019-11-15 16:30:36 +01:00
Erik Krogh Kristensen
4073dfaf24 remove redundant code 2019-11-15 16:17:18 +01:00
Erik Krogh Kristensen
d36312cf9f update expected output 2019-11-15 16:08:13 +01:00
Erik Krogh Kristensen
3edd65f9ab changed the exceptional taint-steps to step through each call-site 2019-11-15 16:05:15 +01:00
yh-semmle
810a046428 Merge pull request #2346 from aschackmull/java/rangeanalysis-integral-fix2
Java: Fix range analysis bug where int was assumed.
2019-11-15 09:54:48 -05:00
Ian Lynagh
4442fd8407 C++: Accept changes to syntax-zoo tests 2019-11-15 14:42:36 +00:00
Ian Lynagh
2cf714a923 C++: Follow changes in lambda locations 2019-11-15 14:42:36 +00:00
Ian Lynagh
8e00516ecf C++: Accept changes in ir test 2019-11-15 14:42:36 +00:00
Erik Krogh Kristensen
e95cceef1d import all the shared XSS sources and sinks 2019-11-15 15:41:53 +01:00
Calum Grant
f5598db070 Merge pull request #2343 from hvitved/csharp/dataflow/assignment-flow
C#: Add missing assignment data flow steps
2019-11-15 14:21:13 +00:00
Anders Schack-Mulligen
81a90943c0 Java: Fix range analysis bug where int was assumed. 2019-11-15 15:08:14 +01:00
Taus
78109db243 Merge pull request #2181 from RasmusWL/python-modernise-pyramid-library
Python: modernise pyramid library
2019-11-15 15:05:44 +01:00
Taus
cb94e7db72 Merge pull request #2140 from RasmusWL/python-fix-flask
Python: Modernise flask + correctly handle flask.make_response
2019-11-15 14:55:27 +01:00
Esben Sparre Andreasen
8e8215893f JS: fix mjs check for extensionless files 2019-11-15 14:38:27 +01:00
Erik Krogh Kristensen
65a018ceed use flow labels to avoid dual configurations 2019-11-15 14:37:46 +01:00
Tom Hvitved
20a1cb6fc8 C#: Teach assertion library about (classical) NUnit assertions
This commit adds support for (classical) NUnit assertions (see
https://github.com/nunit/docs/wiki/Assertions). Modern constraint-based assertions,
such as `Assert.That(o, Is.Not.Null)` are currently not supported, because they
would require a restructuring of the assertion library.
2019-11-15 14:07:28 +01:00
Erik Krogh Kristensen
f813e06680 Merge pull request #2345 from Semmle/esbena-patch-3
Update FlowSteps.qll
2019-11-15 14:04:14 +01:00
Erik Krogh Kristensen
8d2ae136b0 move String.prototype.match taint step to a general AdditionalTaintStep 2019-11-15 12:52:54 +01:00
semmle-qlci
2f63b89941 Merge pull request #2338 from esbena/js/model-get-them-args
Approved by max-schaefer
2019-11-15 11:50:45 +00:00
Max Schaefer
217eda374d Merge pull request #2252 from asger-semmle/regexp
JS: Parse regular expressions from string literals
2019-11-15 11:47:33 +00:00
Esben Sparre Andreasen
a3deb7d4e0 Update FlowSteps.qll 2019-11-15 12:44:04 +01:00
Asger F
e3b15a98c4 JS: Add prop names for array element pattern PropReads 2019-11-15 11:16:50 +00:00
Tom Hvitved
f9bff172d4 C#: Add missing assignment data flow steps 2019-11-15 11:36:05 +01:00
Tom Hvitved
f8791c884f C#: Add more data flow tests for assignments 2019-11-15 11:30:40 +01:00
Jonas Jensen
7d7d166113 C++: Remove whitespace at end of line 2019-11-15 11:21:08 +01:00
Jonas Jensen
6bdfebea96 C++: Rename i to n1 in all examples
I see no reason why the Recommendation and Example sections should use
different variable names for the same thing.
2019-11-15 11:20:00 +01:00
Jonas Jensen
9b89602a86 C++: Make var name in qhelp match source snippet 2019-11-15 11:16:34 +01:00
Calum Grant
aac360463b C#: Tests for default interface methods. 2019-11-15 10:13:04 +00:00
Jonas Jensen
7485cc76b2 C++: Edit Recommendation section
1. The two last examples were misleading at best. The first of those two
   recommended casting to non-negative `int`s to `unsigned int` and then
   checking if their addition would overflow, but overflow was
   impossible because their sum (on 32-bit two's complement) could be at
   most 2^32 - 2. The second example could lead to the wrong condition
   (unsigned overflow) being checked if taken literally. Instead of
   keeping that example, I reworeded the first paragraph of the
   Recommendation section.
2. The assumptions about `delta` being positive was relaxed to
   non-negative.
3. There was no need to assume that an unsigned short was non-negative.
4. Some of the suggestions were missing `i >`.
2019-11-15 11:05:00 +01:00
Esben Sparre Andreasen
a6dbf5fbad Update change-notes/1.23/analysis-javascript.md
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-15 10:43:04 +01:00
Esben Sparre Andreasen
c3fdfdecab JS: rename DefaultParsedCommandLineArgumentsAsSource 2019-11-15 10:40:15 +01:00
Asger F
7a489afdda JS: Add change note 2019-11-15 09:27:21 +00:00
Asger F
66db38266b JS: Add qldoc to HostnameRegexpShared 2019-11-15 09:27:21 +00:00
Asger F
6809eed543 JS: Stats and upgrade script 2019-11-15 09:27:21 +00:00
Asger F
607aed37ee Update javascript/ql/src/semmle/javascript/Expr.qll
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-15 09:27:21 +00:00
Asger F
77e5305b9b Update javascript/ql/src/Security/CWE-020/IncompleteHostnameRegExp.ql
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-15 09:27:21 +00:00
Asger F
37aa85fe81 JS: Fix parsing of non-BMP chars before a quantifier 2019-11-15 09:27:21 +00:00
Asger F
8fcf7a265a JS: Remove unused OffsetTranslationBuilder class 2019-11-15 09:27:21 +00:00
Asger F
4d1f7836f2 JS: Check for [^.] 2019-11-15 09:27:21 +00:00
Asger F
a7a90b4b7e JS: Disregard capture groups in lookaround assertions 2019-11-15 09:27:20 +00:00
Asger F
2242df920f JS: More qldoc 2019-11-15 09:27:20 +00:00
Asger F
dc6c15cbb9 Update javascript/ql/src/semmle/javascript/Regexp.qll
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-15 09:27:20 +00:00
Asger F
dd9274e42c JS: Docs regarding regexp terms in string literals 2019-11-15 09:27:20 +00:00
Asger F
c2e0c8cb39 JS: Do not extract string literal types as regexps 2019-11-15 09:27:20 +00:00
Asger F
57a9cad721 JS: Fix offsets of octal and unicode escape 2019-11-15 09:27:20 +00:00
Asger F
4680e3a89a JS: Simplify charpred of Match 2019-11-15 09:27:20 +00:00
Asger F
c01005a610 JS: Remove outdated comment 2019-11-15 09:27:20 +00:00
Asger F
e01a9846d8 JS: Update test annotations 2019-11-15 09:27:20 +00:00
Asger F
153d34638b JS: Fix a FP 2019-11-15 09:27:20 +00:00
Asger F
8c5b9b9195 JS: Add missing post-anchor case to MissingRegExpAnchor 2019-11-15 09:27:20 +00:00
Asger F
17ad97812e JS: Fix FPs from TLDs without a domain name 2019-11-15 09:27:20 +00:00
Asger F
20fb7717d8 JS: Use type inference to refine regexp string tracking 2019-11-15 09:27:20 +00:00
Asger F
e45c361d64 JS: Port IncompleteHostnameRegExp 2019-11-15 09:27:20 +00:00
Asger F
9ecab1b5d5 JS: Port unanchored RegExp query but for hostnames only 2019-11-15 09:27:20 +00:00
Asger F
e5f2f9e43e JS: Do not flag semi-anchored regexps in .replace() 2019-11-15 09:27:20 +00:00
Asger F
cae09a447b JS: Update test case 2019-11-15 09:27:20 +00:00
Asger F
3e37950170 JS: Whitelist one more FP case 2019-11-15 09:27:20 +00:00
Asger F
2b151cd587 JS: Include anchor direction in message 2019-11-15 09:27:20 +00:00
Asger F
3e952cf564 JS: Restrict semi-anchored regex query more 2019-11-15 09:27:19 +00:00
Asger F
0726bd8cac JS: Add double semi-anchored test case 2019-11-15 09:27:19 +00:00
Asger F
9fa9729470 JS: Shift line numbers in SemiAnchoredRegExp testcase 2019-11-15 09:27:19 +00:00
Asger F
8bc89ee254 JS: Update semi-anchored regex query 2019-11-15 09:27:19 +00:00
Asger F
c21d095d38 JS: Restrict RegExp queries to actual regular expressions 2019-11-15 09:27:19 +00:00
Asger F
b8711fc642 JS: Extend RegExpTerm in ReDoS 2019-11-15 09:27:19 +00:00
Asger F
b6c1c174a9 JS: Deabstractify RegExpTerm classes 2019-11-15 09:27:19 +00:00
Asger F
e0bdc777b9 JS: Make ReDoS check string-based regexes 2019-11-15 09:27:19 +00:00
Asger F
97e5da1046 JS: Update ReDoS query 2019-11-15 09:27:19 +00:00
Asger F
57de6382cd JS: Update QL API 2019-11-15 09:27:19 +00:00
Asger F
d3302c39c0 JS: Fix offsets in regexes parsed from strings with escapes 2019-11-15 09:27:19 +00:00
Asger F
2901b5e8bd JS: Add OffsetTranslation table (preserving behavior) 2019-11-15 09:27:19 +00:00
Asger F
c327ee5d4f JS: Update TRAP 2019-11-15 09:27:19 +00:00
Asger F
591fffc5cc JS: Add test case for wide constants in char class 2019-11-15 09:27:19 +00:00
Asger F
68d23bcf8c JS: Extract surrogate pairs as one constant node 2019-11-15 09:27:19 +00:00
Asger F
6e1c995f2f JS: Merge consecutive constants in RegExps 2019-11-15 09:27:19 +00:00
Asger F
0e1246c0e5 JS: Extract RegExp ASTs from string literals 2019-11-15 09:27:18 +00:00
Asger F
0cf191f70d JS: Bump extractor version string 2019-11-15 09:27:18 +00:00
Jonas Jensen
73d9cc2e7b Merge pull request #2309 from geoffw0/cpp418
CPP: QLDoc enhancements
2019-11-15 08:46:08 +01:00
Esben Sparre Andreasen
8e6a19b3d3 JS: add DefaultParsedCommandLineArgumentsAsSource 2019-11-15 08:42:02 +01:00
Tom Hvitved
74b464ded9 Merge pull request #2321 from calumgrant/cs/netcore-3.0b
C#: Upgrade extractor to .NET Core 3.0
2019-11-15 06:21:17 +01:00
Robert Marsh
562f62879f C++: rename variables in PointerOverflow examples 2019-11-14 15:21:26 -08:00
Robert Marsh
c6d848caf9 C++: simplify PointerOverflow.qhelp 2019-11-14 15:11:39 -08:00
Robert Marsh
dad1c96902 Docs: reword description of isSanitizer example 2019-11-14 14:54:37 -08:00
Dave Bartolomeo
81262d5948 Merge pull request #2328 from geoffw0/routinetest
CPP: Add a quick test of RoutineType.
2019-11-14 15:49:13 -07:00
Esben Sparre Andreasen
2ea7d141c8 Merge pull request #2310 from max-schaefer/js/insufficient-url-scheme-check
JavaScript: Add query `IncompleteUrlSchemeCheck`
2019-11-14 22:13:02 +01:00
semmle-qlci
0638907825 Merge pull request #2324 from esbena/js/torrent-as-remote-source
Approved by max-schaefer
2019-11-14 20:28:07 +00:00
Robert Marsh
facbd32062 Merge branch 'master' into rdmarsh/cpp/ir-callee-side-effects 2019-11-14 11:09:13 -08:00
Robert Marsh
2fb1d4d1b1 C++: fix IR return block successors 2019-11-14 10:29:48 -08:00
Calum Grant
f3c92c5527 C#: Address review comment 2019-11-14 17:14:51 +00:00
Calum Grant
09356a377f C#: Improved CIL instruction types to pass type consistency checks 2019-11-14 17:14:51 +00:00
Calum Grant
051dd6b3dc C#: Update qltests. 2019-11-14 17:14:51 +00:00
Calum Grant
a2e0ae1e79 C#: Update project files to netcoreapp3.0 2019-11-14 17:14:51 +00:00
Max Schaefer
3b1e6c362c JavaScript: Address review comments. 2019-11-14 17:11:59 +00:00
Erik Krogh Kristensen
e49b5e4afc up precision from low to medium, and fix tab/spaces 2019-11-14 17:42:16 +01:00
Geoffrey White
7408726f41 Merge pull request #2312 from jbj/pointer-wraparound-query
C++: New query: Pointer overflow check
2019-11-14 16:13:04 +00:00
Erik Krogh Kristensen
7137a64b7d Added query for detecting XSS that happens through an exception 2019-11-14 17:04:00 +01:00
Taus
d5edb651e1 Merge pull request #2329 from RasmusWL/python-codeowners
CODEOWNERS: Add python team
2019-11-14 17:00:46 +01:00
Rasmus Wriedt Larsen
54f89c8eda CODEOWNERS: Add python team
(and reorder cpp, so it all follows the same pattern)
2019-11-14 16:42:12 +01:00
Geoffrey White
f2b7af7437 CPP: Add example code for RoutineType. 2019-11-14 15:25:00 +00:00
Geoffrey White
dc34fa366c CPP: Add a test of RoutineType. 2019-11-14 15:13:52 +00:00
James Fletcher
4b35d35eed Merge pull request #2326 from shati-patel/docs/snapshot
Docs: Use "database" consistently
2019-11-14 14:05:03 +00:00
Henning Makholm
e46d9158db Merge pull request #2314 from Semmle/lgtm.com
Mergback lgtm.com branch into master
2019-11-14 14:55:26 +01:00
Jonas Jensen
c35229f062 Merge pull request #2327 from nickrolfe/missing_backtick
C++: add missing backtick in qldoc comment
2019-11-14 14:40:12 +01:00
Nick Rolfe
f5513342d6 C++: add missing backtick in qldoc comment 2019-11-14 13:20:41 +00:00
Shati Patel
f64633b2fe Docs: Use "database" 2019-11-14 13:11:40 +00:00
Esben Sparre Andreasen
cc768345d0 JS: add security tests for malicious torrents 2019-11-14 13:54:19 +01:00
Esben Sparre Andreasen
bea59ec8ad JS: add some parsed torrent properties as remote flow sources 2019-11-14 13:54:19 +01:00
Geoffrey White
beb3602253 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:49:02 +00:00
Geoffrey White
6724632413 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:48:50 +00:00
Rasmus Wriedt Larsen
1159344972 Merge pull request #2320 from tausbn/python-add-walrus-support
Python: Add AST classes for walrus operator.
2019-11-14 13:48:05 +01:00
Geoffrey White
45cc6c445c Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:48:05 +00:00
Geoffrey White
0bb37c17f2 CPP: Delete parenthesized comment. 2019-11-14 12:46:43 +00:00
James Fletcher
f085b81e51 Merge pull request #2323 from shati-patel/docs/rename
Docs: Tidy up links in relevant topics
2019-11-14 12:44:54 +00:00
Geoffrey White
8b30baf656 CPP: Delete 'compiler-generated'. 2019-11-14 12:43:54 +00:00
Geoffrey White
f96cffa1f3 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:41:10 +00:00
Geoffrey White
82c6ff02b2 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:40:53 +00:00
Geoffrey White
6262cee27d Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:40:41 +00:00
Geoffrey White
fe5bd42203 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:40:29 +00:00
Geoffrey White
d8aeedfe01 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:40:11 +00:00
Geoffrey White
877e9ba6d8 Update cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:39:54 +00:00
Geoffrey White
acefadda8c Update cpp/ql/src/semmle/code/cpp/exprs/Assignment.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:35:15 +00:00
Geoffrey White
b1dfc60422 Update cpp/ql/src/semmle/code/cpp/exprs/Cast.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 12:34:13 +00:00
Shati Patel
557b95ccb1 Docs: Tidy up links in relevant topics 2019-11-14 12:32:21 +00:00
Anders Schack-Mulligen
106b8cfbca Java/C++/C#: Fix bad magic and bad join-order. 2019-11-14 13:17:17 +01:00
Anders Schack-Mulligen
6a2edce040 Merge pull request #2205 from rneatherway/java/hamcrest-nullness
Java: Respect Hamcrest assertThat(X, notNullValue())
2019-11-14 13:09:56 +01:00
Jonas Jensen
c7176e50ca C++: Tweak wording in docs 2019-11-14 13:03:34 +01:00
James Fletcher
2eaf91e1fb Merge pull request #2322 from shati-patel/docs/typo
Docs: Typo fix
2019-11-14 11:56:39 +00:00
Shati Patel
3cdaef7211 Docs: Typo fix 2019-11-14 11:50:43 +00:00
Geoffrey White
79a000d88f Update cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:31:27 +00:00
Geoffrey White
0f2a2cb956 Update cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:31:01 +00:00
Geoffrey White
25db90021b Update cpp/ql/src/semmle/code/cpp/exprs/Expr.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:29:03 +00:00
Geoffrey White
01b25199d0 CPP: Lesser than -> Less than. 2019-11-14 11:27:15 +00:00
Geoffrey White
238918c394 Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:24:54 +00:00
Geoffrey White
b3bda421bc Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:24:15 +00:00
Geoffrey White
90909d211c Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:24:00 +00:00
Geoffrey White
7d2babd9db Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:22:16 +00:00
Geoffrey White
97559857bf Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-14 11:22:07 +00:00
Taus Brock-Nannestad
dcffd1dbc3 Python: Add AST classes for walrus operator.
Happily, these were already present in the `dbscheme`.
2019-11-14 12:10:04 +01:00
Jonas Jensen
931b0f1445 Apply suggestions from code review
Co-Authored-By: Alistair <54933897+hubwriter@users.noreply.github.com>
2019-11-14 12:06:02 +01:00
Tom Hvitved
94583cde10 Merge pull request #2245 from calumgrant/cs/nullability-refactor
C#: Store nullability on the side
2019-11-14 11:44:39 +01:00
Calum Grant
7c406861a0 Merge pull request #2317 from dave-bartolomeo/dbartol/QLPack
Port QLPack changes to enable IntelliSense and Go to Definition
2019-11-14 10:25:14 +00:00
Tom Hvitved
a9f08671ca C#: Address review comments 2019-11-14 11:00:19 +01:00
semmle-qlci
67963a5b9d Merge pull request #2258 from asger-semmle/js-ignore-codesql-databases
Approved by esbena
2019-11-14 08:34:23 +00:00
Robert Marsh
f0b2aace1a C++/Docs: add isAdditionalTaintStep to example 2019-11-13 14:04:55 -08:00
Dave Bartolomeo
08620046ab Merge pull request #2068 from rdmarsh2/rdmarsh/cpp/ir-constructor-side-effects
C++: side effect instrs for constructor qualifiers
2019-11-13 14:56:24 -07:00
Robert Marsh
9e8455406f C++/Docs: add example based on NtohlArrayNoBound 2019-11-13 13:17:44 -08:00
Dave Bartolomeo
c2313cbe12 Add QL test directories to .codeqlmanifest.json 2019-11-13 13:31:46 -07:00
Max Schaefer
f93dab4864 Add qlpack.yml files for test folders. 2019-11-13 13:31:34 -07:00
Dave Bartolomeo
55010d030d Merge pull request #2315 from geoffw0/errtest
CPP: Add a quick test of ErroneousType.
2019-11-13 13:24:39 -07:00
Henning Makholm
e1467a77e8 Merge pull request #2316 from dave-bartolomeo/dbartol/TestManifests
Add QL test directories to `.codeqlmanifest.json`
2019-11-13 20:58:59 +01:00
Dave Bartolomeo
dd0f04b949 Add QL test directories to .codeqlmanifest.json 2019-11-13 12:37:51 -07:00
Dave Bartolomeo
e89ecc19e3 Merge pull request #2302 from max-schaefer/test-qlpacks
Add `qlpack.yml` files for test folders.
2019-11-13 12:21:19 -07:00
Robert Marsh
0175c44a14 C#: update IR test expectations 2019-11-13 10:58:38 -08:00
Geoffrey White
32b5501177 CPP: Add a test of ErroneousType. 2019-11-13 18:53:43 +00:00
semmle-qlci
252e1c76a6 Merge pull request #2313 from erik-krogh/quickFixreflectiveCallNode
Approved by max-schaefer
2019-11-13 17:00:38 +00:00
Geoffrey White
44ffb600d6 CPP: Improve the UnknwonType example as suggested. 2019-11-13 16:55:32 +00:00
Geoffrey White
2b73af09e4 CPP: Consistency. 2019-11-13 16:39:51 +00:00
Geoffrey White
e72bf2d35e CPP: *lvalue* -> _lvalue_ and similar. 2019-11-13 16:36:18 +00:00
Geoffrey White
e883220de3 CPP: Remove other comments about equivalence. 2019-11-13 16:28:50 +00:00
Jonas Jensen
81d06e2ce6 C++: Update annotation in test file 2019-11-13 16:58:25 +01:00
Geoffrey White
5e15265b50 Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-13 15:53:34 +00:00
Geoffrey White
da6fa7adfc Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-13 15:52:49 +00:00
Geoffrey White
4c6fd004e6 Update cpp/ql/src/semmle/code/cpp/Type.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2019-11-13 15:52:15 +00:00
Calum Grant
38f82d8377 Merge remote-tracking branch 'upstream/master' into cs/nullability-refactor 2019-11-13 15:31:45 +00:00
Tom Hvitved
46bc804562 Merge pull request #2286 from calumgrant/cs/windows-tests
C#: Make qltests pass on all platforms
2019-11-13 16:21:08 +01:00
Calum Grant
6e24a92179 Merge remote-tracking branch 'upstream/master' into cs/nullability-refactor 2019-11-13 14:58:58 +00:00
Erik Krogh Kristensen
538690eee6 remove duplicate reflectiveCallNode method, and removing redundant getExpr() method 2019-11-13 15:53:21 +01:00
Calum Grant
18d6138320 C#: Address review comment. 2019-11-13 14:47:06 +00:00
Henning Makholm
b78d081973 Merge pull request #2311 from alexet/fix-suite
Suites: Fix suite definition.
2019-11-13 14:56:08 +01:00
Jonas Jensen
4ddac749af C++: Add change note
Also fix discrepancies between `SignedOverflowCheck.ql` and its change
note.
2019-11-13 14:43:30 +01:00
Jonas Jensen
2d72a9cdec C++: Rename query
This new name is similar to its sister query "Signed overflow check".
2019-11-13 14:40:27 +01:00
Jonas Jensen
1b849dbf0e C++: More principled macro exclusion
We no longer exclude macros based on their name, which means we can now
find results inside arguments to the `likely` macro in Linux (except
that Linux is compiled with `-fno-strict-overflow`).
2019-11-13 14:22:38 +01:00
Jonas Jensen
db33053422 C++: Add test for macro exclusions 2019-11-13 14:21:29 +01:00
semmle-qlci
b11a7427c2 Merge pull request #2270 from erik-krogh/reflectiveExpr
Approved by max-schaefer
2019-11-13 13:08:40 +00:00
Jonas Jensen
8d79634f8c C++: Factor out isFromMacroDefinition predicate
This trick for excluding elements from macro bodies but not macro
arguments looks promising and should probably be used much more. With
this commit, it's now easy to use from any query.

Performance is still good because the new predicate gets appropriately
magiced.
2019-11-13 14:07:33 +01:00
Jonas Jensen
d2009c53dc C++: Support GCC flags making ptr overflow defined 2019-11-13 14:07:33 +01:00
Jonas Jensen
463bf964a9 C++: Test showing FP with -fno-strict-overflow 2019-11-13 14:07:33 +01:00
Jonas Jensen
8ed991759c C++: Rename PointerWrapAround to PointerOverflow
Overflow was the terminology I found for this in the C standard (C11
6.5.6-8).
2019-11-13 14:06:58 +01:00
Jonas Jensen
bd08c64933 C++: Apply my own review comments from #2218 2019-11-13 14:05:23 +01:00
Geoffrey White
abcf9e0d78 CPP: Autoformat. 2019-11-13 12:35:26 +00:00
Geoffrey White
86bea78413 CPP: Fix bad merge. 2019-11-13 12:34:35 +00:00
Tom Hvitved
9c9744620e Merge pull request #2291 from calumgrant/cs/assembly-prefix
C#: Fix prefixing assembly IDs to type IDs
2019-11-13 13:25:15 +01:00
Max Schaefer
f804d316d7 Update javascript/ql/src/Security/CWE-020/IncompleteUrlSchemeCheck.ql
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2019-11-13 12:24:19 +00:00
Calum Grant
b65ab15d46 C#: Delete unused file. 2019-11-13 12:16:05 +00:00
alexet
2570f81aa7 Suites: Fix suite definition. 2019-11-13 12:03:13 +00:00
Geoffrey White
93b4985532 CPP: Backticks. 2019-11-13 10:42:28 +00:00
Max Schaefer
4fe09e8e73 JavaScript: Sort new query change notes alphabetically. 2019-11-13 10:27:18 +00:00
Max Schaefer
ab583b7994 JavaScript: Add query IncompleteUrlSchemeCheck.ql. 2019-11-13 10:27:18 +00:00
Calum Grant
3b775a9ecb Merge pull request #2095 from hvitved/csharp/type-unification
C#: Type unification library
2019-11-13 09:48:59 +00:00
Geoffrey White
a5d2fbd25d CPP: Resolve remaining comments from the original PR. 2019-11-13 09:46:09 +00:00
semmle-qlci
f34025c5a0 Merge pull request #2306 from Semmle/revert-2247-odasa-8149
Approved by asger-semmle
2019-11-13 09:04:22 +00:00
Jonas Jensen
8a9ee8fcdd Merge pull request #2300 from geoffw0/names
CPP: Rename/relocate some queries and libraries
2019-11-13 09:11:24 +01:00
Max Schaefer
155cea7b5b Revert "JavaScript: Improve double-escaping query" 2019-11-12 22:54:12 +00:00
Robert Marsh
3de590763e C++: autoformat 2019-11-12 13:57:49 -08:00
yh-semmle
429c307832 Merge pull request #2304 from aschackmull/java/rangeanalysis-integral-fix
Java: Fix range analysis bug in integral inequality bounds.
2019-11-12 16:33:12 -05:00
yh-semmle
6a16eb838d Merge pull request #2305 from aschackmull/java/overflowcheck-conditionalexpr
Java: Add ConditionalExpr to overflow candidate pattern.
2019-11-12 16:32:09 -05:00
Dave Bartolomeo
5b33255e44 Merge pull request #1585 from rdmarsh2/rdmarsh/cpp/hasGlobalOrStdName
C++: add Declaration.hasGlobalOrStdName()
2019-11-12 12:00:17 -07:00
Robert Marsh
47f87c214c Merge branch 'master' into rdmarsh/cpp/ir-constructor-side-effects 2019-11-12 10:31:04 -08:00
Geoffrey White
db26b85fa3 CPP: Fix test (I missed a file in the move). 2019-11-12 18:25:20 +00:00
Robert Marsh
9554513cd6 autoformat 2019-11-12 10:16:01 -08:00
Ziemowit Laski
5cc92b7502 [CPP-418] Mention that GNU vector initializers are syntactically
similar to array initializers.
2019-11-12 17:35:50 +00:00
Ziemowit Laski
d0069fcacd [CPP-418] Literals. 2019-11-12 17:35:50 +00:00
Ziemowit Laski
20e28b8a97 [CPP-418] Reformat. 2019-11-12 17:35:50 +00:00
Ziemowit Laski
2baa748390 Address further review comments. 2019-11-12 17:35:50 +00:00
Ziemowit Laski
faf4342d8e [CPP-418] Update references to BuiltInOperationBuiltInOffsetOf and __builtin_offsetof. 2019-11-12 17:35:50 +00:00
Ziemowit Laski
6eac51dba4 [CPP-418] Address review comments. 2019-11-12 17:35:49 +00:00
Ziemowit Laski
e2d5a82735 [CPP-418] Expressions. 2019-11-12 17:35:49 +00:00
Ziemowit Laski
1f337e943f [CPP-418] Typo. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
98eca4743a [CPP-418] Calls, casts, assignments and other goodness. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
e647dc341a [CPP-418] Fill in examples for ErroneousType, UnknownType, and
assorted complex/imaginary arithmetic operations.
2019-11-12 17:33:08 +00:00
Ziemowit Laski
09f538a4bf [CPP-418] Merge detritus. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
f255977027 [CPP-418] Some more complex numbers, vectors. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
89655612b0 [CPP-418] Tweak vector initializer syntax. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
ecb700c8f4 [CPP-418] Some assignments and call expressions. Some could not be divined. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
113481d096 [CPP-418] Add concrete syntax for arithmetic operation, EXCEPT for assorted complex number operations, where surface syntax could not be determined. 2019-11-12 17:33:08 +00:00
Ziemowit Laski
e328e781b5 [CPP-418] Address @geoffw0's review comments. 2019-11-12 17:33:07 +00:00
Ziemowit Laski
3fdf84ddb4 [CPP-418] Logical and comparison operators; reformat built-ins. 2019-11-12 17:33:07 +00:00
Ziemowit Laski
b0a93481cb [CPP-418] Add QLDoc entries for typedef types, user types, bitwise operations and built-in operations. 2019-11-12 17:33:07 +00:00
semmle-qlci
6c9f92666e Merge pull request #2285 from asger-semmle/dataflow-syntax-examples
Approved by max-schaefer
2019-11-12 16:50:29 +00:00
Ziemowit Laski
1f35f4bb52 [CPP-418] Add descriptions for QL classes in Type.qll. (Still need to figure out how to describe unknown and erroneous types.) 2019-11-12 16:47:29 +00:00
Ziemowit Laski
f54e0d0d07 [CPP-418] Initial modifications to Type.qll. To be continued. 2019-11-12 16:47:29 +00:00
Anders Schack-Mulligen
7619275c8b Java: Fix range analysis bug in integral inequality bounds. 2019-11-12 17:28:40 +01:00
Anders Schack-Mulligen
8cd6b51763 Java: Add ConditionalExpr to overflow candidate pattern. 2019-11-12 17:27:18 +01:00
Geoffrey White
ea9e3bb1a8 CPP: Rename VirtualDispatch again. 2019-11-12 16:17:03 +00:00
Max Schaefer
5b2e32b051 Add qlpack.yml files for test folders. 2019-11-12 15:03:02 +00:00
Geoffrey White
5c87ed5ab2 CPP: Remove unused code. 2019-11-12 14:45:43 +00:00
Geoffrey White
0343bd6b9c CPP: Inline BufferAccess into NtohlArrayNoBound.qll (we'd prefer other queries to be written with the models library or Security.BufferAccess). 2019-11-12 14:44:20 +00:00
Geoffrey White
f50dd84c49 CPP: Rename good and bad example files. 2019-11-12 14:09:54 +00:00
Calum Grant
e990bea248 C#: Update upgrade script 2019-11-12 13:40:58 +00:00
Calum Grant
7c21ebb526 C#: Change dbscheme from nullability_member to nullability_parent 2019-11-12 13:40:58 +00:00
Calum Grant
41b441614b C#: Address review comments part 1. 2019-11-12 13:40:58 +00:00
Calum Grant
fe83bac0fb C#: Fix up test output
C#: Fix a qltest whereby a tuple type having multiple underlying types was causing an issue with the IR sanity checks.
C#: Revert more changes.
C#: Fix tests and remove dead code.
2019-11-12 13:40:58 +00:00
Calum Grant
a261cbaeef C#: Fix type ID generation from merge 2019-11-12 13:40:58 +00:00
Calum Grant
ce188c0c22 C#: Autoformat 2019-11-12 13:40:58 +00:00
Calum Grant
4d13957eed C#: Modify db upgrade script 2019-11-12 13:40:58 +00:00
Calum Grant
657c839e2b C#: Change varchar to string in the dbscheme. 2019-11-12 13:40:58 +00:00
Calum Grant
61630118fe C#: Fix ql tests. 2019-11-12 13:40:58 +00:00
Calum Grant
58e14af9cd C#: Address review comments. Create a TNullability type annotation and restructure TAnnotation. 2019-11-12 13:40:58 +00:00
Calum Grant
f00276a82c C#: Remove non-essential changes 2019-11-12 13:40:58 +00:00
Calum Grant
a0fa7dad79 C#: Autoformat 2019-11-12 13:40:58 +00:00
Calum Grant
c8225adf1b C#: Add missing file & minor fixes. 2019-11-12 13:40:58 +00:00
Calum Grant
e7f5fd6b4b C#: DB upgrade script 2019-11-12 13:40:58 +00:00
Calum Grant
163b931d49 C#: Update db stats 2019-11-12 13:40:58 +00:00
Calum Grant
9fd4a9ceb6 C#: Implement NullabilityEntity to model structured nullability on the side 2019-11-12 13:40:57 +00:00
Calum Grant
61ab9431ab C#: Fix DB inconsistencies, and rework id generation. 2019-11-12 13:40:57 +00:00
Tom Hvitved
05684b350f C#: Add change note 2019-11-12 12:13:19 +01:00
Tom Hvitved
28141c9d4d C#: Teach unification library about tuple types 2019-11-12 12:09:58 +01:00
Tom Hvitved
ee2496ab7c C#: Add unification tests for tuple types 2019-11-12 12:08:03 +01:00
semmle-qlci
39a45ceefe Merge pull request #2297 from erik-krogh/returnlessAttr
Approved by max-schaefer
2019-11-12 10:26:12 +00:00
Geoffrey White
d198b56b3a CPP: Move VirtualDispatch.qll into the controlflow directory (I don't see the point in having a subdirectory for one file, when we don't anticipate any other files ever being added there). 2019-11-12 09:55:23 +00:00
Geoffrey White
60c7cb38e8 CPP: Relocate the test as well. 2019-11-12 09:55:22 +00:00
Geoffrey White
dff490e658 CPP: Remove the 'boostorg' subdirectory (these queries could be extended to support other libraries, as their names and descriptions already suggest). 2019-11-12 09:55:22 +00:00
Geoffrey White
784c3047da CPP: Merge the duplicate IgnoreReturnValueSAL.ql query into the older existing one. 2019-11-12 09:54:56 +00:00
Geoffrey White
806703b929 CPP: Relocate the test as well. 2019-11-12 09:54:55 +00:00
Geoffrey White
2b9428df32 CPP: Remove the 'Buffer Overflow' subdirectory (we have many buffer overflow queries, putting one in a special directory will only create confusion). 2019-11-12 09:54:46 +00:00
Geoffrey White
b917264770 CPP: Rename NtohlArrayNoBoundOpenSource.ql -> NtohlArrayNoBound.ql (I believe the 'OpenSource' part is a remnant from the way the contributor organizes their queries). 2019-11-12 09:53:59 +00:00
Rasmus Wriedt Larsen
54246660c6 Python: Add test-case to password_in_cookie 2019-11-12 10:36:12 +01:00
Rasmus Wriedt Larsen
3ad43f32b6 Python: Add flask xss examples to flask tests 2019-11-12 10:36:10 +01:00
Jonas Jensen
18cc539c8d Merge branch 'master' into pointer-wraparound-query 2019-11-12 10:22:46 +01:00
Anders Schack-Mulligen
e6d0a2eca5 Merge pull request #2215 from yh-semmle/java-remove-obsolete-queries
Java: remove some obsolete metric queries
2019-11-12 10:14:55 +01:00
Jonas Jensen
c36b73f09c Merge pull request #2232 from geoffw0/formatsymbols
CPP: Fully support n$ in format strings
2019-11-12 09:43:20 +01:00
Erik Krogh Kristensen
6f6c4c4fcc fix tests after change from tabs to spaces 2019-11-12 08:48:01 +01:00
Dave Bartolomeo
303bab61b5 Merge pull request #2289 from jbj/ConvertToNonVirtualBaseInstruction
C++ IR: clearly distinguish between virtual and non-virtual base conversions
2019-11-11 13:37:07 -07:00
Rasmus Wriedt Larsen
8476bc7d42 Python: correctly handle flask.make_response
Fixes https://github.com/Semmle/ql/issues/1572

Adjust mock so it's more aligned with what the flask code actually does. Tests
were passing before, even though we didn't handle the case in real code :\
2019-11-11 17:24:36 +01:00
Rasmus Wriedt Larsen
002190f8db Python: Autoformat flask library 2019-11-11 17:18:26 +01:00
Rasmus Wriedt Larsen
a9d43a2c49 Python: Modernise flask library 2019-11-11 17:18:26 +01:00
Rasmus Wriedt Larsen
edfcf39137 Python: Add flask tests from internal repo 2019-11-11 17:18:26 +01:00
Jonas Jensen
ec79bfacf8 Merge pull request #2249 from geoffw0/tlsperf
CPP: TlsSettingsMisconfiguration.ql performance and cleanup
2019-11-11 16:47:53 +01:00
Geoffrey White
a4250be72f CPP: Un-deprecate getNumArgNeeded(n). Turns out I missed a place where it's used. 2019-11-11 15:28:09 +00:00
Geoffrey White
ed87f25886 CPP: Performance improvement. 2019-11-11 15:28:09 +00:00
Geoffrey White
695d4ff511 CPP: Change note. 2019-11-11 15:28:08 +00:00
Geoffrey White
a9fbe221ba CPP: Try to make the predicate names and qldoc a bit more consistent. 2019-11-11 15:27:23 +00:00
Geoffrey White
dff21e02db CPP: Fully support positional arguments. 2019-11-11 15:27:23 +00:00
Geoffrey White
2430bf4c83 CPP: Deprecate helper version of getNumArgNeeded. 2019-11-11 15:27:23 +00:00
Geoffrey White
27478640f2 CPP: Bring the logic for argument indices together in getFormatArgumentIndexFor. 2019-11-11 15:27:22 +00:00
Geoffrey White
760884051c CPP: Add test cases using various combinations of width and precision specifiers, positional arguments, and flags. 2019-11-11 15:27:22 +00:00
Jonas Jensen
f2a9876c2a Merge pull request #2003 from geoffw0/formatarg
CPP: WrongTypeFormatArguments.ql Fix
2019-11-11 16:07:37 +01:00
Jonas Jensen
d9bdb2cd4e Merge pull request #2274 from geoffw0/oddsends
CPP: Clean up new queries and libraries
2019-11-11 16:05:20 +01:00
Taus
e576395c90 Merge pull request #2241 from RasmusWL/python-always-legacy-conf
Python: Always enable legacy taint tracking configuration
2019-11-11 16:00:04 +01:00
Jonas Jensen
eb55d964a8 C++: Fix semantic merge conflict
This test output must have been wrong because I produced it with an
extractor that didn't have #2153 applied.
2019-11-11 15:39:53 +01:00
Erik Krogh Kristensen
67b38ed301 correctly weed out benign calls inside attributes 2019-11-11 15:30:33 +01:00
James Fletcher
c33d28542e Merge pull request #2294 from felicitymay/1.22-mergeback-master
1.22 mergeback master
2019-11-11 14:14:09 +00:00
Geoffrey White
e77fefaf9e Merge pull request #2295 from jbj/self-comparison-templates
C++: Suppress PointlessSelfComparison.ql on templates
2019-11-11 14:12:55 +00:00
Felicity Chapman
37c78bf1ea Fix poor conflict resolution in training slides 2019-11-11 13:11:28 +00:00
Jonas Jensen
97cc0ebc8c C++: Suppress PointlessSelfComparison on templates
It's a bit crude to suppress all results in instantiations, but we're
already using this kind of suppression in `PointlessComparison.ql`
(without the `Self`) because there is no convenient alternative. It
means we lose some good results but also suppress a new false positive
in Boost that surfaced after we added support for non-type template
parameters.
2019-11-11 14:00:00 +01:00
Jonas Jensen
281d512178 C++: Add tests for self-comparison template FP 2019-11-11 13:52:22 +01:00
Felicity Chapman
b3c3677cbf Merge branch 'rc/1.22' into 1.22-mergeback-master
Conflicts resolved in favour of master:
	docs/language/learn-ql/cpp/conversions-classes.rst
	docs/language/learn-ql/cpp/function-classes.rst
	docs/language/learn-ql/cpp/introduce-libraries-cpp.rst
	docs/language/learn-ql/csharp/ql-for-csharp.rst
	docs/language/learn-ql/javascript/introduce-libraries-ts.rst
	docs/language/learn-ql/python/introduce-libraries-python.rst
	docs/language/ql-training/cpp/bad-overflow-guard.rst
	docs/language/ql-training/cpp/control-flow-cpp.rst
	docs/language/ql-training/cpp/global-data-flow-cpp.rst
	docs/language/ql-training/cpp/intro-ql-cpp.rst
	docs/language/ql-training/cpp/program-representation-cpp.rst
	docs/language/ql-training/cpp/snprintf.rst
	docs/language/ql-training/index.rst
	docs/language/ql-training/java/global-data-flow-java.rst
	docs/language/ql-training/java/intro-ql-java.rst
	docs/language/ql-training/java/program-representation-java.rst
	docs/language/ql-training/java/query-injection-java.rst
2019-11-11 10:18:43 +00:00
Rasmus Wriedt Larsen
9151a7e433 Python: Always enable legacy taint tracking configuration
If the legacy configuration is only enabled if there are no other
configurations, defining a configuration in an imported library can lead to
unwanted results. For example, code that uses `any(MyTaintKind t).taints(node)`
would *stop* working, if it did not define its own configuration. (this actually
happened to us)

We performed a dist-compare to ensure there is not a performance deg ration by
doing this. Results at https://git.semmle.com/gist/rasmuswl/a1eca07f3a92f5f65ee78d733e5d260e

Tests that were affected by this:

- RockPaperScissors + Simple: new edges because no configuration was defined for
  SqlInjectionTaint or CommandInjectionTaint
- CleartextLogging + CleartextStorage: new edges because no configuration was
  defined before, AND duplicate deges.
- TestNode: new edges because no configuration was defined before

- PathInjection: Duplicate edges
- TarSlip: Duplicate edges
- CommandInjection: Duplicate edges
- ReflectedXss: Duplicate edges
- SqlInjection: Duplicate edges
- CodeInjection: Duplicate edges
- StackTraceExposure: Duplicate edges
- UnsafeDeserialization: Duplicate edges
- UrlRedirect: Duplicate edges
2019-11-11 11:17:21 +01:00
Anders Schack-Mulligen
b0fecbce28 Merge pull request #2230 from yh-semmle/java-move-cwe502-lib
Java: move `UnsafeDeserialization.qll` to standard library location
2019-11-11 10:44:52 +01:00
Felicity Chapman
c4f958d396 Merge pull request #2263 from sauyon/master
Update links to OWASP cheat sheet
2019-11-11 08:51:52 +00:00
Calum Grant
bd925d2bee C#: Fix prefixing assembly IDs to type IDs. 2019-11-10 13:05:08 +00:00
Jonas Jensen
751263db91 C++: Use ConvertToBaseInstruction in IR data flow
This should make virtual dispatch work also for virtual bases.
2019-11-10 11:17:35 +01:00
Jonas Jensen
7758b43e34 C++: Add ConvertToBase{Opcode,Instruction} classes
These should make it easy to match base-class conversions when it's not
important whether the base class is virtual.
2019-11-10 11:09:54 +01:00
Jonas Jensen
279fc16b60 C++: ConvertToBase -> ConvertToNonVirtualBase
This rename was done with

    perl -p -i -e's/ConvertToBase/ConvertToNonVirtualBase/g' **/*.ql* **/*.expected

followed by re-running the affected tests.
2019-11-10 10:35:53 +01:00
James Fletcher
aa05908d19 Merge pull request #2287 from felicitymay/1.22/support-codeql
1.22: Update for support info for CodeQL term change
2019-11-09 22:07:34 +00:00
Felicity Chapman
25eb1d0cc9 Update for CodeQL term change and port nav changes 2019-11-09 14:36:35 +00:00
Jonas Jensen
f3e691b5ec Merge pull request #2075 from zlaski-semmle/zlaski/cpp434
[CPP-434] Detect signed overflow checks
2019-11-09 09:57:23 +01:00
Ziemowit Laski
7a4c4b62f6 [zlaski/pointer-overflow-check] Rename PointerOverflowCheck -> PointerWrapAround. 2019-11-08 14:54:20 -08:00
Ziemowit Laski
f2105867a8 [zlaski/pointer-overflow-check] Enhance qhelp and test case. 2019-11-08 14:36:33 -08:00
Robert Marsh
64b34ad975 Merge branch 'master' of github.com:Semmle/ql into rdmarsh/cpp/ir-constructor-side-effects 2019-11-08 14:06:36 -08:00
Robert Marsh
1dc0cb89d0 Merge branch 'master' of github.com:Semmle/ql into rdmarsh/cpp/ir-constructor-side-effects 2019-11-08 12:47:27 -08:00
Robert Marsh
b812a0338d Merge pull request #2268 from dave-bartolomeo/dbartol/StringLiteralAlias
C++/C#: Treat string literals like read-only global variables for alias purposes
2019-11-08 12:43:57 -08:00
Robert Marsh
7e8a67a046 Merge branch 'master' into rdmarsh/cpp/hasGlobalOrStdName 2019-11-08 11:33:35 -08:00
Dave Bartolomeo
c365b2f2f0 Merge from master
Resolve conflicts in test output
2019-11-08 10:42:29 -07:00
Dave Bartolomeo
2b89139d5f Merge pull request #2269 from rdmarsh2/rdmarsh/cpp/uninit-string-initializers
C++: uninit instr for string literal initializers
2019-11-08 10:33:57 -07:00
Calum Grant
9715d8849a C#: Disable a CIL consistency check that seems to be invalid. 2019-11-08 16:50:51 +00:00
Calum Grant
4e2e64e949 C#: Fix up CallableReturns tests. 2019-11-08 16:42:22 +00:00
Asger F
a2ff4e9494 JS: member -> property 2019-11-08 16:23:59 +00:00
Calum Grant
e12a33d4e0 C#: Disposal tests do not depend on external DLLs. 2019-11-08 16:22:47 +00:00
Asger F
2a473fb9e7 Update javascript/ql/src/semmle/javascript/dataflow/Nodes.qll
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-08 16:15:08 +00:00
Asger F
4ad03a9061 Update javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-08 16:14:53 +00:00
Geoffrey White
58b6fc6bbf CPP: Autoformat. 2019-11-08 16:06:23 +00:00
Taus
7527f13443 Merge pull request #2283 from RasmusWL/python-fix-python2-specific-tests
Python: fix python2 specific tests
2019-11-08 17:03:54 +01:00
Geoffrey White
983a970c36 CPP: Autoformat. 2019-11-08 15:59:04 +00:00
Asger F
53d470da2f JS: Add syntax examples to DataFlow classes 2019-11-08 15:51:26 +00:00
Calum Grant
d64c244257 C#: Fix test for AspLine. 2019-11-08 15:48:56 +00:00
Geoffrey White
d434f909a5 CPP: Correct change note. 2019-11-08 15:10:44 +00:00
Geoffrey White
b4fb98dc7c CPP: Fix comments. 2019-11-08 15:10:13 +00:00
Geoffrey White
821d5061a7 CPP: Correct the tests. 2019-11-08 15:10:13 +00:00
Geoffrey White
73b55f019d CPP: Autoformat. 2019-11-08 15:10:13 +00:00
Geoffrey White
0063fa2974 CPP: Change note. 2019-11-08 15:10:13 +00:00
Geoffrey White
cd3bccf73a CPP: Fix FPs. 2019-11-08 15:09:46 +00:00
Geoffrey White
1cf4449314 CPP: Test for NonConstantFormat with multiple definitons. 2019-11-08 15:09:45 +00:00
Geoffrey White
144cda7dd9 CPP: Test for WrongTypeFormatArguments with multiple definitions. 2019-11-08 15:09:45 +00:00
semmle-qlci
9986de87c4 Merge pull request #2284 from shati-patel/ql-codeql-1
Approved by jf205
2019-11-08 14:37:26 +00:00
semmle-qlci
d9c7549dbe Merge pull request #2279 from max-schaefer/js/touchstone-files
Approved by asger-semmle
2019-11-08 14:33:23 +00:00
shati-patel
fe654a9c99 update to match support page 2019-11-08 14:32:59 +00:00
shati-patel
3f51260fb4 Docs: Update sidebar 2019-11-08 14:04:44 +00:00
Esben Sparre Andreasen
9b346b1d52 Merge pull request #2260 from max-schaefer/js/_min
JavaScript: Classify files with names ending in `_min` as minified.
2019-11-08 13:52:33 +01:00
Rasmus Wriedt Larsen
358964b1e2 Python: Accept changes in Python 2 specific six tests
We don't use a locked-down version of six, so some internal things probably
changed from the version used last time, and the versoin I have installed.

Long term fix would be to use a specific version of six for tests!
2019-11-08 13:49:52 +01:00
Rasmus Wriedt Larsen
6c259e5608 Python: Temporarily accept changes in Python 2 specific MRO tests
Due to internal PR#35123 we now actually run the tests under
`python/ql/test/2/...`

These seems like a regression, since the tests state that N is ok, but A and J
should not be allowed.

For now we can accept them, so we don't block all other Python PRs
2019-11-08 13:48:21 +01:00
Rasmus Wriedt Larsen
89a13213e2 Python: Accept changes in Python 2 specific tests
Due to internal PR#35123 we now actually run the tests under
`python/ql/test/2/...`

Since we haven't done this in a while, test output has changed a bit. These
changes look perfectly fine.
2019-11-08 13:48:14 +01:00
Tom Hvitved
af5c60c341 C#: Use type unification library in virtual dispatch library 2019-11-08 12:06:05 +01:00
Tom Hvitved
f4b92137d9 C#: Add more virtual dispatch tests 2019-11-08 12:06:05 +01:00
Tom Hvitved
ae54852fa4 C#: Add type unification library 2019-11-08 12:06:05 +01:00
semmle-qlci
867ed16777 Merge pull request #2276 from asger-semmle/inclusion-test
Approved by max-schaefer
2019-11-08 10:57:11 +00:00
Max Schaefer
d7831d2680 JavaScript: Short-circuit bad-header check on empty files. 2019-11-08 10:30:53 +00:00
Felicity Chapman
8ed0d726ee Merge pull request #2280 from jf205/codeql-homepage-links
docs: update banner links
2019-11-08 10:06:27 +00:00
james
0554de06a1 docs: update banner links 2019-11-08 09:32:20 +00:00
Tom Hvitved
dee4ddbb5b C#: Only set UseSharedCompilation=false in autobuilder when needed
Since we are now able to trace shared compilation builds on Linux and macOS
(starting from .NET Core 3), and always were able to on Windows, there is
no need to set `UseSharedCompilation=false` in those cases. This may have a
positive performance impact, as shared compilation is generally faster then
non-shared compilation.
2019-11-08 10:28:20 +01:00
Max Schaefer
e8510fe71a TypeScript: Skip Touchstone files. 2019-11-08 09:17:05 +00:00
Dave Bartolomeo
17f76c2516 C++: Fix merge conflicts 2019-11-07 22:02:15 -07:00
Ziemowit Laski
4ea8569081 [CPP-434] Squelch query alerts if ALL files were compiled
with `-fwrapv` or `-fno-strict-overflow`
2019-11-07 16:40:03 -08:00
Robert Marsh
2582b69e17 Merge branch 'master' of github.com:Semmle/ql into rdmarsh/cpp/ir-constructor-side-effects 2019-11-07 15:46:08 -08:00
Robert Marsh
e93dcdb16c Merge branch 'master' into rdmarsh/cpp/ir-constructor-side-effects 2019-11-07 15:19:46 -08:00
Robert Marsh
f483ec152b Merge branch 'master' of github.com:Semmle/ql into rdmarsh/cpp/uninit-string-initializers 2019-11-07 14:36:58 -08:00
Robert Marsh
ee185ea92e Merge pull request #2273 from geoffw0/ntohl
CPP: Add tests of NtohlArrayNoBoundOpenSource.ql.
2019-11-07 14:06:32 -08:00
Robert Marsh
ae1377447e C++: only generate uninits when needed 2019-11-07 13:55:49 -08:00
Dave Bartolomeo
6c1d219c86 Merge from master 2019-11-07 14:50:04 -07:00
Robert Marsh
c5396d9980 Merge pull request #2262 from jbj/ir-virtual-dispatch-local
C++: Rudimentary support for IR data flow virtual dispatch
2019-11-07 13:09:24 -08:00
Dave Bartolomeo
df1d64fbeb Merge pull request #2244 from jbj/IRType-cached
C++: Minimal caching of the IR type system
2019-11-07 12:44:16 -07:00
Dave Bartolomeo
f808dcefab Merge pull request #2277 from ian-semmle/cfg_diffs
C++: Remove tests for CFG differences
2019-11-07 12:41:40 -07:00
Dave Bartolomeo
64480c2ace Merge pull request #1999 from jbj/ir-copy-unloaded-result
C++: Make sure there's a Instruction for each Expr
2019-11-07 12:31:54 -07:00
Dave Bartolomeo
2c88848d2f Merge pull request #2272 from jbj/getIRTypeForPRValue-join-order
C++/C#: Fix getIRTypeForPRValue join order
2019-11-07 12:22:39 -07:00
Ian Lynagh
b5af4e5acd C++: Remove tests for CFG differences
Now that we have switched over, they are no longer interesting.
2019-11-07 16:32:18 +00:00
igfoo
c8c37c4976 Merge pull request #2271 from matt-gretton-dann/cpp-172-template-members
Template members
2019-11-07 16:30:08 +00:00
shati-patel
ec2008d57a Merge pull request #2275 from jf205/sd-4017
Learn CodeQL docs: add short note about new terminology
2019-11-07 16:12:12 +00:00
Asger F
812ee34bbc JS: Use Files.exists() instead 2019-11-07 15:53:29 +00:00
semmle-qlci
e65271dfad Merge pull request #2251 from asger-semmle/barrier-guard-improvements
Approved by esbena
2019-11-07 15:50:23 +00:00
semmle-qlci
f79c2a7630 Merge pull request #2224 from asger-semmle/access-paths-with-source-node-root
Approved by max-schaefer
2019-11-07 15:46:14 +00:00
James Fletcher
8178e3e671 Update docs/language/learn-ql/terminology-note.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-11-07 14:40:04 +00:00
James Fletcher
d31ec56ea6 Update docs/language/learn-ql/index.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-11-07 14:39:52 +00:00
Rasmus Wriedt Larsen
9ffb67a460 Merge pull request #2266 from tausbn/python-multiple-calls-to-init-join-order-fix
Python: Fix bad join order for `py/multiple-calls-to-init`.
2019-11-07 15:38:43 +01:00
Asger F
8544850945 JS: Generalize StringOps::Includes to ::InclusionTest 2019-11-07 14:35:17 +00:00
james
db2039d8a7 docs: learn codeql terminology note 2019-11-07 14:32:05 +00:00
semmle-qlci
2b120def01 Merge pull request #2211 from hvitved/csharp/unsafe-deserialization
Approved by jf205
2019-11-07 14:16:13 +00:00
Matthew Gretton-Dann
ddf1ef8a7d C++: Add new test case for template member change
We now output literals for accesses to members of template parameters:

So for `foo` in the following example:

```
template<typename T> void bar(T& t) {
  T.foo(1)
}
```
2019-11-07 14:08:25 +00:00
Matthew Gretton-Dann
c0884e9a88 C++: Update expected results. 2019-11-07 14:08:25 +00:00
Erik Krogh Kristensen
0c080a82be fix expected output 2019-11-07 14:31:09 +01:00
Erik Krogh Kristensen
232e875274 add test for getEnclosingExpr 2019-11-07 14:29:31 +01:00
Erik Krogh Kristensen
e4f6f41634 add DataFlow::getEnclosingExpr to get the an Expr from a potentially reflective call 2019-11-07 14:29:31 +01:00
semmle-qlci
3a7f9a588d Merge pull request #2267 from max-schaefer/js/qltest-extractor-options
Approved by asger-semmle
2019-11-07 11:36:45 +00:00
shati-patel
7394d5c726 Merge pull request #2242 from felicitymay/codeql/SD-4059-markdown
Docs: update terminology in markdown files (SD-4059)
2019-11-07 11:30:32 +00:00
Jonas Jensen
6385528d5f C++/C#: Fix getIRTypeForPRValue join order
This predicate was taking 39s on a snapshot of Facebook Fizz because it
had disjuncts like this:

    43685     ~0%     {1} r34 = JOIN Type::FunctionPointerIshType#f AS L WITH Type::Type::getUnspecifiedType_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>
    43685     ~1%     {2} r35 = JOIN r34 WITH CppType::getTypeSize#ff AS R ON FIRST 1 OUTPUT R.<1>, r34.<0>
    170371500 ~2%     {2} r36 = JOIN r35 WITH IRType::IRSizedType#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>, r35.<1>
    43685     ~6%     {2} r37 = JOIN r36 WITH IRType::IRFunctionAddressType#class#ff AS R ON FIRST 1 OUTPUT r36.<1>, r36.<0>

Instead of fixing the joins in `getIRTypeForPRValue` itself, I've
changed the `IRType::getByteSize` predicate such that the optimiser
knows how to join with it efficiently.

The disjunct shown above now looks like this instead:

    43685  ~0%     {1} r26 = JOIN Type::FunctionPointerIshType#f AS L WITH Type::Type::getUnspecifiedType_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT R.<1>
    43685  ~1%     {2} r27 = JOIN r26 WITH CppType::getTypeSize#ff AS R ON FIRST 1 OUTPUT R.<1>, r26.<0>
    43685  ~6%     {2} r28 = JOIN r27 WITH IRType::IRFunctionAddressType::getByteSize#ff_10#join_rhs AS R ON FIRST 1 OUTPUT r27.<1>, R.<1>
2019-11-07 11:48:16 +01:00
Max Schaefer
e314869e5c JavaScript: Classify files with names ending in _min as minified.
We already do the same for `-min` and `.min`. [Here](https://github.com/antoniogarrote/rdfstore-js/blob/master/dist/rdfstore_min.js) is a real-world example.
2019-11-07 10:33:47 +00:00
Sauyon Lee
0040c9fb4c Update links to OWASP cheat sheet 2019-11-06 20:21:47 -08:00
Robert Marsh
81ad11090e C++: uninit instr for string literal initializers 2019-11-06 13:37:03 -08:00
Robert Marsh
51c4ef4f7f C++: add SSA IR test for array initializers 2019-11-06 13:32:35 -08:00
Dave Bartolomeo
a9e3bfbd11 C++/C#: Treat string literals like read-only global variables for alias purposes.
Previously, we didn't track string literals as known memory locations at all, so they all just got marked as `UnknownMemoryLocation`, just like an aribtrary read from a random pointer. This led to some confusing def-use chains, where it would look like the contents of a string literal were being written to by the side effect of an earlier function call, which of course is impossible.

To fix this, I've made two changes. First, each string literal is now given a corresponding `IRVariable` (specifically `IRStringLiteral`), since a string literal behaves more or less as a read-only global variable. Second, the `IRVariable` for each string literal is now marked `isReadOnly()`, which the alias analysis uses to determine that an arbitrary write to aliased memory will not overwrite the contents of a string literal.

I originally planned to treat all string literals with the same value as being the same memory location, since this is the usual behavior of modern compilers. However, this made implementing `IRVariable.getAST()` tricky for string literals, so I left them unpooled.
2019-11-06 13:08:28 -07:00
Robin Neatherway
7850d67a78 Remove TODO comment
I've checked Hamcrest versions 1.3, 2.0, 2.1 and 2.2
2019-11-06 17:47:02 +00:00
Geoffrey White
6c38f55e28 CPP: QLDoc protocols.qll. 2019-11-06 17:06:57 +00:00
semmle-qlci
717490b670 Merge pull request #2265 from tausbn/python-fix-unused-import-global-name-used-join-order
Approved by RasmusWL
2019-11-06 16:38:07 +00:00
Max Schaefer
54e40a8977 JavaScript: Move --html all extractor options into options file. 2019-11-06 16:30:01 +00:00
Geoffrey White
e886cf7297 CPP: 'i.e.' -> 'that is'. 2019-11-06 16:27:06 +00:00
Taus Brock-Nannestad
2b24eb2e70 Python: Fix bad join order for py/multiple-calls-to-init.
The `multiple_invocation_paths` predicate had a bad join order where
we (essentially) joined `i1` with `i2` and only then joined `i1` and `i2`
separately to reduce the number of tuples. The join coming from `i1 != i2` had
little impact, but `i1.getFunction() = multi` made a big difference (and
similarly for `i2`). I factored out the code so that these joins would be done
more eagerly. Thus, we went from

```
[2019-11-06 16:53:05] (38s) Starting to evaluate predicate MethodCallOrder::multiple_invocation_paths#ffff/4@2ce75a
[2019-11-06 16:53:35] (68s) Tuple counts for MethodCallOrder::multiple_invocation_paths#ffff:
                      134547    ~9%       {2} r1 = SCAN CallGraph::TInvocation#fff AS I OUTPUT I.<0>, I.<2>
                      235284431 ~3%       {4} r2 = JOIN r1 WITH CallGraph::TInvocation#fff AS R ON FIRST 1 OUTPUT r1.<0>, r1.<1>, R.<1>, R.<2>
                      235149884 ~3%       {4} r3 = SELECT r2 ON r2.<3> != r2.<1>
                      235149884 ~4%       {3} r4 = SCAN r3 OUTPUT r3.<1>, r3.<0>, r3.<3>
                      166753634 ~5%       {4} r5 = JOIN r4 WITH #CallGraph::FunctionInvocation::getACallee_dispred#ffPlus#swapped AS R ON FIRST 1 OUTPUT R.<1>, r4.<2>, r4.<1>, r4.<0>
                      129778    ~0%       {4} r6 = JOIN r5 WITH #CallGraph::FunctionInvocation::getACallee_dispred#ffPlus AS R ON FIRST 2 OUTPUT r5.<0>, r5.<3>, r5.<1>, r5.<2>
                                          return r6
[2019-11-06 16:53:35] (68s) Registering MethodCallOrder::multiple_invocation_paths#ffff + [] with content 1705dcbc08kd9aa40rp2g2e9civhv
[2019-11-06 16:53:35] (68s)  >>> Wrote relation MethodCallOrder::multiple_invocation_paths#ffff with 129778 rows and 4 columns.
```

to

```
[2019-11-06 17:22:22] (25s) Starting to evaluate predicate MethodCallOrder::multiple_invocation_paths_helper#ffff/4@586aec
[2019-11-06 17:22:22] (25s) Tuple counts for MethodCallOrder::multiple_invocation_paths_helper#ffff:
                      134547 ~0%     {2} r1 = SCAN CallGraph::TInvocation#fff AS I OUTPUT I.<2>, I.<0>
                      88111  ~4%     {3} r2 = JOIN r1 WITH #CallGraph::FunctionInvocation::getACallee_dispred#ffPlus#swapped AS R ON FIRST 1 OUTPUT R.<1>, r1.<1>, r1.<0>
                      761305 ~0%     {4} r3 = JOIN r2 WITH #CallGraph::FunctionInvocation::getACallee_dispred#ffPlus AS R ON FIRST 1 OUTPUT r2.<1>, r2.<2>, r2.<0>, R.<1>
                      673194 ~0%     {4} r4 = SELECT r3 ON r3.<3> != r3.<1>
                      673194 ~0%     {4} r5 = SCAN r4 OUTPUT r4.<2>, r4.<1>, r4.<3>, r4.<0>
                                     return r5
[2019-11-06 17:22:22] (25s) Registering MethodCallOrder::multiple_invocation_paths_helper#ffff + [] with content 20edaaecf25nldgp24d9c4et8m3kv
[2019-11-06 17:22:22] (25s)  >>> Wrote relation MethodCallOrder::multiple_invocation_paths_helper#ffff with 673194 rows and 4 columns.
[2019-11-06 17:22:22] (25s) Starting to evaluate predicate MethodCallOrder::multiple_invocation_paths_helper#ffff_2301#join_rhs/4@9e5441
[2019-11-06 17:22:22] (25s) Tuple counts for MethodCallOrder::multiple_invocation_paths_helper#ffff_2301#join_rhs:
                      673194 ~0%     {4} r1 = SCAN MethodCallOrder::multiple_invocation_paths_helper#ffff AS I OUTPUT I.<2>, I.<3>, I.<0>, I.<1>
                                     return r1
[2019-11-06 17:22:22] (25s) Registering MethodCallOrder::multiple_invocation_paths_helper#ffff_2301#join_rhs + [] with content 2069301e655fi9mcovngg9hetfqas
[2019-11-06 17:22:22] (25s)  >>> Wrote relation MethodCallOrder::multiple_invocation_paths_helper#ffff_2301#join_rhs with 673194 rows and 4 columns.
[2019-11-06 17:22:22] (25s) Starting to evaluate predicate MethodCallOrder::multiple_invocation_paths#ffff/4@2f7c34
[2019-11-06 17:22:22] (25s) Tuple counts for MethodCallOrder::multiple_invocation_paths#ffff:
                      134547 ~0%     {2} r1 = SCAN CallGraph::TInvocation#fff AS I OUTPUT I.<2>, I.<0>
                      129778 ~0%     {4} r2 = JOIN r1 WITH MethodCallOrder::multiple_invocation_paths_helper#ffff_2301#join_rhs AS R ON FIRST 2 OUTPUT R.<2>, R.<3>, r1.<0>, r1.<1>
                                     return r2
[2019-11-06 17:22:22] (25s) Registering MethodCallOrder::multiple_invocation_paths#ffff + [] with content 1705dcbc08kd9aa40rp2g2e9civhv
[2019-11-06 17:22:22] (25s)  >>> Wrote relation MethodCallOrder::multiple_invocation_paths#ffff with 129778 rows and 4 columns.
[2019-11-06 17:22:22] (25s) Starting to evaluate predicate MethodCallOrder::multiple_invocation_paths#ffff_0312#join_rhs/4@9f9146
[2019-11-06 17:22:22] (25s) Tuple counts for MethodCallOrder::multiple_invocation_paths#ffff_0312#join_rhs:
                      129778 ~0%     {4} r1 = SCAN MethodCallOrder::multiple_invocation_paths#ffff AS I OUTPUT I.<0>, I.<3>, I.<1>, I.<2>
                                     return r1
[2019-11-06 17:22:22] (25s) Registering MethodCallOrder::multiple_invocation_paths#ffff_0312#join_rhs + [] with content 17c3fe1fcbf6ghhdr7hiukqp41rst
[2019-11-06 17:22:22] (25s)  >>> Wrote relation MethodCallOrder::multiple_invocation_paths#ffff_0312#join_rhs with 129778 rows and 4 columns.
```

Execution time on `salt` went from 29.5s to somewhere below 299ms (the predicate
was not listed in the timing report).
2019-11-06 17:27:03 +01:00
Geoffrey White
81c58d5a64 CPP: Improve QLDoc comments. 2019-11-06 16:20:39 +00:00
Geoffrey White
0c3f4e530f CPP: Make some library predicates private. 2019-11-06 16:07:28 +00:00
Geoffrey White
399ac1f112 CPP: Rename 'getAssertedFalseCondition' to something less misleading. 2019-11-06 15:57:44 +00:00
Taus Brock-Nannestad
43148083eb Python: Fix bad join order for global_name_used.
As it turns out, there was a further bad join-order in the `global_name_used`
predicate. In this case, there was a common subexpression in the RA that was
being factored out and evaluated separately, producing a large number of tuples.
2019-11-06 16:37:01 +01:00
Nick Rolfe
5b00b21713 Merge pull request #2153 from matt-gretton-dann/cpp-447-support-non-type-template-parameters
RFC: C++ Support non type template parameter values
2019-11-06 15:11:34 +00:00
Rasmus Wriedt Larsen
47a292b241 Merge pull request #2264 from tausbn/python-fix-unused-import-join-order
Python: Fix bad join order in `py/unused-import`
2019-11-06 16:09:44 +01:00
Jonas Jensen
8ffd7c1055 Merge pull request #2222 from geoffw0/libraryperf
CPP: Improvements for ConditionallyInitializedVariable.ql
2019-11-06 15:54:16 +01:00
Jonas Jensen
217ecd3551 C++: Add <p> tags to split text into paragraphs
Without this, the rendered output is one big paragraph.
2019-11-06 15:50:08 +01:00
shati-patel
5d1d7ea075 Merge pull request #2257 from jf205/codeql-training-material
docs: update terminology in training material
2019-11-06 14:43:55 +00:00
Asger F
d9beb54dde Merge pull request #2102 from erik-krogh/deferredModel
JS: add Deferred model in js/use-of-returnless-function
2019-11-06 14:30:03 +00:00
Jonas Jensen
76a3db9eed Merge remote-tracking branch 'upstream/master' into ir-copy-unloaded-result 2019-11-06 15:21:22 +01:00
Taus Brock-Nannestad
b6f16dee81 Python: Fix bad join order in py/unused-import 2019-11-06 15:14:48 +01:00
semmle-qlci
f73caac88d Merge pull request #2254 from asger-semmle/for-of-propread
Approved by max-schaefer
2019-11-06 13:44:55 +00:00
Geoffrey White
f9feb05a72 CPP: Add a test of NtohlArrayNoBoundOpenSource.ql. 2019-11-06 13:36:31 +00:00
Jonas Jensen
aa841c306d C++: Use virtual dispatch in DefaultTaintTracking
This bit is only used by the compatibility code that sends flow into
parameters of functions without body.
2019-11-06 14:04:07 +01:00
Jonas Jensen
ec9ef33486 C++: IR data flow through inheritance conversions
This makes IR data flow behave more like AST data flow, and it makes IR
virtual dispatch work without further changes.
2019-11-06 14:04:07 +01:00
Jonas Jensen
49008c9ff5 C++: IR data flow local virtual dispatch
This is just good enough to cause no performance regressions and pass
the virtual-dispatch tests we have for `security.TaintTracking`. In
particular, it fixes the tests for `UncontrolledProcessOperation.ql`
when enabling `DefaultTaintTracking.qll`.
2019-11-06 14:04:02 +01:00
Max Schaefer
725059deea JavaScript: Remove --source-type module extractor options. 2019-11-06 13:01:59 +00:00
Max Schaefer
3ad5af7cef JavaScript: Move --extract-program-text extractor options into options files. 2019-11-06 13:01:55 +00:00
Max Schaefer
6b817203fd JavaScript: Move --tolerate-parse-errors extractor options into options file. 2019-11-06 13:01:28 +00:00
Max Schaefer
5681565d4a JavaScript: Move --html elements extractor options into options file. 2019-11-06 13:01:28 +00:00
Max Schaefer
8fdf6298b9 JavaScript: Remove --platform node extractor options. 2019-11-06 13:01:28 +00:00
Max Schaefer
4848372435 JavaScript: Replace --externs extractor flag with /** @externs */ comment. 2019-11-06 13:01:28 +00:00
Max Schaefer
1fa8c43a8c JavaScript: Remove a redundant extractor option. 2019-11-06 13:01:28 +00:00
Max Schaefer
79f1079460 JavaScript: Add options files with --experimental extractor options. 2019-11-06 13:01:23 +00:00
James Fletcher
2e7bd4db6f Update docs/language/ql-training/cpp/program-representation-cpp.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-11-06 12:59:45 +00:00
Max Schaefer
a4bf361f64 JavaScript: Remove remaining --experimental extractor options. 2019-11-06 12:54:44 +00:00
james
24615f2bdb docs: further review comments 2019-11-06 12:44:45 +00:00
Erik Krogh Kristensen
19554ff6e7 change "e.g." to "for example" in qldoc 2019-11-06 13:37:54 +01:00
Erik Krogh Kristensen
dc923ef694 remove change note
Co-Authored-By: Esben Sparre Andreasen <esbena@github.com>
2019-11-06 13:28:46 +01:00
Asger F
81723ab92a JS: Update GlobalAccessPaths test 2019-11-06 11:58:06 +00:00
Asger F
3ec95881b4 Update javascript/ql/src/semmle/javascript/GlobalAccessPaths.qll
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-06 11:58:06 +00:00
Asger F
7e80823cb6 JS: Fix deprecated API usage 2019-11-06 11:58:06 +00:00
Asger F
b373901e11 JS: Avoid leading dot in access paths 2019-11-06 11:58:06 +00:00
Asger F
c365833731 JS: Refactor the public access path API 2019-11-06 11:58:06 +00:00
Asger F
e90516d4d8 JS: Dont use getALocalSource in fromRhs 2019-11-06 11:58:06 +00:00
Asger F
bc35f24f31 JS: Generalize access paths to arbitrary root nodes 2019-11-06 11:58:06 +00:00
Asger F
7a7a8b2b09 JS: More steps in getImmediatePredecessor 2019-11-06 11:58:06 +00:00
Max Schaefer
2bcd418c23 Merge pull request #2261 from Semmle/esbena-patch-2
Doc: Add missing `t` in `support`.
2019-11-06 09:24:30 +00:00
Esben Sparre Andreasen
21d4e5f186 Doc: Add missing t in support. 2019-11-06 10:16:43 +01:00
semmle-qlci
04f0c22f24 Merge pull request #2203 from erik-krogh/ignorePureFunction
Approved by max-schaefer, mchammer01
2019-11-06 09:09:11 +00:00
Jonas Jensen
fca7d9a391 C#: Cache IRType like for C++ 2019-11-06 07:42:34 +01:00
Ziemowit Laski
1f82ea7750 [zlaski/pointer-overflow-check] Refine query to exclude macros (other than 'assert'). 2019-11-05 18:25:41 -08:00
Ziemowit Laski
0df3d2ce60 [zlaski/pointer-overflow-check] Improve test case. 2019-11-05 13:00:55 -08:00
james
8d02a740dd docs: address remaining comments 2019-11-05 20:03:47 +00:00
James Fletcher
488ce15888 Apply suggestions from code review
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2019-11-05 19:57:24 +00:00
Taus
e9336fe30e Merge pull request #2129 from RasmusWL/python-update-django
Python: update django support
2019-11-05 20:51:55 +01:00
Dave Bartolomeo
c90fa1b3b1 Merge pull request #2255 from jbj/localInstructionFlow
C++: localInstruction{Flow,Taint} helpers
2019-11-05 11:57:06 -07:00
Asger F
f3850e580c JS: Skip codeql databases in AutoBuild 2019-11-05 16:30:57 +00:00
james
0b6592f650 docs: version number and small css tweaks
(cherry picked from commit ff78feeeea)
2019-11-05 16:06:13 +00:00
james
2d00ca5773 docs: semmle logo
(cherry picked from commit 4a8e8fa0de)
2019-11-05 16:06:11 +00:00
james
69d7baa9bc docs: update snapshot terminology 2019-11-05 16:06:11 +00:00
james
8661de11f2 docs: update ql terminology 2019-11-05 16:06:04 +00:00
Max Schaefer
3e92d0ffb5 JavaScript: Remove redundant --experimental extractor options. 2019-11-05 15:59:24 +00:00
Erik Krogh Kristensen
16b63b3d01 move deferred model to the query where it is used 2019-11-05 15:45:17 +01:00
Matthew Gretton-Dann
20ae183c16 C++: Tidy up formatting 2019-11-05 14:18:29 +00:00
Erik Krogh Kristensen
7045cd2648 Merge remote-tracking branch 'upstream/master' into deferredModel 2019-11-05 15:08:47 +01:00
Jonas Jensen
df2fbfb3d0 C++: localInstruction{Flow,Taint} helpers
These are analogous to the existing `localExpr{Flow,Taint}` predicates.
2019-11-05 14:13:20 +01:00
Geoffrey White
7456a92d6d CPP: Autoformat. 2019-11-05 13:10:19 +00:00
Geoffrey White
5106626bd0 CPP: QLDoc helper predicates. 2019-11-05 13:06:43 +00:00
semmle-qlci
1fe5a9e7e7 Merge pull request #2236 from max-schaefer/js/data-flow-exploration
Approved by erik-krogh, esbena
2019-11-05 12:15:00 +00:00
Matthew Gretton-Dann
8eef953cd7 C++: Update 1.23 change notes 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
afe666500f C++: Simplify getTemplateArgument*() impl. 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
6b4506dbea C++: Update schema stats 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
6fe22a76da C++: Change API for exposing template parameters.
Note that Declaration::getTemplateArgumentType() and
Declaration::getTemplateArgumentValue() need to be public so that they
can be overriden in derived classes.
2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
45ec8527c3 C++: Update expected test output. 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
afeaa6254d C++: Improve Template Value docs. 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
809d97de02 C++: Print print nontype template params 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
f1c3ce04d1 C++: Correct spelling mistake 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
ca898d4be0 C++: Further nontype template testcases. 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
57cd9b3990 C++: Update test results
We now support getting the name used for non-type template parameters
2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
469832668f C++: Add some simple non-type template tests 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
4ab87291f3 C++: Further use of TemplateArgumentValue 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
6334ad92c5 C++: Add DB Upgrade script. 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
faf5ba432b C++: Update expected test results 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
df7d21220b C++: Basic lib support for template param values 2019-11-05 11:39:22 +00:00
Matthew Gretton-Dann
48c7d1d7c1 C++: add *_template_parameter_value() tuples 2019-11-05 11:39:22 +00:00
semmle-qlci
794d5bda6d Merge pull request #2116 from erik-krogh/arrayCBRet
Approved by max-schaefer
2019-11-05 11:32:13 +00:00
Geoffrey White
8c16b36c7f Merge pull request #2231 from semmledocs-ac/newqueries-docscheck
CPP & C#: Review of qhelp (SD-4028)
2019-11-05 11:11:34 +00:00
Asger F
c373be0dee JS: Update TaintBarriers test 2019-11-05 10:26:04 +00:00
Asger F
d8ac0abb7f JS: Add test 2019-11-05 10:06:21 +00:00
Asger F
d8f3a2c550 JS: Add lvalue of for..of loop as a PropRead 2019-11-05 10:01:18 +00:00
semmle-qlci
eb6e8866fa Merge pull request #2247 from max-schaefer/odasa-8149
Approved by asger-semmle, esbena
2019-11-05 09:40:54 +00:00
Erik Krogh Kristensen
df3c70e57e add js/ignore-array-result to correctness-core suite 2019-11-05 10:40:14 +01:00
Ziemowit Laski
3aafcf4604 [zlaski/pointer-overflow-check] Minor tweak to Qhelp. 2019-11-04 17:00:06 -08:00
Ziemowit Laski
9228844604 [zlaski/pointer-overflow-check] Expand test case. 2019-11-04 17:00:06 -08:00
Ziemowit Laski
9407ba1a35 [zlaski/pointer-overflow-check] Initial version. 2019-11-04 17:00:06 -08:00
Ziemowit Laski
398896a4b2 [CPP-434] Change list items to ordinary paragraphs in the Recommendation section. 2019-11-04 16:44:31 -08:00
Ziemowit Laski
ce8ba86f2d [CPP-434] Use a bullet list instead of a table in order to placate Jenkins. 2019-11-04 12:30:52 -08:00
Erik Krogh Kristensen
bdb81c268c change tense 2019-11-04 18:56:03 +01:00
Erik Krogh Kristensen
aa47e3f6d2 update change-note to reflect changed query 2019-11-04 18:55:13 +01:00
Erik Krogh Kristensen
8ebfe15f0d apply doc feedback from mchammer01
Co-Authored-By: mc <42146119+mchammer01@users.noreply.github.com>
2019-11-04 18:54:43 +01:00
Erik Krogh Kristensen
6cac9619d3 add missing not
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-11-04 18:44:13 +01:00
Max Schaefer
016808b92e JavaScript: Address review comments. 2019-11-04 17:00:12 +00:00
Max Schaefer
770a4703c9 Merge pull request #2237 from asger-semmle/typescript3.7-rc
TS: Add support for TypeScript 3.7
2019-11-04 16:36:11 +00:00
semmle-qlci
d71fe0bffd Merge pull request #2246 from esbena/js/classify-doxygen
Approved by max-schaefer
2019-11-04 15:30:06 +00:00
Asger F
57aa166bff TS: Clean up yarn.lock 2019-11-04 14:59:42 +00:00
Asger F
b6f4ce0244 TS: Depend on typescript 3.7.2 2019-11-04 14:58:38 +00:00
Taus
aa7a997c7a Merge pull request #2248 from RasmusWL/python-sensitive-data-fewer-fp
Python: Limit what functions we treat as returning sensitive data
2019-11-04 15:09:52 +01:00
Rasmus Wriedt Larsen
ca22ec6104 Merge pull request #2042 from tausbn/python-fix-unused-import-fps
Python: Fix false positives in `py/unused-import`.
2019-11-04 14:47:30 +01:00
Tom Hvitved
508b09f565 C#: Address review comments 2019-11-04 13:43:39 +01:00
Tom Hvitved
fd63246f44 Merge remote-tracking branch 'upstream/master' into csharp/unsafe-deserialization 2019-11-04 13:42:35 +01:00
semmle-qlci
fa5388b5f3 Merge pull request #2209 from hvitved/csharp/deserialized-delegate
Approved by calumgrant, jf205
2019-11-04 12:32:04 +00:00
Rasmus Wriedt Larsen
b075103198 Merge pull request #2163 from tausbn/python-undefined-export-fp
Python: Modernise and fix FP in `py/undefined-export`
2019-11-04 13:10:48 +01:00
Geoffrey White
3e8b28a0a8 Merge pull request #2213 from jbj/BarrierGuard
C++: Implement DataFlow::BarrierGuard for AST+IR
2019-11-04 11:08:36 +00:00
Rasmus Wriedt Larsen
6593477d0b Python: Limit what functions we treat as returning sensitive data
Before this change, any function that has a parameter that was called
password/credentials would be treated as returning sensitive data of that
kind. `py/clear-text-logging-sensitive-data` would alert if one of these are
logged, which has a LOT of false-positives.
2019-11-04 11:32:21 +01:00
Tom Hvitved
cc7c30def8 Merge pull request #2179 from calumgrant/cs/local-disposal
C#: Fix a FP in cs/local-not-disposed
2019-11-04 11:23:50 +01:00
Taus Brock-Nannestad
d2f985038c Python: Fix missing modernisation. 2019-11-04 10:48:42 +01:00
Felicity Chapman
3eea0452b1 Merge pull request #2180 from shati-patel/docs/renaming
Docs: Update terminology
2019-11-04 09:14:18 +00:00
Esben Sparre Andreasen
7f55e3f336 JS: classify Doxygen-generated files as "generated" 2019-11-04 09:57:41 +01:00
Asger F
2d7443ef98 TS: Add upgrade script 2019-11-04 07:55:20 +00:00
Asger F
79dbdac8fa TS: Support declare modifier for fields 2019-11-04 07:54:38 +00:00
Asger F
9bc45f351c TS: Fix typo in stats file 2019-11-04 07:54:38 +00:00
Asger F
09a2542477 TS: Update a javadoc comment 2019-11-04 07:54:38 +00:00
Asger F
1b8335a4e9 JS: Update change note 2019-11-04 07:54:38 +00:00
Asger F
4846e53a10 TS: Blacklist another cyclic property 2019-11-04 07:54:38 +00:00
Asger F
7dfd4e0687 TS: Stop using the deprecated TypeReference.typeArguments 2019-11-04 07:54:38 +00:00
Asger F
341c11523c TS: Add recursive type alias tests (already works) 2019-11-04 07:54:38 +00:00
Asger F
b81931e402 TS: Support assertion types 2019-11-04 07:54:38 +00:00
Asger F
4e7b987fa3 TS: Rename IsTypeExpr -> PredicateTypeExpr 2019-11-04 07:54:38 +00:00
Asger F
f50f3b48c4 TS: Add test for ?? operator (already works) 2019-11-04 07:54:38 +00:00
Asger F
869fe4558f TS: Support optional chaining 2019-11-04 07:54:38 +00:00
Asger F
f76006e490 JS: Delete duplicate test case (typo) 2019-11-04 07:54:38 +00:00
Asger F
36b6c32f4f TS: Update expected output 2019-11-04 07:54:37 +00:00
Asger F
637394fb62 TS: Add TypeScript-3.7.1-rc 2019-11-04 07:54:37 +00:00
Max Schaefer
ef1778a8a7 Merge pull request #2212 from yh-semmle/java13-ql
Java: support JDK 13
2019-11-04 06:32:57 +00:00
Jonas Jensen
fb4dac597c C++: Minimal caching of the IR type system
This was the minimal amount of predicates I could easily cache without
introducing extra cached stages. The predicates that are not cached
here, like `CppType::getTypeSize` and `getCanonicalLanguageType`, appear
to be cheap.

I've tested that this avoids recomputation of the IR type system by
running

    grep -c 'Starting to evaluate predicate CppType::CppType::getIRType_dispred'

on the evaluator log for `IRSanity.ql`. It drops from 4 to 1. The
pretty-printed DIL drops from 79,175 lines to 76,326 lines.
2019-11-03 16:40:30 +01:00
yh-semmle
e232f538e9 Java 13: update test options 2019-11-02 16:09:32 -04:00
yh-semmle
e8a65101bc Java 13: add db stats for @yieldstmt 2019-11-02 16:09:32 -04:00
yh-semmle
de0869c216 Java 13: remove superfluous disjunct in JumpStmt.getAPotentialTarget() 2019-11-02 16:09:31 -04:00
yh-semmle
8fb4dbe092 Java 13: account for changes to switch expressions 2019-11-02 16:09:31 -04:00
yh-semmle
9f37237b4a Java 13: add stmt kind @yieldstmt to dbscheme 2019-11-02 16:09:31 -04:00
Ziemowit Laski
2bad9394b7 [CPP-434] Squelch alerts for expressions inside macros; try to make Qhelp Jenkins-friendly. 2019-11-01 15:24:22 -07:00
Geoffrey White
c2812197a9 CPP: Further speedup. 2019-11-01 18:16:12 +00:00
Jonas Jensen
426565ae68 Merge pull request #2239 from DX-MON/master
Query cpp/unused-static-variable was producing incorrect results for constexpr variables
2019-11-01 18:59:52 +01:00
Geoffrey White
08293d0009 CPP: Simplify. 2019-11-01 17:58:29 +00:00
Geoffrey White
98b9afd83f CPP: Remove apparently irrelevant parts of the query.
This is not strictly behaviour preserving, but I believe the parts I've removed or simplified weren't intended to do what they were doing.
2019-11-01 17:54:13 +00:00
Geoffrey White
c08493670b CPP: Speed up ExistsAnyFlowConfig. 2019-11-01 17:40:44 +00:00
Geoffrey White
6a865ed580 CPP: De-duplicate TlsSettingsMisconfiguration.ql. 2019-11-01 17:40:41 +00:00
Geoffrey White
fa203254ce CPP: Add test cases. 2019-11-01 17:40:27 +00:00
Asger F
f48d16fcb7 JS: Support barrier guards that are reflective calls 2019-11-01 15:23:38 +00:00
Asger F
d6158427c5 JS: Generalize SanitizerFunction to data flow configs and flow labels 2019-11-01 15:23:38 +00:00
Asger F
e2b0ec5696 JS: Handle multiple and/or operators in SanitizerFunction 2019-11-01 15:23:38 +00:00
Felicity Chapman
458108f66b Make 'open source' consistent on the page and with other docs 2019-11-01 14:08:50 +00:00
Felicity Chapman
692e977a71 Update docs/query-metadata-style-guide.md
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-11-01 13:44:23 +00:00
Felicity Chapman
236e1f7955 Update change notes for name change 2019-11-01 12:27:43 +00:00
Felicity Chapman
570e55190d Update style guides for name change 2019-11-01 12:22:05 +00:00
Felicity Chapman
02bb142e7c Update repository artifacts for name change 2019-11-01 12:21:24 +00:00
Shati Patel
bd08e8baaf Docs: Rename Sphinx project to "Learning CodeQL" 2019-11-01 11:22:36 +00:00
shati-patel
d94e91b39b Apply suggestions from code review
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2019-11-01 11:03:12 +00:00
semmle-qlci
e8e2f7bb20 Merge pull request #2240 from max-schaefer/js/indirect-command-argument-data-flow
Approved by esbena
2019-11-01 11:00:22 +00:00
Ziemowit Laski
3e1fd4a737 [CPP-434] Add table of constructs to Qhelp. Rewrite examples section. 2019-10-31 18:03:34 -07:00
Dave Bartolomeo
ea23c2daac Merge pull request #2188 from jbj/printast-override
C++: Add a sample class in PrintAST.ql
2019-10-31 17:02:20 -07:00
Dave Bartolomeo
e6f632b44e Merge pull request #2228 from jbj/DefaultTaintTracking-getASTVariable
C++: Use getASTVariable in DefaultTaintTracking
2019-10-31 17:00:49 -07:00
Dave Bartolomeo
2f63ab0250 Merge pull request #2150 from rdmarsh2/rdmarsh/cpp/ir-buffer-read-call-se
C++: buffer read side effects on unmodeled funcs
2019-10-31 16:59:51 -07:00
Rachel Mant
413f49bba5 Query cpp/unused-static-variable was producing incorrect results for constexpr variables 2019-10-31 22:50:44 +00:00
Robert Marsh
31f25c8cfc C++: primary instrs for constructor side effects 2019-10-31 11:43:47 -07:00
Robert Marsh
86b5e97f76 Merge branch 'master' of github.com:Semmle/ql into rdmarsh/cpp/ir-constructor-side-effects 2019-10-31 11:34:22 -07:00
Robert Marsh
9477bd5698 Merge branch 'master' of github.com:Semmle/ql into rdmarsh/cpp/ir-buffer-read-call-se 2019-10-31 11:00:01 -07:00
semmle-qlci
d03aecaa98 Merge pull request #2235 from max-schaefer/js/issue-2233
Approved by esbena
2019-10-31 14:17:58 +00:00
Max Schaefer
03c9a40ba3 JavaScript: Add libraries for forward and backward data-flow exploration. 2019-10-31 12:37:31 +00:00
Max Schaefer
8aae1f443f JavaScript: Use type tracking instead of auxiliary data-flow configuration to track indirect command arguments. 2019-10-31 12:13:55 +00:00
Max Schaefer
311cbd824c JavaScript: Recognize ":" pseudo-directive. 2019-10-31 11:39:09 +00:00
Robin Neatherway
d3016e5b98 Run autoformatter 2019-10-31 11:21:57 +00:00
Tom Hvitved
ceea96e03f C#: Update change note 2019-10-31 12:00:16 +01:00
semmle-qlci
2a3980222b Merge pull request #2201 from max-schaefer/js/avoid-duplicate-source-and-sink-nodes
Approved by asger-semmle
2019-10-31 10:47:30 +00:00
Robert Marsh
24c9b8b9b1 C++: fix unbound variables 2019-10-30 14:06:19 -07:00
Geoffrey White
ee3b49af3a Merge pull request #2219 from jbj/rangeanalysis-best-bound
C++: Restrict the output of IR Range Analysis to the best bounds
2019-10-30 17:18:59 +00:00
alistair
27d0b51c6b CPP & C#: Review of qhelp
PR #2151 got merged without a review of the qhelp
by a technical writer.
The current PR makes changes I would have suggested on that PR.
2019-10-30 16:10:03 +00:00
yh-semmle
8620b0513e Java: move UnsafeDeserialization.qll to standard library location 2019-10-30 11:18:36 -04:00
Max Schaefer
3bbded57d3 JavaScript: Autoformat. 2019-10-30 14:49:18 +00:00
Max Schaefer
bb0771b36c JavaScript: Deal with escape-unescape-escape (and similar) chains. 2019-10-30 14:49:01 +00:00
Max Schaefer
8c133ff61d JavaScript: Deal with (un-)escaping on captured variables. 2019-10-30 14:46:50 +00:00
Max Schaefer
a8214ce7ee JavaScript: Fix regexes for escaping schemes. 2019-10-30 14:15:59 +00:00
Max Schaefer
5349e0f881 JavaScript: Recognise wrapped chains of replacements. 2019-10-30 13:14:38 +00:00
Max Schaefer
02d16b1dc9 JavaScript: Recognise wrapped string replacement functions. 2019-10-30 13:01:17 +00:00
Max Schaefer
aaeca32519 JavaScript: Recognize string escaping using .replace with a callback. 2019-10-30 12:45:32 +00:00
Jonas Jensen
1e6c983d62 C++: Use getASTVariable in DefaultTaintTracking
This library is not yet used in a query or test, so it broke silently
when `VariableAddressInstruction.getVariable` was removed.
2019-10-30 13:42:17 +01:00
Max Schaefer
bd1c99d8a4 JavaScript: Recognise JSON.stringify and JSON.parse as escaper/unescaper. 2019-10-30 12:38:05 +00:00
semmle-qlci
a778efe71e Merge pull request #2216 from asger-semmle/xss-encodeURIComponent
Approved by max-schaefer
2019-10-30 11:49:31 +00:00
Max Schaefer
63f24476e9 JavaScript: Refactor DoubleEscaping.ql. 2019-10-30 10:59:14 +00:00
Aditya Sharad
ecd4c08cb4 Merge pull request #2225 from hvitved/csharp/autobuilder-tests
C#: Update autobuilder tests
2019-10-29 12:21:04 -07:00
Robin Neatherway
96f9a01355 Correct minor compilation errors in test code 2019-10-29 17:52:13 +00:00
Robin Neatherway
84202ff2e1 Java: Respect Hamcrest assertThat(X, notNullValue()) 2019-10-29 17:52:13 +00:00
Luke Cartey
d9d4aa30a9 Merge pull request #2214 from hmakholm/pr/upgrade-packs
Make each upgrade directory a QL pack
2019-10-29 16:45:02 +00:00
semmle-qlci
fde56cf290 Merge pull request #2223 from hvitved/csharp/autobuilder-curl-redirect
Approved by jbj
2019-10-29 15:38:02 +00:00
Rasmus Wriedt Larsen
87ec58aff1 Merge pull request #2221 from tausbn/python-unreachable-catch-all-assert
Python: Do not report unreachable "catch-all" cases in `elif`-chains.
2019-10-29 16:36:51 +01:00
Max Schaefer
b42026a90a JavaScript: Update expected output. 2019-10-29 15:36:24 +00:00
Max Schaefer
530fa2c11c JavaScript: Collapse edges instead of hiding nodes.
Instead of skipping over initial and final nodes, we now introduce edges from source and to sink nodes that circumvent these nodes entirely.
2019-10-29 15:30:24 +00:00
Max Schaefer
dc1d1c2f22 JavaScript: Update expected output. 2019-10-29 15:30:06 +00:00
Max Schaefer
278ea90049 JavaScript: Collapse flow labels at start/end nodes to avoid duplication. 2019-10-29 15:24:40 +00:00
Max Schaefer
316962233c JavaScript: Factor out MidPathNode into its own class. 2019-10-29 15:24:40 +00:00
Max Schaefer
7c56c9f999 JavaScript: Move suppression of hidden nodes into edges predicate.
They should really only be hidden for display purposes.
2019-10-29 15:19:26 +00:00
Max Schaefer
3373742077 JavaScript: Turn PathNode::getASuccessorInternal and PathNode::getAHiddenSuccessor into top-level predicates. 2019-10-29 15:19:26 +00:00
Max Schaefer
b6f4785645 JavaScript: Rename MkPathNode to MkMidNode. 2019-10-29 15:19:26 +00:00
Max Schaefer
d71faaa5f9 JavaScript: Introduce PathNode::wraps. 2019-10-29 15:19:26 +00:00
Max Schaefer
98e0932de5 JavaScript: Make Configuration::isLive nullary.
This makes it more obvious to the evaluator that it is a good predicate to pick as a sentinel, and in practice we mostly just have one configuration in scope anyway.
2019-10-29 15:19:26 +00:00
Tom Hvitved
edbdfdfa27 C#: Update autobuilder tests 2019-10-29 16:14:58 +01:00
Max Schaefer
6964945c74 JavaScript: Restrict edges to only contain nodes. 2019-10-29 15:03:52 +00:00
alexet
924d23f657 Cache the computation of core toString predicates. 2019-10-29 14:48:27 +00:00
Taus Brock-Nannestad
5e62da7690 Python: Do not report unreachable "catch-all" cases in elif-chains.
This was brought up on the LGTM.com forums here:
https://discuss.lgtm.com/t/warn-when-always-failing-assert-is-reachable-rather-than-unreachable/2436

Essentially, in a complex chain of `elif` statements, like

```python
if x < 0:
    ...
elif x >= 0:
    ...
else:
    ...
```

the `else` clause is redundant, since the preceding conditions completely
exhaust the possible values for `x` (assuming `x` is an integer). Rather than
promoting the final `elif` clause to an `else` clause, it is common to instead
raise an explicit exception in the `else` clause. During execution, this
exception will never actually be raised, but its presence indicates that the
preceding conditions are intended to cover all possible cases.

I think it's a fair point. This is a clear instance where the alert, even if it
is technically correct, is not useful for the end user.

Also, I decided to make the exclusion fairly restrictive: it only applies if
the unreachable statement is an `assert False, ...` or `raise ...`, and only
if said statement is the first in the `else` block. Any other statements will
still be reported.
2019-10-29 15:30:32 +01:00
Tom Hvitved
6a77751713 C#: Add -L flag to autobuilder curl invocation
Turns out that `https://dot.net/v1/dotnet-install.sh` has moved to
`https://dotnet.microsoft.com/download/dotnet-core/scripts/v1/dotnet-install.sh`.
Instead of updating the URL in the code, I prefer to keep the old URL (which is
still referenced in the documentation), and let `curl` handle the redirect.
2019-10-29 14:15:17 +01:00
Rasmus Wriedt Larsen
fc851b46c3 Python: Fix Django class-based views 2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
fb864b7262 Python: Consolidate tests for django
The tests in 3/ was not Python 3 specific anymore
2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
91f269ed7b Python: Remove unused django sinks
This would find instances of `thing = MyThing.objects.get(field=userinput)`, and
what seems to be a query that wants to match on `thing = MyThing();
thing.field=userinput`. Both are not vulnerable to user-input, due to the
build-in escaping by django.

The DjangoModelFieldWrite actually matches on `MyThing.field=userinput` and not
`thing.field=userinput`. I suspect this to be a mistake.

Matching on `thing.field=userinput`, would require this CodeQL:

attr.getObject(_).pointsTo().getClass() = model
2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
471318369b Python: Don't quote %s in django example
This is vulnerable to SQL injection because of the quotes around %s -- added
some code that highlights this in test.py

Since our examples did this in the safe query, I ended up rewriting them
completely, causing a lot of trouble for myself :D
2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
afe7a0536c Python: Support positional arguments in Django routes 2019-10-29 13:58:07 +01:00
Rasmus Wriedt Larsen
49dd2216a6 Python: Refactor django library
Use General.qll for routing, like in other web libraries
2019-10-29 13:58:07 +01:00
Shati Patel
e2b446db19 Docs: Update Python 2019-10-29 12:36:16 +00:00
Shati Patel
3337eaf0f9 Docs: Update JavaScript/TypeScript 2019-10-29 12:36:06 +00:00
Erik Krogh Kristensen
2d01e7c5ed simplify the callsArray predicate 2019-10-29 12:13:01 +01:00
Erik Krogh Kristensen
563f32193c suggestions from @max-schaefer
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-10-29 12:10:12 +01:00
Jonas Jensen
b6038f3caa C++: Remove best-bound logic from test
This logic, in an improved form, is now part of the library itself.
2019-10-29 11:54:32 +01:00
Jonas Jensen
311963906b C++: Only give the best delta in range analysis
This mirrors Java's 6b85fe087a.
2019-10-29 11:49:49 +01:00
Taus
6e6dab9ab8 Merge pull request #2178 from RasmusWL/python-minor-qldoc-fix
Python: Fix qldoc for TaintTracking Configuration
2019-10-29 10:40:12 +01:00
Jonas Jensen
ff62afb575 C++: Rename parameter to b to match QLDoc 2019-10-29 10:38:23 +01:00
semmle-qlci
2cddb82f10 Merge pull request #2210 from max-schaefer/js/better-destructuring-type-inference
Approved by asger-semmle, esbena
2019-10-29 08:08:51 +00:00
Jonas Jensen
0b2c2620cd Merge pull request #2184 from dave-bartolomeo/dave/AliasedUse
C++/C#: Add `AliasedUse` instruction to all functions
2019-10-29 08:37:57 +01:00
Robert Marsh
8076156cb1 Merge branch 'master' into rdmarsh/cpp/ir-callee-side-effects 2019-10-28 16:50:34 -07:00
Robert Marsh
120fa6c330 C++: alias fixes for ReturnIndirection 2019-10-28 15:09:35 -07:00
Robert Marsh
5e946cc9f3 C++: add param read side effects to IR exit blocks 2019-10-28 15:09:04 -07:00
Geoffrey White
3584c0b2e5 CPP: Speed up InitializationFunctions.qll's getTarget. 2019-10-28 19:54:10 +00:00
Geoffrey White
2d64fedeb0 CPP: Speed up VirtualDispatch.qll's getAViableTarget. 2019-10-28 19:54:10 +00:00
Geoffrey White
c40c88ec4b CPP: Add test cases for ConditionallyUninitializedVariables.ql. 2019-10-28 18:43:00 +00:00
Geoffrey White
d693eb8c20 CPP: Correct the ConditionallyUninitializedVariable examples. 2019-10-28 17:39:45 +00:00
Asger F
94dd9a1c04 JS: Block XSS flow through encodeURIComponent 2019-10-28 17:12:40 +00:00
Henning Makholm
ae554cf1e9 Make each upgrade directory a QL pack 2019-10-28 17:14:31 +01:00
Taus
04e3683035 Merge pull request #2194 from RasmusWL/python-improve-getbasetype-qldoc
Python: Improve qldoc for ClassValue::getABaseType
2019-10-28 17:07:19 +01:00
Anders Schack-Mulligen
d0842fc35d Java/C++/C#: Minor refactor following review comment. 2019-10-28 16:31:22 +01:00
Jonas Jensen
b13535ac7d C++: Implement DataFlow::BarrierGuard for AST+IR
The change note is copied from the Java change note.
2019-10-28 16:22:23 +01:00
Anders Schack-Mulligen
0ffcf9ce64 Merge pull request #2192 from JLLeitschuh/feature/JLL/http_response_splitting_netty
Add CWE-113 check for io.netty.handler.codec.http.DefaultHttpHeaders
2019-10-28 15:01:20 +01:00
semmle-qlci
70b114b827 Merge pull request #2208 from hvitved/csharp/codeql/no-bundled-nuget
Approved by p0
2019-10-28 13:47:50 +00:00
Tom Hvitved
3f5ee5138b C#: Add change notes 2019-10-28 14:22:59 +01:00
Tom Hvitved
eb990525d7 C#: Add precision tags to UnsafeDeserialization[UntrustedInput].ql 2019-10-28 14:19:40 +01:00
Tom Hvitved
b0cf7cb39a C#: Move UnsafeDeserialization.qll 2019-10-28 13:38:53 +01:00
Tom Hvitved
c3f23f542a C#: Add change note 2019-10-28 13:15:20 +01:00
Tom Hvitved
1fc786bea7 C#: Add precision tag to cs/deserialized-delegate 2019-10-28 13:11:10 +01:00
shati-patel
d94b0cab29 Update docs/language/learn-ql/java/introduce-libraries-java.rst
Co-Authored-By: Felicity Chapman <felicitymay@github.com>
2019-10-28 12:05:51 +00:00
semmle-qlci
30a907861b Merge pull request #2193 from max-schaefer/js/autobuilder-exclude-node_modules
Approved by asger-semmle
2019-10-28 11:26:51 +00:00
Tom Hvitved
8a08038ff3 C#: Use system-nuget in Autobuilder when SEMMLE_PLATFORM_TOOLS is not set 2019-10-28 10:59:26 +01:00
Geoffrey White
8839bdd688 Merge pull request #1428 from jbj/infinite-loops-visible
C++: Make cpp/comparison-with-wider-type visible
2019-10-28 09:49:38 +00:00
Anders Schack-Mulligen
379ef1d2f9 Java: Fix bad magic and join-order. 2019-10-28 10:40:06 +01:00
semmle-qlci
33374ee089 Merge pull request #2202 from asger-semmle/express-sendfile
Approved by esbena
2019-10-28 09:24:34 +00:00
Max Schaefer
b333c6a214 Merge pull request #2106 from asger-semmle/call-graph-3
JS: Call graph changes
2019-10-28 09:24:10 +00:00
Ziemowit Laski
1500148c76 [CPP-434] Clarify Qhelp. 2019-10-27 11:23:54 -07:00
Erik Krogh Kristensen
b2c31701f3 add documentation to two predicates 2019-10-27 09:12:56 +01:00
Erik Krogh Kristensen
92cebea235 update tests to include empty reciever case 2019-10-27 00:25:59 +02:00
Erik Krogh Kristensen
c6f53199d4 ignore when the reciever is the empty array 2019-10-27 00:24:38 +02:00
Erik Krogh Kristensen
da23898eba update tests 2019-10-26 23:26:45 +02:00
Pavel Avgustinov
d501316c76 Merge pull request #2195 from hmakholm/pr/chain-to-codeql
codeqlmanifest: explicitly chain to ./codeql if we have it
2019-10-26 21:55:50 +01:00
Ziemowit Laski
6ee3d7d788 [CPP-434] Address more comments re .cpp test cases. 2019-10-25 15:50:00 -07:00
Ziemowit Laski
7204e13746 [CPP-434] Address comments re .cpp test cases. 2019-10-25 14:37:28 -07:00
Dave Bartolomeo
cc5a689293 C++/C#: Fix up after merge from master 2019-10-25 14:11:34 -07:00
Ziemowit Laski
f964fe8b0e [CPP-434] Address comments regarding .ql and .qhelp. 2019-10-25 14:08:30 -07:00
Dave Bartolomeo
f5e320e988 Merge from master 2019-10-25 13:24:19 -07:00
Dave Bartolomeo
56cbd0c152 C++/C#: Make AliasedUse access only non-local memory
The `AliasedUse` instruction is supposed to represent future uses of aliased memory after the function returns. Since local variables from that function are no longer allocated after the function returns, the `AliasedUse` instruction should access only the set of aliased locations that does not include locals from the current stack frame.
2019-10-25 13:10:39 -07:00
Ziemowit Laski
1d052a8e62 [CPP-434] Address comments re change notes. 2019-10-25 13:07:54 -07:00
Jonathan Leitschuh
934eed97df Apply suggestions from code review for netty DefaultHttpHeaders
Co-Authored-By: Anders Schack-Mulligen <aschackmull@users.noreply.github.com>
2019-10-25 12:30:16 -04:00
Erik Krogh Kristensen
841dac1aba address review feedback 2019-10-25 17:46:55 +02:00
semmle-qlci
d2f3574427 Merge pull request #2165 from erik-krogh/dosHigh
Approved by asger-semmle
2019-10-25 16:28:07 +01:00
Erik Krogh Kristensen
5b26d03f1c introduce backtracking, and also marking join/slice calls 2019-10-25 16:50:09 +02:00
Jonas Jensen
d63cc3d287 Merge remote-tracking branch 'upstream/master' into infinite-loops-visible
Moved the change note to 1.23.
2019-10-25 15:44:03 +02:00
Max Schaefer
d4b9beb010 JavaScript: Teach autobuilder not to extract node_modules and bower_components folders. 2019-10-25 14:25:02 +01:00
Max Schaefer
bd6109484d JavaScript: Rename node_modules to vendor in AutoBuildTests. 2019-10-25 14:25:02 +01:00
Max Schaefer
89f68f47a0 JavaScript: Improve type inference for captured variables. 2019-10-25 14:22:24 +01:00
Max Schaefer
6269dd99ab JavaScript: Improve type inference for destructuring assignments. 2019-10-25 14:22:24 +01:00
Asger F
04ee483c9e JS: update test output 2019-10-25 14:10:18 +01:00
Asger F
4e3f6c5107 JS: Add change note 2019-10-25 13:09:39 +01:00
Asger F
7ed31baeea JS: Rename to upward navigation 2019-10-25 13:07:07 +01:00
Asger F
39e2d1480e JS: Default to imprecision zero by default 2019-10-25 12:20:16 +01:00
Rasmus Wriedt Larsen
f1004b10ba Merge pull request #2147 from tausbn/python-cyclic-import-package-fp
Python: Fix cyclic import FP relating to packages.
2019-10-25 11:57:55 +02:00
Asger F
5636d42c13 JS: Update test 2019-10-25 09:57:10 +01:00
Asger F
ad645d3d50 JS: Restrict sendfile sink 2019-10-25 09:57:10 +01:00
semmle-qlci
89896c02c4 Merge pull request #2176 from Semmle/esbena-patch-1
Approved by erik-krogh
2019-10-25 09:26:12 +01:00
Jonas Jensen
22de0efc58 Merge pull request #2008 from dave-bartolomeo/dave/IRType2
C++: Implement language-neutral IR type system
2019-10-25 09:42:23 +02:00
yh-semmle
80fd5b2ada Merge pull request #2175 from aschackmull/java/continue-in-false-loop
Java: Port C++ query cpp/continue-in-false-loop to Java.
2019-10-24 20:47:59 -04:00
Dave Bartolomeo
80e29dce8b C++: Fix comment and remove unnecessary max() 2019-10-24 14:15:59 -07:00
Dave Bartolomeo
1223388ab6 C++: Fix test expectations 2019-10-24 13:54:21 -07:00
Dave Bartolomeo
956c18f976 C++/C#: Fix formatting 2019-10-24 13:54:09 -07:00
Ziemowit Łąski
01035f15cf Merge pull request #2123 from geoffw0/comparison2
CPP: Reword ComparisonPrecedence.ql query message.
2019-10-24 12:05:59 -07:00
Tom Hvitved
6d22e351f1 Merge pull request #2151 from raulgarciamsft/users/raul/oss
Users/raul/oss
2019-10-24 19:35:40 +02:00
Geoffrey White
f2656d8556 CPP: Autoformat. 2019-10-24 17:29:05 +01:00
Geoffrey White
73c677d417 Merge pull request #2189 from jbj/eivc-2019
C++: Minor tweaks to ExprInVoidContext
2019-10-24 16:50:35 +01:00
Henning Makholm
8dd0fcbf46 codeqlmanifest: explicitly chain to ./codeql if we have it 2019-10-24 17:40:43 +02:00
Jonas Jensen
8f58e7e6c9 C++: Clarify qldoc 2019-10-24 17:34:01 +02:00
Geoffrey White
e48936244d CPP: Reword the query message. 2019-10-24 16:22:51 +01:00
Rasmus Wriedt Larsen
c50d366527 Python: Improve qldoc for ClassValue::getABaseType
Hopefully it is more clear that you can get multiple results from getABaseType
because of multiple inheritance, and not because we are following the chain of
inheritance
2019-10-24 17:10:42 +02:00
Jonas Jensen
73e217a51e C++: Un-deprecate class Qualifier
It turns out this was used in the internal repo.
2019-10-24 16:47:29 +02:00
Jonathan Leitschuh
dcbd6e0a11 Add CWE-113 check for io.netty.handler.codec.http.DefaultHttpHeaders
Closes #2185
2019-10-24 10:27:40 -04:00
Erik Krogh Kristensen
5489a80372 add query for detecting ignored calls to Array.prototype.concat 2019-10-24 16:17:19 +02:00
Hening Makholm
c927a4c354 Merge pull request #2191 from lcartey/lgtm-selectors
Update new-style suite definitions
2019-10-24 16:15:56 +02:00
Calum Grant
ad867bb855 Merge pull request #2186 from hvitved/csharp/new-env-variables
C#: Teach extractor and autobuilder about new environment variables
2019-10-24 15:12:13 +01:00
Shati Patel
6090867542 Docs: Update Java 2019-10-24 14:59:55 +01:00
Shati Patel
fbc11e505f Docs: Update Go 2019-10-24 14:59:40 +01:00
Shati Patel
f9e76b27f5 Docs: Update C# 2019-10-24 14:59:32 +01:00
Luke Cartey
6bcfb4e5cc Update new-style suite definitions
Capture path-problem as well as problem queries.
2019-10-24 14:54:13 +01:00
Erik Krogh Kristensen
5c07750286 simplify the heuristic for Deferred promises 2019-10-24 15:51:36 +02:00
Jonas Jensen
6c069ff444 C++: The update of a for-loop is ExprInVoidContext 2019-10-24 15:27:54 +02:00
Jonas Jensen
edc9e23a9d C++: Deprecate class Qualifier
It's not used anywhere outside `VoidContext.qll`, where it was defined.
The use in `VoidContext.qll` is 10 years old and was a workaround for an
extractor bug that no longer exists.
2019-10-24 15:22:44 +02:00
Jonas Jensen
11da4a5328 C++: Accept test results for GVN and sign analysis 2019-10-24 15:17:16 +02:00
Anders Schack-Mulligen
fe2988ab39 Merge pull request #2152 from yh-semmle/java-alert-suppression-annotations
Java: support LGTM alert suppression using `@SuppressWarnings` annotations
2019-10-24 15:04:29 +02:00
Rasmus Wriedt Larsen
5b6675aa71 Python: Select location first in tornado Classes test
so it conforms with the general scheme in tests
2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
e7eaf2b7d9 Python: Autoformat (4 spaces) tornado library 2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
2bb933fef0 Python: Modernise tornado library 2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
3e3833927b Python: Remove unused getTornadoRequestHandlerMethod
It was only used in a test, and with the mock, it gives no results anyway.
2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
bc50e90f5b Python: Use mock for tornado tests 2019-10-24 15:01:40 +02:00
Rasmus Wriedt Larsen
4248a8418b Python: Move tornado tests from internal repo 2019-10-24 15:01:35 +02:00
Jonas Jensen
8e31b8167a C++: Add a sample class in PrintAST.ql
I've found myself typing out this class whenever I want to print the AST
of one function. I hope it will be useful to others too.
2019-10-24 14:46:10 +02:00
Tom Hvitved
4ac32c4b12 C#: Fix more tests 2019-10-24 13:00:14 +02:00
Asger F
7dd7463288 Merge pull request #2169 from erik-krogh/importMeta
JS: add initial support for import.meta expressions in TypeScript
2019-10-24 11:20:04 +01:00
Calum Grant
b9ba534bcb C#: Update qltest output. 2019-10-24 11:06:34 +01:00
Tom Hvitved
83ec2d6162 C#: Teach extractor and autobuilder about new environment variables 2019-10-24 11:15:33 +02:00
Erik Krogh Kristensen
ab42b5de80 fix line end at end of dbscheme 2019-10-24 10:17:06 +02:00
Erik Krogh Kristensen
a584d7c850 change update script description
Co-Authored-By: Max Schaefer <54907921+max-schaefer@users.noreply.github.com>
2019-10-24 10:17:06 +02:00
Erik Krogh Kristensen
834b572f45 add initial support for expressions in TypeScript 2019-10-24 10:17:00 +02:00
Jonas Jensen
4b27b2ac05 Merge pull request #2173 from zlaski-semmle/zlaski/bad-addition-qhelp-reword
Reword and reformat Qhelp for BadAdditionOverflowCheck query
2019-10-24 09:26:41 +02:00
Calum Grant
6ac163abac C#: Add change note 2019-10-23 21:59:42 +01:00
Calum Grant
df1e215d98 C#: Add ?? as a local dataflow step. 2019-10-23 21:47:03 +01:00
Dave Bartolomeo
d03a4f86e5 C++/C#: Add AliasedUse instruction to all functions
This new instruction is the dual of the existing `AliasedDefinition` instruction. Whereas that instruction defines the contents of aliased memory before the function was called, `AliasedUse` represents the potential use of all aliased memory after the function returns. This ensures that writes to aliased memory do not appear "dead", even if there are no further reads from aliased memory within the function itself.
2019-10-23 11:59:05 -07:00
Geoffrey White
0427b1eb3f C#: Fix more tests. 2019-10-23 18:20:44 +01:00
Shati Patel
2aefcbd42c Docs: Update C/C++ 2019-10-23 18:17:52 +01:00
Shati Patel
6cf8f06191 Docs: Update COBOL 2019-10-23 18:17:10 +01:00
Shati Patel
9b8516cbd6 Remove some mentions of "CodeQL" and fix typos 2019-10-23 17:40:48 +01:00
Rasmus Wriedt Larsen
2874c54133 Python: Move pyramid tests from internal repo
Use minimal mock instead of full library
2019-10-23 16:28:46 +02:00
Rasmus Wriedt Larsen
7c44c37d8b Python: Autoformat (4 spaces) pyramid library 2019-10-23 16:28:46 +02:00
Rasmus Wriedt Larsen
4463b30ce7 Python: Update pyramid library to use correct response class
Tested with pyramid 1.10.4 and python 3.6.8
2019-10-23 16:28:46 +02:00
Rasmus Wriedt Larsen
66a0e153a5 Python: Modernise pyramid library 2019-10-23 16:28:46 +02:00
Rasmus Wriedt Larsen
59e09d6d5d Python: Add nullary pointsTo to Expr class
Like the one existing in ControlFlowNode.

This is useful for checking class of value being poitned to, as

    expr.pointsTo().getClass() = someClass

Without this you need to do

    exists(Value v | v.getClass() = someClass | expr.pointsTo(v))
2019-10-23 16:28:46 +02:00
Anders Schack-Mulligen
3462624995 Java: Add test. 2019-10-23 16:24:26 +02:00
Calum Grant
48c0d9ecca C#: Add qltests for ?? dataflow. 2019-10-23 15:17:26 +01:00
Rasmus Wriedt Larsen
8767d29d21 Python: Use src for naming in TaintTrackign::Configuration
We picked `src` since this is used much more than `source` in our existing code.
2019-10-23 15:56:37 +02:00
Shati Patel
60226801aa Docs: Update terminology
A more in-depth attempt at changing terminology for GHU.
I've only updated the non-language specific topics so far.
2019-10-23 14:54:02 +01:00
semmle-qlci
fc8c1e195a Merge pull request #2177 from asger-semmle/nodejs-detector-class-expression
Approved by max-schaefer
2019-10-23 14:33:07 +01:00
Calum Grant
6b15bf62fd C#: Rewrite null-coalsecing logic 2019-10-23 13:49:22 +01:00
Calum Grant
01ad93d199 C#: Fix for false positive. 2019-10-23 12:26:01 +01:00
Asger F
45667cc127 TS: Tolerate syntax errors in class declaration 2019-10-23 11:40:34 +01:00
Calum Grant
ee7cf17b15 C#: Add test case for local disposal. 2019-10-23 11:22:52 +01:00
Jonas Jensen
7a6ec83572 C++: No CopyValue for immediately discarded exprs
Expressions like the `e` in `e;` or `e, e2`, whose result is immediately
discarded, should not get a synthetic `CopyValue`. This removes a lot of
redundancy from the IR.

To prevent these expressions from being confused with the expressions
from which they get their result, the predicate
`getInstructionConvertedResultExpression` now suppresses results for
expressions that don't produce their own result. This should fix the
mapping between expressions and IR data-flow nodes.
2019-10-23 11:56:30 +02:00
Taus
30483db621 Merge pull request #2146 from RasmusWL/python-improve-iter-returns-non-iterator
Python: improve py/iter-returns-non-iterator
2019-10-23 11:53:00 +02:00
Esben Sparre Andreasen
207692a7a1 add missing .ql extension to suite file name 2019-10-23 11:18:48 +02:00
Rasmus Wriedt Larsen
5c5eaacc09 Python: Remove cached annotation in py/iter-returns-non-iterator 2019-10-23 10:46:07 +02:00
Rasmus Wriedt Larsen
a98466392d Python: Improve tests and docs for py/iter-returns-non-iterator 2019-10-23 10:46:07 +02:00
shati-patel
41969a3d92 Merge pull request #2174 from jf205/go-docs/sd-3871
docs: add ql for go topic
2019-10-23 09:25:30 +01:00
james
efe84a6d93 docs: ql-for-go.rst 2019-10-23 09:16:38 +01:00
Geoffrey White
e331a24dbb C#: Fix autoformat. 2019-10-23 08:48:07 +01:00
Jonas Jensen
cbbe9b4718 Merge remote-tracking branch 'upstream/master' into ir-copy-unloaded-result
Fixed conflicts by accepting new qltest output.

Conflicts:
      cpp/ql/test/library-tests/ir/ir/raw_ir.expected
      cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected
      cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected
      cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_sanity.expected
      cpp/ql/test/library-tests/syntax-zoo/unaliased_ssa_sanity.expected
2019-10-23 08:46:39 +02:00
Ziemowit Laski
6eb0f0709a [CPP-434] Update Qhelp. 2019-10-22 17:28:35 -07:00
Ziemowit Laski
ad5aa182df [CPP-434] When analyzing overflow, discard any explicit casts.
Use the simple range analysis library to detect which
          additions may in fact overflow.
2019-10-22 15:21:30 -07:00
Robert Marsh
e8dd0227ae C++: accept test changes 2019-10-22 14:27:43 -07:00
Ziemowit Laski
ac7a1230e6 [zlaski/bad-addition-qhelp-reword] Left-justify help text so that it renders proerly in MD. 2019-10-22 14:00:02 -07:00
Ziemowit Laski
ad4cd6f2bb [zlaski/bad-addition-qhelp-reword] Initial change. 2019-10-22 13:43:35 -07:00
Ziemowit Laski
06f63c5477 [CPP-434] Incremental changes to SignedOverflowCheck.cpp test suite. 2019-10-22 13:06:33 -07:00
Dave Bartolomeo
0219dbeeed C++: Fix override warning 2019-10-22 11:50:48 -07:00
Robert Marsh
219fcb7889 Merge pull request #2160 from jf205/review-cpp-docs
docs: editorial suggestions to new C/C++ topics
2019-10-22 10:59:59 -07:00
Robert Marsh
9f0499cce9 Merge pull request #2063 from jbj/dataflow-ref-parameter
C++: Data flow through reference parameters
2019-10-22 09:40:15 -07:00
Pavel Avgustinov
325dbfe9c0 Merge pull request #2172 from hmakholm/qlpack.yml
qlpack files are now YAML rather than JSON
2019-10-22 17:19:52 +01:00
Geoffrey White
9949d8a000 C#: Fix warnings. 2019-10-22 17:10:11 +01:00
semmle-qlci
cbfa1cd058 Merge pull request #2168 from xiemaisi/js/remove-duplicate-configuration
Approved by erik-krogh
2019-10-22 17:02:26 +01:00
Geoffrey White
b218a87ecc C#: Override tags. 2019-10-22 16:57:12 +01:00
Henning Makholm
f4a6261f7c add a codeql manifest too 2019-10-22 17:36:35 +02:00
Henning Makholm
347d97c14c qlpack.json is now qlpack.yml 2019-10-22 17:36:35 +02:00
Pavel Avgustinov
72de1b25ab Merge pull request #2164 from hmakholm/suites
Add some new-style suite definitions
2019-10-22 16:35:19 +01:00
Geoffrey White
ae20e9ace1 CPP: Fix autoformat. 2019-10-22 16:28:53 +01:00
Anders Schack-Mulligen
da57dbc528 Java: Port C++ query cpp/continue-in-false-loop. 2019-10-22 17:07:57 +02:00
Taus
a19569ce3e Merge pull request #2161 from RasmusWL/python-fix-cookieset-tostring
Python: Fix toString for CookieSet classes
2019-10-22 16:48:31 +02:00
James Fletcher
25e3258b10 Merge pull request #2170 from shati-patel/link
Docs: Fix broken link
2019-10-22 15:43:03 +01:00
Geoffrey White
41984a8731 CPP: Fix more qhelp. 2019-10-22 15:38:44 +01:00
Geoffrey White
78e56d9f7f C#: Sync identical files. 2019-10-22 15:24:50 +01:00
Geoffrey White
2fa80c7da5 CPP: Fix qhelp. 2019-10-22 15:21:27 +01:00
Shati Patel
50c7816a66 Fix broken link 2019-10-22 15:12:06 +01:00
Geoffrey White
33867dd859 C#: Fixes. 2019-10-22 15:05:32 +01:00
Geoffrey White
63003894c3 CPP: Fixes. 2019-10-22 14:51:17 +01:00
Henning Makholm
fd768a1af6 Add some new-style suite definitions 2019-10-22 15:51:00 +02:00
Taus Brock-Nannestad
32de65c0c6 Python: Add discussed test case (a false negative). 2019-10-22 15:10:40 +02:00
Taus Brock-Nannestad
83bf54c524 Python: Move false positive (now a true negative) into subfolder. 2019-10-22 15:08:29 +02:00
semmle-qlci
cb3a05c6de Merge pull request #2166 from xiemaisi/js/fix-typo
Approved by esben-semmle
2019-10-22 12:38:10 +01:00
Max Schaefer
1c23615742 JavaScript: Fix typo in doc comment. 2019-10-22 10:44:25 +01:00
Anders Schack-Mulligen
c37195b226 Java/C++/C#: Sync. 2019-10-22 11:42:35 +02:00
Anders Schack-Mulligen
2ffbb2ecd6 Java: Refactor dataflow to simplify return flow. 2019-10-22 11:42:35 +02:00
Geoffrey White
faf1a2acbe CPP: Fix typos. 2019-10-22 09:56:50 +01:00
Geoffrey White
47169e2ece C#: Fix autoformat. 2019-10-22 09:56:49 +01:00
Geoffrey White
3b674de12c C#: Disable precision tags for now. 2019-10-22 09:56:49 +01:00
Geoffrey White
49e7addaa4 C#: Autoformat. 2019-10-22 09:56:42 +01:00
Geoffrey White
31dd3cae84 CPP: Autoformat. 2019-10-22 09:55:48 +01:00
Raul Garcia (MSFT)
cb8dcf7db2 Publishing queries to the OSS Semmle repository 2019-10-22 09:55:39 +01:00
Erik Krogh Kristensen
ad3185c558 simplify lastStatementHasNoEffect and use the control-flow to determine which statement is the last 2019-10-22 10:33:05 +02:00
Rasmus Wriedt Larsen
e487fd3648 Python: Improve alert message for py/iter-returns-non-iterator
Fixes https://github.com/Semmle/ql/issues/1427
2019-10-22 10:27:55 +02:00
Rasmus Wriedt Larsen
6056b457e9 Python: Autoformat py/iter-returns-non-iterator 2019-10-22 10:25:01 +02:00
Erik Krogh Kristensen
db22916850 fix the alwaysHasNoEffect predicate, and rename it to lastStatementHasNoEffect 2019-10-22 09:37:19 +02:00
semmle-qlci
1c79ec550e Merge pull request #2092 from esben-semmle/js/brittle-system-reflection-command
Approved by mchammer01, xiemaisi
2019-10-22 08:36:44 +01:00
Erik Krogh Kristensen
1ae8e25603 change precision of js/loop-bound-injection and fix a false positive 2019-10-22 09:21:19 +02:00
semmle-qlci
eb9d90dff6 Merge pull request #2143 from esben-semmle/js/fix-all-sanitisers
Approved by xiemaisi
2019-10-22 07:16:27 +01:00
semmle-qlci
0dcb189e67 Merge pull request #2162 from xiemaisi/js/remove-deprecated-queries
Approved by esben-semmle
2019-10-22 07:15:58 +01:00
Ziemowit Laski
9bc4c2d9a5 [CPP-434] Ctrl + Shift + F. 2019-10-21 18:40:20 -07:00
Dave Bartolomeo
63038896f4 C++: Accept test output after changes 2019-10-21 17:06:32 -07:00
Ziemowit Laski
2292518933 [CPP-434] Change query so it flags overflows that were cast to unsigned. 2019-10-21 17:04:46 -07:00
Dave Bartolomeo
2cd694756b C++: Remove mistakenly-added file 2019-10-21 15:58:38 -07:00
Dave Bartolomeo
1c8e275b40 C++/C#: Autoformat all the things 2019-10-21 15:00:05 -07:00
Esben Sparre Andreasen
5a983cb535 JS: add query js/shell-command-injection-from-environment 2019-10-21 23:31:55 +02:00
Dave Bartolomeo
7241c1aae6 C++/C#: More sanity checks for IRType 2019-10-21 14:22:46 -07:00
Dave Bartolomeo
958754bed8 C++: Use max to handle mixed 32/64-bit extraction 2019-10-21 11:56:12 -07:00
Dave Bartolomeo
5776077bf6 C++: Add comment about enum signedness 2019-10-21 11:37:18 -07:00
Erik Krogh Kristensen
2e0244cda6 address review feedback 2019-10-21 20:32:45 +02:00
Dave Bartolomeo
debb662b8c C++: Reformat comment 2019-10-21 10:55:59 -07:00
Dave Bartolomeo
71a6b5dffe C++/C#: Fix some duplicate IRType problems, and add a sanity test 2019-10-21 10:46:30 -07:00
Max Schaefer
b9203377c7 JavaScript: Remove a duplicate Configuration class. 2019-10-21 17:32:02 +01:00
Taus Brock-Nannestad
ab2c8f312c Python: Apply autoformat. 2019-10-21 17:40:36 +02:00
Taus Brock-Nannestad
4fe1ba0ea4 Python: Refactor py/undefined-export for more clarity. 2019-10-21 17:40:36 +02:00
Taus Brock-Nannestad
8a1d1e7b7a Python: Modernise and false positive in py/undefined-export. 2019-10-21 16:07:48 +02:00
Max Schaefer
90cefead84 Merge pull request #1988 from erik-krogh/unreacableOverloads
JS: Unreachable overloads
2019-10-21 14:57:29 +01:00
Max Schaefer
55fb86d618 JavaScript: Remove deprecated queries.
These queries have all been deprecated since 1.17 (released in July 2018). I think it's time to say goodbye.
2019-10-21 14:42:02 +01:00
Rasmus Wriedt Larsen
016c95a69c Merge pull request #2078 from taus-semmle/python-unreachable-suppressed
Python: Teach `py/unreachable-statement` about `contextlib.suppress`.
2019-10-21 15:14:39 +02:00
Taus Brock-Nannestad
b2f7b0921b Python: Add false negative test case. 2019-10-21 14:31:05 +02:00
Taus Brock-Nannestad
99b99ef2b6 Python: Teach py/unreachable-statement about contextlib.suppress. 2019-10-21 14:31:05 +02:00
Erik Krogh Kristensen
9eda120de4 implement a new query to detect unreachable overloaded methods in TypeScript 2019-10-21 13:34:42 +02:00
james
ec15add112 docs: fix headings 2019-10-21 12:03:59 +01:00
Asger F
8aa34e6a54 JS: Add XSS test case for new PostMessageEventHandler cases 2019-10-21 11:32:22 +01:00
Asger F
0ad9067b7d JS: pragma[noopt] -> pragma[noinline] 2019-10-21 11:32:22 +01:00
Asger F
96b6c83eba JS: Tests and fixes for PartialInvokeNode 2019-10-21 11:32:22 +01:00
James Fletcher
31bd2abd87 Update docs/language/learn-ql/cpp/value-numbering-hash-cons.rst
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-10-21 11:26:27 +01:00
james
d4e9aa53f3 docs: edits to new cpp topics 2019-10-21 10:34:28 +01:00
Rasmus Wriedt Larsen
9cf0e244b1 Python: Fix toString for CookieSet classes
The old implementation would result in empty recursion.
2019-10-21 11:26:10 +02:00
James Fletcher
82ca45f0b5 Merge pull request #2131 from shati-patel/spec-links
Docs: Update links to avoid redirects within help.semmle.com
2019-10-21 10:02:34 +01:00
Calum Grant
4ee3f2c46e Merge pull request #2139 from hvitved/csharp/dataflow/callcontext-bool-pruning
C#: Data-flow pruning based on call contexts
2019-10-21 09:49:05 +01:00
Jonas Jensen
c0fdcf3089 Merge pull request #2094 from rdmarsh2/rdmarsh/docs/cpp/advanced-library-guide
C++/Docs: Add guides to advanced AST libraries
2019-10-21 10:40:53 +02:00
Jonas Jensen
defe99503d Merge pull request #2113 from raulgarciamsft/users/raulga/boost
Users/raulga/boost
2019-10-20 13:14:44 +02:00
yh-semmle
28720679ad Java: remove some obsolete metric queries 2019-10-19 20:55:46 -04:00
Robert Marsh
fc7dbeb0a9 Docs: quotes around "then" block and "else" block 2019-10-18 13:00:02 -07:00
Dave Bartolomeo
f871c72660 C++: Fix PR feedback 2019-10-18 12:54:03 -07:00
Dave Bartolomeo
8ec15933f5 C++/C#: Blob -> Opaque 2019-10-18 12:51:25 -07:00
Robert Marsh
bea9a1cbb2 autoformat 2019-10-18 12:15:21 -07:00
Robert Marsh
8905159de7 C++: add InitializeIndirection for pointer params 2019-10-18 11:06:09 -07:00
Robert Marsh
e57fef093b C++: accept syntax-zoo changes 2019-10-18 10:08:53 -07:00
Asger F
3dcb134e6b JS: Improve documentation 2019-10-18 17:00:38 +01:00
yh-semmle
afcde14403 Merge pull request #2085 from aschackmull/java/overflow-check-fp
Java: Add another overflow check pattern to UselessComparisonTest.
2019-10-18 11:01:24 -04:00
Geoffrey White
446763d331 CPP: Fix typo. 2019-10-18 14:47:21 +01:00
yh-semmle
155d14a185 Java: simplify Extents.qll 2019-10-18 09:46:00 -04:00
yh-semmle
4348241f72 Java: simplify java/alert-suppression-annotations 2019-10-18 09:45:49 -04:00
Geoffrey White
411f74db70 CPP: Delete comment. 2019-10-18 14:44:38 +01:00
semmle-qlci
0ad802bad0 Merge pull request #2145 from xiemaisi/js/es2020
Approved by esben-semmle
2019-10-18 14:06:45 +01:00
Taus
45158a7177 Merge pull request #2053 from RasmusWL/python-modernise-falcon-library
Python modernise falcon library
2019-10-18 14:47:33 +02:00
Taus Brock-Nannestad
70d9d1bd0e Python: Add false positive test case for cyclic import. 2019-10-18 14:03:23 +02:00
Anders Schack-Mulligen
582a91f1e9 Java: Add change note. 2019-10-18 11:59:09 +02:00
Anders Schack-Mulligen
27b8a46dac Java: Exclude loop conditions from overflow check heuristic. 2019-10-18 11:58:46 +02:00
Taus
37291c5642 Merge pull request #2100 from RasmusWL/python-fix-hasFlowPath
Python: Fix hasFlowPath default implementation of isSink/2
2019-10-18 11:16:58 +02:00
Geoffrey White
5a97a16945 CPP: Autoformat. 2019-10-18 09:46:04 +01:00
Jonas Jensen
dcc446660e Merge pull request #2149 from rdmarsh2/rdmarsh/cpp/ir-side-effect-primary
C++: Add getPrimaryInstruction to specific side effects
2019-10-18 10:31:01 +02:00
yh-semmle
1d415b3680 Java: enable java/alert-suppression-annotations in LGTM suite 2019-10-17 22:09:04 -04:00
yh-semmle
ee2c97f147 Java: add extra test for java/alert-suppression-annotations 2019-10-17 22:09:04 -04:00
yh-semmle
62521dca32 Java: account for multiple strings in java/alert-suppression-annotations 2019-10-17 22:09:04 -04:00
yh-semmle
f3a980deb6 Java: clarify predicate name in java/alert-suppression-annotations 2019-10-17 22:09:03 -04:00
yh-semmle
d165ce95f2 Java: tidy QLDoc in Extents.qll 2019-10-17 22:09:03 -04:00
yh-semmle
e3f828c588 Java: refine ranges in java/alert-suppression-annotations 2019-10-17 22:09:03 -04:00
yh-semmle
b2bc8382b0 Java: add alert-suppression query for @SuppressWarnings("lgtm[...]") 2019-10-17 22:09:02 -04:00
Ziemowit Laski
6772fa1352 [CPP-434] Reformat QHelp. 2019-10-17 17:21:14 -07:00
Ziemowit Laski
70441edacf [CPP-434] Additional test case; improve QHelp by including themes from the BadAdditionOverflowCheck QHelp. 2019-10-17 16:41:17 -07:00
Robert Marsh
30e501e110 C++/Docs: reword "divide" to "partition"
Co-Authored-By: Jonas Jensen <jbj@knef.dk>
2019-10-17 12:22:37 -07:00
Robert Marsh
5451c394a2 C++/C#: autoformat 2019-10-17 12:20:36 -07:00
Robert Marsh
b29f88450b C++: buffer read side effects on unmodeled funcs 2019-10-17 12:10:23 -07:00
Robert Marsh
b8bbce0eb6 C#: sync IR 2019-10-17 11:00:04 -07:00
Nick Rolfe
176d7672a1 Merge pull request #2148 from Semmle/cpp-454-invalid_key-diagnostic_for
Drop unique diagnostic key on diagnostic_for tuple
2019-10-17 16:51:03 +01:00
Matthew Gretton-Dann
4e345fb921 C++: Add upgrade script 2019-10-17 15:37:34 +01:00
Matthew Gretton-Dann
bc0d73b86e C++: Remove unique diagniostic key on diagnostic_for. 2019-10-17 15:34:51 +01:00
Esben Sparre Andreasen
80a32aebc1 JS: add SystemCommandExecution::isShellInterpreted 2019-10-17 13:29:24 +02:00
Max Schaefer
a4bffe35fd JavaScript: Add support for globalThis. 2019-10-17 12:04:01 +01:00
semmle-qlci
9995c12132 Merge pull request #2144 from shati-patel/monospace-links
Approved by jf205
2019-10-17 11:55:58 +01:00
Taus Brock-Nannestad
067bdf5ec4 Python: Disregard packages when looking for cyclic imports. 2019-10-17 12:47:34 +02:00
Shati Patel
54d7bba3dd Docs: Remove unused styling 2019-10-17 11:31:35 +01:00
Jonas Jensen
9bc7ce1fac Merge pull request #2141 from geoffw0/newtest
CPP: AV Rule 114 test cases
2019-10-17 09:28:10 +02:00
Esben Sparre Andreasen
93b1e59d62 JS: fix spelling: sanitisers -> sanitizers 2019-10-17 09:05:03 +02:00
Robert Marsh
30d7238921 C++: fix missing getPrimaryInstruction 2019-10-16 17:05:37 -07:00
Robert Marsh
fffe3c2432 C++: add sanity test for side effect primaries 2019-10-16 16:53:55 -07:00
Robert Marsh
6cef936046 C++: add function info to duplicateChiOperand 2019-10-16 15:59:00 -07:00
Dave Bartolomeo
6e61b1dcd0 C++: Fix up after merge from master
The one interesting piece that needed to be fixed up was the type of an `Indirect[Read|Write]SideEffect` operand/result. If the parameter type is a pointer or reference to an incomplete type, we need to set the type of the side effect memory access to `Unknown`, because we don't model incomplete types in the IR type system.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

We've had good experience in the taint tracking library with conflating
pointers and objects, and it improves results for field flow, so perhaps
it's time to try it out for all data flow.
2019-09-17 13:16:34 +02:00
Asger F
f8eff06aa1 JS: Change note 2019-09-17 11:20:39 +01:00
Tom Hvitved
396a72db5f Merge pull request #1898 from AndreiDiaconu1/ircsharp-collections
C# IR: Object creation refactor and collection initializers
2019-09-17 10:48:07 +02:00
Dave Bartolomeo
21f6ab787d C++: Rename predicates in FunctionInputsAndOutputs.qll and add QLDoc 2019-09-16 12:06:06 -07:00
Tom Hvitved
1f927516d8 Merge pull request #1936 from calumgrant/cs/nameof-qualified-namespace
C# extractor: Handle nameof(A.B) where A.B is a qualified namespace
2019-09-16 19:28:48 +02:00
Geoffrey White
3df31e6ccf CPP: Tiny qldoc fixes. 2019-09-16 16:52:48 +01:00
Calum Grant
4e6216379d Merge pull request #1935 from AndreiDiaconu1/ircsharp-forinitfix
C# IR: Fix for init
2019-09-16 16:24:30 +01:00
AndreiDiaconu1
43accd37e1 Address PR comments 2019-09-16 15:42:45 +01:00
Max Schaefer
df739e0fca JavaScript: Fix performance regression in IncorrectSuffixCheck. 2019-09-16 15:25:17 +01:00
Calum Grant
8eeded5982 C#: Handle nameof(A.B) where A.B is a nested namespace. 2019-09-16 15:12:10 +01:00
AndreiDiaconu1
fcb3d99351 C# IR: Fix for init 2019-09-16 11:57:37 +01:00
semmle-qlci
e6b748a8e7 Merge pull request #1875 from esben-semmle/js/blacklist-more-hardcoded-passwords
Approved by xiemaisi
2019-09-16 10:57:35 +01:00
Tom Hvitved
4f897b2628 C#: Address review comments 2019-09-16 10:45:37 +02:00
Esben Sparre Andreasen
a5645e168a JS: exclude keys from whitelist 2019-09-16 10:13:18 +02:00
Esben Sparre Andreasen
c9d31e90fe JS: add change notes 2019-09-16 10:11:43 +02:00
Esben Sparre Andreasen
0e2d2f8662 JS: whitelist some hardcoded dummy-passwords in two queries 2019-09-16 10:11:43 +02:00
Esben Sparre Andreasen
aa3f4a7048 JS: change passwords in tests 2019-09-16 10:09:59 +02:00
jf205
526c123016 Merge pull request #1931 from shati-patel/docs/ql-lexer
Docs/QL lexer: Require whitespace character after annotation
2019-09-14 07:00:31 +01:00
Dave Bartolomeo
553238a9e8 Merge pull request #1922 from jbj/qlcfg-const-pointer-to-member
C++: Add PointerToFieldLiteral class
2019-09-13 10:44:52 -07:00
Shati Patel
9187db585c QL lexer: Require whitespace character after annotation 2019-09-13 16:13:13 +01:00
Asger F
a8e8ae868a JS: Update extractor version string 2019-09-13 15:48:31 +01:00
Asger F
173f32d2ba JS: Recognize 'require' calls in more cases 2019-09-13 15:48:31 +01:00
Asger F
3b7ecd5ccf JS: Add NumModules metric 2019-09-13 15:48:31 +01:00
semmle-qlci
82097f63ac Merge pull request #1903 from jf205/js-links
Approved by asger-semmle
2019-09-13 15:25:02 +01:00
Erik Krogh Kristensen
9dc9adda64 fix capitalization in test case
Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-09-13 14:54:18 +01:00
Erik Krogh Kristensen
3fb64abb09 fix consistency and spelling in the documentation
suggestions from the documentation team

Co-Authored-By: shati-patel <42641846+shati-patel@users.noreply.github.com>
2019-09-13 14:52:11 +01:00
Jonas Jensen
7cfbe88e7b C++: IR DataFlow::Node.toString consistency
The `toString` for IR data-flow nodes are now similar to AST data-flow
nodes. This should make it easier to use the IR as a drop-in replacement
in the future. There are still differences because the IR data flow
library takes conversions into account.

I did not attempt to align the new nodes we use for field flow. That can
come later, when we add field flow to IR data flow.
2019-09-13 14:33:31 +02:00
Jonas Jensen
562bffe710 C++: Simplify toString of ImplicitParameterNode
This string looked out of place compared to `ExplicitParameterNode`,
whose string is simply the name of the parameter and therefore
indistinguishable from an access to the parameter without looking at the
location also. This has not been a problem so far, and if we want to
distinguish more clearly between initial values and accesses at some
point, we should do it for `ExplicitParameterNode` and
`UninitializedNode` too.
2019-09-13 14:33:26 +02:00
Erik Krogh Kristensen
c4f27ed4cc rename TaintedLength to LoopBoundInjection 2019-09-13 11:12:01 +01:00
Erik Krogh Kristensen
673e883c21 use superscript to denote the size of the tainted object 2019-09-13 11:00:11 +01:00
semmle-qlci
d0d3882121 Merge pull request #1919 from esben-semmle/js/fixup-1
Approved by asger-semmle, xiemaisi
2019-09-13 10:40:38 +01:00
semmle-qlci
1313821a25 Merge pull request #1904 from erik-semmle/passportModel
Approved by asger-semmle, esben-semmle
2019-09-13 10:38:14 +01:00
Erik Krogh Kristensen
5b2b60f132 change DOS to DoS, and other small documentation fixes
Co-Authored-By: Max Schaefer <max@semmle.com>
2019-09-13 10:26:01 +01:00
Tom Hvitved
f5cae9b6ea Merge pull request #1881 from aschackmull/java/pathgraph-nodes
Java/C++/C#: Add nodes predicate to PathGraph.
2019-09-13 10:32:47 +02:00
Dave Bartolomeo
e8cf3f876e Merge pull request #1660 from zlaski-semmle/zlaski/builtin-va-list
Add a `__builtin_va_list` type, to complement `__builtin_va_*`
2019-09-12 14:04:55 -07:00
Dave Bartolomeo
9072f6231f Merge pull request #1928 from jbj/autoformat-ssa
C++: Autoformat IR SSA files
2019-09-12 14:03:20 -07:00
zlaski-semmle
45640395a9 Merge pull request #1803 from geoffw0/qldoceg9
CPP: Add syntax examples to QLDoc in Variable.qll
2019-09-12 12:32:58 -07:00
Robert Marsh
7f6108259e Merge pull request #1927 from jbj/instructionNode
C++: Add DataFlow::instructionNode
2019-09-12 12:06:01 -07:00
Rebecca Valentine
f503e042fc Merge pull request #1877 from taus-semmle/python-modernise-non-iterator-query
Python: Modernise the `py/non-iterable-in-for-loop` query.
2019-09-12 11:14:40 -07:00
Calum Grant
b7db15646c Merge pull request #1858 from AndreiDiaconu1/ircsharp-continue
C# IR: Add support for `ContinueStmt`
2019-09-12 17:37:01 +01:00
Erik Krogh Kristensen
c2efb0afe7 two tiny qldoc changes 2019-09-12 16:58:07 +01:00
Erik Krogh Kristensen
119b1ffb80 changes based on review from max 2019-09-12 16:30:42 +01:00
Erik Krogh Kristensen
dc891dc420 added js/loop-bound-injection to javascript security suite 2019-09-12 15:50:50 +01:00
Erik Krogh Kristensen
17a71a97c5 add loop-bound-injection to change-notes 2019-09-12 15:28:14 +01:00
Erik Krogh Kristensen
3d359bc8dc Merge remote-tracking branch 'upstream/master' into taintedLength 2019-09-12 15:24:36 +01:00
Erik Krogh Kristensen
30f1bcf5bc updated query ID and expected output 2019-09-12 15:24:33 +01:00
Jonas Jensen
0c092e21b0 C++: Autoformat IR SSA files
One autoformat omission had also slipped into
`DefaultTaintTracking.qll`.
2019-09-12 15:45:08 +02:00
Jonas Jensen
10270cb36d C++: Turn a comment into QLDoc 2019-09-12 15:44:04 +02:00
AndreiDiaconu1
e55f16d990 Fix comment 2019-09-12 13:57:28 +01:00
AndreiDiaconu1
91fdfd48e5 Fixed CP problem 2019-09-12 13:09:49 +01:00
Jonas Jensen
c7e6081079 C++: Add DataFlow::instructionNode
This is for symmetry with `exprNode` etc., and it should be handy for
the same reasons. I found one caller of `asInstruction` that got simpler
by using the new predicate instead.
2019-09-12 11:44:17 +02:00
Tom Hvitved
5070270605 C#: Fix CFG for nested finally blocks 2019-09-12 11:44:04 +02:00
Tom Hvitved
b9fa837963 C#: Add new CFG test for try/finally 2019-09-12 11:44:04 +02:00
Tom Hvitved
3d32f3d173 C#: Restructure existing CFG tests for try/finally 2019-09-12 11:44:04 +02:00
AndreiDiaconu1
47120bc923 PR fixes 2019-09-12 10:34:00 +01:00
Calum Grant
e330d5a6c6 Merge pull request #1549 from hvitved/csharp/cfg/loop-unrolling
C#: Loop unrolling for `foreach` statements
2019-09-12 10:24:26 +01:00
AndreiDiaconu1
420abbf3dc C# IR: Support for ContinueStmt
Added support for continue stmt.
Minimal refactoring of the `TranslatedSpecificJump` classes.
Added a new test file, `jumps.cs` and updated the expected output.
2019-09-12 10:01:48 +01:00
Anders Schack-Mulligen
6299625b3d C#: Adjust qltest expected output. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
61e4e61087 C++: Adjust qltest expected output. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
2d620698d8 Java: Adjust qltest expected output. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
95e2f162d9 Java/C++/C#: Adjust toString of empty accesspath. 2019-09-12 11:00:49 +02:00
Anders Schack-Mulligen
0a4b15d40b Java/C++/C#: Add nodes predicate to PathGraph. 2019-09-12 11:00:49 +02:00
Erik Krogh Kristensen
2db0cdf4e2 two small qhelp fixes 2019-09-12 10:00:08 +01:00
semmle-qlci
10076a6b2b Merge pull request #1886 from jbj/ir-taint-shared
Approved by rdmarsh2
2019-09-12 06:48:24 +01:00
Robert Marsh
e71a39f6b6 Merge pull request #1912 from jbj/tainttracking-ir-1
C++: Stub replacement for security.TaintTracking
2019-09-11 13:44:39 -07:00
Tom Hvitved
8f3f9406e2 C#: Early identification of duplicate extraction 2019-09-11 20:47:20 +02:00
Geoffrey White
d1cc28e253 CPP: Address review comments. 2019-09-11 17:14:05 +01:00
Geoffrey White
ee07c705a4 CPP: More review suggestions. 2019-09-11 17:14:05 +01:00
Geoffrey White
8134d80c46 CPP: Review suggestions. 2019-09-11 17:14:05 +01:00
Geoffrey White
120b0c0c2c CPP: Modernize the TemplateVariables test and have the TemplateVariables actually included in the scope of the test. 2019-09-11 17:14:05 +01:00
Geoffrey White
68196df561 CPP: Examples Variable.qll. 2019-09-11 17:11:53 +01:00
semmle-qlci
72db219c13 Merge pull request #1910 from xiemaisi/js/unused-index-variable
Approved by esben-semmle, shati-semmle
2019-09-11 14:33:32 +01:00
Jonas Jensen
6912cafc54 C++: Use the RelationalOperation class 2019-09-11 15:21:49 +02:00
Jonas Jensen
0d0ab9157c C++: Address review comments 2019-09-11 15:20:36 +02:00
Taus Brock-Nannestad
1013fb7b25 Update .expected file for Python 3 tests. 2019-09-11 14:13:05 +02:00
Calum Grant
b85823bec5 Merge pull request #1857 from AndreiDiaconu1/ircsharp-forstmt
C# IR: More support for `ForStmt`s
2019-09-11 13:11:05 +01:00
Jonas Jensen
6021b4f04a C++: Remove local flow from additional taint step
This case was not supposed to be there -- that was the whole point of
having the `localAdditionalTaintStep` predicate.
2019-09-11 14:09:17 +02:00
Erik Krogh Kristensen
493a31d98d more fixes based on review 2019-09-11 12:53:59 +01:00
Jonas Jensen
ee16b239de C++: Add PointerToFieldLiteral class
Marking these expressions as constants fixes the CFG discrepancies that
can be observed on the affected test and on snapshots of MySQL.
2019-09-11 13:40:24 +02:00
Max Schaefer
500cde68c3 JavaScript: Add new query UnusedIndexVariable. 2019-09-11 11:36:50 +01:00
Esben Sparre Andreasen
9aa0e711b2 JS: update expected output 2019-09-11 12:33:41 +02:00
Erik Krogh Kristensen
bec522f0df small changes based on review feedback 2019-09-11 11:26:59 +01:00
Esben Sparre Andreasen
086c473c18 JS: sharpen js/http-to-file-access 2019-09-11 12:05:33 +02:00
Esben Sparre Andreasen
0e31cad027 JS: simplify this.getStringValue() to getStringValue() 2019-09-11 10:56:49 +02:00
Esben Sparre Andreasen
ee106ccff9 JS: simplify asExpr().getStringValue() calls 2019-09-11 10:56:57 +02:00
Esben Sparre Andreasen
aab17850d1 JS: eliminate redundant ConstantString casts 2019-09-11 10:56:49 +02:00
AndreiDiaconu1
195b99cf96 PR fixes 2019-09-11 09:54:01 +01:00
semmle-qlci
16c95d8c5e Merge pull request #1876 from esben-semmle/js/more-delimiter-stripping-whitelisting
Approved by xiemaisi
2019-09-11 09:16:57 +01:00
Esben Sparre Andreasen
f3de75ae07 JS: update a js/code-injection test 2019-09-11 09:45:54 +02:00
Esben Sparre Andreasen
e41080fb40 JS: add RemoteServerResponse as a heuristic remote flow source 2019-09-11 09:38:18 +02:00
Esben Sparre Andreasen
f7bfc472c1 JS: treat server responses as untrusted for command injections 2019-09-11 09:38:18 +02:00
Esben Sparre Andreasen
3e42b078e8 JS: minor additions to ClientRequest::getAResponseDataNode 2019-09-11 09:24:59 +02:00
Robert Marsh
6d8a4388cb Merge pull request #1883 from jbj/partial-definitions-const
C++: Don't create partial defs for calls to const functions
2019-09-10 12:46:39 -07:00
Erik Krogh Kristensen
72bbd4ded1 fix spelling mistake 2019-09-10 17:13:44 +01:00
Erik Krogh Kristensen
62d1f66fda avoid extending the abstract LoopStmt class 2019-09-10 17:08:00 +01:00
Erik Krogh Kristensen
6bb9781466 remove <br/> tags 2019-09-10 16:57:15 +01:00
semmle-qlci
05247849b0 Merge pull request #1913 from xiemaisi/csharp/update-a-qlref
Approved by hvitved
2019-09-10 16:04:19 +01:00
Jonas Jensen
bd59029e2b C++: Add pointer-to-member test to syntax-zoo
This test was inspired by problems observed in a MySQL snapshot. The
results show there are problems with both the QL CFG and the IR.
2019-09-10 16:23:23 +02:00
Erik Krogh Kristensen
97fc10e669 Add query for detecting potential DOS form a tainted .length property 2019-09-10 14:59:48 +01:00
Max Schaefer
ea81531a7b C#: Update a .qlref.
This currently relies on the fact that qltest includes `ql/csharp/ql/src/Metrics` in addition to `ql/csharp/ql/src` on its search path when run internally, which is inconsistent with the other languages. Since this is the only test that relies on it, I'd like to update it and get rid of the extra search root eventually.
2019-09-10 13:01:04 +01:00
Jonas Jensen
de4e2a259e C++: Stub replacement for security.TaintTracking
This commit adds a `semmle.code.cpp.ir.dataflow.DefaultTaintTracking`
library that's API-compatible with the
`semmle.code.cpp.security.TaintTracking` library. The new library is
implemented on top of the IR data flow library.

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

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

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

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

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

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

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

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

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

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

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

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

5
.codeqlmanifest.json Normal file
View File

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

View File

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

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

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

24
.github/labeler.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
"C++":
- cpp/**/*
- change-notes/**/*cpp*
"C#":
- csharp/**/*
- change-notes/**/*csharp*
Java:
- java/**/*
- change-notes/**/*java.*
JS:
- javascript/**/*
- change-notes/**/*javascript*
Python:
- python/**/*
- change-notes/**/*python*
documentation:
- "**/*.qhelp"
- "**/*.md"
- docs/**/*

10
.gitignore vendored
View File

@@ -1,6 +1,7 @@
# editor and OS artifacts
*~
.DS_STORE
*.swp
# query compilation caches
.cache
@@ -12,3 +13,12 @@
# Visual studio temporaries, except a file used by QL4VS
.vs/*
!.vs/VSWorkspaceSettings.json
# Byte-compiled python files
*.pyc
# It's useful (though not required) to be able to unpack codeql in the ql checkout itself
/codeql/
csharp/extractor/Semmle.Extraction.CSharp.Driver/Properties/launchSettings.json
.vscode

View File

@@ -1,10 +1,11 @@
/cpp/ @Semmle/cpp-analysis
/csharp/ @Semmle/cs
/java/ @Semmle/java
/javascript/ @Semmle/js
/cpp/ @Semmle/cpp-analysis
/cpp/**/*.qhelp @semmledocs-ac
/python/ @Semmle/python
/cpp/**/*.qhelp @hubwriter
/csharp/**/*.qhelp @jf205
/java/**/*.qhelp @felicity-semmle
/javascript/**/*.qhelp @mc-semmle
/python/**/*.qhelp @felicity-semmle
/docs/language/ @felicity-semmle @jf205
/java/**/*.qhelp @felicitymay
/javascript/**/*.qhelp @mchammer01
/python/**/*.qhelp @felicitymay
/docs/language/ @shati-patel @jf205

View File

@@ -1,88 +1,66 @@
# Contributing to QL
# Contributing to CodeQL
We welcome contributions to our standard library and standard checks. Got an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request!
We welcome contributions to our CodeQL libraries and queries. Got an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE).
Before we accept your pull request, we require that you have agreed to our Contributor License Agreement, this is not something that you need to do before you submit your pull request, but until you've done so, we will be unable to accept your contribution.
There is lots of useful documentation to help you write queries, ranging from information about query file structure to tutorials for specific target languages. For more information on the documentation available, see [Writing CodeQL queries](https://help.semmle.com/QL/learn-ql/writing-queries/writing-queries.html) on [help.semmle.com](https://help.semmle.com).
## Adding a new query
If you have an idea for a query that you would like to share with other Semmle users, please open a pull request to add it to this repository.
Follow the steps below to help other users understand what your query does, and to ensure that your query is consistent with the other Semmle queries.
## Submitting a new experimental query
1. **Consult the QL documentation for query writers**
If you have an idea for a query that you would like to share with other CodeQL users, please open a pull request to add it to this repository. New queries start out in a `<language>/ql/src/experimental` directory, to which they can be merged when they meet the following requirements.
There is lots of useful documentation to help you write QL, ranging from information about query file structure to language-specific tutorials. For more information on the documentation available, see [Writing QL queries](https://help.semmle.com/QL/learn-ql/writing-queries/writing-queries.html) on [help.semmle.com](https://help.semmle.com).
1. **Directory structure**
2. **Format your QL correctly**
There are five language-specific query directories in this repository:
All of Semmle's standard QL queries and libraries are uniformly formatted for clarity and consistency, so we strongly recommend that all QL contributions follow the same formatting guidelines. If you use QL for Eclipse, you can auto-format your query in the [QL editor](https://help.semmle.com/ql-for-eclipse/Content/WebHelp/ql-editor.html). For more information, see the [QL style guide](https://github.com/Semmle/ql/blob/master/docs/ql-style-guide.md).
* C/C++: `cpp/ql/src`
* C#: `csharp/ql/src`
* Java: `java/ql/src`
* JavaScript: `javascript/ql/src`
* Python: `python/ql/src`
3. **Make sure your query has the correct metadata**
Each language-specific directory contains further subdirectories that group queries based on their `@tags` or purpose.
- Experimental queries and libraries are stored in the `experimental` subdirectory within each language-specific directory in the [CodeQL repository](https://github.com/Semmle/ql). For example, experimental Java queries and libraries are stored in `java/ql/src/experimental` and any corresponding tests in `java/ql/test/experimental`.
- The structure of an `experimental` subdirectory mirrors the structure of its parent directory.
- Select or create an appropriate directory in `experimental` based on the existing directory structure of `experimental` or its parent directory.
Query metadata is used by Semmle's analysis to identify your query and make sure the query results are displayed properly.
The most important metadata to include are the `@name`, `@description`, and the `@kind`.
Other metadata properties (`@precision`, `@severity`, and `@tags`) are usually added after the query has been reviewed by Semmle staff.
For more information on writing query metadata, see the [Query metadata style guide](https://github.com/Semmle/ql/blob/master/docs/query-metadata-style-guide.md).
2. **Query metadata**
4. **Make sure the `select` statement is compatible with the query type**
- The query `@id` must conform to all the requirements in the [guide on query metadata](docs/query-metadata-style-guide.md#query-id-id). In particular, it must not clash with any other queries in the repository, and it must start with the appropriate language-specific prefix.
- The query must have a `@name` and `@description` to explain its purpose.
- The query must have a `@kind` and `@problem.severity` as required by CodeQL tools.
The `select` statement of your query must be compatible with the query type (determined by the `@kind` metadata property) for alert or path results to be displayed correctly in LGTM and QL for Eclipse.
For more information on `select` statement format, see [Introduction to query files](https://help.semmle.com/QL/learn-ql/writing-queries/introduction-to-queries.html#select-clause) on help.semmle.com.
For details, see the [guide on query metadata](docs/query-metadata-style-guide.md).
5. **Save your query in a `.ql` file in correct language directory in this repository**
Make sure the `select` statement is compatible with the query `@kind`. See [Introduction to query files](https://help.semmle.com/QL/learn-ql/writing-queries/introduction-to-queries.html#select-clause) on help.semmle.com.
There are five language-specific directories in this repository:
* C/C++: `ql/cpp/ql/src`
* C#: `ql/csharp/ql/src`
* Java: `ql/java/ql/src`
* JavaScript: `ql/javascript/ql/src`
* Python: `ql/python/ql/src`
3. **Formatting**
Each language-specific directory contains further subdirectories that group queries based on their `@tags` properties or purpose. Select the appropriate subdirectory for your new query, or create a new one if necessary.
- The queries and libraries must be [autoformatted](https://help.semmle.com/codeql/codeql-for-vscode/reference/editor.html#autoformatting).
6. **Write a query help file**
4. **Compilation**
Query help files explain the purpose of your query to other users. Write your query help in a `.qhelp` file and save it in the same directory as your new query.
For more information on writing query help, see the [Query help style guide](https://github.com/Semmle/ql/blob/master/docs/query-help-style-guide.md).
- Compilation of the query and any associated libraries and tests must be resilient to future development of the [supported](docs/supported-queries.md) libraries. This means that the functionality cannot use internal libraries, cannot depend on the output of `getAQlClass`, and cannot make use of regexp matching on `toString`.
- The query and any associated libraries and tests must not cause any compiler warnings to be emitted (such as use of deprecated functionality or missing `override` annotations).
5. **Results**
- The query must have at least one true positive result on some revision of a real project.
Experimental queries and libraries may not be actively maintained as the [supported](docs/supported-queries.md) libraries evolve. They may also be changed in backwards-incompatible ways or may be removed entirely in the future without deprecation warnings.
After the experimental query is merged, we welcome pull requests to improve it. Before a query can be moved out of the `experimental` subdirectory, it must satisfy [the requirements for being a supported query](docs/supported-queries.md).
## Using your personal data
If you contribute to this project, we will record your name and email
address (as provided by you with your contributions) as part of the code
repositories, which might be made public. We might also use this information
repositories, which are public. We might also use this information
to contact you in relation to your contributions, as well as in the
normal course of software development. We also store records of your
CLA agreements. Under GDPR legislation, we do this
on the basis of our legitimate interest in creating the QL product.
on the basis of our legitimate interest in creating the CodeQL product.
Please do get in touch (privacy@semmle.com) if you have any questions about
Please do get in touch (privacy@github.com) if you have any questions about
this or our data protection policies.
## Contributor License Agreement
This Contributor License Agreement (“Agreement”) is entered into between Semmle Limited (“Semmle,” “we” or “us” etc.), and You (as defined and further identified below).
Accordingly, You hereby agree to the following terms for Your present and future Contributions submitted to Semmle:
1. **Definitions**.
* "You" (or "Your") shall mean the Contribution copyright owner (whether an individual or organization) or legal entity authorized by the copyright owner that is making this Agreement with Semmle. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
* "Contribution(s)" shall mean the code, documentation or other original works of authorship, including any modifications or additions to an existing work, submitted by You to Semmle for inclusion in, or documentation of, any of the products or projects owned or managed by Semmle (the "Work(s)"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Semmle or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Semmle for the purpose of discussing and/or improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
2. **Grant of Copyright License**. You hereby grant to Semmle and to recipients of software distributed by Semmle a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
3. **Grant of Patent License**. You hereby grant to Semmle and to recipients of software distributed by Semmle a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that Your Contribution, or the Work to which You have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
4. **Ownership**. Except as set out above, You keep all right, title, and interest in Your Contribution. The rights that You grant to us under this Agreement are effective on the date You first submitted a Contribution to us, even if Your submission took place before the date You entered this Agreement.
5. **Representations**. You represent and warrant that: (i) the Contributions are an original work and that You can legally grant the rights set out in this Agreement; (ii) the Contributions and Semmles exercise of any license rights granted hereunder, does not and will not, infringe the rights of any third party; (iii) You are not aware of any pending or threatened claims, suits, actions, or charges pertaining to the Contributions, including without limitation any claims or allegations that any or all of the Contributions infringes, violates, or misappropriate the intellectual property rights of any third party (You further agree that You will notify Semmle immediately if You become aware of any such actual or potential claims, suits, actions, allegations or charges).
6. **Employer**. If Your employer(s) has rights to intellectual property that You create that includes Your Contributions, You represent and warrant that Your employer has waived such rights for Your Contributions to Semmle, or that You have received permission to make Contributions on behalf of that employer and that You are authorized to execute this Agreement on behalf of Your employer.
7. **Inclusion of Code**. We determine the code that is in our Works. You understand that the decision to include the Contribution in any project or source repository is entirely that of Semmle, and this agreement does not guarantee that the Contributions will be included in any product.
8. **Disclaimer**. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Except as set forth herein, and unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
9. **General**. The failure of either party to enforce its rights under this Agreement for any period shall not be construed as a waiver of such rights. No changes or modifications or waivers to this Agreement will be effective unless in writing and signed by both parties. In the event that any provision of this Agreement shall be determined to be illegal or unenforceable, that provision will be limited or eliminated to the minimum extent necessary so that this Agreement shall otherwise remain in full force and effect and enforceable. This Agreement shall be governed by and construed in accordance with the laws of the State of California in the United States without regard to the conflicts of laws provisions thereof. In any action or proceeding to enforce rights under this Agreement, the prevailing party will be entitled to recover costs and attorneys fees.

View File

@@ -1,13 +0,0 @@
Copyright (c) Semmle Inc and other contributors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.

189
LICENSE
View File

@@ -1,176 +1,21 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
MIT License
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Copyright (c) 2006-2020 GitHub, Inc.
1. Definitions.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,16 +1,16 @@
# Semmle QL
# CodeQL
This open source repository contains the standard QL libraries and queries that power [LGTM](https://lgtm.com), and the other products that [Semmle](https://semmle.com) makes available to its customers worldwide.
This open source repository contains the standard CodeQL libraries and queries that power [LGTM](https://lgtm.com) and the other CodeQL products that [GitHub](https://github.com) makes available to its customers worldwide.
## How do I learn QL and run queries?
## How do I learn CodeQL and run queries?
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.
There is [extensive documentation](https://help.semmle.com/QL/learn-ql/) on getting started with writing CodeQL.
You can use the [interactive query console](https://lgtm.com/help/lgtm/using-query-console) on LGTM.com or the [CodeQL for Visual Studio Code](https://help.semmle.com/codeql/codeql-for-vscode.html) extension to try out your queries on any open source project that's currently being analyzed.
## Contributing
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md). You can also consult our [style guides](https://github.com/Semmle/ql/tree/master/docs) to learn how to format your QL for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
We welcome contributions to our standard library and standard checks. Do you have an idea for a new check, or how to improve an existing query? Then please go ahead and open a pull request! Before you do, though, please take the time to read our [contributing guidelines](CONTRIBUTING.md). You can also consult our [style guides](https://github.com/Semmle/ql/tree/master/docs) to learn how to format your code for consistency and clarity, how to write query metadata, and how to write query help documentation for your query.
## License
The QL queries in this repository are licensed under [Apache License 2.0](LICENSE) by [Semmle](https://semmle.com).
The code in this repository is licensed under the [MIT License](LICENSE) by [GitHub](https://github.com).

View File

@@ -36,6 +36,7 @@
| Shift out of range (`js/shift-out-of-range`| Fewer false positive results | This rule now correctly handles BigInt shift operands. |
| Superfluous trailing arguments (`js/superfluous-trailing-arguments`) | Fewer false-positive results. | This rule no longer flags calls to placeholder functions that trivially throw an exception. |
| Undocumented parameter (`js/jsdoc/missing-parameter`) | No changes to results | This rule is now run on LGTM, although its results are still not shown by default. |
| Missing space in string concatenation (`js/missing-space-in-concatenation`) | Fewer false positive results | The rule now requires a word-like part exists in the string concatenation. |
## Changes to QL libraries

View File

@@ -0,0 +1,66 @@
# Improvements to C/C++ analysis
The following changes in version 1.23 affect C/C++ analysis in all applications.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | reliability, japanese-era | This query is a combination of two old queries that were identical in purpose but separate as an implementation detail. This new query replaces Hard-coded Japanese era start date in call (`cpp/japanese-era/constructor-or-method-with-exact-era-date`) and Hard-coded Japanese era start date in struct (`cpp/japanese-era/struct-with-exact-era-date`). Results are not shown on LGTM by default. |
| Pointer overflow check (`cpp/pointer-overflow-check`) | correctness, security | Finds overflow checks that rely on pointer addition to overflow, which has undefined behavior. Example: `ptr + a < ptr`. Results are shown on LGTM by default. |
| Signed overflow check (`cpp/signed-overflow-check`) | correctness, security | Finds overflow checks that rely on signed integer addition to overflow, which has undefined behavior. Example: `a + b < a`. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Comparison of narrow type with wide type in loop condition (`cpp/comparison-with-wider-type`) | Higher precision | The precision of this query has been increased to "high" as the alerts from this query have proved to be valuable on real-world projects. With this precision, results are now displayed by default in LGTM. |
| Hard-coded Japanese era start date in call (`cpp/japanese-era/constructor-or-method-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
| Hard-coded Japanese era start date in struct (`cpp/japanese-era/struct-with-exact-era-date`) | Deprecated | This query has been deprecated. Use the new combined query Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) instead. |
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | More correct results | This query now checks for the beginning date of the Reiwa era (1st May 2019). |
| Non-constant format string (`cpp/non-constant-format`) | Fewer false positive results | Fixed false positive results triggrered by mismatching declarations of a formatting function. |
| Sign check of bitwise operation (`cpp/bitwise-sign-check`) | Fewer false positive results | Results involving `>=` or `<=` are no longer reported. |
| Too few arguments to formatting function (`cpp/wrong-number-format-arguments`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |
| Too many arguments to formatting function (`cpp/too-many-format-arguments`) | Fewer false positive results | Fixed false positive results triggered by mismatching declarations of a formatting function. |
| Unclear comparison precedence (`cpp/comparison-precedence`) | Fewer false positive results | False positive results involving template classes and functions have been fixed. |
| Wrong type of arguments to formatting function (`cpp/wrong-type-format-argument`) | More correct results and fewer false positive results | This query now understands explicitly-specified argument numbers in format strings, such as the `1$` in `%1$s`. |
## Changes to libraries
* The data-flow library in `semmle.code.cpp.dataflow.DataFlow` and
`semmle.code.cpp.dataflow.TaintTracking` have had extensive changes:
* Data flow through fields is now more complete and reliable.
* The data-flow library has been extended with a new feature to aid debugging.
Previously, to explore the possible flow from all sources you could specify `isSink(Node n) { any() }` on a configuration.
Now you can use the new `Configuration::hasPartialFlow` predicate,
which gives a more complete picture of the partial flow paths from a given source, including flow that doesn't reach any sink.
The feature is disabled by default and can be enabled for individual configurations by overriding `int explorationLimit()`.
* There is now flow out of C++ reference parameters.
* There is now flow through the address-of operator (`&`).
* The `DataFlow::DefinitionByReferenceNode` class now considers `f(x)` to be a
definition of `x` when `x` is a variable of pointer type. It no longer
considers deep paths such as `f(&x.myField)` to be definitions of `x`. These
changes are in line with the user expectations we've observed.
* It's now easier to specify barriers/sanitizers
arising from guards by overriding the predicate
`isBarrierGuard`/`isSanitizerGuard` on data-flow and taint-tracking
configurations respectively.
* There is now a `DataFlow::localExprFlow` predicate and a
`TaintTracking::localExprTaint` predicate to make it easy to use the most
common case of local data flow and taint: from one `Expr` to another.
* The member predicates of the `FunctionInput` and `FunctionOutput` classes have been renamed for
clarity (for example, `isOutReturnPointer()` to `isReturnValueDeref()`). The existing member predicates
have been deprecated, and will be removed in a future release. Code that uses the old member
predicates should be updated to use the corresponding new member predicate.
* The predicate `Declaration.hasGlobalOrStdName` has been added, making it
easier to recognize C library functions called from C++.
* The control-flow graph is now computed in QL, not in the extractor. This can
lead to changes in how queries are optimized because
optimization in QL relies on static size estimates, and the control-flow edge
relations will now have different size estimates than before.
* Support has been added for non-type template arguments. This means that the
return type of `Declaration::getTemplateArgument()` and
`Declaration::getATemplateArgument` have changed to `Locatable`. For details, see the
CodeQL library documentation for `Declaration::getTemplateArgument()` and
`Declaration::getTemplateArgumentKind()`.

View File

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

View File

@@ -0,0 +1,29 @@
# Improvements to Java analysis
The following changes in version 1.23 affect Java analysis in all applications.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Continue statement that does not continue (`java/continue-in-false-loop`) | correctness | Finds `continue` statements in `do { ... } while (false)` loops. Results are shown on LGTM by default. |
| Disabled Netty HTTP header validation (`java/netty-http-response-splitting`) | security, external/cwe/cwe-113 | Finds response-splitting vulnerabilities due to Netty HTTP header validation being disabled. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Dereferenced variable may be null (`java/dereferenced-value-may-be-null`) | Fewer false positive results | Additional indirect null guards are detected, where two auxiliary variables are known to be equal. |
| Non-synchronized override of synchronized method (`java/non-sync-override`) | Fewer false positive results | Results are now only reported if the immediately overridden method is synchronized. |
| Query built from local-user-controlled sources (`java/sql-injection-local`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as sinks for SQL expressions. |
| Query built from user-controlled sources (`java/sql-injection`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as sinks for SQL expressions. |
| Query built without neutralizing special characters (`java/concatenated-sql-query`) | More results | The query now identifies arguments to `Statement.executeLargeUpdate` and `Connection.prepareCall` as sinks for SQL expressions. |
| Useless comparison test (`java/constant-comparison`) | Fewer false positive results | Additional overflow check patterns are now recognized and no longer reported. Also, a few bug fixes in the range analysis for floating-point variables gives a further reduction in false positive results. |
## Changes to libraries
The data-flow library has been extended with a new feature to aid debugging.
Previously, to explore the possible flow from all sources you could specify `isSink(Node n) { any() }` on a configuration.
Now you can use the new `Configuration::hasPartialFlow` predicate,
which gives a more complete picture of the partial flow paths from a given source, including flow that doesn't reach any sink.
The feature is disabled by default and can be enabled for individual configurations by overriding `int explorationLimit()`.

View File

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

View File

@@ -0,0 +1,52 @@
# Improvements to Python analysis
## General improvements
### Python 3.8 support
Python 3.8 syntax is now supported. In particular, the following constructs are parsed correctly:
- Assignment expressions using the "walrus" operator, such as `while chunk := file.read(1024): ...`.
- The positional argument separator `/`, such as in `def foo(a, /, b, *, c): ...`.
- Self-documenting expressions in f-strings, such as `f"{var=}"`.
### General query improvements
Following the replacement of the `Object` API (for example, `ClassObject`) in favor of the
`Value` API (for example, `ClassValue`) in the 1.21 release, many of the standard queries have been updated
to use the `Value` API. This should result in more precise results.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------|----------|-------------|
| Clear-text logging of sensitive information (`py/clear-text-logging-sensitive-data`) | security, external/cwe/cwe-312 | Finds instances where sensitive information is logged without encryption or hashing. Results are shown on LGTM by default. |
| Clear-text storage of sensitive information (`py/clear-text-storage-sensitive-data`) | security, external/cwe/cwe-312 | Finds instances where sensitive information is stored without encryption or hashing. Results are shown on LGTM by default. |
| Binding a socket to all network interfaces (`py/bind-socket-all-network-interfaces`) | security | Finds instances where a socket is bound to all network interfaces. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------|
| Explicit export is undefined (`py/undefined-export`) | Fewer false positive results | Instances where an exported value may be defined in a module that lacks points-to information are no longer flagged. |
| Module-level cyclic import (`py/unsafe-cyclic-import`) | Fewer false positive results | Instances where one of the links in an import cycle is never actually executed are no longer flagged. |
| Non-iterable used in for loop (`py/non-iterable-in-for-loop`) | Fewer false positive results | `__aiter__` is now recognized as an iterator method. |
| Unreachable code (`py/unreachable-statement`) | Fewer false positive results | Analysis now accounts for uses of `contextlib.suppress` to suppress exceptions. |
| Unreachable code (`py/unreachable-statement`) | Fewer false positive results | Unreachable `else` branches that do nothing but `assert` their non-reachability are no longer flagged. |
| Unused import (`py/unused-import`) | Fewer false positive results | Instances where a module is used in a forward-referenced type annotation, or only during type checking are no longer flagged. |
| `__iter__` method returns a non-iterator (`py/iter-returns-non-iterator`) | Better alert message | Alert now highlights which class is expected to be an iterator. |
| `__init__` method returns a value (`py/explicit-return-in-init`) | Fewer false positive results | Instances where the `__init__` method returns the value of a call to a procedure are no longer flagged. |
## Changes to QL libraries
* Django library now recognizes positional arguments from a `django.conf.urls.url` regex (Django version 1.x)
* Instances of the `Value` class now support the `isAbsent` method, indicating
whether that `Value` lacks points-to information, but inference
suggests that it exists. For instance, if a file contains `import
django`, but `django` was not extracted properly, there will be a
`ModuleValue` corresponding to this "unknown" module, and the `isAbsent`
method will hold for this `ModuleValue`.
* The `Expr` class now has a nullary method `pointsTo` that returns the possible
instances of `Value` that this expression may have.

View File

@@ -0,0 +1,23 @@
[[ condition: enterprise-only ]]
# Improvements to JavaScript analysis
## Changes to code extraction
* Asynchronous generator methods are now parsed correctly and no longer cause a spurious syntax error.
* Files in `node_modules` and `bower_components` folders are no longer extracted by default. If you still want to extract files from these folders, you can add the following filters to your `lgtm.yml` file (or add them to existing filters):
```yaml
extraction:
javascript:
index:
filters:
- include: "**/node_modules"
- include: "**/bower_components"
```
* Additional [Flow](https://flow.org/) syntax is now supported.
* Recognition of CommonJS modules has improved. As a result, some files that were previously extracted as
global scripts are now extracted as modules.
* Top-level `await` is now supported.
* Bugs were fixed in how the TypeScript extractor handles default-exported anonymous classes and computed-instance field names.

View File

@@ -0,0 +1,58 @@
# Improvements to C/C++ analysis
The following changes in version 1.24 affect C/C++ analysis in all applications.
## General improvements
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Implicit function declarations (`cpp/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql`) | correctness, maintainability | This query finds calls to undeclared functions that are compiled by a C compiler. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Buffer not sufficient for string (`cpp/overflow-calculated`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
| No space for zero terminator (`cpp/no-space-for-terminator`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
| Memory is never freed (`cpp/memory-never-freed`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
| Memory may not be freed (`cpp/memory-may-not-be-freed`) | More true positive results | This query now identifies a wider variety of buffer allocations using the `semmle.code.cpp.models.interfaces.Allocation` library. |
| Mismatching new/free or malloc/delete (`cpp/new-free-mismatch`) | Fewer false positive results | Fixed false positive results in template code. |
| Missing return statement (`cpp/missing-return`) | Fewer false positive results | Functions containing `asm` statements are no longer highlighted by this query. |
| Missing return statement (`cpp/missing-return`) | More accurate locations | Locations reported by this query are now more accurate in some cases. |
| No space for zero terminator (`cpp/no-space-for-terminator`) | More correct results | String arguments to formatting functions are now (usually) expected to be null terminated strings. |
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | | This query is no longer run on LGTM. |
| No space for zero terminator (`cpp/no-space-for-terminator`) | Fewer false positive results | This query has been modified to be more conservative when identifying which pointers point to null-terminated strings. This approach produces fewer, more accurate results. |
| Overflow in uncontrolled allocation size (`cpp/uncontrolled-allocation-size`) | Fewer false positive results | Cases where the tainted allocation size is range checked are now more reliably excluded. |
| Overflow in uncontrolled allocation size (`cpp/uncontrolled-allocation-size`) | Fewer false positive results | The query now produces fewer, more accurate results. |
| Overloaded assignment does not return 'this' (`cpp/assignment-does-not-return-this`) | Fewer false positive results | This query no longer reports incorrect results in template classes. |
| Unsafe array for days of the year (`cpp/leap-year/unsafe-array-for-days-of-the-year`) | | This query is no longer run on LGTM. |
| Unsigned comparison to zero (`cpp/unsigned-comparison-zero`) | More correct results | This query now also looks for comparisons of the form `0 <= x`. |
## Changes to libraries
* The data-flow library has been improved, which affects and improves some security queries. The improvements are:
- Track flow through functions that combine taint tracking with flow through fields.
- Track flow through clone-like functions, that is, functions that read contents of a field from a
parameter and stores the value in the field of a returned object.
* Created the `semmle.code.cpp.models.interfaces.Allocation` library to model allocation such as `new` expressions and calls to `malloc`. This in intended to replace the functionality in `semmle.code.cpp.commons.Alloc` with a more consistent and useful interface.
* Created the `semmle.code.cpp.models.interfaces.Deallocation` library to model deallocation such as `delete` expressions and calls to `free`. This in intended to replace the functionality in `semmle.code.cpp.commons.Alloc` with a more consistent and useful interface.
* The new class `StackVariable` should be used in place of `LocalScopeVariable`
in most cases. The difference is that `StackVariable` does not include
variables declared with `static` or `thread_local`.
* As a rule of thumb, custom queries about the _values_ of variables should
be changed from `LocalScopeVariable` to `StackVariable`, while queries
about the _name or scope_ of variables should remain unchanged.
* The `LocalScopeVariableReachability` library is deprecated in favor of
`StackVariableReachability`. The functionality is the same.
* The models library models `strlen` in more detail, and includes common variations such as `wcslen`.
* The models library models `gets` and similar functions.
* The models library now partially models `std::string`.
* The taint tracking library (`semmle.code.cpp.dataflow.TaintTracking`) has had
the following improvements:
* The library now models data flow through `strdup` and similar functions.
* The library now models data flow through formatting functions such as `sprintf`.
* The security pack taint tracking library (`semmle.code.cpp.security.TaintTracking`) uses a new intermediate representation. This provides a more precise analysis of pointers to stack variables and flow through parameters, improving the results of many security queries.
* The global value numbering library (`semmle.code.cpp.valuenumbering.GlobalValueNumbering`) uses a new intermediate representation to provide a more precise analysis of heap allocated memory and pointers to stack variables.
* `freeCall` in `semmle.code.cpp.commons.Alloc` has been deprecated. The`Allocation` and `Deallocation` models in `semmle.code.cpp.models.interfaces` should be used instead.

View File

@@ -0,0 +1,49 @@
# Improvements to C# analysis
The following changes in version 1.24 affect C# analysis in all applications.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Assembly path injection (`cs/assembly-path-injection`) | security, external/cwe/cwe-114 | Finds user-controlled data used to load an assembly. |
| Insecure configuration for ASP.NET requestValidationMode (`cs/insecure-request-validation-mode`) | security, external/cwe/cwe-016 | Finds where this attribute has been set to a value less than 4.5, which turns off some validation features and makes the application less secure. |
| Insecure SQL connection (`cs/insecure-sql-connection`) | security, external/cwe/cwe-327 | Finds unencrypted SQL connection strings. |
| Page request validation is disabled (`cs/web/request-validation-disabled`) | security, frameworks/asp.net, external/cwe/cwe-016 | Finds where ASP.NET page request validation has been disabled, which could make the application less secure. |
| Serialization check bypass (`cs/serialization-check-bypass`) | security, external/cwe/cwe-20 | Finds where data is not validated in a deserialization method. |
| XML injection (`cs/xml-injection`) | security, external/cwe/cwe-091 | Finds user-controlled data that is used to write directly to an XML document. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Useless assignment to local variable (`cs/useless-assignment-to-local`) | Fewer false positive results | Results have been removed when the variable is named `_` in a `foreach` statement. |
| Potentially dangerous use of non-short-circuit logic (`cs/non-short-circuit`) | Fewer false positive results | Results have been removed when the expression contains an `out` parameter. |
| Dereferenced variable may be null (`cs/dereferenced-value-may-be-null`) | More results | Results are reported from parameters with a default value of `null`. |
| Useless assignment to local variable (`cs/useless-assignment-to-local`) | Fewer false positive results | Results have been removed when the value assigned is an (implicitly or explicitly) cast default-like value. For example, `var s = (string)null` and `string s = default`. |
| XPath injection (`cs/xml/xpath-injection`) | More results | The query now recognizes calls to methods on `System.Xml.XPath.XPathNavigator` objects. |
| Information exposure through transmitted data (`cs/sensitive-data-transmission`) | More results | The query now recognizes writes to cookies and writes to ASP.NET (`Inner`)`Text` properties as additional sinks. |
| Information exposure through an exception (`cs/information-exposure-through-exception`) | More results | The query now recognizes writes to cookies, writes to ASP.NET (`Inner`)`Text` properties, and email contents as additional sinks. |
## Removal of old queries
## Changes to code extraction
* Tuple expressions, for example `(int,bool)` in `default((int,bool))` are now extracted correctly.
* Expression nullability flow state is extracted.
* Implicitly typed `stackalloc` expressions are now extracted correctly.
* The difference between `stackalloc` array creations and normal array creations is extracted.
## Changes to libraries
* The data-flow library has been improved, which affects and improves most security queries. The improvements are:
- Track flow through methods that combine taint tracking with flow through fields.
- Track flow through clone-like methods, that is, methods that read contents of a field from a
parameter and stores the value in the field of a returned object.
* The taint tracking library now tracks flow through (implicit or explicit) conversion operator calls.
* [Code contracts](https://docs.microsoft.com/en-us/dotnet/framework/debug-trace-profile/code-contracts) are now recognized, and are treated like any other assertion methods.
* Expression nullability flow state is given by the predicates `Expr.hasNotNullFlowState()` and `Expr.hasMaybeNullFlowState()`.
* `stackalloc` array creations are now represented by the QL class `Stackalloc`. Previously they were represented by the class `ArrayCreation`.
* A new class `RemoteFlowSink` has been added to model sinks where data might be exposed to external users. Examples include web page output, e-mails, and cookies.
## Changes to autobuilder

View File

@@ -0,0 +1,43 @@
# Improvements to Java analysis
The following changes in version 1.24 affect Java analysis in all applications.
## General improvements
* Alert suppression can now be done with single-line block comments (`/* ... */`) as well as line comments (`// ...`).
* A `Customizations.qll` file has been added to allow customizations of the standard library that apply to all queries.
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Disabled Spring CSRF protection (`java/spring-disabled-csrf-protection`) | security, external/cwe/cwe-352 | Finds disabled Cross-Site Request Forgery (CSRF) protection in Spring. Results are shown on LGTM by default. |
| Failure to use HTTPS or SFTP URL in Maven artifact upload/download (`java/maven/non-https-url`) | security, external/cwe/cwe-300, external/cwe/cwe-319, external/cwe/cwe-494, external/cwe/cwe-829 | Finds use of insecure protocols during Maven dependency resolution. Results are shown on LGTM by default. |
| LDAP query built from user-controlled sources (`java/ldap-injection`) | security, external/cwe/cwe-090 | Finds LDAP queries vulnerable to injection of unsanitized user-controlled input. Results are shown on LGTM by default. |
| Left shift by more than the type width (`java/lshift-larger-than-type-width`) | correctness | Finds left shifts of ints by 32 bits or more and left shifts of longs by 64 bits or more. Results are shown on LGTM by default. |
| Suspicious date format (`java/suspicious-date-format`) | correctness | Finds date format patterns that use placeholders that are likely to be incorrect. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|------------------------------|------------------------|-----------------------------------|
| Dereferenced variable may be null (`java/dereferenced-value-may-be-null`) | Fewer false positives | Final fields with a non-null initializer are no longer reported. |
| Expression always evaluates to the same value (`java/evaluation-to-constant`) | Fewer false positives | Expressions of the form `0 * x` are usually intended and no longer reported. Also left shift of ints by 32 bits and longs by 64 bits are no longer reported as they are not constant, these results are instead reported by the new query `java/lshift-larger-than-type-width`. |
| Useless null check (`java/useless-null-check`) | More true positives | Useless checks on final fields with a non-null initializer are now reported. |
## Changes to libraries
* The data-flow library has been improved, which affects and improves most security queries. The improvements are:
- Track flow through methods that combine taint tracking with flow through fields.
- Track flow through clone-like methods, that is, methods that read contents of a field from a
parameter and stores the value in the field of a returned object.
* Identification of test classes has been improved. Previously, one of the
match conditions would classify any class with a name containing the string
"Test" as a test class, but now this matching has been replaced with one that
looks for the occurrence of actual unit-test annotations. This affects the
general file classification mechanism and thus suppression of alerts, and
also any security queries using taint tracking, as test classes act as
default barriers stopping taint flow.
* Parentheses are now no longer modelled directly in the AST, that is, the
`ParExpr` class is empty. Instead, a parenthesized expression can be
identified with the `Expr.isParenthesized()` member predicate.

View File

@@ -0,0 +1,99 @@
# Improvements to JavaScript analysis
## General improvements
* TypeScript 3.8 is now supported.
* Alert suppression can now be done with single-line block comments (`/* ... */`) as well as line comments (`// ...`).
* Resolution of imports has improved, leading to more results from the security queries:
- Imports with the `.js` extension can now be resolved to a TypeScript file,
when the import refers to a file generated by TypeScript.
- Imports that rely on path-mappings from a `tsconfig.json` file can now be resolved.
- Export declarations of the form `export * as ns from "x"` are now analyzed more precisely.
* The analysis of sanitizers has improved, leading to more accurate results from the security queries.
In particular:
- Sanitizer guards now act across function boundaries in more cases.
- Sanitizers can now better distinguish between a tainted value and an object _containing_ a tainted value.
* Call graph construction has been improved, leading to more results from the security queries:
- Calls can now be resolved to indirectly-defined class members in more cases.
- Calls through partial invocations such as `.bind` can now be resolved in more cases.
* Support for flow summaries has been more clearly marked as being experimental and moved to the new `experimental` folder.
* Support for the following frameworks and libraries has been improved:
- [Electron](https://electronjs.org/)
- [fstream](https://www.npmjs.com/package/fstream)
- [Handlebars](https://www.npmjs.com/package/handlebars)
- [jsonfile](https://www.npmjs.com/package/jsonfile)
- [Koa](https://www.npmjs.com/package/koa)
- [Node.js](https://nodejs.org/)
- [Socket.IO](https://socket.io/)
- [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)
- [chrome-remote-interface](https://www.npmjs.com/package/chrome-remote-interface)
- [for-in](https://www.npmjs.com/package/for-in)
- [for-own](https://www.npmjs.com/package/for-own)
- [http2](https://nodejs.org/api/http2.html)
- [jQuery](https://jquery.com/)
- [lazy-cache](https://www.npmjs.com/package/lazy-cache)
- [mongodb](https://www.npmjs.com/package/mongodb)
- [ncp](https://www.npmjs.com/package/ncp)
- [node-dir](https://www.npmjs.com/package/node-dir)
- [path-exists](https://www.npmjs.com/package/path-exists)
- [pg](https://www.npmjs.com/package/pg)
- [react](https://www.npmjs.com/package/react)
- [recursive-readdir](https://www.npmjs.com/package/recursive-readdir)
- [request](https://www.npmjs.com/package/request)
- [rimraf](https://www.npmjs.com/package/rimraf)
- [send](https://www.npmjs.com/package/send)
- [SockJS](https://www.npmjs.com/package/sockjs)
- [SockJS-client](https://www.npmjs.com/package/sockjs-client)
- [typeahead.js](https://www.npmjs.com/package/typeahead.js)
- [vinyl-fs](https://www.npmjs.com/package/vinyl-fs)
- [write-file-atomic](https://www.npmjs.com/package/write-file-atomic)
- [ws](https://github.com/websockets/ws)
## New queries
| **Query** | **Tags** | **Purpose** |
|---------------------------------------------------------------------------------|-------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Cross-site scripting through exception (`js/xss-through-exception`) | security, external/cwe/cwe-079, external/cwe/cwe-116 | Highlights potential XSS vulnerabilities where an exception is written to the DOM. Results are not shown on LGTM by default. |
| Regular expression always matches (`js/regex/always-matches`) | correctness, regular-expressions | Highlights regular expression checks that trivially succeed by matching an empty substring. Results are shown on LGTM by default. |
| Missing await (`js/missing-await`) | correctness | Highlights expressions that operate directly on a promise object in a nonsensical way, instead of awaiting its result. Results are shown on LGTM by default. |
| Polynomial regular expression used on uncontrolled data (`js/polynomial-redos`) | security, external/cwe/cwe-730, external/cwe/cwe-400 | Highlights expensive regular expressions that may be used on malicious input. Results are shown on LGTM by default. |
| Prototype pollution in utility function (`js/prototype-pollution-utility`) | security, external/cwe/cwe-400, external/cwe/cwe-471 | Highlights recursive assignment operations that are susceptible to prototype pollution. Results are shown on LGTM by default. |
| Unsafe jQuery plugin (`js/unsafe-jquery-plugin`) | Highlights potential XSS vulnerabilities in unsafely designed jQuery plugins. Results are shown on LGTM by default. |
| Unnecessary use of `cat` process (`js/unnecessary-use-of-cat`) | correctness, security, maintainability | Highlights command executions of `cat` where the fs API should be used instead. Results are shown on LGTM by default. |
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
| Clear-text logging of sensitive information (`js/clear-text-logging`) | More results | More results involving `process.env` and indirect calls to logging methods are recognized. |
| Duplicate parameter names (`js/duplicate-parameter-name`) | Fewer results | This query now recognizes additional parameters that reasonably can have duplicated names. |
| Incomplete string escaping or encoding (`js/incomplete-sanitization`) | Fewer false positive results | This query now recognizes additional cases where a single replacement is likely to be intentional. |
| Unbound event handler receiver (`js/unbound-event-handler-receiver`) | Fewer false positive results | This query now recognizes additional ways event handler receivers can be bound. |
| Expression has no effect (`js/useless-expression`) | Fewer false positive results | The query now recognizes block-level flow type annotations and ignores the first statement of a try block. |
| Use of call stack introspection in strict mode (`js/strict-mode-call-stack-introspection`) | Fewer false positive results | The query no longer flags expression statements. |
| Missing CSRF middleware (`js/missing-token-validation`) | Fewer false positive results | The query reports fewer duplicates and only flags handlers that explicitly access cookie data. |
| Uncontrolled data used in path expression (`js/path-injection`) | More results | This query now recognizes additional ways dangerous paths can be constructed and used. |
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now recognizes additional ways of constructing arguments to `cmd.exe` and `/bin/sh`. |
| Syntax error (`js/syntax-error`) | Lower severity | This results of this query are now displayed with lower severity. |
| Use of password hash with insufficient computational effort (`js/insufficient-password-hash`) | Fewer false positive results | This query now recognizes additional cases that do not require secure hashing. |
| Useless regular-expression character escape (`js/useless-regexp-character-escape`) | Fewer false positive results | This query now distinguishes escapes in strings and regular expression literals. |
| Identical operands (`js/redundant-operation`) | Fewer results | This query now recognizes cases where the operands change a value using ++/-- expressions. |
| Superfluous trailing arguments (`js/superfluous-trailing-arguments`) | Fewer results | This query now recognizes cases where a function uses the `Function.arguments` value to process a variable number of parameters. |
| Incomplete URL scheme check (`js/incomplete-url-scheme-check`) | More results | This query now recognizes more variations of URL scheme checks. |
## Changes to libraries
* The predicates `RegExpTerm.getSuccessor` and `RegExpTerm.getPredecessor` have been changed to reflect textual, not operational, matching order. This only makes a difference in lookbehind assertions, which are operationally matched backwards. Previously, `getSuccessor` would mimick this, so in an assertion `(?<=ab)` the term `b` would be considered the predecessor, not the successor, of `a`. Textually, however, `a` is still matched before `b`, and this is the order we now follow.
* An extensible model of the `EventEmitter` pattern has been implemented.
* Taint-tracking configurations now interact differently with the `data` flow label, which may affect queries
that combine taint-tracking and flow labels.
- Sources added by the 1-argument `isSource` predicate are associated with the `taint` label now, instead of the `data` label.
- Sanitizers now only block the `taint` label. As a result, sanitizers no longer block the flow of tainted values wrapped inside a property of an object.
To retain the old behavior, instead use a barrier, or block the `data` flow label using a labeled sanitizer.

View File

@@ -0,0 +1,40 @@
# Improvements to Python analysis
The following changes in version 1.24 affect Python analysis in all applications.
## General improvements
Support for Django version 2.x and 3.x
## New queries
| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
## Changes to existing queries
| **Query** | **Expected impact** | **Change** |
|----------------------------|------------------------|------------------------------------------------------------------|
| Uncontrolled command line (`py/command-line-injection`) | More results | We now model the `fabric` and `invoke` pacakges for command execution. |
### Web framework support
The QL-library support for the web frameworks Bottle, CherryPy, Falcon, Pyramid, TurboGears, Tornado, and Twisted have
been fixed so they provide a proper HttpRequestTaintSource, instead of a TaintSource. This will enable results for the following queries:
- py/path-injection
- py/command-line-injection
- py/reflective-xss
- py/sql-injection
- py/code-injection
- py/unsafe-deserialization
- py/url-redirection
The QL-library support for the web framework Twisted have been fixed so they provide a proper
HttpResponseTaintSink, instead of a TaintSink. This will enable results for the following
queries:
- py/reflective-xss
- py/stack-trace-exposure
## Changes to libraries

View File

@@ -0,0 +1,7 @@
[[ condition: enterprise-only ]]
# Improvements to JavaScript analysis
## Changes to code extraction
* `import.meta` expressions no longer result in a syntax error in JavaScript files.

View File

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

View File

@@ -9,6 +9,7 @@
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll",
@@ -28,6 +29,8 @@
"TaintTracking::Configuration Java/C++/C#": [
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
@@ -36,45 +39,128 @@
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
"java/ql/src/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll"
],
"DataFlow Java/C++/C# Consistency checks": [
"java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll",
"cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
"csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll"
],
"C++ SubBasicBlocks": [
"cpp/ql/src/semmle/code/cpp/controlflow/SubBasicBlocks.qll",
"cpp/ql/src/semmle/code/cpp/dataflow/internal/SubBasicBlocks.qll"
],
"IR Instruction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/Instruction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/Instruction.qll"
],
"IR IRBlock": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRBlock.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRBlock.qll"
],
"IR IRVariable": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRVariable.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRVariable.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRVariable.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRVariable.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRVariable.qll"
],
"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"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRFunction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRFunction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRFunction.qll"
],
"IR Operand": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Operand.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Operand.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/Operand.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/Operand.qll"
],
"IR IRType": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/IRType.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/IRType.qll"
],
"IR IRConfiguration": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/IRConfiguration.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/IRConfiguration.qll"
],
"IR UseSoundEscapeAnalysis": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/UseSoundEscapeAnalysis.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/UseSoundEscapeAnalysis.qll"
],
"IR Operand Tag": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/OperandTag.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/internal/OperandTag.qll"
],
"IR TIRVariable":[
"cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TIRVariable.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/internal/TIRVariable.qll"
],
"IR IR": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IR.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IR.qll"
],
"IR IRSanity": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRSanity.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRSanity.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRSanity.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRSanity.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/IRSanity.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/IRSanity.qll"
],
"IR PrintIR": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/PrintIR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/PrintIR.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/PrintIR.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/PrintIR.qll"
],
"IR IntegerConstant": [
"cpp/ql/src/semmle/code/cpp/ir/internal/IntegerConstant.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/IntegerConstant.qll"
],
"IR IntegerInteval": [
"cpp/ql/src/semmle/code/cpp/ir/internal/IntegerInterval.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/IntegerInterval.qll"
],
"IR IntegerPartial": [
"cpp/ql/src/semmle/code/cpp/ir/internal/IntegerPartial.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/IntegerPartial.qll"
],
"IR Overlap": [
"cpp/ql/src/semmle/code/cpp/ir/internal/Overlap.qll",
"csharp/ql/src/semmle/code/csharp/ir/internal/Overlap.qll"
],
"IR EdgeKind": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/EdgeKind.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/EdgeKind.qll"
],
"IR MemoryAccessKind": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/MemoryAccessKind.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/MemoryAccessKind.qll"
],
"IR TempVariableTag": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/TempVariableTag.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/TempVariableTag.qll"
],
"IR Opcode": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/Opcode.qll"
],
"IR SSASanity": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSASanity.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSASanity.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/SSASanity.qll"
],
"C++ IR InstructionImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/InstructionImports.qll",
@@ -106,22 +192,62 @@
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/PrintIRImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintIRImports.qll"
],
"C++ SSA AliasAnalysis": [
"C++ SSA SSAConstructionImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstructionImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstructionImports.qll"
],
"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"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysis.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/AliasAnalysis.qll"
],
"C++ SSA SSAConstruction": [
"C++ SSA AliasAnalysisImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasAnalysisImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasAnalysisImports.qll"
],
"C++ IR ValueNumberingImports": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/gvn/internal/ValueNumberingImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/internal/ValueNumberingImports.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingImports.qll"
],
"IR SSA SimpleSSA": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SimpleSSA.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/SimpleSSA.qll"
],
"IR AliasConfiguration (unaliased_ssa)": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/AliasConfiguration.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/AliasConfiguration.qll"
],
"IR SSA SSAConstruction": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll"
],
"C++ SSA PrintSSA": [
"IR SSA PrintSSA": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/PrintSSA.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintSSA.qll"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/PrintSSA.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/PrintSSA.qll"
],
"IR ValueNumberInternal": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/gvn/internal/ValueNumberingInternal.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/internal/ValueNumberingInternal.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/internal/ValueNumberingInternal.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/gvn/internal/ValueNumberingInternal.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/gvn/internal/ValueNumberingInternal.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"
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/ValueNumbering.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/gvn/ValueNumbering.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/gvn/ValueNumbering.qll"
],
"C++ IR PrintValueNumbering": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/gvn/PrintValueNumbering.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/gvn/PrintValueNumbering.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/gvn/PrintValueNumbering.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/gvn/PrintValueNumbering.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/gvn/PrintValueNumbering.qll"
],
"C++ IR ConstantAnalysis": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/constant/ConstantAnalysis.qll",
@@ -148,5 +274,40 @@
"C++ IR PrintDominance": [
"cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/reachability/PrintDominance.qll",
"cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/reachability/PrintDominance.qll"
],
"C# IR InstructionImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/InstructionImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/InstructionImports.qll"
],
"C# IR IRImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/IRImports.qll"
],
"C# IR IRBlockImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRBlockImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/IRBlockImports.qll"
],
"C# IR IRVariableImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/IRVariableImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/IRVariableImports.qll"
],
"C# IR OperandImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/OperandImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/OperandImports.qll"
],
"C# IR PrintIRImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/PrintIRImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/internal/PrintIRImports.qll"
],
"C# IR ValueNumberingImports": [
"csharp/ql/src/semmle/code/csharp/ir/implementation/raw/gvn/internal/ValueNumberingImports.qll",
"csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/gvn/internal/ValueNumberingImports.qll"
],
"XML": [
"cpp/ql/src/semmle/code/cpp/XML.qll",
"csharp/ql/src/semmle/code/csharp/XML.qll",
"java/ql/src/semmle/code/xml/XML.qll",
"javascript/ql/src/semmle/javascript/XML.qll",
"python/ql/src/semmle/python/xml/XML.qll"
]
}

140
config/sync-files.py Normal file
View File

@@ -0,0 +1,140 @@
#!/usr/bin/env python3
# Due to various technical limitations, we sometimes have files that need to be
# kept identical in the repository. This script loads a database of such
# files and can perform two functions: check whether they are still identical,
# and overwrite the others with a master copy if needed.
import hashlib
import shutil
import os
import sys
import json
import re
path = os.path
file_groups = {}
def add_prefix(prefix, relative):
result = path.join(prefix, relative)
if path.commonprefix((path.realpath(result), path.realpath(prefix))) != \
path.realpath(prefix):
raise Exception("Path {} is not below {}".format(
result, prefix))
return result
def load_if_exists(prefix, json_file_relative):
json_file_name = path.join(prefix, json_file_relative)
if path.isfile(json_file_name):
print("Loading file groups from", json_file_name)
with open(json_file_name, 'r', encoding='utf-8') as fp:
raw_groups = json.load(fp)
prefixed_groups = {
name: [
add_prefix(prefix, relative)
for relative in relatives
]
for name, relatives in raw_groups.items()
}
file_groups.update(prefixed_groups)
# Generates a list of C# test files that should be in sync
def csharp_test_files():
test_file_re = re.compile('.*(Bad|Good)[0-9]*\\.cs$')
csharp_doc_files = {
file:os.path.join(root, file)
for root, dirs, files in os.walk("csharp/ql/src")
for file in files
if test_file_re.match(file)
}
return {
"C# test '" + file + "'" : [os.path.join(root, file), csharp_doc_files[file]]
for root, dirs, files in os.walk("csharp/ql/test")
for file in files
if file in csharp_doc_files
}
def file_checksum(filename):
with open(filename, 'rb') as file_handle:
return hashlib.sha1(file_handle.read()).hexdigest()
def check_group(group_name, files, master_file_picker, emit_error):
checksums = {file_checksum(f) for f in files}
if len(checksums) == 1:
return
master_file = master_file_picker(files)
if master_file is None:
emit_error(__file__, 0,
"Files from group '"+ group_name +"' not in sync.")
emit_error(__file__, 0,
"Run this script with a file-name argument among the "
"following to overwrite the remaining files with the contents "
"of that file or run with the --latest switch to update each "
"group of files from the most recently modified file in the group.")
for filename in files:
emit_error(__file__, 0, " " + filename)
else:
print(" Syncing others from", master_file)
for filename in files:
if filename == master_file:
continue
print(" " + filename)
os.replace(filename, filename + '~')
shutil.copy(master_file, filename)
print(" Backups written with '~' appended to file names")
def chdir_repo_root():
root_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
os.chdir(root_path)
def choose_master_file(master_file, files):
if master_file in files:
return master_file
else:
return None
def choose_latest_file(files):
latest_time = None
latest_file = None
for filename in files:
file_time = os.path.getmtime(filename)
if (latest_time is None) or (latest_time < file_time):
latest_time = file_time
latest_file = filename
return latest_file
local_error_count = 0
def emit_local_error(path, line, error):
print('ERROR: ' + path + ':' + line + " - " + error)
global local_error_count
local_error_count += 1
# This function is invoked directly by a CI script, which passes a different error-handling
# callback.
def sync_identical_files(emit_error):
if len(sys.argv) == 1:
master_file_picker = lambda files: None
elif len(sys.argv) == 2:
if sys.argv[1] == "--latest":
master_file_picker = choose_latest_file
elif os.path.isfile(sys.argv[1]):
master_file_picker = lambda files: choose_master_file(sys.argv[1], files)
else:
raise Exception("File not found")
else:
raise Exception("Bad command line or file not found")
chdir_repo_root()
load_if_exists('.', 'config/identical-files.json')
file_groups.update(csharp_test_files())
for group_name, files in file_groups.items():
check_group(group_name, files, master_file_picker, emit_error)
def main():
sync_identical_files(emit_local_error)
if local_error_count > 0:
exit(1)
if __name__ == "__main__":
main()

View File

@@ -18,11 +18,14 @@
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/ExprHasNoEffect.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooFewArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooManyArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.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
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BitwiseSignCheck.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/SignedOverflowCheck.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/PointerOverflow.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/NestedLoopSameVar.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/UseInOwnInitializer.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Critical/NewArrayDeleteMismatch.ql: /Correctness/Common Errors

View File

@@ -19,11 +19,14 @@
+ semmlecode-cpp-queries/Likely Bugs/Likely Typos/ExprHasNoEffect.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooFewArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/TooManyArguments.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.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
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BitwiseSignCheck.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/SignedOverflowCheck.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/PointerOverflow.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/NestedLoopSameVar.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Likely Bugs/UseInOwnInitializer.ql: /Correctness/Common Errors
+ semmlecode-cpp-queries/Critical/NewArrayDeleteMismatch.ql: /Correctness/Common Errors

View File

@@ -10,70 +10,75 @@ import cpp
/**
* An alert suppression comment.
*/
class SuppressionComment extends CppStyleComment {
class SuppressionComment extends Comment {
string annotation;
string text;
SuppressionComment() {
text = getContents().suffix(2) and
( // match `lgtm[...]` anywhere in the comment
(
this instanceof CppStyleComment and
// strip the beginning slashes
text = getContents().suffix(2)
or
this instanceof CStyleComment and
// strip both the beginning /* and the end */ the comment
exists(string text0 |
text0 = getContents().suffix(2) and
text = text0.prefix(text0.length() - 2)
) and
// The /* */ comment must be a single-line comment
not text.matches("%\n%")
) and
(
// match `lgtm[...]` anywhere in the comment
annotation = text.regexpFind("(?i)\\blgtm\\s*\\[[^\\]]*\\]", _, _)
or
// match `lgtm` at the start of the comment and after semicolon
annotation = text.regexpFind("(?i)(?<=^|;)\\s*lgtm(?!\\B|\\s*\\[)", _, _)
.trim()
annotation = text.regexpFind("(?i)(?<=^|;)\\s*lgtm(?!\\B|\\s*\\[)", _, _).trim()
)
}
/** Gets the text in this comment, excluding the leading //. */
string getText() {
result = text
}
string getText() { result = text }
/** Gets the suppression annotation in this comment. */
string getAnnotation() {
result = annotation
}
string getAnnotation() { result = annotation }
/**
* Holds if this comment applies to the range from column `startcolumn` of line `startline`
* to column `endcolumn` of line `endline` in file `filepath`.
*/
* Holds if this comment applies to the range from column `startcolumn` of line `startline`
* to column `endcolumn` of line `endline` in file `filepath`.
*/
predicate covers(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
this.getLocation().hasLocationInfo(filepath, startline, _, endline, endcolumn) and
startcolumn = 1
}
/** Gets the scope of this suppression. */
SuppressionScope getScope() {
result = this
}
SuppressionScope getScope() { result = this }
}
/**
* The scope of an alert suppression comment.
*/
class SuppressionScope extends ElementBase {
SuppressionScope() {
this instanceof SuppressionComment
}
SuppressionScope() { this instanceof SuppressionComment }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
*/
predicate hasLocationInfo(string filepath, int startline, int startcolumn, int endline, int endcolumn) {
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
* column `endcolumn` of line `endline` in file `filepath`.
* For more information, see
* [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
*/
predicate hasLocationInfo(
string filepath, int startline, int startcolumn, int endline, int endcolumn
) {
this.(SuppressionComment).covers(filepath, startline, startcolumn, endline, endcolumn)
}
}
from SuppressionComment c
select c, // suppression comment
c.getText(), // text of suppression comment (excluding delimiters)
c.getAnnotation(), // text of suppression annotation
c.getScope() // scope of suppression
select c, // suppression comment
c.getText(), // text of suppression comment (excluding delimiters)
c.getAnnotation(), // text of suppression annotation
c.getScope() // scope of suppression

View File

@@ -3,7 +3,7 @@
* @description A function that uses more functions and variables from another file than functions and variables from its own file. This function might be better placed in the other file, to avoid exposing internals of the file it depends on.
* @kind problem
* @problem.severity recommendation
* @precision high
* @precision medium
* @id cpp/feature-envy
* @tags maintainability
* modularity
@@ -25,7 +25,8 @@ predicate functionUsesFunction(Function source, Function f, File target) {
}
predicate dependencyCount(Function source, File target, int res) {
res = strictcount(Declaration d |
res =
strictcount(Declaration d |
functionUsesVariable(source, d, target) or
functionUsesFunction(source, d, target)
)

View File

@@ -38,14 +38,16 @@ where
n = count(Function f | f.fromSource()).toString()
or
l = "Number of Lines Of Code" and
n = sum(File f, int toSum |
n =
sum(File f, int toSum |
f.fromSource() and toSum = f.getMetrics().getNumberOfLinesOfCode()
|
toSum
).toString()
or
l = "Self-Containedness" and
n = (
n =
(
100 * sum(Class c | c.fromSource() | c.getMetrics().getEfferentSourceCoupling()) /
sum(Class c | c.fromSource() | c.getMetrics().getEfferentCoupling())
).toString() + "%"

View File

@@ -3,7 +3,7 @@
* @description Two files share too much information about each other (accessing many operations or variables in both directions). It would be better to invert some of the dependencies to reduce the coupling between the two files.
* @kind problem
* @problem.severity recommendation
* @precision high
* @precision medium
* @id cpp/file-intimacy
* @tags maintainability
* modularity

View File

@@ -3,7 +3,7 @@
* @description Finds classes with many fields; they could probably be refactored by breaking them down into smaller classes, and using composition.
* @kind problem
* @problem.severity recommendation
* @precision high
* @precision medium
* @id cpp/class-many-fields
* @tags maintainability
* statistical
@@ -42,9 +42,7 @@ newtype TVariableDeclarationInfo =
*/
class VariableDeclarationLine extends TVariableDeclarationInfo {
Class c;
File f;
int line;
VariableDeclarationLine() {
@@ -82,11 +80,8 @@ class VariableDeclarationLine extends TVariableDeclarationInfo {
* (that is, the first is 0, the second is 1 and so on).
*/
private int getRank() {
line = rank[result](VariableDeclarationLine vdl, int l |
vdl = TVariableDeclarationLine(c, f, l)
|
l
)
line =
rank[result](VariableDeclarationLine vdl, int l | vdl = TVariableDeclarationLine(c, f, l) | l)
}
/**
@@ -135,7 +130,8 @@ class VariableDeclarationGroup extends VariableDeclarationLine {
* Gets the number of uniquely named `VariableDeclarationEntry`s in this group.
*/
int getCount() {
result = count(VariableDeclarationLine l |
result =
count(VariableDeclarationLine l |
l = getProximateNext*()
|
l.getAVDE().getVariable().getName()
@@ -168,7 +164,8 @@ class ExtClass extends Class {
from ExtClass c, int n, VariableDeclarationGroup vdg, string suffix
where
n = strictcount(string fieldName |
n =
strictcount(string fieldName |
exists(Field f |
f.getDeclaringType() = c and
fieldName = f.getName() and

View File

@@ -50,7 +50,8 @@ class BlockOrNonChild extends Element {
private int getNonContiguousStartRankIn(AffectedFile file) {
// When using `rank` with `order by`, the ranks may not be contiguous.
this = rank[result](BlockOrNonChild boc, int startLine, int startCol |
this =
rank[result](BlockOrNonChild boc, int startLine, int startCol |
boc.getLocation().hasLocationInfo(file.getAbsolutePath(), startLine, startCol, _, _)
|
boc order by startLine, startCol
@@ -58,13 +59,15 @@ class BlockOrNonChild extends Element {
}
int getStartRankIn(AffectedFile file) {
this.getNonContiguousStartRankIn(file) = rank[result](int rnk |
this.getNonContiguousStartRankIn(file) =
rank[result](int rnk |
exists(BlockOrNonChild boc | boc.getNonContiguousStartRankIn(file) = rnk)
)
}
int getNonContiguousEndRankIn(AffectedFile file) {
this = rank[result](BlockOrNonChild boc, int endLine, int endCol |
this =
rank[result](BlockOrNonChild boc, int endLine, int endCol |
boc.getLocation().hasLocationInfo(file.getAbsolutePath(), _, _, endLine, endCol)
|
boc order by endLine, endCol
@@ -79,9 +82,8 @@ predicate emptyBlockContainsNonchild(Block b) {
emptyBlock(_, b) and
exists(BlockOrNonChild c, AffectedFile file |
c.(BlockOrNonChild).getStartRankIn(file) = 1 + b.(BlockOrNonChild).getStartRankIn(file) and
c.(BlockOrNonChild).getNonContiguousEndRankIn(file) < b
.(BlockOrNonChild)
.getNonContiguousEndRankIn(file)
c.(BlockOrNonChild).getNonContiguousEndRankIn(file) <
b.(BlockOrNonChild).getNonContiguousEndRankIn(file)
)
}

View File

@@ -0,0 +1,17 @@
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>
When eras change, date and time conversions that rely on a hard-coded era start date need to be reviewed. Conversions relying on Japanese dates in the current era can produce an ambiguous date.
The values for the current Japanese era dates should be read from a source that will be updated, such as the Windows registry.
</p>
</overview>
<references>
<li>
<a href="https://blogs.msdn.microsoft.com/shawnste/2018/04/12/the-japanese-calendars-y2k-moment/">The Japanese Calendar's Y2K Moment</a>.
</li>
</references>
</qhelp>

View File

@@ -0,0 +1,73 @@
/**
* @name Hard-coded Japanese era start date
* @description Japanese era changes can lead to code behaving differently. Avoid hard-coding Japanese era start dates.
* @kind problem
* @problem.severity warning
* @id cpp/japanese-era/exact-era-date
* @precision low
* @tags maintainability
* reliability
* japanese-era
*/
import cpp
import semmle.code.cpp.commons.DateTime
predicate assignedYear(Struct s, YearFieldAccess year, int value) {
exists(Operation yearAssignment |
s.getAField().getAnAccess() = year and
yearAssignment.getAnOperand() = year and
yearAssignment.getAnOperand().getValue().toInt() = value
)
}
predicate assignedMonth(Struct s, MonthFieldAccess month, int value) {
exists(Operation monthAssignment |
s.getAField().getAnAccess() = month and
monthAssignment.getAnOperand() = month and
monthAssignment.getAnOperand().getValue().toInt() = value
)
}
predicate assignedDay(Struct s, DayFieldAccess day, int value) {
exists(Operation dayAssignment |
s.getAField().getAnAccess() = day and
dayAssignment.getAnOperand() = day and
dayAssignment.getAnOperand().getValue().toInt() = value
)
}
predicate eraDate(int year, int month, int day) {
year = 1989 and month = 1 and day = 8
or
year = 2019 and month = 5 and day = 1
}
predicate badStructInitialization(Element target, string message) {
exists(
StructLikeClass s, YearFieldAccess year, MonthFieldAccess month, DayFieldAccess day,
int yearValue, int monthValue, int dayValue
|
eraDate(yearValue, monthValue, dayValue) and
assignedYear(s, year, yearValue) and
assignedMonth(s, month, monthValue) and
assignedDay(s, day, dayValue) and
target = year and
message = "A time struct that is initialized with exact Japanese calendar era start date."
)
}
predicate badCall(Element target, string message) {
exists(Call cc, int i |
eraDate(cc.getArgument(i).getValue().toInt(), cc.getArgument(i + 1).getValue().toInt(),
cc.getArgument(i + 2).getValue().toInt()) and
target = cc and
message = "Call that appears to have hard-coded Japanese era start date as parameter."
)
}
from Element target, string message
where
badStructInitialization(target, message) or
badCall(target, message)
select target, message

View File

@@ -307,7 +307,8 @@ predicate nonTrivialValue(string value, Literal literal) {
}
predicate valueOccurrenceCount(string value, int n) {
n = strictcount(Location loc |
n =
strictcount(Location loc |
exists(Literal lit | lit.getLocation() = loc | nonTrivialValue(value, lit)) and
// Exclude generated files (they do not have the same maintainability
// concerns as ordinary source files)
@@ -338,7 +339,8 @@ predicate check(Literal lit, string value, int n, File f) {
}
predicate checkWithFileCount(string value, int overallCount, int fileCount, File f) {
fileCount = strictcount(Location loc |
fileCount =
strictcount(Location loc |
exists(Literal lit | lit.getLocation() = loc | check(lit, value, overallCount, f))
)
}
@@ -364,7 +366,8 @@ predicate firstOccurrence(Literal lit, string value, int n) {
predicate magicConstant(Literal e, string msg) {
exists(string value, int n |
firstOccurrence(e, value, n) and
msg = "Magic constant: literal '" + value + "' is repeated " + n.toString() +
msg =
"Magic constant: literal '" + value + "' is repeated " + n.toString() +
" times and should be encapsulated in a constant."
)
}

View File

@@ -28,13 +28,15 @@ import cpp
// design question and carries has no safety risk.
predicate generatedCopyAssignment(CopyConstructor cc, string msg) {
cc.getDeclaringType().hasImplicitCopyAssignmentOperator() and
msg = "No matching copy assignment operator in class " + cc.getDeclaringType().getName() +
msg =
"No matching copy assignment operator in class " + cc.getDeclaringType().getName() +
". It is good practice to match a copy constructor with a " + "copy assignment operator."
}
predicate generatedCopyConstructor(CopyAssignmentOperator ca, string msg) {
ca.getDeclaringType().hasImplicitCopyConstructor() and
msg = "No matching copy constructor in class " + ca.getDeclaringType().getName() +
msg =
"No matching copy constructor in class " + ca.getDeclaringType().getName() +
". It is good practice to match a copy assignment operator with a " + "copy constructor."
}

View File

@@ -14,15 +14,14 @@
import cpp
predicate declarationHasSideEffects(Variable v) {
exists(Class c | c = v.getUnspecifiedType() |
c.hasConstructor() or c.hasDestructor()
)
exists(Class c | c = v.getUnspecifiedType() | c.hasConstructor() or c.hasDestructor())
}
from Variable v
where
v.isStatic() and
v.hasDefinition() and
not v.isConstexpr() and
not exists(VariableAccess a | a.getTarget() = v) and
not v instanceof MemberVariable and
not declarationHasSideEffects(v) and

View File

@@ -22,7 +22,7 @@ predicate testAndBranch(Expr e, Stmt branch) {
)
}
predicate choice(LocalScopeVariable v, Stmt branch, string value) {
predicate choice(StackVariable v, Stmt branch, string value) {
exists(AnalysedExpr e |
testAndBranch(e, branch) and
(
@@ -33,7 +33,7 @@ predicate choice(LocalScopeVariable v, Stmt branch, string value) {
)
}
predicate guarded(LocalScopeVariable v, Stmt loopstart, AnalysedExpr child) {
predicate guarded(StackVariable v, Stmt loopstart, AnalysedExpr child) {
choice(v, loopstart, _) and
loopstart.getChildStmt*() = child.getEnclosingStmt() and
(definition(v, child) or exists(child.getNullSuccessor(v)))
@@ -47,9 +47,7 @@ predicate addressLeak(Variable v, Stmt leak) {
)
}
from
LocalScopeVariable v, Stmt branch, AnalysedExpr cond, string context, string test,
string testresult
from StackVariable 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) |

View File

@@ -13,7 +13,7 @@ import semmle.code.cpp.pointsto.PointsTo
import Negativity
predicate closeCall(FunctionCall fc, Variable v) {
fc.getTarget().hasGlobalName("close") and v.getAnAccess() = fc.getArgument(0)
fc.getTarget().hasGlobalOrStdName("close") and v.getAnAccess() = fc.getArgument(0)
or
exists(FunctionCall midcall, Function mid, int arg |
fc.getArgument(arg) = v.getAnAccess() and
@@ -23,14 +23,14 @@ predicate closeCall(FunctionCall fc, Variable v) {
)
}
predicate openDefinition(LocalScopeVariable v, ControlFlowNode def) {
predicate openDefinition(StackVariable v, ControlFlowNode def) {
exists(Expr expr | exprDefinition(v, def, expr) and allocateDescriptorCall(expr))
}
predicate openReaches(ControlFlowNode def, ControlFlowNode node) {
exists(LocalScopeVariable v | openDefinition(v, def) and node = def.getASuccessor())
exists(StackVariable v | openDefinition(v, def) and node = def.getASuccessor())
or
exists(LocalScopeVariable v, ControlFlowNode mid |
exists(StackVariable v, ControlFlowNode mid |
openDefinition(v, def) and
openReaches(def, mid) and
not errorSuccessor(v, mid) and
@@ -40,7 +40,7 @@ predicate openReaches(ControlFlowNode def, ControlFlowNode node) {
)
}
predicate assignedToFieldOrGlobal(LocalScopeVariable v, Assignment assign) {
predicate assignedToFieldOrGlobal(StackVariable v, Assignment assign) {
exists(Variable external |
assign.getRValue() = v.getAnAccess() and
assign.getLValue().(VariableAccess).getTarget() = external and
@@ -48,7 +48,7 @@ predicate assignedToFieldOrGlobal(LocalScopeVariable v, Assignment assign) {
)
}
from LocalScopeVariable v, ControlFlowNode def, ReturnStmt ret
from StackVariable v, ControlFlowNode def, ReturnStmt ret
where
openDefinition(v, def) and
openReaches(def, ret) and

View File

@@ -6,7 +6,7 @@
<overview>
<p>
This rule finds calls to <code>open</code> or <code>socket</code> where there is no corresponding <code>close</code> call in the program analyzed.
This rule finds calls to <code>socket</code> where there is no corresponding <code>close</code> call in the program analyzed.
Leaving descriptors open will cause a resource leak that will persist even after the program terminates.
</p>
@@ -14,7 +14,7 @@ Leaving descriptors open will cause a resource leak that will persist even after
</overview>
<recommendation>
<p>Ensure that all file or socket descriptors allocated by the program are freed before it terminates.</p>
<p>Ensure that all socket descriptors allocated by the program are freed before it terminates.</p>
</recommendation>
<example>

View File

@@ -1,6 +1,6 @@
/**
* @name Open descriptor never closed
* @description Functions that always return before closing the socket or file they opened leak resources.
* @description Functions that always return before closing the socket they opened leak resources.
* @kind problem
* @id cpp/descriptor-never-closed
* @problem.severity warning
@@ -13,7 +13,7 @@ import semmle.code.cpp.pointsto.PointsTo
predicate closed(Expr e) {
exists(FunctionCall fc |
fc.getTarget().hasGlobalName("close") and
fc.getTarget().hasGlobalOrStdName("close") and
fc.getArgument(0) = e
)
}

View File

@@ -1,5 +1,6 @@
import semmle.code.cpp.pointsto.PointsTo
/** Holds if there exists a call to a function that might close the file specified by `e`. */
predicate closed(Expr e) {
fcloseCall(_, e) or
exists(ExprCall c |
@@ -8,10 +9,19 @@ predicate closed(Expr e) {
)
}
/** An expression for which there exists a function call that might close it. */
class ClosedExpr extends PointsToExpr {
ClosedExpr() { closed(this) }
override predicate interesting() { closed(this) }
}
/**
* Holds if `fc` is a call to a function that opens a file that might be closed. For example:
* ```
* FILE* f = fopen("file.txt", "r");
* ...
* fclose(f);
* ```
*/
predicate fopenCallMayBeClosed(FunctionCall fc) { fopenCall(fc) and anythingPointsTo(fc) }

View File

@@ -10,7 +10,7 @@
*/
import FileClosed
import semmle.code.cpp.controlflow.LocalScopeVariableReachability
import semmle.code.cpp.controlflow.StackVariableReachability
/**
* Extend the NullValue class used by Nullness.qll to include simple -1 as a 'null' value
@@ -26,20 +26,18 @@ class MinusOne extends NullValue {
*/
predicate mayCallFunction(Expr call, Function f) {
call.(FunctionCall).getTarget() = f or
call.(VariableCall).getVariable().getAnAssignedValue().
getAChild*().(FunctionAccess).getTarget() = f
call.(VariableCall).getVariable().getAnAssignedValue().getAChild*().(FunctionAccess).getTarget() =
f
}
predicate fopenCallOrIndirect(Expr e) {
// direct fopen call
fopenCall(e) and
// We are only interested in fopen calls that are
// actually closed somehow, as FileNeverClosed
// will catch those that aren't.
fopenCallMayBeClosed(e)
or
exists(ReturnStmt rtn |
// indirect fopen call
mayCallFunction(e, rtn.getEnclosingFunction()) and
@@ -70,36 +68,33 @@ predicate fcloseCallOrIndirect(FunctionCall fc, Variable v) {
)
}
predicate fopenDefinition(LocalScopeVariable v, ControlFlowNode def) {
predicate fopenDefinition(StackVariable v, ControlFlowNode def) {
exists(Expr expr | exprDefinition(v, def, expr) and fopenCallOrIndirect(expr))
}
class FOpenVariableReachability extends LocalScopeVariableReachabilityWithReassignment {
class FOpenVariableReachability extends StackVariableReachabilityWithReassignment {
FOpenVariableReachability() { this = "FOpenVariableReachability" }
override predicate isSourceActual(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSourceActual(ControlFlowNode node, StackVariable v) {
fopenDefinition(v, node)
}
override predicate isSinkActual(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSinkActual(ControlFlowNode node, StackVariable v) {
// node may be used in fopenReaches
exists(node.(AnalysedExpr).getNullSuccessor(v)) or
fcloseCallOrIndirect(node, v) or
assignedToFieldOrGlobal(v, node) or
// node may be used directly in query
v.getFunction() = node.(ReturnStmt).getEnclosingFunction()
}
override predicate isBarrier(ControlFlowNode node, LocalScopeVariable v) {
definitionBarrier(v, node)
}
override predicate isBarrier(ControlFlowNode node, StackVariable v) { definitionBarrier(v, node) }
}
/**
* The value from fopen at `def` is still held in Variable `v` upon entering `node`.
*/
predicate fopenVariableReaches(LocalScopeVariable v, ControlFlowNode def, ControlFlowNode node) {
predicate fopenVariableReaches(StackVariable v, ControlFlowNode def, ControlFlowNode node) {
exists(FOpenVariableReachability r |
// reachability
r.reachesTo(def, _, node, v)
@@ -110,27 +105,23 @@ predicate fopenVariableReaches(LocalScopeVariable v, ControlFlowNode def, Contro
)
}
class FOpenReachability extends LocalScopeVariableReachabilityExt {
class FOpenReachability extends StackVariableReachabilityExt {
FOpenReachability() { this = "FOpenReachability" }
override predicate isSource(ControlFlowNode node, LocalScopeVariable v) {
fopenDefinition(v, node)
}
override predicate isSource(ControlFlowNode node, StackVariable v) { fopenDefinition(v, node) }
override predicate isSink(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSink(ControlFlowNode node, StackVariable v) {
v.getFunction() = node.(ReturnStmt).getEnclosingFunction()
}
override predicate isBarrier(
ControlFlowNode source, ControlFlowNode node, ControlFlowNode next,
LocalScopeVariable v)
{
ControlFlowNode source, ControlFlowNode node, ControlFlowNode next, StackVariable v
) {
isSource(source, v) and
next = node.getASuccessor() and
// the file (stored in any variable `v0`) opened at `source` is closed or
// assigned to a global at node, or NULL checked on the edge node -> next.
exists(LocalScopeVariable v0 | fopenVariableReaches(v0, source, node) |
exists(StackVariable v0 | fopenVariableReaches(v0, source, node) |
node.(AnalysedExpr).getNullSuccessor(v0) = next or
fcloseCallOrIndirect(node, v0) or
assignedToFieldOrGlobal(v0, node)
@@ -147,11 +138,11 @@ predicate fopenReaches(ControlFlowNode def, ControlFlowNode node) {
exists(FOpenReachability r | r.reaches(def, _, node))
}
predicate assignedToFieldOrGlobal(LocalScopeVariable v, Expr e) {
// assigned to anything except a LocalScopeVariable
predicate assignedToFieldOrGlobal(StackVariable v, Expr e) {
// assigned to anything except a StackVariable
// (typically a field or global, but for example also *ptr = v)
e.(Assignment).getRValue() = v.getAnAccess() and
not e.(Assignment).getLValue().(VariableAccess).getTarget() instanceof LocalScopeVariable
not e.(Assignment).getLValue().(VariableAccess).getTarget() instanceof StackVariable
or
exists(Expr midExpr, Function mid, int arg |
// indirect assignment
@@ -168,10 +159,8 @@ predicate assignedToFieldOrGlobal(LocalScopeVariable v, Expr e) {
from ControlFlowNode def, ReturnStmt ret
where
fopenReaches(def, ret) and
not exists(LocalScopeVariable v |
not exists(StackVariable v |
fopenVariableReaches(v, def, ret) and
ret.getAChild*() = v.getAnAccess()
)
select
def, "The file opened here may not be closed at $@.",
ret, "this exit point"
select def, "The file opened here may not be closed at $@.", ret, "this exit point"

View File

@@ -11,7 +11,7 @@
import cpp
from LocalScopeVariable v, ControlFlowNode def, VariableAccess checked, VariableAccess unchecked
from StackVariable v, ControlFlowNode def, VariableAccess checked, VariableAccess unchecked
where
checked = v.getAnAccess() and
dereferenced(checked) and

View File

@@ -13,7 +13,7 @@
import cpp
predicate negativeCheck(LocalScopeVariable v, ComparisonOperation op) {
predicate negativeCheck(StackVariable v, ComparisonOperation op) {
exists(int varindex, string constant, Literal lit |
op.getChild(varindex) = v.getAnAccess() and
op.getChild(1 - varindex) = lit and
@@ -38,7 +38,7 @@ predicate negativeCheck(LocalScopeVariable v, ComparisonOperation op) {
)
}
from LocalScopeVariable v, ArrayExpr dangerous, Expr check
from StackVariable v, ArrayExpr dangerous, Expr check
where
useUsePair(v, dangerous.getArrayOffset(), check.getAChild()) and
negativeCheck(v, check) and

View File

@@ -2,12 +2,24 @@
import cpp
/**
* An assignment to a variable with the value `0`. For example:
* ```
* int x;
* x = 0;
* ```
* but not:
* ```
* int x = 0;
* ```
*/
class ZeroAssignment extends AssignExpr {
ZeroAssignment() {
this.getAnOperand() instanceof VariableAccess and
this.getAnOperand() instanceof Zero
}
/** Gets a variable that is assigned the value `0`. */
Variable assignedVariable() { result.getAnAccess() = this.getAnOperand() }
}

View File

@@ -1,28 +1,27 @@
import semmle.code.cpp.pointsto.PointsTo
private predicate freed(Expr e) {
exists(FunctionCall fc, Expr arg |
freeCall(fc, arg) and
arg = e
)
or
exists(DeleteExpr de | de.getExpr() = e)
or
exists(DeleteArrayExpr de | de.getExpr() = e)
e = any(DeallocationExpr de).getFreedExpr()
or
exists(ExprCall c |
// cautiously assume that any ExprCall could be a freeCall.
// cautiously assume that any `ExprCall` could be a deallocation expression.
c.getAnArgument() = e
)
}
/** An expression that might be deallocated. */
class FreedExpr extends PointsToExpr {
FreedExpr() { freed(this) }
override predicate interesting() { freed(this) }
}
predicate allocMayBeFreed(Expr alloc) {
isAllocationExpr(alloc) and
anythingPointsTo(alloc)
}
/**
* An allocation expression that might be deallocated. For example:
* ```
* int* p = new int;
* ...
* delete p;
* ```
*/
predicate allocMayBeFreed(AllocationExpr alloc) { anythingPointsTo(alloc) }

View File

@@ -10,7 +10,7 @@
*/
import MemoryFreed
import semmle.code.cpp.controlflow.LocalScopeVariableReachability
import semmle.code.cpp.controlflow.StackVariableReachability
/**
* 'call' is either a direct call to f, or a possible call to f
@@ -18,20 +18,18 @@ import semmle.code.cpp.controlflow.LocalScopeVariableReachability
*/
predicate mayCallFunction(Expr call, Function f) {
call.(FunctionCall).getTarget() = f or
call.(VariableCall).getVariable().getAnAssignedValue().
getAChild*().(FunctionAccess).getTarget() = f
call.(VariableCall).getVariable().getAnAssignedValue().getAChild*().(FunctionAccess).getTarget() =
f
}
predicate allocCallOrIndirect(Expr e) {
// direct alloc call
isAllocationExpr(e) and
e.(AllocationExpr).requiresDealloc() and
// We are only interested in alloc calls that are
// actually freed somehow, as MemoryNeverFreed
// will catch those that aren't.
allocMayBeFreed(e)
or
exists(ReturnStmt rtn |
// indirect alloc call
mayCallFunction(e, rtn.getEnclosingFunction()) and
@@ -55,8 +53,7 @@ predicate allocCallOrIndirect(Expr e) {
* can cause memory leaks.
*/
predicate verifiedRealloc(FunctionCall reallocCall, Variable v, ControlFlowNode verified) {
reallocCall.getTarget().hasGlobalName("realloc") and
reallocCall.getArgument(0) = v.getAnAccess() and
reallocCall.(AllocationExpr).getReallocPtr() = v.getAnAccess() and
(
exists(Variable newV, ControlFlowNode node |
// a realloc followed by a null check at 'node' (return the non-null
@@ -64,7 +61,6 @@ predicate verifiedRealloc(FunctionCall reallocCall, Variable v, ControlFlowNode
newV.getAnAssignedValue() = reallocCall and
node.(AnalysedExpr).getNonNullSuccessor(newV) = verified and
// note: this case uses naive flow logic (getAnAssignedValue).
// special case: if the result of the 'realloc' is assigned to the
// same variable, we don't descriminate properly between the old
// and the new allocation; better to not consider this a free at
@@ -74,23 +70,19 @@ predicate verifiedRealloc(FunctionCall reallocCall, Variable v, ControlFlowNode
or
// a realloc(ptr, 0), which always succeeds and frees
// (return the realloc itself)
reallocCall.getArgument(1).getValue() = "0" and
reallocCall.(AllocationExpr).getReallocPtr().getValue() = "0" and
verified = reallocCall
)
}
predicate freeCallOrIndirect(ControlFlowNode n, Variable v) {
// direct free call
freeCall(n, v.getAnAccess()) and
not n.(FunctionCall).getTarget().hasGlobalName("realloc")
n.(DeallocationExpr).getFreedExpr() = v.getAnAccess() and
not exists(n.(AllocationExpr).getReallocPtr())
or
// verified realloc call
verifiedRealloc(_, v, n)
or
n.(DeleteExpr).getExpr() = v.getAnAccess()
or
n.(DeleteArrayExpr).getExpr() = v.getAnAccess()
or
exists(FunctionCall midcall, Function mid, int arg |
// indirect free call
n.(Call).getArgument(arg) = v.getAnAccess() and
@@ -100,36 +92,33 @@ predicate freeCallOrIndirect(ControlFlowNode n, Variable v) {
)
}
predicate allocationDefinition(LocalScopeVariable v, ControlFlowNode def) {
predicate allocationDefinition(StackVariable v, ControlFlowNode def) {
exists(Expr expr | exprDefinition(v, def, expr) and allocCallOrIndirect(expr))
}
class AllocVariableReachability extends LocalScopeVariableReachabilityWithReassignment {
class AllocVariableReachability extends StackVariableReachabilityWithReassignment {
AllocVariableReachability() { this = "AllocVariableReachability" }
override predicate isSourceActual(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSourceActual(ControlFlowNode node, StackVariable v) {
allocationDefinition(v, node)
}
override predicate isSinkActual(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSinkActual(ControlFlowNode node, StackVariable v) {
// node may be used in allocationReaches
exists(node.(AnalysedExpr).getNullSuccessor(v)) or
freeCallOrIndirect(node, v) or
assignedToFieldOrGlobal(v, node) or
// node may be used directly in query
v.getFunction() = node.(ReturnStmt).getEnclosingFunction()
}
override predicate isBarrier(ControlFlowNode node, LocalScopeVariable v) {
definitionBarrier(v, node)
}
override predicate isBarrier(ControlFlowNode node, StackVariable v) { definitionBarrier(v, node) }
}
/**
* The value from allocation `def` is still held in Variable `v` upon entering `node`.
*/
predicate allocatedVariableReaches(LocalScopeVariable v, ControlFlowNode def, ControlFlowNode node) {
predicate allocatedVariableReaches(StackVariable v, ControlFlowNode def, ControlFlowNode node) {
exists(AllocVariableReachability r |
// reachability
r.reachesTo(def, _, node, v)
@@ -140,27 +129,25 @@ predicate allocatedVariableReaches(LocalScopeVariable v, ControlFlowNode def, Co
)
}
class AllocReachability extends LocalScopeVariableReachabilityExt {
class AllocReachability extends StackVariableReachabilityExt {
AllocReachability() { this = "AllocReachability" }
override predicate isSource(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSource(ControlFlowNode node, StackVariable v) {
allocationDefinition(v, node)
}
override predicate isSink(ControlFlowNode node, LocalScopeVariable v) {
override predicate isSink(ControlFlowNode node, StackVariable v) {
v.getFunction() = node.(ReturnStmt).getEnclosingFunction()
}
override predicate isBarrier(
ControlFlowNode source, ControlFlowNode node, ControlFlowNode next,
LocalScopeVariable v)
{
ControlFlowNode source, ControlFlowNode node, ControlFlowNode next, StackVariable v
) {
isSource(source, v) and
next = node.getASuccessor() and
// the memory (stored in any variable `v0`) allocated at `source` is freed or
// assigned to a global at node, or NULL checked on the edge node -> next.
exists(LocalScopeVariable v0 | allocatedVariableReaches(v0, source, node) |
exists(StackVariable v0 | allocatedVariableReaches(v0, source, node) |
node.(AnalysedExpr).getNullSuccessor(v0) = next or
freeCallOrIndirect(node, v0) or
assignedToFieldOrGlobal(v0, node)
@@ -177,11 +164,11 @@ predicate allocationReaches(ControlFlowNode def, ControlFlowNode node) {
exists(AllocReachability r | r.reaches(def, _, node))
}
predicate assignedToFieldOrGlobal(LocalScopeVariable v, Expr e) {
// assigned to anything except a LocalScopeVariable
predicate assignedToFieldOrGlobal(StackVariable v, Expr e) {
// assigned to anything except a StackVariable
// (typically a field or global, but for example also *ptr = v)
e.(Assignment).getRValue() = v.getAnAccess() and
not e.(Assignment).getLValue().(VariableAccess).getTarget() instanceof LocalScopeVariable
not e.(Assignment).getLValue().(VariableAccess).getTarget() instanceof StackVariable
or
exists(Expr midExpr, Function mid, int arg |
// indirect assignment
@@ -198,10 +185,8 @@ predicate assignedToFieldOrGlobal(LocalScopeVariable v, Expr e) {
from ControlFlowNode def, ReturnStmt ret
where
allocationReaches(def, ret) and
not exists(LocalScopeVariable v |
not exists(StackVariable v |
allocatedVariableReaches(v, def, ret) and
ret.getAChild*() = v.getAnAccess()
)
select
def, "The memory allocated here may not be released at $@.",
ret, "this exit point"
select def, "The memory allocated here may not be released at $@.", ret, "this exit point"

View File

@@ -11,6 +11,8 @@
import MemoryFreed
from Expr alloc
where isAllocationExpr(alloc) and not allocMayBeFreed(alloc)
from AllocationExpr alloc
where
alloc.requiresDealloc() and
not allocMayBeFreed(alloc)
select alloc, "This memory is never freed"

View File

@@ -43,7 +43,7 @@ class FunctionWithNegativeReturn extends Function {
predicate dangerousUse(IntegralReturnValue val, Expr use) {
exists(ArrayExpr ae | ae.getArrayOffset() = val and use = val)
or
exists(LocalScopeVariable v, ControlFlowNode def, ArrayExpr ae |
exists(StackVariable v, ControlFlowNode def, ArrayExpr ae |
exprDefinition(v, def, val) and
use = ae.getArrayOffset() and
not boundsChecked(v, use) and
@@ -54,7 +54,7 @@ predicate dangerousUse(IntegralReturnValue val, Expr use) {
val = use and
use.getType().getUnderlyingType() instanceof PointerType
or
exists(LocalScopeVariable v, ControlFlowNode def, AddExpr add |
exists(StackVariable v, ControlFlowNode def, AddExpr add |
exprDefinition(v, def, val) and
definitionUsePair(v, def, use) and
add.getAnOperand() = use and

View File

@@ -1,10 +1,19 @@
import cpp
/**
* Holds if `val` is an access to the variable `v`, or if `val`
* is an assignment with an access to `v` on the left-hand side.
*/
predicate valueOfVar(Variable v, Expr val) {
val = v.getAnAccess() or
val.(AssignExpr).getLValue() = v.getAnAccess()
}
/**
* Holds if either:
* - `cond` is an (in)equality expression that compares the variable `v` to the value `-1`, or
* - `cond` is a relational expression that compares the variable `v` to a constant.
*/
predicate boundsCheckExpr(Variable v, Expr cond) {
exists(EQExpr eq |
cond = eq and
@@ -43,6 +52,18 @@ predicate boundsCheckExpr(Variable v, Expr cond) {
)
}
/**
* Holds if `node` is an expression in a conditional statement and `succ` is an
* immediate successor of `node` that may be reached after evaluating `node`.
* For example, given
* ```
* if (a < 10 && b) func1();
* else func2();
* ```
* this predicate holds when either:
* - `node` is `a < 10` and `succ` is `func2()` or `b`, or
* - `node` is `b` and `succ` is `func1()` or `func2()`
*/
predicate conditionalSuccessor(ControlFlowNode node, ControlFlowNode succ) {
if node.isCondition()
then succ = node.getATrueSuccessor() or succ = node.getAFalseSuccessor()
@@ -52,6 +73,12 @@ predicate conditionalSuccessor(ControlFlowNode node, ControlFlowNode succ) {
)
}
/**
* Holds if the current value of the variable `v` at control-flow
* node `n` has been used either in:
* - an (in)equality comparison with the value `-1`, or
* - a relational comparison that compares `v` to a constant.
*/
predicate boundsChecked(Variable v, ControlFlowNode node) {
exists(Expr test |
boundsCheckExpr(v, test) and
@@ -63,6 +90,14 @@ predicate boundsChecked(Variable v, ControlFlowNode node) {
)
}
/**
* Holds if `cond` compares `v` to some common error values. Specifically, this
* predicate holds when:
* - `cond` checks that `v` is equal to `-1`, or
* - `cond` checks that `v` is less than `0`, or
* - `cond` checks that `v` is less than or equal to `-1`, or
* - `cond` checks that `v` is not some common success value (see `successCondition`).
*/
predicate errorCondition(Variable v, Expr cond) {
exists(EQExpr eq |
cond = eq and
@@ -88,6 +123,14 @@ predicate errorCondition(Variable v, Expr cond) {
)
}
/**
* Holds if `cond` compares `v` to some common success values. Specifically, this
* predicate holds when:
* - `cond` checks that `v` is not equal to `-1`, or
* - `cond` checks that `v` is greater than or equal than `0`, or
* - `cond` checks that `v` is greater than `-1`, or
* - `cond` checks that `v` is not some common error value (see `errorCondition`).
*/
predicate successCondition(Variable v, Expr cond) {
exists(NEExpr ne |
cond = ne and
@@ -113,6 +156,11 @@ predicate successCondition(Variable v, Expr cond) {
)
}
/**
* Holds if there exists a comparison operation that checks whether `v`
* represents some common *error* values, and `n` may be reached
* immediately following the comparison operation.
*/
predicate errorSuccessor(Variable v, ControlFlowNode n) {
exists(Expr cond |
errorCondition(v, cond) and n = cond.getATrueSuccessor()
@@ -121,6 +169,11 @@ predicate errorSuccessor(Variable v, ControlFlowNode n) {
)
}
/**
* Holds if there exists a comparison operation that checks whether `v`
* represents some common *success* values, and `n` may be reached
* immediately following the comparison operation.
*/
predicate successSuccessor(Variable v, ControlFlowNode n) {
exists(Expr cond |
successCondition(v, cond) and n = cond.getATrueSuccessor()
@@ -129,6 +182,10 @@ predicate successSuccessor(Variable v, ControlFlowNode n) {
)
}
/**
* Holds if the current value of the variable `v` at control-flow node
* `n` may have been checked against a common set of *error* values.
*/
predicate checkedError(Variable v, ControlFlowNode n) {
errorSuccessor(v, n)
or
@@ -139,6 +196,10 @@ predicate checkedError(Variable v, ControlFlowNode n) {
)
}
/**
* Holds if the current value of the variable `v` at control-flow node
* `n` may have been checked against a common set of *success* values.
*/
predicate checkedSuccess(Variable v, ControlFlowNode n) {
successSuccessor(v, n)
or

View File

@@ -5,16 +5,34 @@
import cpp
import semmle.code.cpp.controlflow.SSA
import semmle.code.cpp.dataflow.DataFlow
import semmle.code.cpp.models.implementations.Allocation
import semmle.code.cpp.models.implementations.Deallocation
/**
* Holds if `alloc` is a use of `malloc` or `new`. `kind` is
* a string describing the type of the allocation.
*/
predicate allocExpr(Expr alloc, string kind) {
isAllocationExpr(alloc) and
(
alloc instanceof FunctionCall and
kind = "malloc"
exists(Function target |
alloc.(AllocationExpr).(FunctionCall).getTarget() = target and
(
target.getName() = "operator new" and
kind = "new" and
// exclude placement new and custom overloads as they
// may not conform to assumptions
not target.getNumberOfParameters() > 1
or
target.getName() = "operator new[]" and
kind = "new[]" and
// exclude placement new and custom overloads as they
// may not conform to assumptions
not target.getNumberOfParameters() > 1
or
not target instanceof OperatorNewAllocationFunction and
kind = "malloc"
)
)
or
alloc instanceof NewExpr and
kind = "new" and
@@ -27,7 +45,8 @@ predicate allocExpr(Expr alloc, string kind) {
// exclude placement new and custom overloads as they
// may not conform to assumptions
not alloc.(NewArrayExpr).getAllocatorCall().getTarget().getNumberOfParameters() > 1
)
) and
not alloc.isFromUninstantiatedTemplate(_)
}
/**
@@ -47,7 +66,7 @@ predicate allocExprOrIndirect(Expr alloc, string kind) {
or
exists(Expr e |
allocExprOrIndirect(e, kind) and
DataFlow::localFlow(DataFlow::exprNode(e), DataFlow::exprNode(rtn.getExpr()))
DataFlow::localExprFlow(e, rtn.getExpr())
)
)
)
@@ -60,7 +79,7 @@ predicate allocExprOrIndirect(Expr alloc, string kind) {
pragma[nomagic]
private predicate allocReachesVariable(Variable v, Expr alloc, string kind) {
exists(Expr mid |
not v instanceof LocalScopeVariable and
not v instanceof StackVariable and
v.getAnAssignedValue() = mid and
allocReaches0(mid, alloc, kind)
)
@@ -76,7 +95,7 @@ private predicate allocReaches0(Expr e, Expr alloc, string kind) {
allocExprOrIndirect(alloc, kind) and
e = alloc
or
exists(SsaDefinition def, LocalScopeVariable v |
exists(SsaDefinition def, StackVariable v |
// alloc via SSA
allocReaches0(def.getAnUltimateDefiningValue(v), alloc, kind) and
e = def.getAUse(v)
@@ -109,8 +128,20 @@ predicate allocReaches(Expr e, Expr alloc, string kind) {
* describing the type of that free or delete.
*/
predicate freeExpr(Expr free, Expr freed, string kind) {
freeCall(free, freed) and
kind = "free"
exists(Function target |
freed = free.(DeallocationExpr).getFreedExpr() and
free.(FunctionCall).getTarget() = target and
(
target.getName() = "operator delete" and
kind = "delete"
or
target.getName() = "operator delete[]" and
kind = "delete[]"
or
not target instanceof OperatorDeleteDeallocationFunction and
kind = "free"
)
)
or
free.(DeleteExpr).getExpr() = freed and
kind = "delete"

View File

@@ -8,9 +8,11 @@
* external/cwe/cwe-457
*/
import cpp
/*
* See also InitialisationNotRun.ql and GlobalUseBeforeInit.ql
*/
// See also InitialisationNotRun.ql and GlobalUseBeforeInit.ql
import cpp
/**
* Holds if `s` defines variable `v` (conservative).

View File

@@ -11,42 +11,30 @@
*/
import cpp
class MallocCall extends FunctionCall {
MallocCall() {
this.getTarget().hasGlobalName("malloc") or
this.getTarget().hasQualifiedName("std", "malloc")
}
Expr getAllocatedSize() {
if this.getArgument(0) instanceof VariableAccess
then
exists(LocalScopeVariable v, ControlFlowNode def |
definitionUsePair(v, def, this.getArgument(0)) and
exprDefinition(v, def, result)
)
else result = this.getArgument(0)
}
}
import semmle.code.cpp.dataflow.DataFlow
import semmle.code.cpp.models.interfaces.Allocation
predicate spaceProblem(FunctionCall append, string msg) {
exists(MallocCall malloc, StrlenCall strlen, AddExpr add, FunctionCall insert, Variable buffer |
exists(
AllocationExpr malloc, StrlenCall strlen, AddExpr add, FunctionCall insert, Variable buffer
|
add.getAChild() = strlen and
exists(add.getAChild().getValue()) and
malloc.getAllocatedSize() = add and
DataFlow::localExprFlow(add, malloc.getSizeExpr()) and
buffer.getAnAccess() = strlen.getStringExpr() and
(
insert.getTarget().hasGlobalName("strcpy") or
insert.getTarget().hasGlobalName("strncpy")
insert.getTarget().hasGlobalOrStdName("strcpy") or
insert.getTarget().hasGlobalOrStdName("strncpy")
) and
(
append.getTarget().hasGlobalName("strcat") or
append.getTarget().hasGlobalName("strncat")
append.getTarget().hasGlobalOrStdName("strcat") or
append.getTarget().hasGlobalOrStdName("strncat")
) and
malloc.getASuccessor+() = insert and
insert.getArgument(1) = buffer.getAnAccess() and
insert.getASuccessor+() = append and
msg = "This buffer only contains enough room for '" + buffer.getName() + "' (copied on line " +
msg =
"This buffer only contains enough room for '" + buffer.getName() + "' (copied on line " +
insert.getLocation().getStartLine().toString() + ")"
)
}

View File

@@ -25,7 +25,7 @@ import semmle.code.cpp.security.TaintTracking
predicate sourceSized(FunctionCall fc, Expr src) {
exists(string name |
(name = "strncpy" or name = "strncat" or name = "memcpy" or name = "memmove") and
fc.getTarget().hasGlobalName(name)
fc.getTarget().hasGlobalOrStdName(name)
) and
exists(Expr dest, Expr size, Variable v |
fc.getArgument(0) = dest and
@@ -33,12 +33,10 @@ predicate sourceSized(FunctionCall fc, Expr src) {
fc.getArgument(2) = size and
src = v.getAnAccess() and
size.getAChild+() = v.getAnAccess() and
// exception: `dest` is also referenced in the size argument
not exists(Variable other |
dest = other.getAnAccess() and size.getAChild+() = other.getAnAccess()
) and
// exception: `src` and `dest` are both arrays of the same type and size
not exists(ArrayType srctype, ArrayType desttype |
dest.getType().getUnderlyingType() = desttype and

View File

@@ -33,7 +33,6 @@ class BufferAccess extends ArrayExpr {
staticBuffer(this.getArrayBase(), _, size) and
size != 0
) and
// exclude accesses in macro implementation of `strcmp`,
// which are carefully controlled but can look dangerous.
not exists(Macro m |
@@ -52,7 +51,8 @@ predicate overflowOffsetInLoop(BufferAccess bufaccess, string msg) {
loop.getStmt().getAChild*() = bufaccess.getEnclosingStmt() and
loop.limit() >= bufaccess.bufferSize() and
loop.counter().getAnAccess() = bufaccess.getArrayOffset() and
msg = "Potential buffer-overflow: counter '" + loop.counter().toString() + "' <= " +
msg =
"Potential buffer-overflow: counter '" + loop.counter().toString() + "' <= " +
loop.limit().toString() + " but '" + bufaccess.buffer().getName() + "' has " +
bufaccess.bufferSize().toString() + " elements."
)
@@ -61,19 +61,19 @@ predicate overflowOffsetInLoop(BufferAccess bufaccess, string msg) {
predicate bufferAndSizeFunction(Function f, int buf, int size) {
f.hasGlobalName("read") and buf = 1 and size = 2
or
f.hasGlobalName("fgets") and buf = 0 and size = 1
f.hasGlobalOrStdName("fgets") and buf = 0 and size = 1
or
f.hasGlobalName("strncpy") and buf = 0 and size = 2
f.hasGlobalOrStdName("strncpy") and buf = 0 and size = 2
or
f.hasGlobalName("strncat") and buf = 0 and size = 2
f.hasGlobalOrStdName("strncat") and buf = 0 and size = 2
or
f.hasGlobalName("memcpy") and buf = 0 and size = 2
f.hasGlobalOrStdName("memcpy") and buf = 0 and size = 2
or
f.hasGlobalName("memmove") and buf = 0 and size = 2
f.hasGlobalOrStdName("memmove") and buf = 0 and size = 2
or
f.hasGlobalName("snprintf") and buf = 0 and size = 1
f.hasGlobalOrStdName("snprintf") and buf = 0 and size = 1
or
f.hasGlobalName("vsnprintf") and buf = 0 and size = 1
f.hasGlobalOrStdName("vsnprintf") and buf = 0 and size = 1
}
class CallWithBufferSize extends FunctionCall {
@@ -95,7 +95,7 @@ class CallWithBufferSize extends FunctionCall {
int statedSizeValue() {
exists(Expr statedSizeSrc |
DataFlow::localFlow(DataFlow::exprNode(statedSizeSrc), DataFlow::exprNode(statedSizeExpr())) and
DataFlow::localExprFlow(statedSizeSrc, statedSizeExpr()) and
result = statedSizeSrc.getValue().toInt()
)
}
@@ -107,8 +107,9 @@ predicate wrongBufferSize(Expr error, string msg) {
statedSize = min(call.statedSizeValue()) and
statedSize > bufsize and
error = call.statedSizeExpr() and
msg = "Potential buffer-overflow: '" + buf.getName() + "' has size " + bufsize.toString() +
" not " + statedSize + "."
msg =
"Potential buffer-overflow: '" + buf.getName() + "' has size " + bufsize.toString() + " not " +
statedSize + "."
)
}
@@ -122,8 +123,9 @@ predicate outOfBounds(BufferAccess bufaccess, string msg) {
or
access = size and not exists(AddressOfExpr addof | bufaccess = addof.getOperand())
) and
msg = "Potential buffer-overflow: '" + buf + "' has size " + size.toString() + " but '" + buf +
"[" + access.toString() + "]' is accessed here."
msg =
"Potential buffer-overflow: '" + buf + "' has size " + size.toString() + " but '" + buf + "[" +
access.toString() + "]' is accessed here."
)
}

View File

@@ -20,11 +20,10 @@ class ReturnPointsToExpr extends PointsToExpr {
ReturnStmt getReturnStmt() { result.getExpr().getFullyConverted() = this }
}
from ReturnPointsToExpr ret, LocalVariable local, float confidence
from ReturnPointsToExpr ret, StackVariable local, float confidence
where
ret.pointsTo() = local and
ret.getReturnStmt().getEnclosingFunction() = local.getFunction() and
not local.isStatic() and
confidence = ret.confidence() and
confidence > 0.01
select ret,

View File

@@ -23,7 +23,8 @@ predicate important(Function f, string message) {
predicate dubious(Function f, string message) {
not important(f, _) and
exists(Options opts, int used, int total, int percentage |
used = count(FunctionCall fc |
used =
count(FunctionCall fc |
fc.getTarget() = f and not opts.okToIgnoreReturnValue(fc) and not unused(fc)
) and
total = count(FunctionCall fc | fc.getTarget() = f and not opts.okToIgnoreReturnValue(fc)) and

View File

@@ -17,12 +17,12 @@ import cpp
class Allocation extends FunctionCall {
Allocation() {
exists(string name |
this.getTarget().hasGlobalName(name) and
this.getTarget().hasGlobalOrStdName(name) and
(name = "malloc" or name = "calloc" or name = "realloc")
)
}
private string getName() { this.getTarget().hasGlobalName(result) }
private string getName() { this.getTarget().hasGlobalOrStdName(result) }
int getSize() {
this.getName() = "malloc" and

View File

@@ -17,12 +17,12 @@ import cpp
class Allocation extends FunctionCall {
Allocation() {
exists(string name |
this.getTarget().hasGlobalName(name) and
this.getTarget().hasGlobalOrStdName(name) and
(name = "malloc" or name = "calloc" or name = "realloc")
)
}
private string getName() { this.getTarget().hasGlobalName(result) }
private string getName() { this.getTarget().hasGlobalOrStdName(result) }
int getSize() {
this.getName() = "malloc" and

View File

@@ -20,11 +20,10 @@ class ScopeUtilityClass extends Class {
Call getAUse() { result = this.getAConstructor().getACallToThisFunction() }
}
from LocalScopeVariable v, ControlFlowNode def
from StackVariable v, ControlFlowNode def
where
definition(v, def) and
not definitionUsePair(v, def, _) and
not v.isStatic() and
not v.getAnAccess().isAddressOfAccess() and
// parameter initializers are not in the call-graph at the moment
not v.(Parameter).getInitializer().getExpr() = def and

View File

@@ -10,13 +10,13 @@
*/
import cpp
import semmle.code.cpp.controlflow.LocalScopeVariableReachability
import semmle.code.cpp.controlflow.StackVariableReachability
/** `e` is an expression that frees the memory pointed to by `v`. */
predicate isFreeExpr(Expr e, LocalScopeVariable v) {
predicate isFreeExpr(Expr e, StackVariable v) {
exists(VariableAccess va | va.getTarget() = v |
exists(FunctionCall fc | fc = e |
fc.getTarget().hasGlobalName("free") and
fc.getTarget().hasGlobalOrStdName("free") and
va = fc.getArgument(0)
)
or
@@ -27,7 +27,7 @@ predicate isFreeExpr(Expr e, LocalScopeVariable v) {
}
/** `e` is an expression that (may) dereference `v`. */
predicate isDerefExpr(Expr e, LocalScopeVariable v) {
predicate isDerefExpr(Expr e, StackVariable v) {
v.getAnAccess() = e and dereferenced(e)
or
isDerefByCallExpr(_, _, e, v)
@@ -39,27 +39,27 @@ predicate isDerefExpr(Expr e, LocalScopeVariable v) {
* or a source code function that dereferences the relevant
* parameter.
*/
predicate isDerefByCallExpr(Call c, int i, VariableAccess va, LocalScopeVariable v) {
predicate isDerefByCallExpr(Call c, int i, VariableAccess va, StackVariable v) {
v.getAnAccess() = va and
va = c.getAnArgumentSubExpr(i) and
not c.passesByReference(i, va) and
(c.getTarget().hasEntryPoint() implies isDerefExpr(_, c.getTarget().getParameter(i)))
}
class UseAfterFreeReachability extends LocalScopeVariableReachability {
class UseAfterFreeReachability extends StackVariableReachability {
UseAfterFreeReachability() { this = "UseAfterFree" }
override predicate isSource(ControlFlowNode node, LocalScopeVariable v) { isFreeExpr(node, v) }
override predicate isSource(ControlFlowNode node, StackVariable v) { isFreeExpr(node, v) }
override predicate isSink(ControlFlowNode node, LocalScopeVariable v) { isDerefExpr(node, v) }
override predicate isSink(ControlFlowNode node, StackVariable v) { isDerefExpr(node, v) }
override predicate isBarrier(ControlFlowNode node, LocalScopeVariable v) {
override predicate isBarrier(ControlFlowNode node, StackVariable v) {
definitionBarrier(v, node) or
isFreeExpr(node, v)
}
}
from UseAfterFreeReachability r, LocalScopeVariable v, Expr free, Expr e
from UseAfterFreeReachability r, StackVariable v, Expr free, Expr e
where r.reaches(free, v, e)
select e, "Memory pointed to by '" + v.getName().toString() + "' may have been previously freed $@",
free, "here"

View File

@@ -13,14 +13,11 @@ private import Options as CustomOptions
/**
* Default predicates that specify information about the behavior of
* the program being analyzed.
* the program being analyzed.
*/
class Options extends string
{
Options() {
this = "Options"
}
class Options extends string {
Options() { this = "Options" }
/**
* Holds if we wish to override the "may return NULL" inference for this
* call. If this holds, then rather than trying to infer whether this
@@ -60,15 +57,17 @@ class Options extends string
* `noreturn` attribute.
*/
predicate exits(Function f) {
f.getAnAttribute().hasName("noreturn") or
exists(string name | f.hasGlobalName(name) |
f.getAnAttribute().hasName("noreturn")
or
exists(string name | f.hasGlobalOrStdName(name) |
name = "exit" or
name = "_exit" or
name = "abort" or
name = "__assert_fail" or
name = "longjmp" or
name = "__builtin_unreachable"
) or
)
or
CustomOptions::exits(f) // old Options.qll
}
@@ -92,7 +91,7 @@ class Options extends string
* By default holds only for `fgets`.
*/
predicate alwaysCheckReturnValue(Function f) {
f.hasGlobalName("fgets") or
f.hasGlobalOrStdName("fgets") or
CustomOptions::alwaysCheckReturnValue(f) // old Options.qll
}
@@ -108,14 +107,11 @@ class Options extends string
fc.isInMacroExpansion()
or
// common way of sleeping using select:
(fc.getTarget().hasGlobalName("select") and
fc.getArgument(0).getValue() = "0")
fc.getTarget().hasGlobalName("select") and
fc.getArgument(0).getValue() = "0"
or
CustomOptions::okToIgnoreReturnValue(fc) // old Options.qll
}
}
Options getOptions()
{
any()
}
Options getOptions() { any() }

View File

@@ -1,26 +1,35 @@
/**
* Provides heuristics to find "todo" and "fixme" comments (in all caps).
*/
import cpp
string getCommentTextCaptioned(Comment c, string caption) {
(caption = "TODO" or caption = "FIXME") and
exists (string commentContents, string commentBody, int offset, string interestingSuffix, int endOfLine, string dontCare, string captionedLine, string followingLine
| commentContents = c.getContents()
and commentContents.matches("%" + caption + "%")
and // Add some '\n's so that any interesting line, and its
// following line, will definitely begin and end with '\n'.
commentBody = commentContents.regexpReplaceAll("(?s)^/\\*(.*)\\*/$|^//(.*)$", "\n$1$2\n\n")
and dontCare = commentBody.regexpFind("\\n[/* \\t\\x0B\\f\\r]*" + caption, _, offset)
and interestingSuffix = commentBody.suffix(offset)
and endOfLine = interestingSuffix.indexOf("\n", 1, 0)
and captionedLine = interestingSuffix.prefix(endOfLine).regexpReplaceAll("^[/*\\s]*" + caption + "\\s*:?", "").trim()
and followingLine = interestingSuffix.prefix(interestingSuffix.indexOf("\n", 2, 0)).suffix(endOfLine).trim()
and if captionedLine = ""
then result = caption + " comment"
else if followingLine = ""
then result = caption + " comment: " + captionedLine
else result = caption + " comment: " + captionedLine + " [...]"
)
(caption = "TODO" or caption = "FIXME") and
exists(
string commentContents, string commentBody, int offset, string interestingSuffix, int endOfLine,
string dontCare, string captionedLine, string followingLine
|
commentContents = c.getContents() and
commentContents.matches("%" + caption + "%") and
// Add some '\n's so that any interesting line, and its
// following line, will definitely begin and end with '\n'.
commentBody = commentContents.regexpReplaceAll("(?s)^/\\*(.*)\\*/$|^//(.*)$", "\n$1$2\n\n") and
dontCare = commentBody.regexpFind("\\n[/* \\t\\x0B\\f\\r]*" + caption, _, offset) and
interestingSuffix = commentBody.suffix(offset) and
endOfLine = interestingSuffix.indexOf("\n", 1, 0) and
captionedLine =
interestingSuffix
.prefix(endOfLine)
.regexpReplaceAll("^[/*\\s]*" + caption + "\\s*:?", "")
.trim() and
followingLine =
interestingSuffix.prefix(interestingSuffix.indexOf("\n", 2, 0)).suffix(endOfLine).trim() and
if captionedLine = ""
then result = caption + " comment"
else
if followingLine = ""
then result = caption + " comment: " + captionedLine
else result = caption + " comment: " + captionedLine + " [...]"
)
}

View File

@@ -6,44 +6,42 @@ import cpp
bindingset[line]
private predicate looksLikeCode(string line) {
exists(string trimmed |
// trim leading and trailing whitespace, and HTML codes:
// trim leading and trailing whitespace, and HTML codes:
// * HTML entities in common notation (e.g. &amp;gt; and &amp;eacute;)
// * HTML entities in decimal notation (e.g. a&amp;#768;)
// * HTML entities in hexadecimal notation (e.g. &amp;#x705F;)
trimmed = line.regexpReplaceAll("(?i)(^\\s+|&#?[a-z0-9]{1,31};|\\s+$)", "")
|
(
// Match comment lines ending with '{', '}' or ';'
trimmed.regexpMatch(".*[{};]") and
(
// Match comment lines ending with '{', '}' or ';'
trimmed.regexpMatch(".*[{};]") and
(
// If this line looks like code because it ends with a closing
// brace that's preceded by something other than whitespace ...
trimmed.regexpMatch(".*.\\}")
implies
// ... then there has to be ") {" (or some variation)
// on the line, suggesting it's a statement like `if`
// or a function definition. Otherwise it's likely to be a
// benign use of braces such as a JSON example or explanatory
// pseudocode.
trimmed.regexpMatch(".*(\\)|const|volatile|override|final|noexcept|&)\\s*\\{.*")
)
) or (
// Match comment lines that look like preprocessor code
trimmed.regexpMatch("#\\s*(include|define|undef|if|ifdef|ifndef|elif|else|endif|error|pragma)\\b.*")
// If this line looks like code because it ends with a closing
// brace that's preceded by something other than whitespace ...
trimmed.regexpMatch(".*.\\}")
implies
// ... then there has to be ") {" (or some variation)
// on the line, suggesting it's a statement like `if`
// or a function definition. Otherwise it's likely to be a
// benign use of braces such as a JSON example or explanatory
// pseudocode.
trimmed.regexpMatch(".*(\\)|const|volatile|override|final|noexcept|&)\\s*\\{.*")
)
) and (
// Exclude lines that start with '>' or contain '@{' or '@}'.
// To account for the code generated by protobuf, we also insist that the comment
// does not begin with `optional` or `repeated` and end with a `;`, which would
// normally be a quoted bit of literal `.proto` specification above the associated
// declaration.
// To account for emacs folding markers, we ignore any line containing
// `{{{` or `}}}`.
// Finally, some code tends to embed GUIDs in comments, so we also exclude those.
not trimmed
or
// Match comment lines that look like preprocessor code
trimmed
.regexpMatch("#\\s*(include|define|undef|if|ifdef|ifndef|elif|else|endif|error|pragma)\\b.*")
) and
// Exclude lines that start with '>' or contain '@{' or '@}'.
// To account for the code generated by protobuf, we also insist that the comment
// does not begin with `optional` or `repeated` and end with a `;`, which would
// normally be a quoted bit of literal `.proto` specification above the associated
// declaration.
// To account for emacs folding markers, we ignore any line containing
// `{{{` or `}}}`.
// Finally, some code tends to embed GUIDs in comments, so we also exclude those.
not trimmed
.regexpMatch("(>.*|.*[\\\\@][{}].*|(optional|repeated) .*;|.*(\\{\\{\\{|\\}\\}\\}).*|\\{[-0-9a-zA-Z]+\\})")
)
)
}
@@ -76,7 +74,6 @@ private predicate preprocLine(File f, int line) {
private int lineInFile(CppStyleComment c, File f) {
f = c.getFile() and
result = c.getLocation().getStartLine() and
// Ignore comments on the same line as a preprocessor directive.
not preprocLine(f, result)
}
@@ -119,12 +116,11 @@ class CommentBlock extends Comment {
this instanceof CppStyleComment
implies
not exists(CppStyleComment pred, File f | lineInFile(pred, f) + 1 = lineInFile(this, f))
) and (
// Ignore comments on the same line as a preprocessor directive.
not exists(Location l |
l = this.getLocation() and
preprocLine(l.getFile(), l.getStartLine())
)
) and
// Ignore comments on the same line as a preprocessor directive.
not exists(Location l |
l = this.getLocation() and
preprocLine(l.getFile(), l.getStartLine())
)
}

View File

@@ -11,26 +11,26 @@
* @tags maintainability
* documentation
*/
import cpp
import cpp
predicate isCommented(FunctionDeclarationEntry f) {
exists(Comment c | c.getCommentedElement() = f)
}
// Uses of 'f' in 'other'
Call uses(File other, Function f) {
result.getTarget() = f and result.getFile() = other
}
Call uses(File other, Function f) { result.getTarget() = f and result.getFile() = other }
from File callerFile, Function f, Call use, int numCalls
where numCalls = strictcount(File other | exists(uses(other, f)) and other != f.getFile())
and not isCommented(f.getADeclarationEntry())
and not f instanceof Constructor
and not f instanceof Destructor
and not f.hasName("operator=")
and f.getMetrics().getNumberOfLinesOfCode() >= 5
and numCalls > 1
and use = uses(callerFile, f)
and callerFile != f.getFile()
select f, "Functions called from other files should be documented (called from $@).", use, use.getFile().getRelativePath()
where
numCalls = strictcount(File other | exists(uses(other, f)) and other != f.getFile()) and
not isCommented(f.getADeclarationEntry()) and
not f instanceof Constructor and
not f instanceof Destructor and
not f.hasName("operator=") and
f.getMetrics().getNumberOfLinesOfCode() >= 5 and
numCalls > 1 and
use = uses(callerFile, f) and
callerFile != f.getFile()
select f, "Functions called from other files should be documented (called from $@).", use,
use.getFile().getRelativePath()

View File

@@ -9,6 +9,7 @@
* documentation
* external/cwe/cwe-546
*/
import cpp
import Documentation.CaptionedComments

View File

@@ -9,10 +9,10 @@
* documentation
* external/cwe/cwe-546
*/
import cpp
import Documentation.CaptionedComments
from Comment c, string message
where message = getCommentTextCaptioned(c, "TODO")
select c, message

View File

@@ -10,10 +10,14 @@
* statistical
* non-attributable
*/
import cpp
from MetricFunction f, int n
where n = f.getNumberOfLines() and n > 100 and
f.getCommentRatio() <= 0.02 and
not f.isMultiplyDefined()
select f, "Poorly documented function: fewer than 2% comments for a function of " + n.toString() + " lines."
where
n = f.getNumberOfLines() and
n > 100 and
f.getCommentRatio() <= 0.02 and
not f.isMultiplyDefined()
select f,
"Poorly documented function: fewer than 2% comments for a function of " + n.toString() + " lines."

View File

@@ -11,20 +11,20 @@
import cpp
predicate markedAsNonterminating(Loop l) {
exists(Comment c | c.getContents().matches("%@non-terminating@%") |
c.getCommentedElement() = l
)
exists(Comment c | c.getContents().matches("%@non-terminating@%") | c.getCommentedElement() = l)
}
Stmt exitFrom(Loop l) {
l.getAChild+() = result and
(result instanceof ReturnStmt or
exists(BreakStmt break | break = result |
not l.getAChild*() = break.getTarget())
(
result instanceof ReturnStmt
or
exists(BreakStmt break | break = result | not l.getAChild*() = break.getTarget())
)
}
from Loop l, Stmt exit
where markedAsNonterminating(l) and
exit = exitFrom(l)
where
markedAsNonterminating(l) and
exit = exitFrom(l)
select exit, "$@ should not be exited.", l, "This permanent loop"

View File

@@ -1,7 +1,7 @@
/**
* @name Unbounded loop
* @description All loops should have a fixed upper bound; the counter should also be incremented along all paths within the loop.
This check excludes loops that are meant to be nonterminating (like schedulers).
* This check excludes loops that are meant to be nonterminating (like schedulers).
* @kind problem
* @id cpp/jpl-c/loop-bounds
* @problem.severity warning
@@ -30,7 +30,8 @@ predicate upperBoundCheck(Loop loop, VariableAccess checked) {
rop.getGreaterOperand().(VariableAccess).getTarget().isConst() or
validVarForBound(loop, rop.getGreaterOperand().(VariableAccess).getTarget())
) and
not rop.getGreaterOperand() instanceof CharLiteral)
not rop.getGreaterOperand() instanceof CharLiteral
)
}
predicate lowerBoundCheck(Loop loop, VariableAccess checked) {
@@ -43,20 +44,24 @@ predicate lowerBoundCheck(Loop loop, VariableAccess checked) {
rop.getLesserOperand().(VariableAccess).getTarget().isConst() or
validVarForBound(loop, rop.getLesserOperand().(VariableAccess).getTarget())
) and
not rop.getLesserOperand() instanceof CharLiteral)
not rop.getLesserOperand() instanceof CharLiteral
)
}
VariableAccess getAnIncrement(Variable var) {
result.getTarget() = var and
(
result.getParent() instanceof IncrementOperation
or
or
exists(AssignAddExpr a | a.getLValue() = result and a.getRValue().getValue().toInt() > 0)
or
or
exists(AssignExpr a | a.getLValue() = result |
a.getRValue() =
any(AddExpr ae | ae.getAnOperand() = var.getAnAccess() and
ae.getAnOperand().getValue().toInt() > 0))
any(AddExpr ae |
ae.getAnOperand() = var.getAnAccess() and
ae.getAnOperand().getValue().toInt() > 0
)
)
)
}
@@ -64,62 +69,78 @@ VariableAccess getADecrement(Variable var) {
result.getTarget() = var and
(
result.getParent() instanceof DecrementOperation
or
or
exists(AssignSubExpr a | a.getLValue() = result and a.getRValue().getValue().toInt() > 0)
or
or
exists(AssignExpr a | a.getLValue() = result |
a.getRValue() =
any(SubExpr ae | ae.getLeftOperand() = var.getAnAccess() and
ae.getRightOperand().getValue().toInt() > 0))
any(SubExpr ae |
ae.getLeftOperand() = var.getAnAccess() and
ae.getRightOperand().getValue().toInt() > 0
)
)
)
}
predicate inScope(Loop l, Stmt s) {
l.getAChild*() = s
}
predicate inScope(Loop l, Stmt s) { l.getAChild*() = s }
predicate reachesNoInc(VariableAccess source, ControlFlowNode target) {
(upperBoundCheck(_, source) and source.getASuccessor() = target) or
exists(ControlFlowNode mid | reachesNoInc(source, mid) and not mid = getAnIncrement(source.getTarget()) |
target = mid.getASuccessor() and
inScope(source.getEnclosingStmt(), target.getEnclosingStmt()))
upperBoundCheck(_, source) and source.getASuccessor() = target
or
exists(ControlFlowNode mid |
reachesNoInc(source, mid) and not mid = getAnIncrement(source.getTarget())
|
target = mid.getASuccessor() and
inScope(source.getEnclosingStmt(), target.getEnclosingStmt())
)
}
predicate reachesNoDec(VariableAccess source, ControlFlowNode target) {
(lowerBoundCheck(_, source) and source.getASuccessor() = target) or
exists(ControlFlowNode mid | reachesNoDec(source, mid) and not mid = getADecrement(source.getTarget()) |
target = mid.getASuccessor() and
inScope(source.getEnclosingStmt(), target.getEnclosingStmt()))
}
predicate hasSafeBound(Loop l) {
exists(VariableAccess bound | upperBoundCheck(l, bound) |
not reachesNoInc(bound, bound)
) or exists(VariableAccess bound | lowerBoundCheck(l, bound) |
not reachesNoDec(bound, bound)
) or exists(l.getControllingExpr().getValue())
}
predicate markedAsNonterminating(Loop l) {
exists(Comment c | c.getContents().matches("%@non-terminating@%") |
c.getCommentedElement() = l
lowerBoundCheck(_, source) and source.getASuccessor() = target
or
exists(ControlFlowNode mid |
reachesNoDec(source, mid) and not mid = getADecrement(source.getTarget())
|
target = mid.getASuccessor() and
inScope(source.getEnclosingStmt(), target.getEnclosingStmt())
)
}
predicate hasSafeBound(Loop l) {
exists(VariableAccess bound | upperBoundCheck(l, bound) | not reachesNoInc(bound, bound))
or
exists(VariableAccess bound | lowerBoundCheck(l, bound) | not reachesNoDec(bound, bound))
or
exists(l.getControllingExpr().getValue())
}
predicate markedAsNonterminating(Loop l) {
exists(Comment c | c.getContents().matches("%@non-terminating@%") | c.getCommentedElement() = l)
}
from Loop loop, string msg
where not hasSafeBound(loop) and
not markedAsNonterminating(loop) and
(
(
not upperBoundCheck(loop, _) and
not lowerBoundCheck(loop, _) and
msg = "This loop does not have a fixed bound."
) or exists(VariableAccess bound | upperBoundCheck(loop, bound) and
reachesNoInc(bound, bound) and
msg = "The loop counter " + bound.getTarget().getName() + " is not always incremented in the loop body."
) or exists(VariableAccess bound | lowerBoundCheck(loop, bound) and
reachesNoDec(bound, bound) and
msg = "The loop counter " + bound.getTarget().getName() + " is not always decremented in the loop body."
)
where
not hasSafeBound(loop) and
not markedAsNonterminating(loop) and
(
not upperBoundCheck(loop, _) and
not lowerBoundCheck(loop, _) and
msg = "This loop does not have a fixed bound."
or
exists(VariableAccess bound |
upperBoundCheck(loop, bound) and
reachesNoInc(bound, bound) and
msg =
"The loop counter " + bound.getTarget().getName() +
" is not always incremented in the loop body."
)
or
exists(VariableAccess bound |
lowerBoundCheck(loop, bound) and
reachesNoDec(bound, bound) and
msg =
"The loop counter " + bound.getTarget().getName() +
" is not always decremented in the loop body."
)
)
select loop, msg

View File

@@ -13,14 +13,15 @@
import cpp
class RecursiveCall extends FunctionCall {
RecursiveCall() {
this.getTarget().calls*(this.getEnclosingFunction())
}
RecursiveCall() { this.getTarget().calls*(this.getEnclosingFunction()) }
}
from RecursiveCall call, string msg
where if (call.getTarget() = call.getEnclosingFunction()) then
msg = "This call directly invokes its containing function $@."
else
msg = "The function " + call.getEnclosingFunction() + " is indirectly recursive via this call to $@."
where
if call.getTarget() = call.getEnclosingFunction()
then msg = "This call directly invokes its containing function $@."
else
msg =
"The function " + call.getEnclosingFunction() +
" is indirectly recursive via this call to $@."
select call, msg, call.getTarget(), call.getTarget().getName()

View File

@@ -23,12 +23,17 @@ class Initialization extends Function {
class Allocation extends FunctionCall {
Allocation() {
exists(string name | name = this.getTarget().getName() |
name = "malloc" or name = "calloc" or name = "alloca" or
name = "sbrk" or name = "valloc")
name = "malloc" or
name = "calloc" or
name = "alloca" or
name = "sbrk" or
name = "valloc"
)
}
}
from Function f, Allocation a
where not f instanceof Initialization and
a.getEnclosingFunction() = f
where
not f instanceof Initialization and
a.getEnclosingFunction() = f
select a, "Dynamic memory allocation is only allowed during initialization."

View File

@@ -14,8 +14,10 @@ import cpp
class ForbiddenCall extends FunctionCall {
ForbiddenCall() {
exists(string name | name = this.getTarget().getName() |
name = "task_delay" or name = "taskDelay" or
name = "sleep" or name = "nanosleep" or
name = "task_delay" or
name = "taskDelay" or
name = "sleep" or
name = "nanosleep" or
name = "clock_nanosleep"
)
}

View File

@@ -12,20 +12,22 @@
import Semaphores
LockOperation maybeLocked(Function f) {
result.getEnclosingFunction() = f or
exists(Function g | f.calls(g) |
result = maybeLocked(g)
)
result.getEnclosingFunction() = f
or
exists(Function g | f.calls(g) | result = maybeLocked(g))
}
predicate intraproc(LockOperation inner, string msg, LockOperation outer) {
inner = outer.getAReachedNode() and outer.getLocked() != inner.getLocked() and
inner = outer.getAReachedNode() and
outer.getLocked() != inner.getLocked() and
msg = "This lock operation is nested in a $@."
}
predicate interproc(FunctionCall inner, string msg, LockOperation outer) {
inner = outer.getAReachedNode() and
exists(LockOperation lock | lock = maybeLocked(inner.getTarget()) and lock.getLocked() != outer.getLocked() |
exists(LockOperation lock |
lock = maybeLocked(inner.getTarget()) and lock.getLocked() != outer.getLocked()
|
msg = "This call may perform a " + lock.say() + " while under the effect of a $@."
)
}

View File

@@ -11,6 +11,8 @@
import Semaphores
from FunctionCall call, string kind
where (call instanceof SemaphoreCreation and kind = "semaphores") or
(call instanceof LockingPrimitive and kind = "locking primitives")
where
call instanceof SemaphoreCreation and kind = "semaphores"
or
call instanceof LockingPrimitive and kind = "locking primitives"
select call, "Use of " + kind + " should be avoided."

View File

@@ -17,12 +17,17 @@ predicate lockOrder(LockOperation outer, LockOperation inner) {
}
int orderCount(Declaration outerLock, Declaration innerLock) {
result = strictcount(LockOperation outer, LockOperation inner |
outer.getLocked() = outerLock and inner.getLocked() = innerLock and
lockOrder(outer, inner))
result =
strictcount(LockOperation outer, LockOperation inner |
outer.getLocked() = outerLock and
inner.getLocked() = innerLock and
lockOrder(outer, inner)
)
}
from LockOperation outer, LockOperation inner
where lockOrder(outer, inner)
and orderCount(outer.getLocked(), inner.getLocked()) <= orderCount(inner.getLocked(), outer.getLocked())
where
lockOrder(outer, inner) and
orderCount(outer.getLocked(), inner.getLocked()) <=
orderCount(inner.getLocked(), outer.getLocked())
select inner, "Out-of-order locks: A " + inner.say() + " usually precedes a $@.", outer, outer.say()

View File

@@ -4,29 +4,31 @@
import cpp
class SemaphoreCreation extends FunctionCall {
SemaphoreCreation() {
exists(string name | name = this.getTarget().getName() |
name = "semBCreate" or name = "semMCreate" or name = "semCCreate" or
name = "semBCreate" or
name = "semMCreate" or
name = "semCCreate" or
name = "semRWCreate"
)
}
Variable getSemaphore() {
result.getAnAccess() = this.getParent().(Assignment).getLValue()
}
Variable getSemaphore() { result.getAnAccess() = this.getParent().(Assignment).getLValue() }
}
abstract class LockOperation extends FunctionCall {
abstract UnlockOperation getMatchingUnlock();
abstract Declaration getLocked();
abstract string say();
ControlFlowNode getAReachedNode() {
result = this or
result = this
or
exists(ControlFlowNode mid | mid = getAReachedNode() |
not(mid != this.getMatchingUnlock()) and
not mid != this.getMatchingUnlock() and
result = mid.getASuccessor()
)
}
@@ -39,24 +41,21 @@ abstract class UnlockOperation extends FunctionCall {
class SemaphoreTake extends LockOperation {
SemaphoreTake() {
exists(string name | name = this.getTarget().getName() |
name = "semTake" or
name = "semTake"
or
// '_' is a wildcard, so this matches calls like
// semBTakeScalable or semMTake_inline.
name.matches("sem_Take%")
)
}
override Variable getLocked() {
result.getAnAccess() = this.getArgument(0)
}
override Variable getLocked() { result.getAnAccess() = this.getArgument(0) }
override UnlockOperation getMatchingUnlock() {
result.(SemaphoreGive).getLocked() = this.getLocked()
}
override string say() {
result = "semaphore take of " + getLocked().getName()
}
override string say() { result = "semaphore take of " + getLocked().getName() }
}
class SemaphoreGive extends UnlockOperation {
@@ -67,14 +66,9 @@ class SemaphoreGive extends UnlockOperation {
)
}
Variable getLocked() {
result.getAnAccess() = this.getArgument(0)
}
override LockOperation getMatchingLock() {
this = result.getMatchingUnlock()
}
Variable getLocked() { result.getAnAccess() = this.getArgument(0) }
override LockOperation getMatchingLock() { this = result.getMatchingUnlock() }
}
class LockingPrimitive extends FunctionCall, LockOperation {
@@ -84,18 +78,14 @@ class LockingPrimitive extends FunctionCall, LockOperation {
)
}
override Function getLocked() {
result = this.getTarget()
}
override Function getLocked() { result = this.getTarget() }
override UnlockOperation getMatchingUnlock() {
result.(UnlockingPrimitive).getTarget().getName() =
this.getTarget().getName().replaceAll("Lock", "Unlock")
}
override string say() {
result = "call to " + getLocked().getName()
}
override string say() { result = "call to " + getLocked().getName() }
}
class UnlockingPrimitive extends FunctionCall, UnlockOperation {
@@ -105,11 +95,7 @@ class UnlockingPrimitive extends FunctionCall, UnlockOperation {
)
}
Function getLocked() {
result = getMatchingLock().getLocked()
}
Function getLocked() { result = getMatchingLock().getLocked() }
override LockOperation getMatchingLock() {
this = result.getMatchingUnlock()
}
override LockOperation getMatchingLock() { this = result.getMatchingUnlock() }
}

View File

@@ -15,8 +15,11 @@ import cpp
class ForbiddenFunction extends Function {
ForbiddenFunction() {
exists(string name | name = this.getName() |
name = "setjmp" or name = "longjmp" or
name = "sigsetjmp" or name = "siglongjmp")
name = "setjmp" or
name = "longjmp" or
name = "sigsetjmp" or
name = "siglongjmp"
)
}
}

View File

@@ -8,15 +8,14 @@
* readability
* external/jpl
*/
import cpp
predicate hasInitializer(EnumConstant c) {
c.getInitializer().fromSource()
}
predicate hasInitializer(EnumConstant c) { c.getInitializer().fromSource() }
/** Does this have an initializer that is not just a ref to another constant in the same enum? */
predicate hasNonReferenceInitializer(EnumConstant c) {
exists (Initializer init |
exists(Initializer init |
init = c.getInitializer() and
init.fromSource() and
not init.getExpr().(EnumConstantAccess).getTarget().getDeclaringEnum() = c.getDeclaringEnum()
@@ -24,14 +23,13 @@ predicate hasNonReferenceInitializer(EnumConstant c) {
}
predicate hasReferenceInitializer(EnumConstant c) {
exists (Initializer init |
exists(Initializer init |
init = c.getInitializer() and
init.fromSource() and
init.getExpr().(EnumConstantAccess).getTarget().getDeclaringEnum() = c.getDeclaringEnum()
)
}
// There exists another constant whose value is implicit, but it's
// not the last one: the last value is okay to use to get the highest
// enum value automatically. It can be followed by aliases though.
@@ -48,15 +46,16 @@ predicate enumThatHasConstantWithImplicitValue(Enum e) {
}
from Enum e, int i
where // e is at position i, and has an explicit value in the source - but
// not just a reference to another enum constant
hasNonReferenceInitializer(e.getEnumConstant(i)) and
// but e is not the first or the last constant of the enum
i != 0 and
exists(e.getEnumConstant(i+1)) and
// and there exists another constant whose value is implicit, but it's
// not the last one: the last value is okay to use to get the highest
// enum value automatically. It can be followed by aliases though.
enumThatHasConstantWithImplicitValue(e)
select e, "In an enumerator list, the = construct should not be used to explicitly initialize members other than the first, unless all items are explicitly initialized."
where
// e is at position i, and has an explicit value in the source - but
// not just a reference to another enum constant
hasNonReferenceInitializer(e.getEnumConstant(i)) and
// but e is not the first or the last constant of the enum
i != 0 and
exists(e.getEnumConstant(i + 1)) and
// and there exists another constant whose value is implicit, but it's
// not the last one: the last value is okay to use to get the highest
// enum value automatically. It can be followed by aliases though.
enumThatHasConstantWithImplicitValue(e)
select e,
"In an enumerator list, the = construct should not be used to explicitly initialize members other than the first, unless all items are explicitly initialized."

View File

@@ -11,7 +11,8 @@
import cpp
from VariableDeclarationEntry v
where v.getVariable() instanceof GlobalVariable and
where
v.getVariable() instanceof GlobalVariable and
v.hasSpecifier("extern") and
not v.getFile() instanceof HeaderFile
select v, v.getName() + " should be declared only in a header file that is included as needed."

View File

@@ -13,9 +13,11 @@
import cpp
from GlobalVariable v
where forex(VariableAccess va | va.getTarget() = v | va.getFile() = v.getDefinitionLocation().getFile())
and not v.hasSpecifier("static")
and strictcount(v.getAnAccess().getEnclosingFunction()) > 1 // If = 1, variable should be function-scope.
and not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
select v, "The global variable " + v.getName() + " is not accessed outside of " + v.getFile().getBaseName()
+ " and could be made static."
where
forex(VariableAccess va | va.getTarget() = v | va.getFile() = v.getDefinitionLocation().getFile()) and
not v.hasSpecifier("static") and
strictcount(v.getAnAccess().getEnclosingFunction()) > 1 and // If = 1, variable should be function-scope.
not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
select v,
"The global variable " + v.getName() + " is not accessed outside of " + v.getFile().getBaseName() +
" and could be made static."

View File

@@ -12,8 +12,11 @@
import cpp
from GlobalVariable v, Function f
where v.getAnAccess().getEnclosingFunction() = f and
strictcount(v.getAnAccess().getEnclosingFunction()) = 1 and
forall(VariableAccess a | a = v.getAnAccess() | exists(a.getEnclosingFunction())) and
not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
select v, "The variable " + v.getName() + " is only accessed in $@ and should be scoped accordingly.", f, f.getName()
where
v.getAnAccess().getEnclosingFunction() = f and
strictcount(v.getAnAccess().getEnclosingFunction()) = 1 and
forall(VariableAccess a | a = v.getAnAccess() | exists(a.getEnclosingFunction())) and
not v.getADeclarationEntry().getFile() instanceof HeaderFile // intended to be accessed elsewhere
select v,
"The variable " + v.getName() + " is only accessed in $@ and should be scoped accordingly.", f,
f.getName()

View File

@@ -8,27 +8,29 @@
* readability
* external/jpl
*/
import cpp
class LocalVariableOrParameter extends Variable {
LocalVariableOrParameter() {
this instanceof LocalVariable or
this instanceof LocalVariable
or
// A function declaration (i.e. "int foo(int bar);") doesn't usefully
// shadow globals; the parameter should be on the version of the function
// that has a body.
exists(Parameter p | p = this |
p.getFunction().getDefinitionLocation().getFile() = this.getFile() and
exists(p.getFunction().getBlock()))
p.getFunction().getDefinitionLocation().getFile() = this.getFile() and
exists(p.getFunction().getBlock())
)
}
string type() {
if this instanceof Parameter
then result = "Parameter "
else result = "Local variable "
if this instanceof Parameter then result = "Parameter " else result = "Local variable "
}
}
from LocalVariableOrParameter lv, GlobalVariable gv
where lv.getName() = gv.getName() and
lv.getFile() = gv.getFile()
where
lv.getName() = gv.getName() and
lv.getFile() = gv.getFile()
select lv, lv.type() + lv.getName() + " hides the global variable $@.", gv, gv.getName()

View File

@@ -11,7 +11,8 @@
import cpp
/** In its full generality, the rule applies to all functions that
/**
* In its full generality, the rule applies to all functions that
* return non-void, including things like 'printf' and 'close',
* which are routinely not checked because the behavior on success
* is the same as the behavior on failure. The recommendation is
@@ -27,13 +28,15 @@ predicate whitelist(Function f) {
}
from FunctionCall c, string msg
where not c.getTarget().getType() instanceof VoidType
and not whitelist(c.getTarget())
and
(
(c instanceof ExprInVoidContext and msg = "The return value of non-void function $@ is not checked.")
or
(definition(_, c.getParent()) and not definitionUsePair(_, c.getParent(), _) and
msg = "$@'s return value is stored but not checked.")
)
where
not c.getTarget().getType() instanceof VoidType and
not whitelist(c.getTarget()) and
(
c instanceof ExprInVoidContext and
msg = "The return value of non-void function $@ is not checked."
or
definition(_, c.getParent()) and
not definitionUsePair(_, c.getParent(), _) and
msg = "$@'s return value is stored but not checked."
)
select c, msg, c.getTarget() as f, f.getName()

View File

@@ -12,16 +12,18 @@
import JPL_C.Tasks
predicate flow(Parameter p, ControlFlowNode n) {
(exists(p.getAnAccess()) and n = p.getFunction().getBlock()) or
exists(ControlFlowNode mid | flow(p, mid) and not mid = p.getAnAccess() and n = mid.getASuccessor())
exists(p.getAnAccess()) and n = p.getFunction().getBlock()
or
exists(ControlFlowNode mid |
flow(p, mid) and not mid = p.getAnAccess() and n = mid.getASuccessor()
)
}
VariableAccess firstAccess(Parameter p) {
flow(p, result) and result = p.getAnAccess()
}
VariableAccess firstAccess(Parameter p) { flow(p, result) and result = p.getAnAccess() }
from Parameter p, VariableAccess va
where va = firstAccess(p) and p.getFunction() instanceof PublicFunction and
not exists(Expr e | e.isCondition() | e.getAChild*() = va)
where
va = firstAccess(p) and
p.getFunction() instanceof PublicFunction and
not exists(Expr e | e.isCondition() | e.getAChild*() = va)
select va, "This use of parameter " + p.getName() + " has not been checked."

View File

@@ -12,9 +12,9 @@
import semmle.code.cpp.commons.Assertions
from Assertion a, string value, string msg
where value = a.getAsserted().getValue() and
if value.toInt() = 0 then
msg = "This assertion is always false."
else
msg = "This assertion is always true."
where
value = a.getAsserted().getValue() and
if value.toInt() = 0
then msg = "This assertion is always false."
else msg = "This assertion is always true."
select a.getAsserted(), msg

View File

@@ -12,6 +12,7 @@
import semmle.code.cpp.commons.Assertions
from Function f
where f.getMetrics().getNumberOfLinesOfCode() > 10 and
where
f.getMetrics().getNumberOfLinesOfCode() > 10 and
not exists(Assertion a | a.getAsserted().getEnclosingFunction() = f)
select f, "All functions of more than 10 lines should have at least one assertion."

View File

@@ -13,11 +13,16 @@ import cpp
predicate allowedTypedefs(TypedefType t) {
exists(string name | name = t.getName() |
name = "I64" or name = "U64" or
name = "I32" or name = "U32" or
name = "I16" or name = "U16" or
name = "I8" or name = "U8" or
name = "F64" or name = "F32"
name = "I64" or
name = "U64" or
name = "I32" or
name = "U32" or
name = "I16" or
name = "U16" or
name = "I8" or
name = "U8" or
name = "F64" or
name = "F32"
)
}
@@ -25,7 +30,8 @@ predicate allowedTypedefs(TypedefType t) {
* Gets a type which appears literally in the declaration of `d`.
*/
Type getAnImmediateUsedType(Declaration d) {
d.isDefined() and (
d.hasDefinition() and
(
result = d.(Function).getType() or
result = d.(Variable).getType()
)
@@ -48,7 +54,11 @@ predicate problematic(IntegralType t) {
}
from Declaration d, Type usedType
where usedType = getAUsedType*(getAnImmediateUsedType(d)) and problematic(usedType)
where
usedType = getAUsedType*(getAnImmediateUsedType(d)) and
problematic(usedType) and
// Ignore violations for which we do not have a valid location.
and not(d.getLocation() instanceof UnknownLocation)
select d, d.getName() + " uses the basic integral type " + usedType.getName() + " rather than a typedef with size and signedness."
not d.getLocation() instanceof UnknownLocation
select d,
d.getName() + " uses the basic integral type " + usedType.getName() +
" rather than a typedef with size and signedness."

View File

@@ -12,7 +12,9 @@
import cpp
from BinaryOperation parent, BinaryOperation child
where parent.getAnOperand() = child and not child.isParenthesised() and
where
parent.getAnOperand() = child and
not child.isParenthesised() and
(parent instanceof BinaryBitwiseOperation or child instanceof BinaryBitwiseOperation) and
// Some benign cases...
not (parent instanceof BitwiseAndExpr and child instanceof BitwiseAndExpr) and

View File

@@ -46,10 +46,9 @@ predicate inherentlyUnsafe(Function f) {
exists(Variable v | v.getAnAssignedValue().getEnclosingFunction() = f |
v instanceof GlobalVariable or
v.isStatic()
) or
exists(FunctionCall c | c.getEnclosingFunction() = f |
inherentlyUnsafe(c.getTarget())
)
or
exists(FunctionCall c | c.getEnclosingFunction() = f | inherentlyUnsafe(c.getTarget()))
}
/**
@@ -59,7 +58,9 @@ predicate inherentlyUnsafe(Function f) {
* not inherently unsafe.
*/
predicate safeToCall(Function f) {
forall(PointerType paramPointerType | paramPointerType = getAPointerType(f.getAParameter().getType()) |
forall(PointerType paramPointerType |
paramPointerType = getAPointerType(f.getAParameter().getType())
|
paramPointerType.getBaseType().isConst()
) and
not inherentlyUnsafe(f)
@@ -78,12 +79,16 @@ class BooleanExpression extends Expr {
}
predicate hasSideEffect(Expr e) {
e instanceof Assignment or
e instanceof CrementOperation or
e instanceof ExprCall or
e instanceof Assignment
or
e instanceof CrementOperation
or
e instanceof ExprCall
or
exists(Function f | f = e.(FunctionCall).getTarget() and not safeFunctionWhitelist(f) |
inherentlyUnsafe(f) or not safeToCall(f)
) or
)
or
hasSideEffect(e.getAChild())
}

View File

@@ -12,12 +12,13 @@
import cpp
from PreprocessorDirective p
where not p instanceof Include and
not p instanceof Macro and
not p instanceof PreprocessorIf and
not p instanceof PreprocessorElif and
not p instanceof PreprocessorElse and
not p instanceof PreprocessorIfdef and
not p instanceof PreprocessorIfndef and
not p instanceof PreprocessorEndif
where
not p instanceof Include and
not p instanceof Macro and
not p instanceof PreprocessorIf and
not p instanceof PreprocessorElif and
not p instanceof PreprocessorElse and
not p instanceof PreprocessorIfdef and
not p instanceof PreprocessorIfndef and
not p instanceof PreprocessorEndif
select p, "This preprocessor directive is not allowed."

View File

@@ -12,6 +12,7 @@
import cpp
from PreprocessorDirective i
where (i instanceof PreprocessorIf or i instanceof PreprocessorIfdef or i instanceof PreprocessorIfndef)
and not i.getFile() instanceof HeaderFile
where
(i instanceof PreprocessorIf or i instanceof PreprocessorIfdef or i instanceof PreprocessorIfndef) and
not i.getFile() instanceof HeaderFile
select i, "Use of conditional compilation must be kept to a minimum."

View File

@@ -12,6 +12,10 @@
import cpp
from Macro m, string msg
where (m.getHead().matches("%...%") and msg = "The macro " + m.getHead() + " is variadic, and hence not allowed.") or
(m.getBody().matches("%##%") and msg = "The macro " + m.getHead() + " uses token pasting and is not allowed.")
where
m.getHead().matches("%...%") and
msg = "The macro " + m.getHead() + " is variadic, and hence not allowed."
or
m.getBody().matches("%##%") and
msg = "The macro " + m.getHead() + " uses token pasting and is not allowed."
select m, msg

View File

@@ -12,8 +12,10 @@
import cpp
int lineInBlock(File f) {
exists(Block block, Location blockLocation | block.getFile() = f and blockLocation = block.getLocation()|
result in [blockLocation.getStartLine()..blockLocation.getEndLine()]
exists(Block block, Location blockLocation |
block.getFile() = f and blockLocation = block.getLocation()
|
result in [blockLocation.getStartLine() .. blockLocation.getEndLine()]
)
}

View File

@@ -12,43 +12,35 @@
import cpp
class FileWithDirectives extends File {
FileWithDirectives() {
exists(Directive d | d.getFile() = this)
}
FileWithDirectives() { exists(Directive d | d.getFile() = this) }
int getDirectiveLine(Directive d) {
d.getFile() = this and d.getLocation().getStartLine() = result
}
int getDirectiveIndex(Directive d) {
exists(int line | line = getDirectiveLine(d) |
line = rank[result](getDirectiveLine(_))
)
exists(int line | line = getDirectiveLine(d) | line = rank[result](getDirectiveLine(_)))
}
int depth(Directive d) {
exists(int index | index = getDirectiveIndex(d) |
(index = 1 and result = d.depthChange()) or
exists(Directive prev | getDirectiveIndex(prev) = index-1 |
index = 1 and result = d.depthChange()
or
exists(Directive prev | getDirectiveIndex(prev) = index - 1 |
result = d.depthChange() + depth(prev)
)
)
}
Directive lastDirective() {
getDirectiveIndex(result) = max(getDirectiveIndex(_))
}
Directive lastDirective() { getDirectiveIndex(result) = max(getDirectiveIndex(_)) }
}
abstract class Directive extends PreprocessorDirective {
abstract int depthChange();
abstract predicate mismatched();
int depth() {
exists(FileWithDirectives f |
f.depth(this) = result
)
}
int depth() { exists(FileWithDirectives f | f.depth(this) = result) }
}
class IfDirective extends Directive {
@@ -59,6 +51,7 @@ class IfDirective extends Directive {
}
override int depthChange() { result = 1 }
override predicate mismatched() { none() }
}
@@ -69,24 +62,26 @@ class ElseDirective extends Directive {
}
override int depthChange() { result = 0 }
override predicate mismatched() { depth() < 1 }
}
class EndifDirective extends Directive {
EndifDirective() {
this instanceof PreprocessorEndif
}
EndifDirective() { this instanceof PreprocessorEndif }
override int depthChange() { result = -1 }
override predicate mismatched() { depth() < 0 }
}
from FileWithDirectives f, Directive d, string msg
where d.getFile() = f and
if d.mismatched() then (
msg = "'" + d + "' has no matching #if in file " + f.getBaseName() + "."
) else (
d = f.lastDirective() and d.depth() > 0 and msg = "File " + f.getBaseName() +
" ends with " + d.depth() + " unterminated #if directives."
where
d.getFile() = f and
if d.mismatched()
then msg = "'" + d + "' has no matching #if in file " + f.getBaseName() + "."
else (
d = f.lastDirective() and
d.depth() > 0 and
msg = "File " + f.getBaseName() + " ends with " + d.depth() + " unterminated #if directives."
)
select d, msg

View File

@@ -22,16 +22,17 @@ class OneLineStmt extends Stmt {
}
}
int numStmt(File f, int line) {
result = strictcount(OneLineStmt o | o.onLine(f, line))
}
int numStmt(File f, int line) { result = strictcount(OneLineStmt o | o.onLine(f, line)) }
from File f, int line, OneLineStmt o, int cnt
where numStmt(f, line) = cnt
and cnt > 1
and o.onLine(f, line)
and o.getLocation().getStartColumn() =
min(OneLineStmt other, int toMin
| other.onLine(f, line) and toMin = other.getLocation().getStartColumn()
| toMin)
where
numStmt(f, line) = cnt and
cnt > 1 and
o.onLine(f, line) and
o.getLocation().getStartColumn() =
min(OneLineStmt other, int toMin |
other.onLine(f, line) and toMin = other.getLocation().getStartColumn()
|
toMin
)
select o, "This line contains " + cnt + " statements; only one is allowed."

View File

@@ -12,7 +12,8 @@
import cpp
from DeclStmt d
where exists(Variable v1, Variable v2 | v1 = d.getADeclaration() and v2 = d.getADeclaration() |
where
exists(Variable v1, Variable v2 | v1 = d.getADeclaration() and v2 = d.getADeclaration() |
v1 != v2 and
v1.getLocation().getStartLine() = v2.getLocation().getStartLine()
)

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