@nodesecure/js-x-ray 4.2.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ JavaScript AST analysis. This package has been created to export the [Node-Secur
10
10
 
11
11
  The goal is to quickly identify dangerous code and patterns for developers and Security researchers. Interpreting the results of this tool will still require you to have a set of security notions.
12
12
 
13
- > 💖 I have no particular background in security. I'm simply becoming more and more interested and passionate about static code analysis. But I would be more than happy to learn that my work can help prevent potential future attacks (or leaks).
13
+ > **Note** I have no particular background in security. I'm simply becoming more and more interested and passionate about static code analysis. But I would be more than happy to learn that my work can help prevent potential future attacks (or leaks).
14
14
 
15
15
  ## Goals
16
16
  The objective of the project is to successfully detect all potentially suspicious JavaScript codes.. The target is obviously codes that are added or injected for malicious purposes..
@@ -71,27 +71,59 @@ console.log(warnings);
71
71
 
72
72
  The analysis will return: `http` (in try), `crypto`, `util` and `fs`.
73
73
 
74
- > ⚠️ There is also a lot of suspicious code example in the root cases directory. Feel free to try the tool on these files.
74
+ > **Warning** There is also a lot of suspicious code example in the `./examples` cases directory. Feel free to try the tool on these files.
75
75
 
76
- ## Warnings Legends (v2.0+)
76
+ ## Warnings
77
77
 
78
- > Node-secure versions equal or lower than 0.7.0 are no longer compatible with the warnings table below.
78
+ This section describes how use `warnings` export.
79
79
 
80
- This section describe all the possible warnings returned by JSXRay.
80
+ The structure of the `warnings` is as follows:
81
+ ```js
82
+ /**
83
+ * @property {object} warnings - The default values for Constants.
84
+ * @property {string} warnings[name] - The default warning name (parsingError, unsafeImport etc...).
85
+ * @property {string} warnings[name].i18n - i18n token.
86
+ * @property {string} warnings[name].code - Used to perform unit tests.
87
+ * @property {string} warnings[name].severity - Warning severity.
88
+ */
89
+
90
+ export const warnings = Object.freeze({
91
+ parsingError: {
92
+ i18n: "sast_warnings.ast_error"
93
+ code: "ast-error",
94
+ severity: "Information"
95
+ },
96
+ ...otherWarnings
97
+ });
98
+ ```
99
+
100
+ We make a call to `i18n` through the package `NodeSecure/i18n` to get the translation.
101
+
102
+ ```js
103
+ import * as jsxray from "@nodesecure/js-x-ray";
104
+ import * as i18n from "@nodesecure/i18n";
105
+
106
+ console.log(i18n.getToken(jsxray.warnings.parsingError.i18n));
107
+ ```
81
108
 
82
- | name | description |
83
- | --- | --- |
84
- | parsing-error | An error occured when parsing the JavaScript code with meriyah. It mean that the conversion from string to AST as failed. If you encounter such an error, **please open an issue here**. |
85
- | unsafe-import | Unable to follow an import (require, require.resolve) statement/expr. |
86
- | unsafe-regex | A RegEx as been detected as unsafe and may be used for a ReDoS Attack. |
87
- | unsafe-stmt | Usage of dangerous statement like `eval()` or `Function("")`. |
88
- | unsafe-assign | Assignment of a protected global like `process` or `require`. |
89
- | encoded-literal | An encoded literal has been detected (it can be an hexa value, unicode sequence, base64 string etc) |
90
- | short-identifiers | This mean that all identifiers has an average length below 1.5. Only possible if the file contains more than 5 identifiers. |
91
- | suspicious-literal | This mean that the sum of suspicious score of all Literals is bigger than 3. |
92
- | obfuscated-code (**experimental**) | There's a very high probability that the code is obfuscated... |
109
+ ## Warnings Legends
93
110
 
94
- > 👀 More details on warnings and their implementations [here](./WARNINGS.md)
111
+ > **Warning** versions of NodeSecure greather than v0.7.0 are no longer compatible with the warnings table below.
112
+
113
+ This section describe all the possible warnings returned by JSXRay. Click on the warning **name** for additional information and examples.
114
+
115
+ | name | experimental | description |
116
+ | --- | :-: | --- |
117
+ | [parsing-error](./docs/parsing-error.md) | ❌ | The AST parser throw an error |
118
+ | [unsafe-import](./docs/unsafe-import.md) | ❌ | Unable to follow an import (require, require.resolve) statement/expr. |
119
+ | [unsafe-regex](./docs/unsafe-regex.md) | ❌ | A RegEx as been detected as unsafe and may be used for a ReDoS Attack. |
120
+ | [unsafe-stmt](./docs//unsafe-stmt.md) | ❌ | Usage of dangerous statement like `eval()` or `Function("")`. |
121
+ | [unsafe-assign](./docs/unsafe-assign.md) | ❌ | Assignment of a protected global like `process` or `require`. |
122
+ | [encoded-literal](./docs/encoded-literal.md) | ❌ | An encoded literal has been detected (it can be an hexa value, unicode sequence or a base64 string) |
123
+ | [short-identifiers](./docs/short-identifiers.md) | ❌ | This mean that all identifiers has an average length below 1.5. |
124
+ | [suspicious-literal](./docs/suspicious-literal.md) | ❌ | A suspicious literal has been found in the source code. |
125
+ | [obfuscated-code](./docs/obfuscated-code.md) | ✔️ | There's a very high probability that the code is obfuscated. |
126
+ | [weak-crypto](./docs/weak-crypto.md) | ✔️ | The code probably contains a weak crypto algorithm (md5, sha1...) |
95
127
 
96
128
  ## API
97
129
 
@@ -119,11 +151,37 @@ interface Report {
119
151
 
120
152
  </details>
121
153
 
154
+ <details>
155
+ <summary>runASTAnalysisOnFile(pathToFile: string, options?: RuntimeFileOptions): Promise< ReportOnFile ></summary>
156
+
157
+ ```ts
158
+ interface RuntimeOptions {
159
+ module?: boolean;
160
+ isMinified?: boolean;
161
+ }
162
+ ```
163
+
164
+ Run the SAST scanner on a given JavaScript file.
165
+
166
+ ```ts
167
+ export type ReportOnFile = {
168
+ ok: true,
169
+ warnings: Warning<BaseWarning>[];
170
+ dependencies: ASTDeps;
171
+ isMinified: boolean;
172
+ } | {
173
+ ok: false,
174
+ warnings: Warning<BaseWarning>[];
175
+ }
176
+ ```
177
+
178
+ </details>
179
+
122
180
 
123
181
  ## Contributors ✨
124
182
 
125
183
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
126
- [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
184
+ [![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)
127
185
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
128
186
 
129
187
  Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -136,6 +194,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
136
194
  <td align="center"><a href="https://www.linkedin.com/in/thomas-gentilhomme/"><img src="https://avatars.githubusercontent.com/u/4438263?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gentilhomme</b></sub></a><br /><a href="https://github.com/NodeSecure/js-x-ray/commits?author=fraxken" title="Code">💻</a> <a href="https://github.com/NodeSecure/js-x-ray/commits?author=fraxken" title="Documentation">📖</a> <a href="https://github.com/NodeSecure/js-x-ray/pulls?q=is%3Apr+reviewed-by%3Afraxken" title="Reviewed Pull Requests">👀</a> <a href="#security-fraxken" title="Security">🛡️</a> <a href="https://github.com/NodeSecure/js-x-ray/issues?q=author%3Afraxken" title="Bug reports">🐛</a></td>
137
195
  <td align="center"><a href="https://github.com/Rossb0b"><img src="https://avatars.githubusercontent.com/u/39910164?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nicolas Hallaert</b></sub></a><br /><a href="https://github.com/NodeSecure/js-x-ray/commits?author=Rossb0b" title="Documentation">📖</a></td>
138
196
  <td align="center"><a href="https://github.com/antoine-coulon"><img src="https://avatars.githubusercontent.com/u/43391199?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antoine</b></sub></a><br /><a href="https://github.com/NodeSecure/js-x-ray/commits?author=antoine-coulon" title="Code">💻</a></td>
197
+ <td align="center"><a href="https://github.com/Mathieuka"><img src="https://avatars.githubusercontent.com/u/34446722?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mathieu</b></sub></a><br /><a href="https://github.com/NodeSecure/js-x-ray/commits?author=Mathieuka" title="Code">💻</a></td>
198
+ <td align="center"><a href="https://github.com/Kawacrepe"><img src="https://avatars.githubusercontent.com/u/40260517?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vincent Dhennin</b></sub></a><br /><a href="https://github.com/NodeSecure/js-x-ray/commits?author=Kawacrepe" title="Code">💻</a> <a href="https://github.com/NodeSecure/js-x-ray/commits?author=Kawacrepe" title="Tests">⚠️</a></td>
199
+ <td align="center"><a href="http://tonygo.dev"><img src="https://avatars.githubusercontent.com/u/22824417?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tony Gorez</b></sub></a><br /><a href="https://github.com/NodeSecure/js-x-ray/commits?author=tony-go" title="Code">💻</a> <a href="https://github.com/NodeSecure/js-x-ray/commits?author=tony-go" title="Documentation">📖</a> <a href="https://github.com/NodeSecure/js-x-ray/commits?author=tony-go" title="Tests">⚠️</a></td>
139
200
  </tr>
140
201
  </table>
141
202
 
package/index.d.ts CHANGED
@@ -17,7 +17,8 @@ declare namespace JSXRay {
17
17
  | "unsafe-assign"
18
18
  | "short-identifiers"
19
19
  | "suspicious-literal"
20
- | "obfuscated-code";
20
+ | "obfuscated-code"
21
+ | "weak-crypto";
21
22
 
22
23
  type WarningLocation = [[number, number], [number, number]];
23
24
  interface BaseWarning {
@@ -55,15 +56,57 @@ declare namespace JSXRay {
55
56
  }
56
57
 
57
58
  interface WarningsNames {
58
- parsingError: "parsing-error",
59
- unsafeImport: "unsafe-import",
60
- unsafeStmt: "unsafe-stmt",
61
- unsafeRegex: "unsafe-regex",
62
- unsafeAssign: "unsafe-assign",
63
- encodedLiteral: "encoded-literal",
64
- shortIdentifiers: "short-identifiers",
65
- suspiciousLiteral: "suspicious-literal",
66
- obfuscatedCode: "obfuscated-code"
59
+ parsingError: {
60
+ code: "ast-error",
61
+ i18n: "sast_warnings.ast_error",
62
+ severity: "Information"
63
+ },
64
+ unsafeImport: {
65
+ code: "unsafe-import",
66
+ i18n: "sast_warnings.unsafe_import",
67
+ severity: "Warning"
68
+ },
69
+ unsafeRegex: {
70
+ code: "unsafe-regex",
71
+ i18n: "sast_warnings.unsafe_regex",
72
+ severity: "Warning"
73
+ },
74
+ unsafeStmt: {
75
+ code: "unsafe-stmt",
76
+ i18n: "sast_warnings.unsafe_stmt",
77
+ severity: "Warning"
78
+ },
79
+ unsafeAssign: {
80
+ code: "unsafe-assign",
81
+ i18n: "sast_warnings.unsafe_assign",
82
+ severity: "Warning"
83
+ },
84
+ encodedLiteral: {
85
+ code: "encoded-literal",
86
+ i18n: "sast_warnings.encoded_literal",
87
+ severity: "Information"
88
+ },
89
+ shortIdentifiers: {
90
+ code: "short-identifiers",
91
+ i18n: "sast_warnings.short_identifiers",
92
+ severity: "Warning"
93
+ },
94
+ suspiciousLiteral: {
95
+ code: "suspicious-literal",
96
+ i18n: "sast_warnings.suspicious_literal",
97
+ severity: "Warning"
98
+ },
99
+ obfuscatedCode: {
100
+ code: "obfuscated-code",
101
+ i18n: "sast_warnings.obfuscated_code",
102
+ severity: "Critical"
103
+ },
104
+ weakCrypto: {
105
+ code: "weak-crypto",
106
+ i18n: "sast_warnings.weak_crypto",
107
+ severity: "Information",
108
+ experimental: true
109
+ }
67
110
  }
68
111
 
69
112
  interface RuntimeOptions {
@@ -90,9 +133,7 @@ declare namespace JSXRay {
90
133
 
91
134
  export function runASTAnalysisOnFile(pathToFile: string, options?: RuntimeFileOptions): Promise<ReportOnFile>;
92
135
 
93
- export namespace CONSTANTS {
94
- export const Warnings: WarningsNames;
95
- }
136
+ export const warnings: WarningsNames;
96
137
  }
97
138
 
98
139
  export = JSXRay;
package/index.js CHANGED
@@ -16,8 +16,13 @@ export function runASTAnalysis(str, options = Object.create(null)) {
16
16
  // Note: if the file start with a shebang then we remove it because 'parseScript' may fail to parse it.
17
17
  // Example: #!/usr/bin/env node
18
18
  const strToAnalyze = str.charAt(0) === "#" ? str.slice(str.indexOf("\n")) : str;
19
+ const isEcmaScriptModule = Boolean(module);
19
20
  const { body } = meriyah.parseScript(strToAnalyze, {
20
- next: true, loc: true, raw: true, module: Boolean(module)
21
+ next: true,
22
+ loc: true,
23
+ raw: true,
24
+ module: isEcmaScriptModule,
25
+ globalReturn: !isEcmaScriptModule
21
26
  });
22
27
 
23
28
  const sastAnalysis = new Analysis();
@@ -78,16 +83,59 @@ export async function runASTAnalysisOnFile(pathToFile, options = {}) {
78
83
  }
79
84
  }
80
85
 
81
- export const CONSTANTS = {
82
- Warnings: Object.freeze({
83
- parsingError: "ast-error",
84
- unsafeImport: "unsafe-import",
85
- unsafeRegex: "unsafe-regex",
86
- unsafeStmt: "unsafe-stmt",
87
- unsafeAssign: "unsafe-assign",
88
- encodedLiteral: "encoded-literal",
89
- shortIdentifiers: "short-identifiers",
90
- suspiciousLiteral: "suspicious-literal",
91
- obfuscatedCode: "obfuscated-code"
92
- })
93
- };
86
+ export const warnings = Object.freeze({
87
+ parsingError: {
88
+ code: "ast-error",
89
+ i18n: "sast_warnings.ast_error",
90
+ severity: "Information"
91
+ },
92
+ unsafeImport: {
93
+ code: "unsafe-import",
94
+ i18n: "sast_warnings.unsafe_import",
95
+ severity: "Warning"
96
+ },
97
+ unsafeRegex: {
98
+ code: "unsafe-regex",
99
+ i18n: "sast_warnings.unsafe_regex",
100
+ severity: "Warning"
101
+ },
102
+ unsafeStmt: {
103
+ code: "unsafe-stmt",
104
+ i18n: "sast_warnings.unsafe_stmt",
105
+ severity: "Warning"
106
+ },
107
+ unsafeAssign: {
108
+ code: "unsafe-assign",
109
+ i18n: "sast_warnings.unsafe_assign",
110
+ severity: "Warning"
111
+ },
112
+ encodedLiteral: {
113
+ code: "encoded-literal",
114
+ i18n: "sast_warnings.encoded_literal",
115
+ severity: "Information"
116
+ },
117
+ shortIdentifiers: {
118
+ code: "short-identifiers",
119
+ i18n: "sast_warnings.short_identifiers",
120
+ severity: "Warning"
121
+ },
122
+ suspiciousLiteral: {
123
+ code: "suspicious-literal",
124
+ i18n: "sast_warnings.suspicious_literal",
125
+ severity: "Warning"
126
+ },
127
+ obfuscatedCode: {
128
+ code: "obfuscated-code",
129
+ i18n: "sast_warnings.obfuscated_code",
130
+ severity: "Critical",
131
+ experimental: true
132
+ },
133
+ weakCrypto: {
134
+ code: "weak-crypto",
135
+ i18n: "sast_warnings.weak_crypto",
136
+ severity: "Information",
137
+ experimental: true
138
+ }
139
+ });
140
+
141
+
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@nodesecure/js-x-ray",
3
- "version": "4.2.1",
4
- "description": "JavaScript AST XRay analysis",
5
- "type": "module",
6
- "exports": "./index.js",
7
- "engines": {
8
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
9
- },
10
- "scripts": {
11
- "lint": "eslint src test",
12
- "prepublishOnly": "pkg-ok",
13
- "test": "cross-env esm-tape-runner 'test/*.spec.js' | tap-monkey",
14
- "check": "cross-env npm run lint && npm run test"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/NodeSecure/js-x-ray.git"
19
- },
20
- "keywords": [
21
- "ast",
22
- "nsecure",
23
- "nodesecure",
24
- "analysis",
25
- "dependencies",
26
- "security"
27
- ],
28
- "files": [
29
- "src",
30
- "index.js",
31
- "index.d.ts"
32
- ],
33
- "author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
34
- "license": "MIT",
35
- "bugs": {
36
- "url": "https://github.com/NodeSecure/js-x-ray/issues"
37
- },
38
- "homepage": "https://github.com/NodeSecure/js-x-ray#readme",
39
- "dependencies": {
40
- "@nodesecure/sec-literal": "^1.0.1",
41
- "estree-walker": "^3.0.1",
42
- "is-minified-code": "^2.0.0",
43
- "meriyah": "^4.2.0",
44
- "safe-regex": "^2.1.1"
45
- },
46
- "devDependencies": {
47
- "@nodesecure/eslint-config": "^1.3.1",
48
- "@slimio/is": "^1.5.1",
49
- "@small-tech/esm-tape-runner": "^1.0.3",
50
- "@small-tech/tap-monkey": "^1.3.0",
51
- "@types/node": "^17.0.15",
52
- "cross-env": "^7.0.3",
53
- "eslint": "^8.8.0",
54
- "pkg-ok": "^2.3.1",
55
- "tape": "^5.5.0"
56
- }
57
- }
1
+ {
2
+ "name": "@nodesecure/js-x-ray",
3
+ "version": "4.5.0",
4
+ "description": "JavaScript AST XRay analysis",
5
+ "type": "module",
6
+ "exports": "./index.js",
7
+ "engines": {
8
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
9
+ },
10
+ "scripts": {
11
+ "lint": "eslint src test",
12
+ "prepublishOnly": "pkg-ok",
13
+ "test": "cross-env esm-tape-runner 'test/**/*.spec.js' | tap-monkey",
14
+ "check": "cross-env npm run lint && npm run test"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/NodeSecure/js-x-ray.git"
19
+ },
20
+ "keywords": [
21
+ "ast",
22
+ "nsecure",
23
+ "nodesecure",
24
+ "analysis",
25
+ "dependencies",
26
+ "security"
27
+ ],
28
+ "files": [
29
+ "src",
30
+ "index.js",
31
+ "index.d.ts"
32
+ ],
33
+ "author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
34
+ "license": "MIT",
35
+ "bugs": {
36
+ "url": "https://github.com/NodeSecure/js-x-ray/issues"
37
+ },
38
+ "homepage": "https://github.com/NodeSecure/js-x-ray#readme",
39
+ "dependencies": {
40
+ "@nodesecure/sec-literal": "^1.1.0",
41
+ "estree-walker": "^3.0.1",
42
+ "is-minified-code": "^2.0.0",
43
+ "meriyah": "^4.2.1",
44
+ "safe-regex": "^2.1.1"
45
+ },
46
+ "devDependencies": {
47
+ "@nodesecure/eslint-config": "^1.4.1",
48
+ "@slimio/is": "^1.5.1",
49
+ "@small-tech/esm-tape-runner": "^2.0.0",
50
+ "@small-tech/tap-monkey": "^1.4.0",
51
+ "@types/node": "^17.0.42",
52
+ "cross-env": "^7.0.3",
53
+ "eslint": "^8.17.0",
54
+ "pkg-ok": "^3.0.0",
55
+ "tape": "^5.5.3"
56
+ }
57
+ }
package/src/ASTDeps.js CHANGED
@@ -1,55 +1,63 @@
1
-
2
- export default class ASTDeps {
3
- #inTry = false;
4
- dependencies = Object.create(null);
5
-
6
- get isInTryStmt() {
7
- return this.#inTry;
8
- }
9
-
10
- set isInTryStmt(value) {
11
- if (typeof value !== "boolean") {
12
- throw new TypeError("value must be a boolean!");
13
- }
14
-
15
- this.#inTry = value;
16
- }
17
-
18
- removeByName(name) {
19
- if (Reflect.has(this.dependencies, name)) {
20
- delete this.dependencies[name];
21
- }
22
- }
23
-
24
- add(depName, location = null, unsafe = false) {
25
- if (depName.trim() === "") {
26
- return;
27
- }
28
-
29
- const cleanDepName = depName.charAt(depName.length - 1) === "/" ? depName.slice(0, -1) : depName;
30
- const dep = {
31
- unsafe,
32
- inTry: this.isInTryStmt
33
- };
34
- if (location !== null) {
35
- dep.location = location;
36
- }
37
- this.dependencies[cleanDepName] = dep;
38
- }
39
-
40
- get size() {
41
- return Object.keys(this.dependencies).length;
42
- }
43
-
44
- * getDependenciesInTryStatement() {
45
- for (const [depName, props] of Object.entries(this.dependencies)) {
46
- if (props.inTry === true && props.unsafe === false) {
47
- yield depName;
48
- }
49
- }
50
- }
51
-
52
- * [Symbol.iterator]() {
53
- yield* Object.keys(this.dependencies);
54
- }
55
- }
1
+
2
+ export default class ASTDeps {
3
+ #inTry = false;
4
+ dependencies = Object.create(null);
5
+
6
+ get isInTryStmt() {
7
+ return this.#inTry;
8
+ }
9
+
10
+ set isInTryStmt(value) {
11
+ if (typeof value !== "boolean") {
12
+ throw new TypeError("value must be a boolean!");
13
+ }
14
+
15
+ this.#inTry = value;
16
+ }
17
+
18
+ removeByName(name) {
19
+ if (Reflect.has(this.dependencies, name)) {
20
+ delete this.dependencies[name];
21
+ }
22
+ }
23
+
24
+ add(depName, location = null, unsafe = false) {
25
+ if (depName.trim() === "") {
26
+ return;
27
+ }
28
+
29
+ const cleanDepName = depName.charAt(depName.length - 1) === "/" ? depName.slice(0, -1) : depName;
30
+ const dep = {
31
+ unsafe,
32
+ inTry: this.isInTryStmt
33
+ };
34
+ if (location !== null) {
35
+ dep.location = location;
36
+ }
37
+ this.dependencies[cleanDepName] = dep;
38
+ }
39
+
40
+ has(depName) {
41
+ if (depName.trim() === "") {
42
+ return false;
43
+ }
44
+
45
+ return Reflect.has(this.dependencies, depName);
46
+ }
47
+
48
+ get size() {
49
+ return Object.keys(this.dependencies).length;
50
+ }
51
+
52
+ * getDependenciesInTryStatement() {
53
+ for (const [depName, props] of Object.entries(this.dependencies)) {
54
+ if (props.inTry === true && props.unsafe === false) {
55
+ yield depName;
56
+ }
57
+ }
58
+ }
59
+
60
+ * [Symbol.iterator]() {
61
+ yield* Object.keys(this.dependencies);
62
+ }
63
+ }
package/src/Analysis.js CHANGED
@@ -24,7 +24,8 @@ const kWarningsNameStr = Object.freeze({
24
24
  [_warnings.encodedLiteral]: "encoded-literal",
25
25
  [_warnings.shortIdentifiers]: "short-identifiers",
26
26
  [_warnings.suspiciousLiteral]: "suspicious-literal",
27
- [_warnings.obfuscatedCode]: "obfuscated-code"
27
+ [_warnings.obfuscatedCode]: "obfuscated-code",
28
+ [_warnings.weakCrypto]: "weak-crypto"
28
29
  });
29
30
 
30
31
  export default class Analysis {
package/src/constants.js CHANGED
@@ -43,5 +43,6 @@ export const warnings = Object.freeze({
43
43
  encodedLiteral: Symbol("EncodedLiteral"),
44
44
  shortIdentifiers: Symbol("ShortIdentifiers"),
45
45
  suspiciousLiteral: Symbol("SuspiciousLiteral"),
46
- obfuscatedCode: Symbol("ObfuscatedCode")
46
+ obfuscatedCode: Symbol("ObfuscatedCode"),
47
+ weakCrypto: Symbol("WeakCrypto")
47
48
  });