@nodesecure/js-x-ray 4.4.0 → 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 +55 -26
- package/index.d.ts +140 -124
- package/index.js +25 -9
- package/package.json +57 -57
- package/src/ASTDeps.js +63 -55
- package/src/Analysis.js +153 -152
- package/src/constants.js +2 -1
- package/src/probes/index.js +68 -66
- package/src/probes/isArrayExpression.js +27 -21
- package/src/probes/isAssignmentExpression.js +29 -22
- package/src/probes/isBinaryExpression.js +53 -39
- package/src/probes/isFunctionDeclaration.js +27 -20
- package/src/probes/isImportDeclaration.js +33 -26
- package/src/probes/isLiteral.js +52 -47
- package/src/probes/isLiteralRegex.js +32 -27
- package/src/probes/isObjectExpression.js +29 -23
- package/src/probes/isRegexObject.js +43 -38
- package/src/probes/isUnaryExpression.js +26 -18
- package/src/probes/isUnsafeCallee.js +24 -19
- package/src/probes/isWeakCrypto.js +34 -0
- package/src/utils.js +188 -182
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
|
-
>
|
|
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,25 +71,27 @@ console.log(warnings);
|
|
|
71
71
|
|
|
72
72
|
The analysis will return: `http` (in try), `crypto`, `util` and `fs`.
|
|
73
73
|
|
|
74
|
-
>
|
|
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
76
|
## Warnings
|
|
77
77
|
|
|
78
78
|
This section describes how use `warnings` export.
|
|
79
79
|
|
|
80
80
|
The structure of the `warnings` is as follows:
|
|
81
|
-
```
|
|
81
|
+
```js
|
|
82
82
|
/**
|
|
83
|
-
* @property {object} warnings
|
|
84
|
-
* @property {string} warnings[name]
|
|
85
|
-
* @property {string} warnings[name].i18n
|
|
86
|
-
* @property {string} warnings[name].code
|
|
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.
|
|
87
88
|
*/
|
|
88
89
|
|
|
89
90
|
export const warnings = Object.freeze({
|
|
90
91
|
parsingError: {
|
|
91
92
|
i18n: "sast_warnings.ast_error"
|
|
92
93
|
code: "ast-error",
|
|
94
|
+
severity: "Information"
|
|
93
95
|
},
|
|
94
96
|
...otherWarnings
|
|
95
97
|
});
|
|
@@ -97,33 +99,31 @@ export const warnings = Object.freeze({
|
|
|
97
99
|
|
|
98
100
|
We make a call to `i18n` through the package `NodeSecure/i18n` to get the translation.
|
|
99
101
|
|
|
100
|
-
```
|
|
102
|
+
```js
|
|
101
103
|
import * as jsxray from "@nodesecure/js-x-ray";
|
|
102
104
|
import * as i18n from "@nodesecure/i18n";
|
|
103
105
|
|
|
104
106
|
console.log(i18n.getToken(jsxray.warnings.parsingError.i18n));
|
|
105
|
-
|
|
106
107
|
```
|
|
107
108
|
|
|
108
|
-
## Warnings Legends
|
|
109
|
-
|
|
110
|
-
> Node-secure versions equal or lower than 0.7.0 are no longer compatible with the warnings table below.
|
|
109
|
+
## Warnings Legends
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
> **Warning** versions of NodeSecure greather than v0.7.0 are no longer compatible with the warnings table below.
|
|
113
112
|
|
|
114
|
-
|
|
115
|
-
| --- | --- |
|
|
116
|
-
| 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**. |
|
|
117
|
-
| unsafe-import | Unable to follow an import (require, require.resolve) statement/expr. |
|
|
118
|
-
| unsafe-regex | A RegEx as been detected as unsafe and may be used for a ReDoS Attack. |
|
|
119
|
-
| unsafe-stmt | Usage of dangerous statement like `eval()` or `Function("")`. |
|
|
120
|
-
| unsafe-assign | Assignment of a protected global like `process` or `require`. |
|
|
121
|
-
| encoded-literal | An encoded literal has been detected (it can be an hexa value, unicode sequence, base64 string etc) |
|
|
122
|
-
| short-identifiers | This mean that all identifiers has an average length below 1.5. Only possible if the file contains more than 5 identifiers. |
|
|
123
|
-
| suspicious-literal | This mean that the sum of suspicious score of all Literals is bigger than 3. |
|
|
124
|
-
| obfuscated-code (**experimental**) | There's a very high probability that the code is obfuscated... |
|
|
113
|
+
This section describe all the possible warnings returned by JSXRay. Click on the warning **name** for additional information and examples.
|
|
125
114
|
|
|
126
|
-
|
|
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...) |
|
|
127
127
|
|
|
128
128
|
## API
|
|
129
129
|
|
|
@@ -151,11 +151,37 @@ interface Report {
|
|
|
151
151
|
|
|
152
152
|
</details>
|
|
153
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
|
+
|
|
154
180
|
|
|
155
181
|
## Contributors ✨
|
|
156
182
|
|
|
157
183
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
158
|
-
[](#contributors-)
|
|
159
185
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
160
186
|
|
|
161
187
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
@@ -168,6 +194,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
168
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>
|
|
169
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>
|
|
170
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>
|
|
171
200
|
</tr>
|
|
172
201
|
</table>
|
|
173
202
|
|
package/index.d.ts
CHANGED
|
@@ -1,124 +1,140 @@
|
|
|
1
|
-
declare class ASTDeps {
|
|
2
|
-
constructor();
|
|
3
|
-
removeByName(name: string): void;
|
|
4
|
-
add(depName: string): void;
|
|
5
|
-
getDependenciesInTryStatement(): IterableIterator<string>;
|
|
6
|
-
|
|
7
|
-
public isInTryStmt: boolean;
|
|
8
|
-
public dependencies: Record<string, JSXRay.Dependency>;
|
|
9
|
-
public readonly size: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare namespace JSXRay {
|
|
13
|
-
type kindWithValue = "parsing-error"
|
|
14
|
-
| "encoded-literal"
|
|
15
|
-
| "unsafe-regex"
|
|
16
|
-
| "unsafe-stmt"
|
|
17
|
-
| "unsafe-assign"
|
|
18
|
-
| "short-identifiers"
|
|
19
|
-
| "suspicious-literal"
|
|
20
|
-
| "obfuscated-code"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
code: "unsafe-
|
|
76
|
-
i18n: "sast_warnings.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1
|
+
declare class ASTDeps {
|
|
2
|
+
constructor();
|
|
3
|
+
removeByName(name: string): void;
|
|
4
|
+
add(depName: string): void;
|
|
5
|
+
getDependenciesInTryStatement(): IterableIterator<string>;
|
|
6
|
+
|
|
7
|
+
public isInTryStmt: boolean;
|
|
8
|
+
public dependencies: Record<string, JSXRay.Dependency>;
|
|
9
|
+
public readonly size: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare namespace JSXRay {
|
|
13
|
+
type kindWithValue = "parsing-error"
|
|
14
|
+
| "encoded-literal"
|
|
15
|
+
| "unsafe-regex"
|
|
16
|
+
| "unsafe-stmt"
|
|
17
|
+
| "unsafe-assign"
|
|
18
|
+
| "short-identifiers"
|
|
19
|
+
| "suspicious-literal"
|
|
20
|
+
| "obfuscated-code"
|
|
21
|
+
| "weak-crypto";
|
|
22
|
+
|
|
23
|
+
type WarningLocation = [[number, number], [number, number]];
|
|
24
|
+
interface BaseWarning {
|
|
25
|
+
kind: "unsafe-import" | kindWithValue;
|
|
26
|
+
file?: string;
|
|
27
|
+
value: string;
|
|
28
|
+
location: WarningLocation | WarningLocation[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Warning<T extends BaseWarning> = T extends { kind: kindWithValue } ? T : Omit<T, "value">;
|
|
32
|
+
|
|
33
|
+
interface Report {
|
|
34
|
+
dependencies: ASTDeps;
|
|
35
|
+
warnings: Warning<BaseWarning>[];
|
|
36
|
+
idsLengthAvg: number;
|
|
37
|
+
stringScore: number;
|
|
38
|
+
isOneLineRequire: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface SourceLocation {
|
|
42
|
+
start: {
|
|
43
|
+
line: number;
|
|
44
|
+
column: number;
|
|
45
|
+
};
|
|
46
|
+
end: {
|
|
47
|
+
line: number;
|
|
48
|
+
column: number;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface Dependency {
|
|
53
|
+
unsafe: boolean;
|
|
54
|
+
inTry: boolean;
|
|
55
|
+
location?: SourceLocation;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface WarningsNames {
|
|
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
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface RuntimeOptions {
|
|
113
|
+
module?: boolean;
|
|
114
|
+
isMinified?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function runASTAnalysis(str: string, options?: RuntimeOptions): Report;
|
|
118
|
+
|
|
119
|
+
export type ReportOnFile = {
|
|
120
|
+
ok: true,
|
|
121
|
+
warnings: Warning<BaseWarning>[];
|
|
122
|
+
dependencies: ASTDeps;
|
|
123
|
+
isMinified: boolean;
|
|
124
|
+
} | {
|
|
125
|
+
ok: false,
|
|
126
|
+
warnings: Warning<BaseWarning>[];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface RuntimeFileOptions {
|
|
130
|
+
packageName?: string;
|
|
131
|
+
module?: boolean;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function runASTAnalysisOnFile(pathToFile: string, options?: RuntimeFileOptions): Promise<ReportOnFile>;
|
|
135
|
+
|
|
136
|
+
export const warnings: WarningsNames;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export = JSXRay;
|
|
140
|
+
export as namespace JSXRay;
|
package/index.js
CHANGED
|
@@ -86,39 +86,55 @@ export async function runASTAnalysisOnFile(pathToFile, options = {}) {
|
|
|
86
86
|
export const warnings = Object.freeze({
|
|
87
87
|
parsingError: {
|
|
88
88
|
code: "ast-error",
|
|
89
|
-
i18n: "sast_warnings.ast_error"
|
|
89
|
+
i18n: "sast_warnings.ast_error",
|
|
90
|
+
severity: "Information"
|
|
90
91
|
},
|
|
91
92
|
unsafeImport: {
|
|
92
93
|
code: "unsafe-import",
|
|
93
|
-
i18n: "sast_warnings.unsafe_import"
|
|
94
|
+
i18n: "sast_warnings.unsafe_import",
|
|
95
|
+
severity: "Warning"
|
|
94
96
|
},
|
|
95
97
|
unsafeRegex: {
|
|
96
98
|
code: "unsafe-regex",
|
|
97
|
-
i18n: "sast_warnings.unsafe_regex"
|
|
99
|
+
i18n: "sast_warnings.unsafe_regex",
|
|
100
|
+
severity: "Warning"
|
|
98
101
|
},
|
|
99
102
|
unsafeStmt: {
|
|
100
103
|
code: "unsafe-stmt",
|
|
101
|
-
i18n: "sast_warnings.unsafe_stmt"
|
|
104
|
+
i18n: "sast_warnings.unsafe_stmt",
|
|
105
|
+
severity: "Warning"
|
|
102
106
|
},
|
|
103
107
|
unsafeAssign: {
|
|
104
108
|
code: "unsafe-assign",
|
|
105
|
-
i18n: "sast_warnings.unsafe_assign"
|
|
109
|
+
i18n: "sast_warnings.unsafe_assign",
|
|
110
|
+
severity: "Warning"
|
|
106
111
|
},
|
|
107
112
|
encodedLiteral: {
|
|
108
113
|
code: "encoded-literal",
|
|
109
|
-
i18n: "sast_warnings.encoded_literal"
|
|
114
|
+
i18n: "sast_warnings.encoded_literal",
|
|
115
|
+
severity: "Information"
|
|
110
116
|
},
|
|
111
117
|
shortIdentifiers: {
|
|
112
118
|
code: "short-identifiers",
|
|
113
|
-
i18n: "sast_warnings.short_identifiers"
|
|
119
|
+
i18n: "sast_warnings.short_identifiers",
|
|
120
|
+
severity: "Warning"
|
|
114
121
|
},
|
|
115
122
|
suspiciousLiteral: {
|
|
116
123
|
code: "suspicious-literal",
|
|
117
|
-
i18n: "sast_warnings.suspicious_literal"
|
|
124
|
+
i18n: "sast_warnings.suspicious_literal",
|
|
125
|
+
severity: "Warning"
|
|
118
126
|
},
|
|
119
127
|
obfuscatedCode: {
|
|
120
128
|
code: "obfuscated-code",
|
|
121
|
-
i18n: "sast_warnings.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
|
|
122
138
|
}
|
|
123
139
|
});
|
|
124
140
|
|
package/package.json
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nodesecure/js-x-ray",
|
|
3
|
-
"version": "4.
|
|
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
|
|
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.
|
|
48
|
-
"@slimio/is": "^1.5.1",
|
|
49
|
-
"@small-tech/esm-tape-runner": "^2.0.0",
|
|
50
|
-
"@small-tech/tap-monkey": "^1.
|
|
51
|
-
"@types/node": "^17.0.
|
|
52
|
-
"cross-env": "^7.0.3",
|
|
53
|
-
"eslint": "^8.
|
|
54
|
-
"pkg-ok": "^3.0.0",
|
|
55
|
-
"tape": "^5.5.3"
|
|
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
|
+
}
|