Commit Graph

26405 Commits

Author SHA1 Message Date
Rasmus Wriedt Larsen
0774e985ce Python: Apply suggestions from code review
Co-authored-by: yoff <lerchedahl@gmail.com>
2021-06-23 13:37:38 +02:00
Tamás Vajk
2dc0849b79 Merge pull request #5664 from tamasvajk/feature/stub-generation
C#: Stub generation
2021-06-23 13:33:10 +02:00
Rasmus Wriedt Larsen
447099a1df Python: Update jmespath tests 2021-06-23 13:32:19 +02:00
Artem Smotrakov
0dfb869c5b Apply suggestions from code review
Co-authored-by: Chris Smowton <smowton@github.com>
2021-06-23 13:23:54 +02:00
Mathias Vorreiter Pedersen
d308dd2f40 Update cpp/ql/src/semmle/code/cpp/controlflow/StackVariableReachability.qll
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2021-06-23 11:54:56 +02:00
Mathias Vorreiter Pedersen
90633b9ce1 C++: Make the new SQL abstract classes extend 'Function' instead. This is more in line with how we model RemoteFlowFunction. 2021-06-23 11:49:51 +02:00
Mathias Vorreiter Pedersen
6379463bcf Merge branch 'main' into improve-tainted-arithmetic 2021-06-23 11:42:45 +02:00
Tamas Vajk
09dd615c6b Regenerate stubs (add System.Void struct) 2021-06-23 11:38:41 +02:00
Geoffrey White
298f70f082 Merge pull request #6120 from MathiasVP/not-overflow-is-barrier-in-cwe-190
C++: Recognize any non-overflowing arithmetic expression as a barrier for `cpp/uncontrolled-arithmetic`
2021-06-23 10:35:33 +01:00
Tamas Vajk
d698f0ae27 Fix VoidType handling 2021-06-23 11:30:47 +02:00
Mathias Vorreiter Pedersen
9b94f3a650 Merge branch 'main' into improve-tainted-arithmetic 2021-06-23 11:04:08 +02:00
Rasmus Wriedt Larsen
902b450b12 Python: Also model pathlib.Path().open().write()
And this transition to type-trackers also helped fix the missing path
through function calls 👍
2021-06-23 10:50:04 +02:00
Rasmus Wriedt Larsen
39ec8701ca Python: Add FileSystemWriteAccess concept
I made `FileSystemWriteAccess` be a subclass of `FileSystemAccess` (like in [JS](64001cc02c/javascript/ql/src/semmle/javascript/Concepts.qll (L68-L74))), but then I started wondering about how I could  give a good result for `getAPathArgument`, and what would a good result even be? The argument to the `open` call, or the object that the `write` method is called on? I can't see how doing either of these enables us to do anything useful...

So I looked closer at how JS uses `FileSystemWriteAccess`:

1. as sink for zip-slip: 7c51dff0f7/javascript/ql/src/semmle/javascript/security/dataflow/ZipSlipCustomizations.qll (L121)
2. as sink for downloading unsafe files (identified through their extension) through non-secure connections: 89ef6ea4eb/javascript/ql/src/semmle/javascript/security/dataflow/InsecureDownloadCustomizations.qll (L134-L150)
3. as sink for writing untrusted data to a local file  93b1e59d62/javascript/ql/src/semmle/javascript/security/dataflow/HttpToFileAccessCustomizations.qll (L43-L46)

for the 2 first sinks, it's important that `getAPathArgument` has a proper result... so that solves the problem, and highlights that it _can_ be important to give proper results for `getAPathArgument` (if possible).

So I'm trying to do best effort for `f = open(...); f.write(...)`, but with this current code we won't always be able to give a result (as highlighted by the tests). It will also be the case that there are multiple `FileSystemAccess` with the same path-argument, which could be a little strange.

overall, I'm not super confident about the way this new concept and implementation turned out, but it also seems like the best I could come up with right now...

The obvious alternative solution is to NOT make `FileSystemWriteAccess` a subclass of `FileSystemAccess`, but I'm not very tempted to go down this path, given the examples of this being useful above, and just the general notion that we should be able to model writes as being a specialized kind of `FileSystemAccess`.
2021-06-23 10:50:04 +02:00
Rasmus Wriedt Larsen
6a6d6fbe92 Python: Add leading space in some inline tests 2021-06-23 10:50:04 +02:00
Rasmus Wriedt Larsen
13609b2888 Python: Move pathlib tests to Python 3 only tests 2021-06-23 10:50:04 +02:00
Rasmus Wriedt Larsen
e2facd0981 Python: Expand cleartext query tests 2021-06-23 10:50:04 +02:00
Rasmus Wriedt Larsen
5506365b0e Python: Split cleartext tests 2021-06-23 10:50:04 +02:00
Rasmus Wriedt Larsen
c0964617d7 Merge pull request #6111 from tausbn/python-a-few-minor-cleanups
Python: A few minor bits of cleanup
2021-06-23 10:42:41 +02:00
Erik Krogh Kristensen
6cf275bb36 update change-note
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
2021-06-23 10:42:26 +02:00
Erik Krogh Kristensen
700dfcc3a7 add comment about why colors/safe is not safe
Co-authored-by: Esben Sparre Andreasen <esbena@github.com>
2021-06-23 10:39:56 +02:00
Rasmus Wriedt Larsen
c77884b8c4 Python: Apply suggestions from code review
Co-authored-by: Jorge <46056498+jorgectf@users.noreply.github.com>
2021-06-23 10:37:06 +02:00
Rasmus Wriedt Larsen
ae841cdd9b Python: Make import python private in Concepts.qll
Just a mistake that we have never caught on to
2021-06-23 10:32:36 +02:00
Mathias Vorreiter Pedersen
a611e76ed2 C++: Respond to review comments. 2021-06-23 10:28:00 +02:00
Erik Krogh Kristensen
8b5c285ac8 add support for the chokidar library 2021-06-23 09:59:34 +02:00
Artem Smotrakov
14e724bce6 Added sinks for RmiBasedExporter and HessianExporter 2021-06-23 09:53:47 +02:00
Tamas Vajk
133d760659 Regenerate stubs to update nested class names in comments 2021-06-23 09:53:39 +02:00
ihsinme
d61fcfc84b Add files via upload 2021-06-23 10:46:03 +03:00
ihsinme
460fde72ff Add files via upload 2021-06-23 10:44:27 +03:00
Tamas Vajk
9ba1529f19 Fix nested class names in comments of stubs expected test file 2021-06-23 09:38:29 +02:00
Tamas Vajk
b40b6f40b6 Change frameworks folder to _frameworks 2021-06-23 09:26:55 +02:00
Tamas Vajk
5b2be8ce2d Fix code review findings 2021-06-23 09:26:55 +02:00
Tom Hvitved
026bcc72f2 C#: Improve performance of stubbing library 2021-06-23 09:26:54 +02:00
Tamas Vajk
405c008b47 Fix conversion operator stubbing + reduce skipped ctor noise in stubs 2021-06-23 09:26:54 +02:00
Tamas Vajk
e4b02e377c Add .net core and asp.net core stubs 2021-06-23 09:26:54 +02:00
Tamas Vajk
0f18fd6892 Adjust script to handle .net core framework reference 2021-06-23 09:26:54 +02:00
Tamas Vajk
4eee6ef1d9 Handle system.object missing base type 2021-06-23 09:26:54 +02:00
Tamas Vajk
97cd006b2c Add missing required private constructors 2021-06-23 09:26:54 +02:00
Tamas Vajk
d7a93a5367 Move default excluded assembly definition 2021-06-23 09:26:54 +02:00
Tamas Vajk
f597c9a7ed Handle special case of duplicate type constraints 2021-06-23 09:26:54 +02:00
Tamas Vajk
42fcfad0d8 Handle types defined in multiple assemblies 2021-06-23 09:26:54 +02:00
Tamas Vajk
22f3b05170 Handle all structs (simple types, intptr, system.void) 2021-06-23 09:26:54 +02:00
Tamas Vajk
914da6bdd2 Fix various stubbing issues 2021-06-23 09:26:54 +02:00
Tamas Vajk
fec0ddd2d2 Add test for tuples with arity < 2 2021-06-23 09:26:54 +02:00
Tamas Vajk
d7d653b9d2 Fix tuple stubbing with arity < 2 2021-06-23 09:26:54 +02:00
Tamas Vajk
2edfa15472 Reduce size of stubDefaultArguments predicate 2021-06-23 09:26:54 +02:00
Tamas Vajk
e93736f583 Change base class of GeneratedDeclaration to Modifiable 2021-06-23 09:26:54 +02:00
Tamas Vajk
53054290d1 Improve QL check for path match on netcore.app.ref in exluded assemblies 2021-06-23 09:26:54 +02:00
Tamas Vajk
a00c2ccf31 Remove _stub.cs file generation 2021-06-23 09:26:54 +02:00
Tamas Vajk
31795c3e6b Introduce test option to include files from projects 2021-06-23 09:26:54 +02:00
Tamas Vajk
cce7404470 Add csproj generation 2021-06-23 09:26:54 +02:00