Skip to content

Commit 6950bfe

Browse files
author
Esben Sparre Andreasen
committed
JS: review fixups in documentation and comments
1 parent 0c4fb15 commit 6950bfe

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

change-notes/1.18/analysis-javascript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
| **Query** | **Tags** | **Purpose** |
3030
|-----------------------------|-----------|--------------------------------------------------------------------|
31-
| Clear text logging of sensitive information (`js/cleartext-logging`) | security, external/cwe/cwe-312, external/cwe/cwe-315, external/cwe/cwe-359 | Highlights logging of sensitive information, indicating a violation of [CWE-312](https://cwe.mitre.org/data/definitions/312.html). Results shown on lgtm by default. |
31+
| Clear-text logging of sensitive information (`js/clear-text-logging`) | security, external/cwe/cwe-312, external/cwe/cwe-315, external/cwe/cwe-359 | Highlights logging of sensitive information, indicating a violation of [CWE-312](https://cwe.mitre.org/data/definitions/312.html). Results shown on LGTM by default. |
3232
| Disabling Electron webSecurity (`js/disabling-electron-websecurity`) | security, frameworks/electron | Highlights Electron browser objects that are created with the `webSecurity` property set to false. Results shown on LGTM by default. |
3333
| Enabling Electron allowRunningInsecureContent (`js/enabling-electron-insecure-content`) | security, frameworks/electron | Highlights Electron browser objects that are created with the `allowRunningInsecureContent` property set to true. Results shown on LGTM by default. |
3434
| Use of externally-controlled format string (`js/tainted-format-string`) | security, external/cwe/cwe-134 | Highlights format strings containing user-provided data, indicating a violation of [CWE-134](https://cwe.mitre.org/data/definitions/134.html). Results shown on LGTM by default. |

javascript/ql/src/Security/CWE-312/CleartextLogging.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
2-
* @name Clear text logging of sensitive information
3-
* @description Sensitive information logged without encryption or hashing can expose it to an
4-
* attacker.
2+
* @name Clear-text logging of sensitive information
3+
* @description Logging sensitive information without encryption or hashing can
4+
* expose it to an attacker.
55
* @kind problem
66
* @problem.severity error
77
* @precision high
8-
* @id js/cleartext-logging
8+
* @id js/clear-text-logging
99
* @tags security
1010
* external/cwe/cwe-312
1111
* external/cwe/cwe-315

javascript/ql/src/Security/CWE-312/CleartextStorage.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ which are stored on the machine of the end-user.
1515
<p>
1616
Ensure that sensitive information is always encrypted before being stored.
1717
If possible, avoid placing sensitive information in cookies altogether.
18-
Instead, prefer storing, in the cookie, a key that can be used to lookup the
18+
Instead, prefer storing, in the cookie, a key that can be used to look up the
1919
sensitive information.
2020
</p>
2121
<p>

javascript/ql/src/semmle/javascript/frameworks/Logging.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ abstract class LoggerCall extends DataFlow::CallNode {
1616

1717
}
1818

19+
/**
20+
* Gets a log level name that is used in RFC5424, `npm`, `console`.
21+
*/
1922
private string getAStandardLoggerMethodName() {
20-
// log level names used in RFC5424, `npm`, `console`
2123
result = "crit" or
2224
result = "debug" or
2325
result = "error" or
@@ -32,7 +34,7 @@ private string getAStandardLoggerMethodName() {
3234
}
3335

3436
/**
35-
* Provides classes for working the builtin NodeJS/Browser `console`.
37+
* Provides classes for working the builtin Node.js/Browser `console`.
3638
*/
3739
private module Console {
3840

javascript/ql/src/semmle/javascript/security/SensitiveActions.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module HeuristicNames {
2222
string suspiciousNonPassword() {
2323
result = "(?is).*(secret|account|accnt|(?<!un)trusted).*"
2424
}
25+
2526
/** A regular expression that identifies strings that look like they represent secret data that are passwords. */
2627
string suspiciousPassword() {
2728
result = "(?is).*(password|passwd).*"

javascript/ql/src/semmle/javascript/security/dataflow/CleartextLogging.qll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
/**
2-
* Provides a dataflow tracking configuration for reasoning about cleartext logging of sensitive information.
2+
* Provides a dataflow tracking configuration for reasoning about clear-text logging of sensitive information.
33
*/
44
import javascript
55
private import semmle.javascript.dataflow.InferredTypes
66
private import semmle.javascript.security.SensitiveActions::HeuristicNames
77

88
module CleartextLogging {
99
/**
10-
* A data flow source for cleartext logging of sensitive information.
10+
* A data flow source for clear-text logging of sensitive information.
1111
*/
1212
abstract class Source extends DataFlow::Node {
1313
/** Gets a string that describes the type of this data flow source. */
1414
abstract string describe();
1515
}
1616

1717
/**
18-
* A data flow sink for cleartext logging of sensitive information.
18+
* A data flow sink for clear-text logging of sensitive information.
1919
*/
2020
abstract class Sink extends DataFlow::Node { }
2121

2222
/**
23-
* A barrier for cleartext logging of sensitive information.
23+
* A barrier for clear-text logging of sensitive information.
2424
*/
2525
abstract class Barrier extends DataFlow::Node { }
2626

2727
/**
28-
* A dataflow tracking configuration for cleartext logging of sensitive information.
28+
* A dataflow tracking configuration for clear-text logging of sensitive information.
2929
*
3030
* This configuration identifies flows from `Source`s, which are sources of
3131
* sensitive data, to `Sink`s, which is an abstract class representing all
32-
* the places sensitive data may be stored in cleartext. Additional sources or sinks can be
32+
* the places sensitive data may be stored in clear-text. Additional sources or sinks can be
3333
* added either by extending the relevant class, or by subclassing this configuration itself,
3434
* and amending the sources and sinks.
3535
*/
@@ -95,7 +95,7 @@ module CleartextLogging {
9595
}
9696

9797
/**
98-
* A data flow node that does not contain a clear text password, according to its syntactic name.
98+
* A data flow node that does not contain a clear-text password, according to its syntactic name.
9999
*/
100100
private class NameGuidedNonCleartextPassword extends NonCleartextPassword {
101101

@@ -129,7 +129,7 @@ module CleartextLogging {
129129
}
130130

131131
/**
132-
* A data flow node that receives flow that is not a clear text password.
132+
* A data flow node that receives flow that is not a clear-text password.
133133
*/
134134
private class NonCleartextPasswordFlow extends NonCleartextPassword {
135135

@@ -151,14 +151,14 @@ module CleartextLogging {
151151
}
152152

153153
/**
154-
* A data flow node that does not contain a clear text password.
154+
* A data flow node that does not contain a clear-text password.
155155
*/
156156
private abstract class NonCleartextPassword extends DataFlow::Node { }
157157

158158
/**
159159
* An object with a property that may contain password information
160160
*
161-
* This is a source since `toString()` on this object will show the property value.
161+
* This is a source since `console.log(obj)` will show the properties of `obj`.
162162
*/
163163
private class ObjectPasswordPropertySource extends DataFlow::ValueNode, Source {
164164
string name;

0 commit comments

Comments
 (0)