Commit Graph

19777 Commits

Author SHA1 Message Date
Tom Hvitved
d17f88bbcd C#: Remove assembly prefix from all extractor IDs 2020-09-02 10:52:04 +02:00
Calum Grant
7628caa2db C#: Avoid typerefs for constructed types. 2020-09-02 10:52:04 +02:00
Calum Grant
aa99269015 C#: Fix merge conflicts. Unfortunately, the type of symbolEntityCache needed to be the same as objectEntityCache to fix nullability warnings. 2020-09-02 10:52:04 +02:00
Calum Grant
0cfe424fc2 C#: Address review comments. 2020-09-02 10:52:04 +02:00
Calum Grant
9a51192d86 C#: Move TypeRefs into a separate file and import it privately. Reorder imports into alphabetical order. 2020-09-02 10:52:04 +02:00
Calum Grant
4740b47f5d C#: Minor edits 2020-09-02 10:52:04 +02:00
Calum Grant
f4b1594461 C#: Unqualify method names and nested types. 2020-09-02 10:52:04 +02:00
Calum Grant
f61fdc6891 C#: Only resolve a single, canonical type for each typeref. 2020-09-02 10:52:04 +02:00
Calum Grant
90517580a5 C#: Address review comment: Make dictionary type more specific. 2020-09-02 10:52:04 +02:00
Calum Grant
cd51a67c0d C#: Take nullability into account when creating symbol entities. Otherwise, an entity with the wrong (cached) nullability could be created. 2020-09-02 10:52:04 +02:00
Calum Grant
d1cde2a815 C#: Address review comment. 2020-09-02 10:52:03 +02:00
Calum Grant
4657ddcb7c C#: Avoid qualifying explicit interface implementations. 2020-09-02 10:52:03 +02:00
Calum Grant
6649d72a2d C#: Qualify type parameters with the entity that declares them 2020-09-02 10:52:03 +02:00
Calum Grant
6e5c2ef0e7 C#: Remove assembly qualifier from some trap-ids. 2020-09-02 10:52:03 +02:00
Calum Grant
29b3759655 Merge pull request #3961 from tausbn/python-add-typetracker
Python: Add type tracker and step summary implementation.
2020-09-02 09:42:14 +01:00
Mathias Vorreiter Pedersen
9887d8b7eb C++: Remove redundant rules 2020-09-02 10:33:12 +02:00
Erik Krogh Kristensen
f0a0f41c3c allow urls that are prefixed with # or ? in js/unsafe-external-link 2020-09-02 10:19:42 +02:00
Jonas Jensen
db45b29806 Merge pull request #4102 from rdmarsh2/rdmarsh2/cpp/input-iterators-1
C++: Basic input iterator models
2020-09-02 07:57:35 +02:00
ubuntu
042d07161c Rename getQueryCall to getQueryCallSink 2020-09-01 22:43:31 +02:00
ubuntu
15562e4814 Update LdapjsSearchOptions 2020-09-01 22:28:58 +02:00
ubuntu
e2e55455c1 Update LdapjsSearchOptions and getQueryCall 2020-09-01 22:23:07 +02:00
Robert Marsh
015bf6e879 C++: Add reverse flow when this ptr is returned 2020-09-01 13:08:44 -07:00
Robert Marsh
2a57fa22e3 C++: handle reference args to iterator operators 2020-09-01 12:52:01 -07:00
Alessio Della Libera
8f00acd4e2 Update javascript/ql/src/experimental/Security/CWE-090/Ldapjs.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-09-01 21:00:49 +02:00
Alessio Della Libera
78ebcee570 Update javascript/ql/src/experimental/Security/CWE-090/Ldapjs.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-09-01 21:00:38 +02:00
Alessio Della Libera
b86b9ba510 Update javascript/ql/src/experimental/Security/CWE-090/LdapInjectionCustomizations.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-09-01 21:00:21 +02:00
Alessio Della Libera
28729915d7 Update javascript/ql/src/experimental/Security/CWE-090/Ldapjs.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-09-01 20:56:25 +02:00
Alessio Della Libera
1b50477fae Update javascript/ql/src/experimental/Security/CWE-090/Ldapjs.qll
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-09-01 20:55:44 +02:00
Alessio Della Libera
44e728016b Update javascript/ql/src/experimental/Security/CWE-090/LdapInjection.qhelp
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2020-09-01 20:54:58 +02:00
Erik Krogh Kristensen
6cbdc7ad8f autoformat 2020-09-01 20:16:49 +02:00
Mathias Vorreiter Pedersen
d4293ad9c3 C++: Fix code after review comments. 2020-09-01 18:25:46 +02:00
Anders Schack-Mulligen
cc61e6117e Merge pull request #3542 from porcupineyhairs/mongoJava
Java : add MongoDB injection sinks
2020-09-01 16:19:17 +02:00
CodeQL CI
311e62f21d Merge pull request #4081 from aschackmull/java/dispatch-ctx-this-param
Approved by aibaars
2020-09-01 15:06:47 +01:00
Ian Lynagh
1cba09dde2 C++: Remove some remnants of the extractor CFG 2020-09-01 14:49:36 +01:00
Rasmus Wriedt Larsen
ab06c459f4 Python: Make validTest error on empty output again
I accidentially disabled that when introducing the ability to handle more than
one OK.
2020-09-01 14:42:11 +02:00
yoff
caa680c72e Merge pull request #4149 from RasmusWL/python-more-additional-taint-steps
Python: more additional taint steps
2020-09-01 14:38:33 +02:00
Rasmus Wriedt Larsen
0cc018fec0 Python: Taint tracking setup alá Go
\## TaintFlow sources

The class `RemoteFlowSource` is very similarly defined as the other languages [C++](ac22e7950c/cpp/ql/src/semmle/code/cpp/security/FlowSources.qll), [Java](6de612a566/java/ql/src/semmle/code/java/dataflow/FlowSources.qll), [C#](fddbce0b7b/csharp/ql/src/semmle/code/csharp/security/dataflow/flowsources/Remote.qll), [JS](78334af354/javascript/ql/src/semmle/javascript/security/dataflow/RemoteFlowSources.qll), and [Go](24b3133e0c/ql/src/semmle/go/security/FlowSources.qll). There are some minor differences:

- Java/C++ defines the class in `FlowSources.qll`
- C# uses `csharp/ql/src/semmle/code/csharp/security/dataflow/flowsources/Remote.qll`, and provide `StoredFlowSource` and `LocalFlowSource` in separate classes.
- JS uses `RemoteFlowSources.qll`.
- JS defines additional predicate `RemoteFlowSource.isUserControlledObject`
- Go uses the class name `UntrustedFlowSource`, but still defined in `ql/src/semmle/go/security/FlowSources.qll`
- Go uses the `::Range` pattern to allow both extensibility and refinement

The big difference is how a RemoteFlowSource is specified:

- Java and C# have all subclasses of `RemoteFlowSource` defined in the same file
- Go and JS defines subclasses for frameworks in the actual framework `.qll` file, and all frameworks are transitively imported by `import go` or `import javascript` (so subclasses are always in scope).
- C++ uses class `RemoteFlowFunction` to do all the heavy lifting (and its subclasses are transitively imported).

\### What we will do

Use file `RemoteFlowSource.qll`, define subclasses in framework library classes.

_Why? Personally I really like it, Go/JS is already doing it, and Tom expressed a preference for doing the same for C# (although that is not what they are doing today)._

Jonas gave this advice:
> Whether you split the definitions between multiple files or keep them all in one file, the property you want is that all definitions are included when the abstract class is included. Otherwise you can get unexpected results via transitive includes.

We will make imports of all frameworks in the same file that defines `RemoteFlowSource`, as it seems to be the least intrusive change. If that turns out to be a problem, we can also move them to `python.qll` (the other way is not so easy).

\## TaintFlow sinks

[JS](473787a426/javascript/ql/src/semmle/javascript/Concepts.qll) and [Go](ecff1e6a16/ql/src/semmle/go/Concepts.qll) defines abstract base classes for interesting sinks in `Concepts.qll` (and all uses the `::Range` pattern in Go).

I really like this idea, since it allows multiple queries to reuse the same sink definitions, and it makes it _easy_ to discover what default sinks are available.

Personally I'm not 100% on board with the naming, but I don't have any good reason to change the naming convention.

\## Framework modeling

Following the model from Go ([example](https://github.com/github/codeql-go/blob/main/ql/src/semmle/go/frameworks/Gin.qll)), I propose that we make every definition in a framework modeling `private`. This allows some greater flexibility in changing our modeling, since we don't need to think about keeping deprecated versions around for a whole year.

It _does_ have the downside that someone writing a query can't reuse the classes/predicates for a framework, but it didn't seem to be too big of a concern. If we need to provide access, we can always make the definitions non-private (the other way is not so easy).

\## Customizations

Also introduced `Customizations.qll` like in JS/Java/Go (to replace `site.qll`)
2020-09-01 14:37:11 +02:00
Taus Brock-Nannestad
6a96c53d15 Python: Add missing getNode invocation 2020-09-01 14:04:31 +02:00
Rasmus Lerchedahl Petersen
8b13a429b7 Python: Address review comments 2020-09-01 14:00:41 +02:00
Taus Brock-Nannestad
26d14aba98 Python: Use nodeFrom/nodeTo instead of pred/succ 2020-09-01 14:00:30 +02:00
CodeQL CI
b9a6183ec2 Merge pull request #4175 from aschackmull/java/adjust-cwe-089-qltest
Approved by aibaars
2020-09-01 12:43:56 +01:00
Erik Krogh Kristensen
2628c05e43 split out comment over multiple lines 2020-09-01 13:12:44 +02:00
Erik Krogh Kristensen
c6947320ea use isAsyncOrGenerator instead of isOrdinary 2020-09-01 13:11:44 +02:00
Arthur Baars
2729d109a5 Merge pull request #4123 from aschackmull/java/records-dataflow
Java: Add data flow for record getters.
2020-09-01 13:02:24 +02:00
Anders Schack-Mulligen
e5d7208c12 Java: Adjust a few qltests. 2020-09-01 12:49:09 +02:00
Arthur Baars
aedfa47cb4 Add missing QHelp files 2020-09-01 12:46:57 +02:00
Rasmus Wriedt Larsen
c5e3333d10 Python: Update expected tests after last commit
I'm pushing too fast it seems
2020-09-01 12:01:34 +02:00
Rasmus Wriedt Larsen
e0cfe8123e Python: Update comments for new taint tests
I see I didn't keep them up to date as I implemented things
2020-09-01 11:58:26 +02:00
Rasmus Lerchedahl Petersen
6d23d7fa0e Python: Test that pointsTo implies data flow
Running the test on a larger database gives some interesting results.
2020-09-01 11:56:22 +02:00
Rasmus Wriedt Larsen
cda88a5e64 Python: Refactor: use DataFlow::Node.asExpr() 2020-09-01 11:53:06 +02:00