Skip to content

Quantum: Initial support for C# #19905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9decd51
Initial quantum support for C#
fegge Jun 16, 2025
66eee73
Fixed issues in C# Language.qll
fegge Jun 16, 2025
69e6308
Added C# query to generate CBOM graph
fegge Jun 19, 2025
07a3032
quantum-c#: initial support for ECDSA and RSA signatures
fcasal Jun 19, 2025
36213c5
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 19, 2025
d690a34
quantum-c#: make type precise
fcasal Jun 19, 2025
9970e58
quantum-c#: add HashAlgorithms
fcasal Jun 19, 2025
1762959
quantum-c#: Add HashAlgorithmInstance
fcasal Jun 23, 2025
01b98fc
quantum-c#: Add generic dataflow module
fcasal Jun 23, 2025
3913f44
quanntum-c#: refactor class names
fcasal Jun 23, 2025
b1bbd97
Added initial support for C# block ciphers
fegge Jun 23, 2025
791c260
quantum-c#: Add HashAlgorithmInstance
fcasal Jun 23, 2025
2642e32
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 23, 2025
6d0024d
quantum-c#: refactoring
fcasal Jun 23, 2025
c7caf97
Extended CryptoStreamKeyOperationInstance
fegge Jun 23, 2025
a3e93ce
quantum-c#: add hash operation instance
fcasal Jun 24, 2025
e0430a7
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 24, 2025
9238b12
Added support for the system CSPRNG
fegge Jun 24, 2025
46c037c
Added unit tests for C# block cipher modes
fegge Jun 24, 2025
a7c5f7a
refactoring
fcasal Jun 24, 2025
50c98f6
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 24, 2025
3e70e8e
Updated Stream related data flow
fegge Jun 24, 2025
e488a74
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 24, 2025
f3c436a
quantum-c#: Use stream flows for the HashOperationInstance
fcasal Jun 24, 2025
45ae4d1
Added support for AesGcm and AesCcm
fegge Jun 25, 2025
e643cc4
Updated test suite with AesGcm and AesCcm tests
fegge Jun 25, 2025
5fc267a
Added support for ChaCha20Poly1305
fegge Jun 25, 2025
e344505
quantum-c#: refactor AVCs for hashes and signatures.
fcasal Jun 25, 2025
601d5d1
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 25, 2025
298d226
Added support for bare symmetric algorithms
fegge Jun 25, 2025
2d4af33
quantum-c#: add tests for signatures
fcasal Jun 25, 2025
7c72a65
Add RSAPKCS1Signature formatters
fcasal Jun 25, 2025
7d7b8b2
Merge branch 'tob/quantum-csharp' of github.com:trailofbits/codeql in…
fcasal Jun 25, 2025
39581e2
quantum-c#: add support for RSAPKC1Signature formatters
fcasal Jun 26, 2025
6763f18
quantum-c#: Add hash tests
fcasal Jun 26, 2025
b417436
quantum-c#: Add support for HMACs
fcasal Jun 27, 2025
e0193f8
Fixed spelling
fegge Jul 4, 2025
0fc2427
Fixed missing symmetric algorithm type
fegge Jul 4, 2025
a452350
Added CBOM graph-based unit tests for .NET
fegge Jul 4, 2025
81f06d9
Fixed QL for QL code scanning results for .NET
fegge Jul 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
quantum-c#: make type precise
  • Loading branch information
fcasal committed Jun 19, 2025
commit d690a34e3c4bceb0c0a63ecb095a4c3d33c035fe
24 changes: 15 additions & 9 deletions csharp/ql/lib/experimental/quantum/dotnet/Cryptography.qll
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ private class RSAClass extends Type {
RSAClass() { this.hasFullyQualifiedName("System.Security.Cryptography", "RSA") }
}

// TODO
// class ByteArrayTypeUnionReadOnlyByteSpan extends ArrayType {
// ByteArrayTypeUnionReadOnlyByteSpan() {
// this.hasFullyQualifiedName("System", "Byte[]") or
// this.hasFullyQualifiedName("System", "ReadOnlySpan`1") or
// }
// }
class ByteArrayType extends Type {
ByteArrayType() { this.getName() = "Byte[]" }
}

class ReadOnlyByteSpanType extends Type {
ReadOnlyByteSpanType() { this.getName() = "ReadOnlySpan<Byte>" }
}

abstract class DotNetSigner extends MethodCall {
DotNetSigner() { this.getTarget().getName().matches(["Verify%", "Sign%"]) }

Expand All @@ -102,8 +103,13 @@ abstract class DotNetSigner extends MethodCall {

Expr getSignatureArg() {
this.isVerifier() and
// TODO: Should replace getAChild* with the proper two types byte[] and ReadOnlySpan<byte>
(result = this.getArgument([1, 3]) and result.getType().getAChild*() instanceof ByteType)
(
result = this.getArgument([1, 3]) and
(
result.getType() instanceof ByteArrayType or
result.getType() instanceof ReadOnlyByteSpanType
)
)
}

Expr getSignatureOutput() {
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy