mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
C++: QLDoc SensitiveExprs.qll.
This commit is contained in:
@@ -1,5 +1,14 @@
|
||||
/**
|
||||
* Provides classes for heuristically identifying variables and functions that
|
||||
* might contain or return a password or other sensitive information.
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
/**
|
||||
* Holds if the name `s` suggests something might contain or return a password
|
||||
* or other sensitive information.
|
||||
*/
|
||||
bindingset[s]
|
||||
private predicate suspicious(string s) {
|
||||
(
|
||||
@@ -16,14 +25,23 @@ private predicate suspicious(string s) {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A variable that might contain a password or other sensitive information.
|
||||
*/
|
||||
class SensitiveVariable extends Variable {
|
||||
SensitiveVariable() { suspicious(getName().toLowerCase()) }
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that might return a password or other sensitive information.
|
||||
*/
|
||||
class SensitiveFunction extends Function {
|
||||
SensitiveFunction() { suspicious(getName().toLowerCase()) }
|
||||
}
|
||||
|
||||
/**
|
||||
* An expression whose value might be a password or other sensitive information.
|
||||
*/
|
||||
class SensitiveExpr extends Expr {
|
||||
SensitiveExpr() {
|
||||
this.(VariableAccess).getTarget() instanceof SensitiveVariable or
|
||||
|
||||
Reference in New Issue
Block a user