xploitscan-shared-rules 1.33.0 → 1.34.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/dist/index.cjs +27 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1518,14 +1518,17 @@ var CONFIG_FILE_PATTERN = new RegExp(
|
|
|
1518
1518
|
].join("|"),
|
|
1519
1519
|
"i"
|
|
1520
1520
|
);
|
|
1521
|
+
function lineTextAt(content, index) {
|
|
1522
|
+
const lineStart = content.lastIndexOf("\n", index - 1) + 1;
|
|
1523
|
+
const lineEnd = content.indexOf("\n", index);
|
|
1524
|
+
return content.substring(lineStart, lineEnd === -1 ? content.length : lineEnd);
|
|
1525
|
+
}
|
|
1521
1526
|
function isCommentLine(content, matchIndex) {
|
|
1522
|
-
const
|
|
1523
|
-
const lineText = content.substring(lineStart, content.indexOf("\n", matchIndex)).trimStart();
|
|
1527
|
+
const lineText = lineTextAt(content, matchIndex).trimStart();
|
|
1524
1528
|
return lineText.startsWith("//") || lineText.startsWith("#") || lineText.startsWith("*") || lineText.startsWith("/*") || lineText.startsWith("<!--") || lineText.startsWith("'") && lineText.length > 1 && /\.(vb|bas)$/i.test("");
|
|
1525
1529
|
}
|
|
1526
1530
|
function isInsideFixMessage(content, matchIndex) {
|
|
1527
|
-
const
|
|
1528
|
-
const lineText = content.substring(lineStart, content.indexOf("\n", matchIndex));
|
|
1531
|
+
const lineText = lineTextAt(content, matchIndex);
|
|
1529
1532
|
return /(?:fix|description|message|suggestion|hint|help|example|doc|comment)\s*[:=]\s*["'`]/i.test(lineText) || /return\s*["'`].*\b(?:Use|Replace|Add|Move|Set|Enable|Disable|Never|Don't|Do not|Instead)\b/i.test(lineText);
|
|
1530
1533
|
}
|
|
1531
1534
|
function filterSilenced(matches, content, ruleId) {
|
|
@@ -1853,7 +1856,7 @@ var missingAuthMiddleware = {
|
|
|
1853
1856
|
/\bgetUser\b/i,
|
|
1854
1857
|
/\bcurrentUser\b/i,
|
|
1855
1858
|
/\bisAuthenticated\b/i,
|
|
1856
|
-
/\
|
|
1859
|
+
/\brequire\w*Auth\b/i,
|
|
1857
1860
|
/\brequireUser\b/i,
|
|
1858
1861
|
/\brequireUserForApi\b/i,
|
|
1859
1862
|
/\bwithAuth\b/i,
|
|
@@ -6715,7 +6718,7 @@ function secretRuleCheck(content, filePath, pattern, ruleId, title, severity, fi
|
|
|
6715
6718
|
if (isCommentLine(content, m.index)) continue;
|
|
6716
6719
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
6717
6720
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
6718
|
-
const lineText =
|
|
6721
|
+
const lineText = lineTextAt(content, m.index);
|
|
6719
6722
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
6720
6723
|
const lineNum = lineNumberAt(content, m.index);
|
|
6721
6724
|
findings.push({
|
|
@@ -6922,7 +6925,7 @@ var hardcodedDatadogKey = {
|
|
|
6922
6925
|
if (isCommentLine(content, m.index)) continue;
|
|
6923
6926
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
6924
6927
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
6925
|
-
const lineText =
|
|
6928
|
+
const lineText = lineTextAt(content, m.index);
|
|
6926
6929
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
6927
6930
|
const lineNum = lineNumberAt(content, m.index);
|
|
6928
6931
|
findings.push({
|
|
@@ -6956,7 +6959,7 @@ var hardcodedVercelToken = {
|
|
|
6956
6959
|
if (isCommentLine(content, m.index)) continue;
|
|
6957
6960
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
6958
6961
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
6959
|
-
const lineText =
|
|
6962
|
+
const lineText = lineTextAt(content, m.index);
|
|
6960
6963
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
6961
6964
|
const lineNum = lineNumberAt(content, m.index);
|
|
6962
6965
|
findings.push({
|
|
@@ -6990,7 +6993,7 @@ var hardcodedSupabaseServiceRole = {
|
|
|
6990
6993
|
if (isCommentLine(content, m.index)) continue;
|
|
6991
6994
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
6992
6995
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
6993
|
-
const lineText =
|
|
6996
|
+
const lineText = lineTextAt(content, m.index);
|
|
6994
6997
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
6995
6998
|
const lineNum = lineNumberAt(content, m.index);
|
|
6996
6999
|
findings.push({
|
|
@@ -7054,7 +7057,7 @@ function contextSecretRuleCheck(content, filePath, pattern, ruleId, title, sever
|
|
|
7054
7057
|
if (isCommentLine(content, m.index)) continue;
|
|
7055
7058
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
7056
7059
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
7057
|
-
const lineText =
|
|
7060
|
+
const lineText = lineTextAt(content, m.index);
|
|
7058
7061
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
7059
7062
|
const lineNum = lineNumberAt(content, m.index);
|
|
7060
7063
|
findings.push({
|
|
@@ -9714,6 +9717,20 @@ var SAFE_PATTERNS = [
|
|
|
9714
9717
|
/^\d+\.\d+\.\d+/,
|
|
9715
9718
|
// Integrity-hash prefix (sha256-, sha512-, ...)
|
|
9716
9719
|
/^sha\d+-/i,
|
|
9720
|
+
// A command line, not a credential.
|
|
9721
|
+
//
|
|
9722
|
+
// npm scripts are the case: `"benchmark:bearer": "node
|
|
9723
|
+
// scripts/bearer-benchmark.js"`. The KEY contains "bearer", which
|
|
9724
|
+
// SECRET_VAR_NAMES treats as secret-suggesting, so the entropy bar drops to
|
|
9725
|
+
// 4.0 and the shell command on the right is reported as a critical hardcoded
|
|
9726
|
+
// secret. This product's own package.json did it twice.
|
|
9727
|
+
//
|
|
9728
|
+
// Two shapes, both unambiguous: a value that starts with a known runner, and
|
|
9729
|
+
// a value containing whitespace plus a path or a file extension. No
|
|
9730
|
+
// credential has either — API keys, tokens, JWTs and connection strings are
|
|
9731
|
+
// all single unbroken words.
|
|
9732
|
+
/^(?:npx?|pnpm|yarn|bun|deno|node|tsx|ts-node|bash|sh|zsh|python3?|ruby|go|cargo|make|docker|vitest|jest|eslint|prettier|next|vite|tsc|turbo|rimraf|concurrently)\b/i,
|
|
9733
|
+
/\s.*(?:\/|\.(?:js|ts|mjs|cjs|jsx|tsx|sh|py|rb|go|json|yml|yaml))\b/,
|
|
9717
9734
|
// URLs without credentials in them
|
|
9718
9735
|
/^https?:\/\/[^:@]*$/,
|
|
9719
9736
|
/^https?:\/\/registry\.npmjs\.org\//,
|