-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into remove-conflation-from-out-nodes
- Loading branch information
Showing
19 changed files
with
397 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* @name Cryptographic Operations | ||
* @description List all cryptographic operations found in the database. | ||
* @kind problem | ||
* @problem.severity info | ||
* @id rust/summary/cryptographic-operations | ||
* @tags summary | ||
*/ | ||
|
||
import rust | ||
import codeql.rust.Concepts | ||
import codeql.rust.security.WeakSensitiveDataHashingExtensions | ||
|
||
/** | ||
* Gets the type of cryptographic algorithm `alg`. | ||
*/ | ||
string getAlgorithmType(Cryptography::CryptographicAlgorithm alg) { | ||
alg instanceof Cryptography::EncryptionAlgorithm and result = "EncryptionAlgorithm" | ||
or | ||
alg instanceof Cryptography::HashingAlgorithm and result = "HashingAlgorithm" | ||
or | ||
alg instanceof Cryptography::PasswordHashingAlgorithm and result = "PasswordHashingAlgorithm" | ||
} | ||
|
||
/** | ||
* Gets a feature of cryptographic algorithm `alg`. | ||
*/ | ||
string getAlgorithmFeature(Cryptography::CryptographicAlgorithm alg) { | ||
alg.isWeak() and result = "WEAK" | ||
} | ||
|
||
/** | ||
* Gets a description of cryptographic algorithm `alg`. | ||
*/ | ||
string describeAlgorithm(Cryptography::CryptographicAlgorithm alg) { | ||
result = | ||
getAlgorithmType(alg) + " " + alg.getName() + " " + concat(getAlgorithmFeature(alg), ", ") | ||
} | ||
|
||
/** | ||
* Gets a feature of cryptographic operation `op`. | ||
*/ | ||
string getOperationFeature(Cryptography::CryptographicOperation op) { | ||
result = "inputs:" + strictcount(op.getAnInput()).toString() or | ||
result = "blockmodes:" + strictcount(op.getBlockMode()).toString() | ||
} | ||
|
||
/** | ||
* Gets a description of cryptographic operation `op`. | ||
*/ | ||
string describeOperation(Cryptography::CryptographicOperation op) { | ||
result = describeAlgorithm(op.getAlgorithm()) + " " + concat(getOperationFeature(op), ", ") | ||
or | ||
not exists(op.getAlgorithm()) and | ||
result = "(unknown) " + concat(getOperationFeature(op), ", ") | ||
} | ||
|
||
from Cryptography::CryptographicOperation operation | ||
select operation, describeOperation(operation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @name Query Sink Counts | ||
* @description Lists the number of query sinks of each type found in the database. Query sinks are | ||
* flow sinks that are used as possible locations for query results. Cryptographic | ||
* operations are excluded. | ||
* @kind metric | ||
* @id rust/summary/query-sink-counts | ||
* @tags summary | ||
*/ | ||
|
||
import rust | ||
import codeql.rust.dataflow.DataFlow | ||
import Stats | ||
|
||
from string kind, int num | ||
where num = strictcount(DataFlow::Node n | getAQuerySinkKind(n) = kind) | ||
select kind, num |
Oops, something went wrong.