|
1 | 1 | /**
|
2 |
| - * Provides classes and predicates for identifying private data and functions for security. |
3 |
| - * |
4 |
| - * 'Private' data in general is anything that would compromise user privacy if exposed. This |
5 |
| - * library tries to guess where private data may either be stored in a variable or produced by a |
6 |
| - * function. |
7 |
| - * |
8 |
| - * This library is not concerned with credentials. See `SensitiveActions` for expressions related |
9 |
| - * to credentials. |
| 2 | + * DEPRECATED: use semmle.code.cpp.security.PrivateData instead. |
10 | 3 | */
|
11 | 4 |
|
12 |
| -import cpp |
13 |
| - |
14 |
| -/** A string for `match` that identifies strings that look like they represent private data. */ |
15 |
| -private string privateNames() { |
16 |
| - result = |
17 |
| - [ |
18 |
| - // Inspired by the list on https://cwe.mitre.org/data/definitions/359.html |
19 |
| - // Government identifiers, such as Social Security Numbers |
20 |
| - "%social%security%number%", |
21 |
| - // Contact information, such as home addresses and telephone numbers |
22 |
| - "%postcode%", "%zipcode%", |
23 |
| - // result = "%telephone%" or |
24 |
| - // Geographic location - where the user is (or was) |
25 |
| - "%latitude%", "%longitude%", |
26 |
| - // Financial data - such as credit card numbers, salary, bank accounts, and debts |
27 |
| - "%creditcard%", "%salary%", "%bankaccount%", |
28 |
| - // Communications - e-mail addresses, private e-mail messages, SMS text messages, chat logs, etc. |
29 |
| - // result = "%email%" or |
30 |
| - // result = "%mobile%" or |
31 |
| - "%employer%", |
32 |
| - // Health - medical conditions, insurance status, prescription records |
33 |
| - "%medical%" |
34 |
| - ] |
35 |
| -} |
36 |
| - |
37 |
| -/** An expression that might contain private data. */ |
38 |
| -abstract class PrivateDataExpr extends Expr { } |
39 |
| - |
40 |
| -/** A functiond call that might produce private data. */ |
41 |
| -class PrivateFunctionCall extends PrivateDataExpr, FunctionCall { |
42 |
| - PrivateFunctionCall() { |
43 |
| - exists(string s | this.getTarget().getName().toLowerCase() = s | s.matches(privateNames())) |
44 |
| - } |
45 |
| -} |
46 |
| - |
47 |
| -/** An access to a variable that might contain private data. */ |
48 |
| -class PrivateVariableAccess extends PrivateDataExpr, VariableAccess { |
49 |
| - PrivateVariableAccess() { |
50 |
| - exists(string s | this.getTarget().getName().toLowerCase() = s | s.matches(privateNames())) |
51 |
| - } |
52 |
| -} |
| 5 | +import semmle.code.cpp.security.PrivateData |
0 commit comments