Commit Graph

21651 Commits

Author SHA1 Message Date
CodeQL CI
0a0bdcca4d Merge pull request #5204 from erik-krogh/inGuard
Approved by asgerf
2021-02-22 02:52:11 -08:00
Asger F
b8e1987cad Update javascript/ql/test/query-tests/DOM/HTML/DuplicateAttributes.html
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
2021-02-22 10:08:56 +00:00
Taus Brock-Nannestad
439f9f1d90 Actions: More cleanup
Removes the checkout action, as this is no longer needed, and folds
the `grep` into `jq`.
2021-02-22 11:05:54 +01:00
Asger Feldthaus
e964771e9c JS: Add test 2021-02-22 09:47:21 +00:00
Mathias Vorreiter Pedersen
f908d2f1de C++: Remove hasTaintFlow from poll and select functions. 2021-02-22 08:54:43 +01:00
Taus Brock-Nannestad
4680b25f23 Actions: Remove dependence on external actions 2021-02-21 15:14:33 +01:00
Rasmus Lerchedahl Petersen
d23a8ad016 Python: elide test output 2021-02-21 13:12:54 +01:00
Rasmus Lerchedahl Petersen
46faba69ff Python: Fix for-iteration of tuples 2021-02-21 12:41:16 +01:00
Rasmus Lerchedahl Petersen
0aecf33fe6 Python: test iteration through overflow parameters
These are in a tuple, so the for-step does not fire
2021-02-21 12:33:04 +01:00
Francis Alexander
45bdb22db8 Switch from sanitizer to tainttracking, formatting and qldoc changes 2021-02-21 16:45:48 +05:30
Artem Smotrakov
43a07bb13a Better sink in SandboxedJexlFlowConfig 2021-02-20 11:17:51 +01:00
luchua-bc
dc799019d0 Add query for Struts and Spring actions 2021-02-20 03:36:21 +00:00
luchua-bc
3d9ac0d094 Add query for enterprise beans 2021-02-20 02:00:42 +00:00
Asger Feldthaus
e9c0f170a1 JS: Restrict names of extracted HTML attributes 2021-02-19 23:28:28 +00:00
Erik Krogh Kristensen
e6009ea8e0 cache getType 2021-02-19 21:25:48 +01:00
Erik Krogh Kristensen
772e78e386 change TypeInference related join-order in module-import predicates 2021-02-19 21:25:44 +01:00
Mathias Vorreiter Pedersen
576a872316 C++: Address review comments. 2021-02-19 20:24:02 +01:00
Mathias Vorreiter Pedersen
f65843a273 Merge pull request #5221 from geoffw0/cwe676
C++: Add CWE-676 tag.
2021-02-19 17:51:54 +01:00
Taus Brock-Nannestad
ca48e57e30 Actions: Peg external actions to specific SHAs 2021-02-19 16:50:08 +01:00
Asger Feldthaus
5264d24f34 JS: Model vue-router 2021-02-19 15:37:24 +00:00
Tamas Vajk
e1b90912de Limit C# codeql analysis to the csharp folder 2021-02-19 16:13:22 +01:00
Mathias Vorreiter Pedersen
299f371715 C++: Accept more test changes. 2021-02-19 16:01:31 +01:00
Geoffrey White
79338052ad C++: Add CWE-676 tag. 2021-02-19 14:55:31 +00:00
Rasmus Wriedt Larsen
40c592ab85 Python: Introduce DataFlowOnlyInternalUse to avoid re-evaluation 2021-02-19 15:29:23 +01:00
Mathias Vorreiter Pedersen
4f23c3546f C++: Don't generate WriteSideEffect instructions for const parameter indirections. 2021-02-19 15:15:51 +01:00
Rasmus Wriedt Larsen
d084261a79 Python: Ignore weak key-sizes from test-code in weak-crypto-key
From looking at old results on LGTM.com, this was quite common (and those alerts
doesn't really provide value).
2021-02-19 15:04:41 +01:00
Rasmus Wriedt Larsen
bfc8ead667 Python: Add example of test-code with weak crypto key 2021-02-19 15:04:14 +01:00
Rasmus Wriedt Larsen
dfa223ac6a Python: Better IntegerLiteral tracking for weak crypto key 2021-02-19 15:03:50 +01:00
Rasmus Wriedt Larsen
a6583345ba Python: Add weak crypto key example through function call
We used to handle this, but no more :(

Adding this example was inspired by looking at results differences
2021-02-19 15:03:49 +01:00
Rasmus Wriedt Larsen
37f0d5a28a Python: Make KeyGeneration range member overrides final
This was the result of an internal dicussion we had about this some time ago.
2021-02-19 15:03:49 +01:00
Rasmus Wriedt Larsen
2a8f720bc6 Python: Port cryptodome models to use API graphs 2021-02-19 15:03:48 +01:00
Rasmus Wriedt Larsen
1eabfbd0e4 Python: Port cryptography models to use API graphs (mostly) 2021-02-19 15:03:47 +01:00
Rasmus Wriedt Larsen
bfbaa85272 Python: Add test of public_key method with cryptodome
Added in 3.10 release https://github.com/Legrandin/pycryptodome/blob/master/Changelog.rst#3100-6-february-2021
2021-02-19 15:03:47 +01:00
Rasmus Wriedt Larsen
8d3170bcb4 Python: Fix bad join in crypto models 2021-02-19 15:03:46 +01:00
Rasmus Wriedt Larsen
32d0790500 Python: Use camelCase for RSA/DSA/ECC
after asking around, this seems to be the right approach
2021-02-19 15:03:45 +01:00
Rasmus Wriedt Larsen
0e9a54e9a9 Python: Rename WeakCrypto to WeakCryptoKey
Since WeakCrypto always makes me think that it's about all weak crypto (like
using MD5, or completely broken ciphers such as ARC4 ro DES) and not just about
weak key generation.
2021-02-19 15:03:44 +01:00
Rasmus Wriedt Larsen
46ad611d57 Python: Port py/weak-crypto-key to use type-tracking
instead of points-to.

Looking at query results also made me realize I didn't supply a very good
"origin" for ECC in cryptography package, so I improved that 👍 -- maybe that
sohuld have been split into multiple commits... too late :(
2021-02-19 15:03:43 +01:00
Shati Patel
d490bea9a9 Merge pull request #5211 from shati-patel/docs-telemetry
Docs (CodeQL for VS Code): Move info about telemetry into codeql.github.com
2021-02-19 13:59:18 +00:00
Shati Patel
97eb98e9eb Emphasize that telemetry is disabled by default 2021-02-19 13:42:47 +00:00
Mathias Vorreiter Pedersen
fef824c37a C++: Implement models for poll, accept and select. 2021-02-19 14:03:54 +01:00
Rasmus Wriedt Larsen
2429c6c450 Python: Rewrite py/weak-crypto-key tests
* Removed backend arugment that is not required
* Added DSA constants (they are just accidentially the same as RSA right now)
* Removed FakeWeakEllipticCurve and used a real weak elliptic curve instead
2021-02-19 13:59:19 +01:00
Rasmus Wriedt Larsen
d5ff477644 Python: Add modeling for pycryptodome PyPI package 2021-02-19 13:59:18 +01:00
Rasmus Wriedt Larsen
6e4c627209 Python: Add modeling for pycryptodomex PyPI package 2021-02-19 13:59:17 +01:00
Rasmus Wriedt Larsen
bd40965afe Python: Add modeling for cryptography PyPI package 2021-02-19 13:59:17 +01:00
Rasmus Wriedt Larsen
1bf9f7d135 Python: Add missing annotations to new crypto tests 2021-02-19 13:59:16 +01:00
Rasmus Wriedt Larsen
11cd0dbbc0 Python: Add concepts for public-key generation
I did spend some time to figure out how to best write `minimumSecureKeySize`
predicate. I wanted to write once and for all the recommended sizes for each
cryptosystem.

I considered making the predicate such as

```codeql
int minimumSecureKeySize() {
    this.getName() = "RSA" and result = 2048
    or
    this.getName() = "DSA" and result = 2048
    or
    this.getName() = "ECC" and result = 244
}
```

but then it would be impossible to add a new model without also being able to
modify the body of this predicate -- which seems like a bad way to start off a
brand new way of modeling things.

So I considered if we could add it to the non-range class, such as

```codeql
class RSAKeyGeneration extends KeyGeneration {
  RSAKeyGeneration() { this.getName() = "RSA" }

  override int minimumSecureKeySize() { result = 2048 }
}
```

This has the major problem that when you're writing the models for a new
API (and therefore extending KeyGeneration::Range), there is no way for you to
see that you need to take this extra step :| (also problem about how we should
define `minimumSecureKeySize` on `KeyGeneration` class then, since if we make it
abstract, we effectively disable the ability to refine `KeyGeneration` since any
subclass must provide an implementation.)

So, therefore I ended up with this solution ;)
2021-02-19 13:59:16 +01:00
Taus Brock-Nannestad
6095138acc Actions: Address comments on change note CI check
- Fail the CI check if change note is missing.
- Disregards changes outside of `*/ql/src`.
- Runs the workflow on label changes, and upon moving the PR out of
  draft mode.
- Only fails the CI check if the PR is out of draft.
- Changes label to `no-change-note-required`.
2021-02-19 13:55:35 +01:00
Rasmus Wriedt Larsen
4ab61bb088 Python: Add a few tests for crypto frameworks
Tests working can be verified by running

```
ls ql/python/ql/test/experimental/library-tests/frameworks/crypto*/*.py | xargs -L1 sh -c 'python $0 || exit 255'
```
2021-02-19 13:26:45 +01:00
Felicity Chapman
f9ff1f2c9c Remove personal assignment
This is part of the work to revise the process for requesting docs content team reviews on pull requests.
2021-02-19 11:38:15 +00:00
Rasmus Wriedt Larsen
a19da54c9e Python: Exclude flask.request imports as RemoteFlowSource
When I changed the taint modeling in 19b7ea8d85, that obviously also means that
some of the related locations for alerts will change. So that's why all the
examples needs to be updated.

Besides this, I had to fix a minor problem with having too many alerts. If
running a query agaisnt code like in the example below, there would be 3 alerts,
2 of them originating from the import.

```
from flask import Flask, request
app = Flask(__name__)
@app.route("/route")
def route():
    SINK(request.args.get['input'])
```

The 2 import sources where:

- ControlFlowNode for ImportMember
- GSSA Variable request

I removed these from being a RemoteFlowSource, as seen in the diff.

I considered restricting `FlaskRequestSource` so it only extends
`DataFlow::CfgNode` (and make the logic a bit simpler), but I wasn't actually
sure if that was safe to do or not... If you know, please let me know :)
2021-02-19 12:22:05 +01:00