Commit Graph

17325 Commits

Author SHA1 Message Date
Asger Feldthaus
c7667d372e JS: Address review comments 2020-10-30 16:25:30 +00:00
Asger Feldthaus
6ab7846e81 JS: Restrict getAContextInput 2020-10-30 09:28:06 +00:00
Asger Feldthaus
fee944ac2a Merge branch 'js/react-hooks' of github.com:asgerf/codeql into js/react-hooks 2020-10-29 10:38:21 +00:00
Asger Feldthaus
a4a6e3beb3 JS: Update dataflow tests 2020-10-29 10:38:09 +00:00
Asger F
581441d585 Update javascript/ql/src/semmle/javascript/frameworks/React.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-10-28 16:29:15 +00:00
Asger F
43336ff5a9 Update change-notes/1.26/analysis-javascript.md
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-10-28 16:29:07 +00:00
Asger Feldthaus
f99db23e7b JS: Add test and fix for contextType 2020-10-28 16:23:36 +00:00
Asger Feldthaus
7ee3846142 JS: Add missing qldoc 2020-10-28 12:43:48 +00:00
Asger Feldthaus
7a3f0095f6 JS: Autoformat 2020-10-28 11:57:23 +00:00
Asger Feldthaus
c03532edfb JS: Change note 2020-10-28 11:57:11 +00:00
Asger Feldthaus
d116b424f4 JS: Add model of react hooks and react-router 2020-10-28 11:57:11 +00:00
Asger Feldthaus
42c03ab2fd JS: Add flow steps through dynamic imports 2020-10-28 11:57:08 +00:00
Asger Feldthaus
a9adb2912a JS: Improve lodash model 2020-10-28 10:09:41 +00:00
Asger Feldthaus
9fc5c0bdb8 JS: Update ComposedFunctions 2020-10-28 10:09:40 +00:00
Asger Feldthaus
7345df63c0 JS: Include DataFlow::AdditionalFlowStep in TaintSteps metric 2020-10-27 08:41:50 +00:00
Rasmus Wriedt Larsen
7993a83750 Merge pull request #4544 from tausbn/python-fix-bad-join-in-use-use-ssa
Python: Fix bad join order in `adjacentUseUseSameVar`
2020-10-23 14:37:27 +02:00
CodeQL CI
bbda22c769 Merge pull request #4534 from RasmusWL/python-update-flask-modeling
Approved by tausbn
2020-10-23 13:28:19 +01:00
Taus Brock-Nannestad
6d81ca12c4 Python: Fix bad join order in adjacentUseUseSameVar 2020-10-23 14:08:45 +02:00
Rasmus Wriedt Larsen
ed0fe29d7d Python: Fix grammar
Co-authored-by: Taus <tausbn@github.com>
2020-10-23 13:53:16 +02:00
Jonas Jensen
08bf464437 Merge pull request #4540 from criemen/printast-performance
C++: Improve PrintAST performance if only individual files are printed
2020-10-23 12:46:34 +02:00
Rasmus Wriedt Larsen
41ec4f8166 Python: Use FlaskModel as workaround name
As suggested by Taus 👍
2020-10-22 19:13:26 +02:00
Cornelius Riemenschneider
6b072686ab C++: Improve PrintAST performance.
This improves the performance of the printAst.ql query by excluding a lot of string concatenations that happen in files unrelated to the one the user is interested in printing.
This is supposed to help the performance of the AST Viewer on bigger databases.
2020-10-22 16:38:52 +02:00
Mathias Vorreiter Pedersen
a1b59e2d6c Merge pull request #4538 from geoffw0/taintbug
C++: Add taint test for memcpy-ing into a vector
2020-10-22 16:05:56 +02:00
Mathias Vorreiter Pedersen
90c027f291 Merge pull request #4532 from geoffw0/wrongtypeformaterr
C++: Harden queries against ErroneousType
2020-10-22 14:21:14 +02:00
Geoffrey White
ceea947f5e C++: Add another test case. 2020-10-22 12:41:23 +01:00
Calum Grant
7544bc872a Merge pull request #3974 from owen-mc/docs/query-classification-and-display
Docs: Query classification and display
2020-10-22 10:01:19 +01:00
Geoffrey White
3cca8443f8 C++: Add memcpy(vector test. 2020-10-22 09:46:07 +01:00
Geoffrey White
227bf91626 C++: Correct test annotation. 2020-10-22 09:45:09 +01:00
Erik Krogh Kristensen
e89e99deaa Merge pull request #4461 from erik-krogh/pyPrint
Python: implement printAst for Python
2020-10-22 09:37:10 +02:00
Rasmus Wriedt Larsen
278c071fe6 Python: Modernise werkzeug FileStorage modeling 2020-10-21 20:36:40 +02:00
Rasmus Wriedt Larsen
d0fdb542e5 Python: Modernise werkzeug MultiDict modeling 2020-10-21 20:30:20 +02:00
Rasmus Wriedt Larsen
b6bd70a5da Python: Modernise flask library modeling
Two interesting things happened while doing this:

1. I found out that you can't use the same name to define a submodule as any
parent module. So we need give unique names to the top-level module, and the
module for modeling the `flask.Flask` class. I randomly choose a new name for
the top-level module to get things moving (and not be stuck in bikeshedding
forever).

2. With this new setup, I wanted to expose the `route` and `add_url_rule`
methods on instances of `flask.Flask`. It wasn't quite obvious how to do so. I
simply lumped them next to `classRef()` and `instance()`, without too much
care. I did consider putting them inside a `instance` module, which would allow
you to access them by `flask::Flask::instance::route()`, but I wasn't quite
sure, and just did something easy to get moving.
2020-10-21 20:30:14 +02:00
Rasmus Wriedt Larsen
62d665ecb3 Python: Fix shared QLDoc for InstanceSource 2020-10-21 19:55:40 +02:00
Rasmus Wriedt Larsen
047a326183 Python: Remove reference to old PR
These have been added to internal tracking issue instead
2020-10-21 19:53:25 +02:00
Aditya Sharad
9ff5142529 Merge pull request #4525 from adityasharad/js/autobuild-github-hidden-folder
JavaScript: Include .github hidden folders in autobuild
2020-10-21 07:10:42 -07:00
Rasmus Wriedt Larsen
a6abee9b3a Merge pull request #4476 from yoff/python-port-sql-injection
Python: Port SqlInjection
2020-10-21 15:55:19 +02:00
Geoffrey White
678e769553 C++: Change note. 2020-10-21 14:52:43 +01:00
Geoffrey White
d97f03c2be C++: Exclude error types from NonPortablePrintf. 2020-10-21 14:51:52 +01:00
yoff
ea4ea6b3e6 Merge pull request #4529 from tausbn/python-remove-cartesian-product-in-tkwoverflownode
Python: Remove bad join in `getCallableScope`
2020-10-21 15:36:38 +02:00
Rasmus Lerchedahl Petersen
060481053a Python: Add note about incompleteness
I was going to do this in an issue, but it makes sense
to have it in the code. We could still add an issue as well.
2020-10-21 15:15:19 +02:00
Rasmus Lerchedahl Petersen
c57c798bfa Python: Add TODO 2020-10-21 15:10:40 +02:00
yoff
ee5221abb4 Apply suggestions from code review
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
2020-10-21 15:08:16 +02:00
Jonas Jensen
2479402a9d Merge pull request #4522 from geoffw0/odasa704
C++: Non-constant format string test case
2020-10-21 14:58:02 +02:00
Jonas Jensen
6a80f3380e Merge pull request #4527 from geoffw0/odasa3940
C++: Improve SizeCheck queries
2020-10-21 14:55:57 +02:00
Taus Brock-Nannestad
31c169daac Python: Remove bad join in getCallableScope
Clause timing report had this suspicious entry

```
CommandInjection.ql-12:DataFlowPublic::Node::getCallableScope#bbf .................. 7.2s
    (4 evaluations with max 6.4s in DataFlowPublic::Node::getCallableScope#bbf/3@i3#119d7b)
```

which indeed was a bad join:
```
Tuple counts for DataFlowPublic::Node::getCallableScope#bbf:
293509   ~2%     {3} r1 = JOIN DataFlowPublic::Node::getCallableScope#bbf#prev_delta AS L WITH DataFlowPublic::TNode#f AS R ON FIRST 1 OUTPUT L.<1>, L.<0>, L.<2>
22337162 ~0%     {3} r2 = JOIN r1 WITH Scope::Scope::getEnclosingScope_dispred#ff_10#join_rhs AS R ON FIRST 1 OUTPUT r1.<1>, r1.<2>, R.<1>
22337162 ~0%     {3} r3 = r2 AND NOT DataFlowPublic::Node::getCallableScope#bbf#prev AS R(r2.<0>, r2.<2>, r2.<1>)
22337162 ~0%     {3} r4 = SCAN r3 OUTPUT r3.<0>, r3.<2>, r3.<1>
722      ~1%     {3} r5 = JOIN r4 WITH m#DataFlowPublic::Node::getCallableScope#bbf AS R ON FIRST 2 OUTPUT r4.<0>, r4.<1>, r4.<2>
722      ~1%     {3} r6 = JOIN r5 WITH m#DataFlowPublic::Node::getCallableScope#bbf AS R ON FIRST 2 OUTPUT r5.<0>, r5.<2>, r5.<1>
722      ~1%     {3} r7 = r6 AND NOT project#DataFlowPrivate::DataFlowCallable::getScope_dispred#ff AS R(r6.<2>)
722      ~1%     {3} r8 = SCAN r7 OUTPUT r7.<0>, r7.<2>, r7.<1>
                 return r8
```

In this case, the join went away by simply moving the helper predicate
out of the class it was situated in (and since it doesn't mention
`this`, it didn't really belong there in the first place).

Result:
```
DataFlowPublic.qll-8:DataFlowPublic::getCallableScope#ff ........................... 26ms
    (4 evaluations with max 15ms in DataFlowPublic::getCallableScope#ff/2@i3#709a9e)
```
2020-10-21 14:45:05 +02:00
yoff
9bd808c924 Merge pull request #4528 from tausbn/python-remove-cartesian-product-in-tkwoverflownode
Python: Prevent early join on `argName` in `getArg`
2020-10-21 14:43:39 +02:00
Rasmus Lerchedahl Petersen
53ff1a32c1 Merge branch 'main' of github.com:github/codeql into python-port-sql-injection 2020-10-21 14:38:02 +02:00
Geoffrey White
ac1e0692bb C++: Exclude error types from WrongTypeFormatArguments. 2020-10-21 13:25:57 +01:00
Rasmus Lerchedahl Petersen
77d4cbc0df Python: Only allow unsafe positional args to extra 2020-10-21 14:21:36 +02:00
Rasmus Lerchedahl Petersen
3a416bce2d Python: Move test annotation 2020-10-21 14:18:16 +02:00