xploitscan-shared-rules 1.33.0 → 1.35.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 +28 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1825,14 +1825,17 @@ var CONFIG_FILE_PATTERN = new RegExp(
|
|
|
1825
1825
|
].join("|"),
|
|
1826
1826
|
"i"
|
|
1827
1827
|
);
|
|
1828
|
+
function lineTextAt(content, index) {
|
|
1829
|
+
const lineStart = content.lastIndexOf("\n", index - 1) + 1;
|
|
1830
|
+
const lineEnd = content.indexOf("\n", index);
|
|
1831
|
+
return content.substring(lineStart, lineEnd === -1 ? content.length : lineEnd);
|
|
1832
|
+
}
|
|
1828
1833
|
function isCommentLine(content, matchIndex) {
|
|
1829
|
-
const
|
|
1830
|
-
const lineText = content.substring(lineStart, content.indexOf("\n", matchIndex)).trimStart();
|
|
1834
|
+
const lineText = lineTextAt(content, matchIndex).trimStart();
|
|
1831
1835
|
return lineText.startsWith("//") || lineText.startsWith("#") || lineText.startsWith("*") || lineText.startsWith("/*") || lineText.startsWith("<!--") || lineText.startsWith("'") && lineText.length > 1 && /\.(vb|bas)$/i.test("");
|
|
1832
1836
|
}
|
|
1833
1837
|
function isInsideFixMessage(content, matchIndex) {
|
|
1834
|
-
const
|
|
1835
|
-
const lineText = content.substring(lineStart, content.indexOf("\n", matchIndex));
|
|
1838
|
+
const lineText = lineTextAt(content, matchIndex);
|
|
1836
1839
|
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);
|
|
1837
1840
|
}
|
|
1838
1841
|
function filterSilenced(matches, content, ruleId) {
|
|
@@ -2160,7 +2163,7 @@ var missingAuthMiddleware = {
|
|
|
2160
2163
|
/\bgetUser\b/i,
|
|
2161
2164
|
/\bcurrentUser\b/i,
|
|
2162
2165
|
/\bisAuthenticated\b/i,
|
|
2163
|
-
/\
|
|
2166
|
+
/\brequire\w*Auth\b/i,
|
|
2164
2167
|
/\brequireUser\b/i,
|
|
2165
2168
|
/\brequireUserForApi\b/i,
|
|
2166
2169
|
/\bwithAuth\b/i,
|
|
@@ -7022,7 +7025,7 @@ function secretRuleCheck(content, filePath, pattern, ruleId, title, severity, fi
|
|
|
7022
7025
|
if (isCommentLine(content, m.index)) continue;
|
|
7023
7026
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
7024
7027
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
7025
|
-
const lineText =
|
|
7028
|
+
const lineText = lineTextAt(content, m.index);
|
|
7026
7029
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
7027
7030
|
const lineNum = lineNumberAt(content, m.index);
|
|
7028
7031
|
findings.push({
|
|
@@ -7229,7 +7232,7 @@ var hardcodedDatadogKey = {
|
|
|
7229
7232
|
if (isCommentLine(content, m.index)) continue;
|
|
7230
7233
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
7231
7234
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
7232
|
-
const lineText =
|
|
7235
|
+
const lineText = lineTextAt(content, m.index);
|
|
7233
7236
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
7234
7237
|
const lineNum = lineNumberAt(content, m.index);
|
|
7235
7238
|
findings.push({
|
|
@@ -7263,7 +7266,7 @@ var hardcodedVercelToken = {
|
|
|
7263
7266
|
if (isCommentLine(content, m.index)) continue;
|
|
7264
7267
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
7265
7268
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
7266
|
-
const lineText =
|
|
7269
|
+
const lineText = lineTextAt(content, m.index);
|
|
7267
7270
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
7268
7271
|
const lineNum = lineNumberAt(content, m.index);
|
|
7269
7272
|
findings.push({
|
|
@@ -7297,7 +7300,7 @@ var hardcodedSupabaseServiceRole = {
|
|
|
7297
7300
|
if (isCommentLine(content, m.index)) continue;
|
|
7298
7301
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
7299
7302
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
7300
|
-
const lineText =
|
|
7303
|
+
const lineText = lineTextAt(content, m.index);
|
|
7301
7304
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
7302
7305
|
const lineNum = lineNumberAt(content, m.index);
|
|
7303
7306
|
findings.push({
|
|
@@ -7361,7 +7364,7 @@ function contextSecretRuleCheck(content, filePath, pattern, ruleId, title, sever
|
|
|
7361
7364
|
if (isCommentLine(content, m.index)) continue;
|
|
7362
7365
|
if (isInsideFixMessage(content, m.index)) continue;
|
|
7363
7366
|
const lineStart = content.lastIndexOf("\n", m.index - 1) + 1;
|
|
7364
|
-
const lineText =
|
|
7367
|
+
const lineText = lineTextAt(content, m.index);
|
|
7365
7368
|
if (PLACEHOLDER_RE.test(lineText)) continue;
|
|
7366
7369
|
const lineNum = lineNumberAt(content, m.index);
|
|
7367
7370
|
findings.push({
|
|
@@ -10021,6 +10024,20 @@ var SAFE_PATTERNS = [
|
|
|
10021
10024
|
/^\d+\.\d+\.\d+/,
|
|
10022
10025
|
// Integrity-hash prefix (sha256-, sha512-, ...)
|
|
10023
10026
|
/^sha\d+-/i,
|
|
10027
|
+
// A command line, not a credential.
|
|
10028
|
+
//
|
|
10029
|
+
// npm scripts are the case: `"benchmark:bearer": "node
|
|
10030
|
+
// scripts/bearer-benchmark.js"`. The KEY contains "bearer", which
|
|
10031
|
+
// SECRET_VAR_NAMES treats as secret-suggesting, so the entropy bar drops to
|
|
10032
|
+
// 4.0 and the shell command on the right is reported as a critical hardcoded
|
|
10033
|
+
// secret. This product's own package.json did it twice.
|
|
10034
|
+
//
|
|
10035
|
+
// Two shapes, both unambiguous: a value that starts with a known runner, and
|
|
10036
|
+
// a value containing whitespace plus a path or a file extension. No
|
|
10037
|
+
// credential has either — API keys, tokens, JWTs and connection strings are
|
|
10038
|
+
// all single unbroken words.
|
|
10039
|
+
/^(?: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,
|
|
10040
|
+
/\s.*(?:\/|\.(?:js|ts|mjs|cjs|jsx|tsx|sh|py|rb|go|json|yml|yaml))\b/,
|
|
10024
10041
|
// URLs without credentials in them
|
|
10025
10042
|
/^https?:\/\/[^:@]*$/,
|
|
10026
10043
|
/^https?:\/\/registry\.npmjs\.org\//,
|
|
@@ -12831,7 +12848,7 @@ var autosaveArmedByFailedLoad = {
|
|
|
12831
12848
|
var import_traverse7 = __toESM(require("@babel/traverse"), 1);
|
|
12832
12849
|
var traverse6 = typeof import_traverse7.default === "function" ? import_traverse7.default : import_traverse7.default.default;
|
|
12833
12850
|
var MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
|
|
12834
|
-
var DURABLE_WRITE = /\b(?:INSERT\s+INTO|UPDATE\s+\w|DELETE\s+FROM
|
|
12851
|
+
var DURABLE_WRITE = /\b(?:INSERT\s+INTO\b|UPDATE\s+\w+\s+SET\b|DELETE\s+FROM\b)|\bprisma\s*\.\s*\w+\s*\.\s*(?:create|createMany|update|updateMany|delete|deleteMany|upsert)\s*\(|\.from\s*\([^)]*\)\s*\.\s*(?:insert|update|delete|upsert)\s*\(|\b(?:db|tx|trx)\s*\.\s*(?:insert|update|delete)\s*\(/i;
|
|
12835
12852
|
var EXTERNAL_MUTATION = /\b\w+\s*\.\s*\w+\s*\.\s*(?:create|send|update|delete|cancel|charge|capture|refund)\s*\(|\bfetch\s*\([^)]{0,300}?method\s*:\s*["'`](?:POST|PUT|PATCH|DELETE)["'`]/is;
|
|
12836
12853
|
var BOOKKEEPING = /analytics|telemetry|track|metric|event|beacon|log|audit|ping/i;
|
|
12837
12854
|
var DIRECT_ENV_TEST = /\bprocess\s*\.\s*env\b|\bDeno\s*\.\s*env\s*\.\s*get\s*\(/;
|