Skip to content

Commit 57ba0c4

Browse files
committed
C#: Move sinks into System.Security.Cryptography framework code.
1 parent c91d49a commit 57ba0c4

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

csharp/ql/lib/semmle/code/csharp/frameworks/system/security/Cryptography.qll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,23 @@ private class SystemSecurityCryptographyOidCollectionFlowModelCsv extends Summar
4242
]
4343
}
4444
}
45+
46+
/** Sinks for `System.Security.Cryptography`. */
47+
private class SystemSecurityCryptographySinkModelCsv extends SinkModelCsv {
48+
override predicate row(string row) {
49+
row =
50+
[
51+
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateEncryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-encryptor;manual",
52+
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateDecryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-decryptor;manual",
53+
"System.Security.Cryptography;SymmetricAlgorithm;true;set_Key;(System.Byte[]);;Argument[0];encryption-keyprop;manual",
54+
]
55+
}
56+
}
57+
58+
/** Sinks for `Windows.Security.Cryptography.Core`. */
59+
private class WindowsSecurityCryptographyCoreSinkModelCsv extends SinkModelCsv {
60+
override predicate row(string row) {
61+
row =
62+
"Windows.Security.Cryptography.Core;SymmetricKeyAlgorithmProvider;false;CreateSymmetricKey;(Windows.Storage.Streams.IBuffer);;Argument[0];encryption-symmetrickey;manual"
63+
}
64+
}

csharp/ql/lib/semmle/code/csharp/security/cryptography/HardcodedSymmetricEncryptionKey.qll

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,6 @@ module HardcodedSymmetricEncryptionKey {
3939
StringLiteralSource() { this.asExpr() instanceof StringLiteral }
4040
}
4141

42-
private class SymmetricAlgorithmSinkCsv extends SinkModelCsv {
43-
override predicate row(string row) {
44-
row =
45-
[
46-
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateEncryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-encryptor;manual",
47-
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateDecryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-decryptor;manual",
48-
"System.Security.Cryptography;SymmetricAlgorithm;true;set_Key;(System.Byte[]);;Argument[0];encryption-keyprop;manual",
49-
"Windows.Security.Cryptography.Core;SymmetricKeyAlgorithmProvider;false;CreateSymmetricKey;(Windows.Storage.Streams.IBuffer);;Argument[0];encryption-symmetrickey;manual"
50-
]
51-
}
52-
}
53-
5442
private class SymmetricAlgorithmSink extends Sink {
5543
private string kind;
5644

0 commit comments

Comments
 (0)