xploitscan-shared-rules 1.6.0 → 1.6.2
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 +46 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4604,7 +4604,12 @@ var complianceMap = {
|
|
|
4604
4604
|
var consoleLogProduction = {
|
|
4605
4605
|
id: "VC097",
|
|
4606
4606
|
title: "Console.log Left in Production Code",
|
|
4607
|
-
|
|
4607
|
+
// Demoted from "low" to "info" 2026-05-11. This is a code-hygiene
|
|
4608
|
+
// signal (leaked debug logs, occasionally PII), not a security
|
|
4609
|
+
// vulnerability in the OWASP sense. Was inflating severity counts
|
|
4610
|
+
// on real codebases (11+ hits on vibecheck's own scan), drowning
|
|
4611
|
+
// the actual security signal.
|
|
4612
|
+
severity: "info",
|
|
4608
4613
|
category: "Performance",
|
|
4609
4614
|
description: "console.log statements left in production code can leak sensitive data, slow down rendering, and clutter browser consoles.",
|
|
4610
4615
|
check(content, filePath) {
|
|
@@ -4627,7 +4632,11 @@ var consoleLogProduction = {
|
|
|
4627
4632
|
var syncFileOps = {
|
|
4628
4633
|
id: "VC098",
|
|
4629
4634
|
title: "Synchronous File Operations",
|
|
4630
|
-
|
|
4635
|
+
// Demoted from "medium" to "info" 2026-05-11. Already a Performance-
|
|
4636
|
+
// category rule (see below) — it's a perf concern, not a security
|
|
4637
|
+
// one, so it shouldn't have been at "medium" alongside actual
|
|
4638
|
+
// security findings. The severity scale should reflect risk class.
|
|
4639
|
+
severity: "info",
|
|
4631
4640
|
category: "Performance",
|
|
4632
4641
|
description: "Synchronous file operations (readFileSync, writeFileSync) block the event loop, causing all other requests to wait.",
|
|
4633
4642
|
check(content, filePath) {
|
|
@@ -4664,7 +4673,9 @@ var eventListenerLeak = {
|
|
|
4664
4673
|
var nPlusOneQuery = {
|
|
4665
4674
|
id: "VC100",
|
|
4666
4675
|
title: "N+1 Query Pattern Detected",
|
|
4667
|
-
|
|
4676
|
+
// Demoted from "medium" to "info" 2026-05-11. Performance pattern,
|
|
4677
|
+
// not a security issue — same rationale as VC098.
|
|
4678
|
+
severity: "info",
|
|
4668
4679
|
category: "Performance",
|
|
4669
4680
|
description: "Database queries inside loops cause N+1 performance problems \u2014 one query per iteration instead of a single batch query.",
|
|
4670
4681
|
check(content, filePath) {
|
|
@@ -4749,7 +4760,11 @@ var todoLeftInCode = {
|
|
|
4749
4760
|
var emptyCatchBlock = {
|
|
4750
4761
|
id: "VC104",
|
|
4751
4762
|
title: "Empty Catch Block",
|
|
4752
|
-
|
|
4763
|
+
// Demoted from "medium" to "info" 2026-05-11. Already a Code-Quality
|
|
4764
|
+
// category — empty catch blocks are a maintainability concern, not a
|
|
4765
|
+
// security vulnerability. Worth flagging, not worth counting as a
|
|
4766
|
+
// security "medium" alongside actual SQL-injection / XSS findings.
|
|
4767
|
+
severity: "info",
|
|
4753
4768
|
category: "Code Quality",
|
|
4754
4769
|
description: "Empty catch blocks silently swallow errors, making bugs impossible to diagnose. At minimum, log the error.",
|
|
4755
4770
|
check(content, filePath) {
|
|
@@ -4783,7 +4798,11 @@ var callbackHell = {
|
|
|
4783
4798
|
var magicNumbers = {
|
|
4784
4799
|
id: "VC106",
|
|
4785
4800
|
title: "Magic Numbers in Code",
|
|
4786
|
-
|
|
4801
|
+
// Demoted from "low" to "info" 2026-05-11. Already a Code-Quality
|
|
4802
|
+
// category — magic numbers are a style/readability concern, not a
|
|
4803
|
+
// security vulnerability. Was the single noisiest rule on the
|
|
4804
|
+
// vibecheck self-scan (44 hits) drowning real security signal.
|
|
4805
|
+
severity: "info",
|
|
4787
4806
|
category: "Code Quality",
|
|
4788
4807
|
description: "Unnamed numeric constants in conditions or calculations make code hard to understand. Extract them into named constants.",
|
|
4789
4808
|
check(content, filePath) {
|
|
@@ -8046,7 +8065,21 @@ For each finding, respond ONLY with a JSON array. No other text.
|
|
|
8046
8065
|
Each element: {"index": <number>, "verdict": "real" or "fp", "reason": "<1 sentence>"}`;
|
|
8047
8066
|
var MAX_FINDINGS_PER_BATCH = 15;
|
|
8048
8067
|
var MAX_CONTEXT_LINES = 10;
|
|
8049
|
-
var
|
|
8068
|
+
var DEFAULT_MAX_TOTAL_FINDINGS = 200;
|
|
8069
|
+
var MAX_TOTAL_FINDINGS = (() => {
|
|
8070
|
+
const raw = process.env.XPLOITSCAN_AI_FILTER_MAX;
|
|
8071
|
+
if (!raw) return DEFAULT_MAX_TOTAL_FINDINGS;
|
|
8072
|
+
const n = parseInt(raw, 10);
|
|
8073
|
+
if (!Number.isFinite(n) || n < 1) return DEFAULT_MAX_TOTAL_FINDINGS;
|
|
8074
|
+
return Math.min(n, 1e3);
|
|
8075
|
+
})();
|
|
8076
|
+
var SEVERITY_PRIORITY = {
|
|
8077
|
+
critical: 0,
|
|
8078
|
+
high: 1,
|
|
8079
|
+
medium: 2,
|
|
8080
|
+
low: 3,
|
|
8081
|
+
info: 4
|
|
8082
|
+
};
|
|
8050
8083
|
function getExpandedContext(content, line, contextLines = MAX_CONTEXT_LINES) {
|
|
8051
8084
|
const lines = content.split("\n");
|
|
8052
8085
|
const start = Math.max(0, line - 1 - contextLines);
|
|
@@ -8094,8 +8127,13 @@ async function filterFalsePositives(findings, fileContents) {
|
|
|
8094
8127
|
const empty = { findings, filteredFindings: [], aiReviewed: false, removedCount: 0, totalBefore: findings.length };
|
|
8095
8128
|
if (!process.env.ANTHROPIC_API_KEY) return empty;
|
|
8096
8129
|
if (findings.length === 0) return empty;
|
|
8097
|
-
const
|
|
8098
|
-
|
|
8130
|
+
const prioritized = [...findings].sort((a, b) => {
|
|
8131
|
+
const pa = SEVERITY_PRIORITY[(a.severity || "").toLowerCase()] ?? 5;
|
|
8132
|
+
const pb = SEVERITY_PRIORITY[(b.severity || "").toLowerCase()] ?? 5;
|
|
8133
|
+
return pa - pb;
|
|
8134
|
+
});
|
|
8135
|
+
const toReview = prioritized.slice(0, MAX_TOTAL_FINDINGS);
|
|
8136
|
+
const overflow = prioritized.slice(MAX_TOTAL_FINDINGS);
|
|
8099
8137
|
const totalBefore = findings.length;
|
|
8100
8138
|
const byFile = /* @__PURE__ */ new Map();
|
|
8101
8139
|
for (const f of toReview) {
|