xploitscan-shared-rules 1.7.2 → 1.7.4
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/dist/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -898,6 +898,12 @@ function isInlineSilenced(content, matchIndex, ruleId) {
|
|
|
898
898
|
);
|
|
899
899
|
return marker.test(matchLine) || marker.test(prevLine);
|
|
900
900
|
}
|
|
901
|
+
function filterSilenced(matches, content, ruleId) {
|
|
902
|
+
if (matches.length === 0) return matches;
|
|
903
|
+
const lines = content.split("\n");
|
|
904
|
+
const lineStartIndex = (line) => lines.slice(0, line - 1).reduce((acc, l) => acc + l.length + 1, 0);
|
|
905
|
+
return matches.filter((m) => !isInlineSilenced(content, lineStartIndex(m.line), ruleId));
|
|
906
|
+
}
|
|
901
907
|
function findMatches(content, pattern, rule, filePath, fixTemplate) {
|
|
902
908
|
const matches = [];
|
|
903
909
|
const lines = content.split("\n");
|
|
@@ -2142,9 +2148,15 @@ var insecureDeserialization = {
|
|
|
2142
2148
|
() => "Never deserialize untrusted data. Use JSON instead of pickle/Marshal/unserialize. For YAML, use yaml.safe_load(). Validate and sanitize all input before deserialization."
|
|
2143
2149
|
));
|
|
2144
2150
|
}
|
|
2151
|
+
const isJsTs = /\.(jsx?|tsx?|mjs|cjs)$/.test(filePath);
|
|
2145
2152
|
return matches.filter((m) => {
|
|
2146
2153
|
if (!/yaml\.load\s*\(/.test(m.snippet ?? "")) return true;
|
|
2147
2154
|
const lineText = (m.snippet ?? "").toLowerCase();
|
|
2155
|
+
if (isJsTs) {
|
|
2156
|
+
const ctxLines = content.split("\n").slice(m.line - 1, m.line + 2).join("\n");
|
|
2157
|
+
if (/default_full_schema|\bfull_schema\b/i.test(ctxLines)) return true;
|
|
2158
|
+
return false;
|
|
2159
|
+
}
|
|
2148
2160
|
if (/safe_schema|failsafe_schema|safe_load|safeloader/.test(lineText)) {
|
|
2149
2161
|
return false;
|
|
2150
2162
|
}
|
|
@@ -3912,7 +3924,11 @@ var xxeVulnerability = {
|
|
|
3912
3924
|
const patterns = [
|
|
3913
3925
|
/\.parseXm?l\s*\(/gi,
|
|
3914
3926
|
// catches parseXml (libxmljs) AND parseXML
|
|
3915
|
-
|
|
3927
|
+
// NOTE: the browser `new DOMParser()` is intentionally NOT flagged.
|
|
3928
|
+
// Per the HTML/XML spec, DOMParser.parseFromString does not resolve
|
|
3929
|
+
// external entities, so it is not an XXE sink — flagging it produced a
|
|
3930
|
+
// critical false positive on ordinary client-side XML/HTML parsing.
|
|
3931
|
+
// Real XXE sinks (libxmljs parseXml with noent, etree, SAX) remain below.
|
|
3916
3932
|
/etree\.parse\s*\(/g,
|
|
3917
3933
|
/lxml\.etree/g,
|
|
3918
3934
|
/SAXParserFactory/g,
|
|
@@ -4171,10 +4187,10 @@ var sensitiveURLParams = {
|
|
|
4171
4187
|
p,
|
|
4172
4188
|
sensitiveURLParams,
|
|
4173
4189
|
filePath,
|
|
4174
|
-
() => "Never pass sensitive data in URL parameters. Use request headers (Authorization: Bearer ...) or POST body instead."
|
|
4190
|
+
() => "Never pass sensitive data in URL parameters. Use request headers (Authorization: Bearer ...) or POST body instead. If this value is intentionally URL-safe (e.g. a one-time, server-verified reference like a Stripe checkout session_id), add an inline `// VC088-OK: <reason>` comment to silence."
|
|
4175
4191
|
));
|
|
4176
4192
|
}
|
|
4177
|
-
return matches;
|
|
4193
|
+
return filterSilenced(matches, content, "VC088");
|
|
4178
4194
|
}
|
|
4179
4195
|
};
|
|
4180
4196
|
var missingContentDisposition = {
|
|
@@ -7083,7 +7099,11 @@ var llmOutputAsHTML = {
|
|
|
7083
7099
|
const findings = [];
|
|
7084
7100
|
const patterns = [
|
|
7085
7101
|
// dangerouslySetInnerHTML with .choices[0].message.content / .text / etc.
|
|
7086
|
-
|
|
7102
|
+
// NOTE: a bare `text` token used to be in this alternation and matched
|
|
7103
|
+
// any `.text` property (e.g. `post.text`) in a file that merely imported
|
|
7104
|
+
// an LLM SDK — a high-severity false positive. Only LLM-specific shapes
|
|
7105
|
+
// remain (delta.text / output_text / generated_text are qualified).
|
|
7106
|
+
/dangerouslySetInnerHTML\s*=\s*\{\{\s*__html\s*:\s*[^}]*\b(?:choices\[\d*\]?\.message|completion|response|message\.content|content_block|delta\.text|generated_text|output_text)\b/g,
|
|
7087
7107
|
// .innerHTML = response.choices[0].message.content
|
|
7088
7108
|
/\.innerHTML\s*=\s*[^;]*\b(?:choices\[\d*\]?\.message|completion|response\.message|message\.content|delta\.text|generated_text|output_text)\b/g
|
|
7089
7109
|
];
|