You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section describe all the possible warnings returned by JSXRay. Click on the warning **name** for additional information and examples.
124
129
@@ -131,161 +136,10 @@ This section describe all the possible warnings returned by JSXRay. Click on the
131
136
|[encoded-literal](./docs/encoded-literal.md)| ❌ | An encoded literal has been detected (it can be an hexa value, unicode sequence or a base64 string) |
132
137
|[short-identifiers](./docs/short-identifiers.md)| ❌ | This mean that all identifiers has an average length below 1.5. |
133
138
|[suspicious-literal](./docs/suspicious-literal.md)| ❌ | A suspicious literal has been found in the source code. |
134
-
|[suspicious-file](./docs/suspicious-file.md)|✔️| A suspicious file with more than ten encoded-literal in it |
139
+
|[suspicious-file](./docs/suspicious-file.md)|❌| A suspicious file with more than ten encoded-literal in it |
135
140
|[obfuscated-code](./docs/obfuscated-code.md)| ✔️ | There's a very high probability that the code is obfuscated. |
136
-
|[weak-crypto](./docs/weak-crypto.md)| ✔️ | The code probably contains a weak crypto algorithm (md5, sha1...) |
137
-
|[shady-link](./docs/shady-link.md)| ✔️ | The code contains shady/unsafe link |
138
-
139
-
## Custom Probes
140
-
141
-
You can also create custom probes to detect specific pattern in the code you are analyzing.
142
-
143
-
A probe is a pair of two functions (`validateNode` and `main`) that will be called on each node of the AST. It will return a warning if the pattern is detected.
144
-
Below a basic probe that detect a string assignation to `danger`:
The `analyseFile`method is a superset of `analyse` with the ability to read the file on the local filesystem with additional features like detecting if the file is ESM or CJS.
47
+
The `analyseFile`and `analyseFileSync` methods is a superset of `analyse` with the ability to read the file on the local filesystem with additional features like detecting if the file is ESM/CJS (using the extension).
47
48
48
49
```ts
50
+
interfaceRuntimeOptions {
51
+
/**
52
+
* @defaulttrue
53
+
*/
54
+
module?:boolean;
55
+
/**
56
+
* @defaultfalse
57
+
*/
58
+
removeHTMLComments?:boolean;
59
+
/**
60
+
* @defaultfalse
61
+
*/
62
+
isMinified?:boolean;
63
+
initialize?: (sourceFile:SourceFile) =>void;
64
+
finalize?: (sourceFile:SourceFile) =>void;
65
+
}
66
+
49
67
interfaceReport {
50
68
dependencies:Map<string, Dependency>;
51
69
warnings:Warning[];
@@ -65,9 +83,7 @@ type ReportOnFile = {
65
83
}
66
84
```
67
85
68
-
## Examples
69
-
70
-
### `initialize`/`finalize` Hooks
86
+
### Hooks
71
87
72
88
The `analyse` method allows for the integration of two hooks: `initialize` and `finalize`.
73
89
These hooks are triggered before and after the analysis process, respectively.
You can also create custom probes to detect specific pattern in the code you are analyzing.
113
+
114
+
A probe is a pair of two functions (`validateNode` and `main`) that will be called on each node of the AST. It will return a warning if the pattern is detected.
115
+
116
+
Below a basic probe that detect a string assignation to `danger`:
0 commit comments