Commit Graph

16798 Commits

Author SHA1 Message Date
Robert Marsh
28fa26629c C++: output iterator flow with user-defined operators 2020-10-13 16:30:47 -07:00
Robert Marsh
6552499545 C++: add model for iter-returning functions 2020-10-13 16:19:15 -07:00
Robert Marsh
4b6ecfb0b1 C++: remove some constexprs in qltest 2020-10-13 16:19:15 -07:00
Robert Marsh
45a27d3296 C++: add tests for back_inserter iterator flow 2020-10-13 16:19:15 -07:00
Robert Marsh
108cc9ea47 C++: fix assignment to *iter++ 2020-10-13 16:19:15 -07:00
Robert Marsh
f39195e339 C++: add tests for assignments to *iter++ 2020-10-13 16:19:15 -07:00
Robert Marsh
b49aa677d0 Merge pull request #4459 from geoffw0/setex
C++: Additional taint flows through std::set
2020-10-13 15:17:54 -04:00
Taus
83937bacae Merge pull request #4448 from RasmusWL/python-simplify-import-modeling
Python: simplify import modeling
2020-10-13 18:08:07 +02:00
Rasmus Wriedt Larsen
2c5996f694 Python: Refactor subprocess_attr type-tracker
Co-authored-by: Taus <tausbn@github.com>
2020-10-13 17:21:21 +02:00
Rasmus Wriedt Larsen
b895641a83 Merge pull request #4464 from tausbn/python-remove-dataflowcfgnode
Python: Get rid of `DataFlowCfgNode`
2020-10-13 15:08:28 +02:00
Rasmus Wriedt Larsen
76c9b8c49f Python: Expose importNode instead of importModule/importMember
Since predicate name `import` is not allowed, I adopted `importNode` as it sort
of matches what `exprNode` does.

---

Due to only using `importMember` in `os_attr` we previously didn't handle
`import os.path as alias` :|

I did creat a hotfix for this (https://github.com/github/codeql/pull/4446), but
in doing so I realized the core of the problem: We're exposing ourselves to
making these kinds of mistakes by having BOTH importModule and importMember, and
we don't really gain anything from doing this!

We do loose the ability to easily only modeling `from mod import val` and not
`import mod.val`, but I don't think that will ever be relevant.

This change will also make us to recognize some invalid code, for example in

    import os.system as runtime_error

we would now model that `runtime_error` is a reference to the `os.system`
function (although the actual import would result in a runtime error).

Overall these are tradeoffs I'm willing to make, as it does makes things simpler
from a QL modeling point of view, and THAT sounds nice 👍
2020-10-13 15:03:22 +02:00
Rasmus Wriedt Larsen
4bfd55f1af Python: Show problem with os.path modeling
This is not a very good test for showing that we don't handle direct imports,
but it was the best I had available without inventing something new. It's very
fragile, since any of these would propagate taint (due to handling all `join`
calls as if the qualifier was a string):

    ospath_alias.join(ts)
    ospath_alias.join(ts, "foo", "bar")

But this test DOES serve the purpose of illustrating that my fix works :D
2020-10-13 14:50:00 +02:00
Taus Brock-Nannestad
1829126230 Python: Get rid of DataFlowCfgNode
Should make modelling data flow nodes that are also specific
subclasses of `ControlFlowNode` a bit smoother.
2020-10-13 13:04:59 +02:00
Erik Krogh Kristensen
83d6d6041a Merge pull request #4462 from erik-krogh/strayTodo
JS: remove stray todo
2020-10-13 12:50:00 +02:00
CodeQL CI
d3f8fb5e53 Merge pull request #4423 from tausbn/python-add-attribute-access-interface
Approved by RasmusWL
2020-10-13 02:56:21 -07:00
Erik Krogh Kristensen
96db3459d0 remove stray todo 2020-10-13 11:48:06 +02:00
CodeQL CI
e2b0c60627 Merge pull request #4449 from max-schaefer/js/api-graphs-type-handling-improvements
Approved by erik-krogh
2020-10-12 11:41:21 -07:00
Robert Marsh
3b7cf7fd27 Merge pull request #4439 from geoffw0/mapex
C++: Additional taint flows through std::map
2020-10-12 14:17:17 -04:00
Max Schaefer
9ac70e3044 JavaScript: Clarify the relationship between MkCanonicalName{Def,Use} with an upper-case M and mkCanonicalName{Def,Use} with a lower-case m. 2020-10-12 16:29:11 +01:00
Arthur Baars
fc4a3426ac Merge pull request #4457 from daniel-beck/file-taint
Java: Track taint through java.io.File constructor and #toURI; URI#toURL
2020-10-12 16:42:11 +02:00
Taus Brock-Nannestad
3288cf1a75 Python: Hopefully final changes to documentation. 2020-10-12 16:38:21 +02:00
Jonas Jensen
24da4cc344 Merge pull request #4421 from jbj/SimpleRangeAnalysis-guard-overflow
C++: Demonstrate overflowing guard bounds
2020-10-12 15:38:13 +02:00
Jonas Jensen
0459248b9f Merge remote-tracking branch 'upstream/main' into SimpleRangeAnalysis-guard-overflow 2020-10-12 14:32:29 +02:00
CodeQL CI
8eb84b2599 Merge pull request #4391 from max-schaefer/js/api-graph-reexport
Approved by asgerf
2020-10-12 05:26:53 -07:00
CodeQL CI
6d1634ef8f Merge pull request #4329 from erik-krogh/DVSA
Approved by esbena
2020-10-12 05:23:29 -07:00
Taus Brock-Nannestad
b07c7abacc Python: Clear up attribute name access QLDoc 2020-10-12 13:49:08 +02:00
Tom Hvitved
35985a9189 Merge pull request #4452 from hvitved/csharp/ssa/overlapping-captured-defs
C#: Avoid overlapping SSA definitions for `ref`/`out` captured variables
2020-10-12 13:01:39 +02:00
Geoffrey White
6440db786d Merge pull request #4420 from jbj/SimpleRangeAnalysis-widen-Expr
C++: SimpleRangeAnalysis: widen recursive *, +, -
2020-10-12 11:20:09 +01:00
Geoffrey White
58727cb8ad C++: Update change note. 2020-10-12 11:01:09 +01:00
Geoffrey White
4363f08b45 C++: Model std::set::emplace and emplace_hint. 2020-10-12 11:01:09 +01:00
Jonas Jensen
30b9d13a45 C++: Correct annotation in test 2020-10-12 11:25:38 +02:00
Geoffrey White
5d87117dc7 C++: Model std::set::lower_bound, upper_bound, equal_range. 2020-10-12 10:10:40 +01:00
Jonas Jensen
9b12ceae8d C++: SimpleRangeAnalysis: widen recursive *, +, -
The number of candidate bounds during the main `SimpleRangeAnalysis`
recursion was in principle always exponential in the size of the
program, but in practice it did not get out of hand when only `+` and
`-` operations were supported. Now that `*` is also supported, the range
analysis started timing out on the SinaMostafanejad/OpenRDM project. The
problematic expressions in that project are of the form

    a*x*x*x + b*x*x + c*x + d

where most of the variables involved are recursive definitions and are
therefore likely to have a large number of candidate bounds.

The fix here is to identify those few binary operations that are most
likely to cause an explosion in the number of bounds and apply widening
to them. Previously, widening was only applied at definitions.
2020-10-12 11:09:01 +02:00
Jonas Jensen
bbeea452e1 C++: Add test with widening of binary Expr 2020-10-12 11:08:41 +02:00
Geoffrey White
fc19bba0bd C++: Model std::set::merge and correct test annotations. 2020-10-12 10:01:57 +01:00
Tom Hvitved
9d1f64d35d C#: Avoid overlapping SSA definitions for ref/out captured variables 2020-10-12 10:52:40 +02:00
Anders Schack-Mulligen
725194a3b8 Merge pull request #4447 from aschackmull/dataflow/postupdate-flow-consistency
Dataflow: Introduce consistency check for flow targeting PostUpdateNodes
2020-10-12 08:56:19 +02:00
Daniel Beck
0c70be145f Track taint through java.io.File constructor and #toURI; URI#toURL 2020-10-10 20:54:55 +02:00
Geoffrey White
c63f7cb409 C++: Taint through emplace from qualifier to return value. 2020-10-09 17:41:24 +01:00
Geoffrey White
270517d379 C++: Revise model of emplace and emplace_hint. Note that 2 of the 3 taint regressions we shouldn't be getting because we don't yet do taint through keys. 2020-10-09 17:27:18 +01:00
Geoffrey White
49c121d370 C++: More test cases covering other std::pair constructors. 2020-10-09 17:22:29 +01:00
Anders Schack-Mulligen
091e3a2931 Dataflow: Adjust test output. 2020-10-09 16:25:14 +02:00
Tom Hvitved
723699a584 C#: Add SSA test for overlapping captured variable definitions 2020-10-09 16:01:19 +02:00
James Fletcher
c8cacb9fee Merge pull request #4451 from github/jf205-patch-2
Fix typo in CodeQL docs template
2020-10-09 14:47:39 +01:00
Geoffrey White
61a78e28ac C++: Fix map::merge. 2020-10-09 14:46:23 +01:00
James Fletcher
42ee136306 Update layout.html 2020-10-09 14:33:45 +01:00
Erik Krogh Kristensen
a0cbeb6093 add change note 2020-10-09 14:54:34 +02:00
Erik Krogh Kristensen
2fb19f0b11 refactor into a single regular expression with two capture groups 2020-10-09 14:50:16 +02:00
Erik Krogh Kristensen
f6f8bbd1d8 Update javascript/ql/src/semmle/javascript/frameworks/ServerLess.qll
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
2020-10-09 14:46:31 +02:00
Anders Schack-Mulligen
1c043447e8 Dataflow: Introduce consistency check for flow targeting PostUpdateNodes. 2020-10-09 14:29:52 +02:00