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.js CHANGED
@@ -4343,7 +4343,12 @@ var complianceMap = {
4343
4343
  var consoleLogProduction = {
4344
4344
  id: "VC097",
4345
4345
  title: "Console.log Left in Production Code",
4346
- severity: "low",
4346
+ // Demoted from "low" to "info" 2026-05-11. This is a code-hygiene
4347
+ // signal (leaked debug logs, occasionally PII), not a security
4348
+ // vulnerability in the OWASP sense. Was inflating severity counts
4349
+ // on real codebases (11+ hits on vibecheck's own scan), drowning
4350
+ // the actual security signal.
4351
+ severity: "info",
4347
4352
  category: "Performance",
4348
4353
  description: "console.log statements left in production code can leak sensitive data, slow down rendering, and clutter browser consoles.",
4349
4354
  check(content, filePath) {
@@ -4366,7 +4371,11 @@ var consoleLogProduction = {
4366
4371
  var syncFileOps = {
4367
4372
  id: "VC098",
4368
4373
  title: "Synchronous File Operations",
4369
- severity: "medium",
4374
+ // Demoted from "medium" to "info" 2026-05-11. Already a Performance-
4375
+ // category rule (see below) — it's a perf concern, not a security
4376
+ // one, so it shouldn't have been at "medium" alongside actual
4377
+ // security findings. The severity scale should reflect risk class.
4378
+ severity: "info",
4370
4379
  category: "Performance",
4371
4380
  description: "Synchronous file operations (readFileSync, writeFileSync) block the event loop, causing all other requests to wait.",
4372
4381
  check(content, filePath) {
@@ -4403,7 +4412,9 @@ var eventListenerLeak = {
4403
4412
  var nPlusOneQuery = {
4404
4413
  id: "VC100",
4405
4414
  title: "N+1 Query Pattern Detected",
4406
- severity: "medium",
4415
+ // Demoted from "medium" to "info" 2026-05-11. Performance pattern,
4416
+ // not a security issue — same rationale as VC098.
4417
+ severity: "info",
4407
4418
  category: "Performance",
4408
4419
  description: "Database queries inside loops cause N+1 performance problems \u2014 one query per iteration instead of a single batch query.",
4409
4420
  check(content, filePath) {
@@ -4488,7 +4499,11 @@ var todoLeftInCode = {
4488
4499
  var emptyCatchBlock = {
4489
4500
  id: "VC104",
4490
4501
  title: "Empty Catch Block",
4491
- severity: "medium",
4502
+ // Demoted from "medium" to "info" 2026-05-11. Already a Code-Quality
4503
+ // category — empty catch blocks are a maintainability concern, not a
4504
+ // security vulnerability. Worth flagging, not worth counting as a
4505
+ // security "medium" alongside actual SQL-injection / XSS findings.
4506
+ severity: "info",
4492
4507
  category: "Code Quality",
4493
4508
  description: "Empty catch blocks silently swallow errors, making bugs impossible to diagnose. At minimum, log the error.",
4494
4509
  check(content, filePath) {
@@ -4522,7 +4537,11 @@ var callbackHell = {
4522
4537
  var magicNumbers = {
4523
4538
  id: "VC106",
4524
4539
  title: "Magic Numbers in Code",
4525
- severity: "low",
4540
+ // Demoted from "low" to "info" 2026-05-11. Already a Code-Quality
4541
+ // category — magic numbers are a style/readability concern, not a
4542
+ // security vulnerability. Was the single noisiest rule on the
4543
+ // vibecheck self-scan (44 hits) drowning real security signal.
4544
+ severity: "info",
4526
4545
  category: "Code Quality",
4527
4546
  description: "Unnamed numeric constants in conditions or calculations make code hard to understand. Extract them into named constants.",
4528
4547
  check(content, filePath) {
@@ -7785,7 +7804,21 @@ For each finding, respond ONLY with a JSON array. No other text.
7785
7804
  Each element: {"index": <number>, "verdict": "real" or "fp", "reason": "<1 sentence>"}`;
7786
7805
  var MAX_FINDINGS_PER_BATCH = 15;
7787
7806
  var MAX_CONTEXT_LINES = 10;
7788
- var MAX_TOTAL_FINDINGS = 50;
7807
+ var DEFAULT_MAX_TOTAL_FINDINGS = 200;
7808
+ var MAX_TOTAL_FINDINGS = (() => {
7809
+ const raw = process.env.XPLOITSCAN_AI_FILTER_MAX;
7810
+ if (!raw) return DEFAULT_MAX_TOTAL_FINDINGS;
7811
+ const n = parseInt(raw, 10);
7812
+ if (!Number.isFinite(n) || n < 1) return DEFAULT_MAX_TOTAL_FINDINGS;
7813
+ return Math.min(n, 1e3);
7814
+ })();
7815
+ var SEVERITY_PRIORITY = {
7816
+ critical: 0,
7817
+ high: 1,
7818
+ medium: 2,
7819
+ low: 3,
7820
+ info: 4
7821
+ };
7789
7822
  function getExpandedContext(content, line, contextLines = MAX_CONTEXT_LINES) {
7790
7823
  const lines = content.split("\n");
7791
7824
  const start = Math.max(0, line - 1 - contextLines);
@@ -7833,8 +7866,13 @@ async function filterFalsePositives(findings, fileContents) {
7833
7866
  const empty = { findings, filteredFindings: [], aiReviewed: false, removedCount: 0, totalBefore: findings.length };
7834
7867
  if (!process.env.ANTHROPIC_API_KEY) return empty;
7835
7868
  if (findings.length === 0) return empty;
7836
- const toReview = findings.slice(0, MAX_TOTAL_FINDINGS);
7837
- const overflow = findings.slice(MAX_TOTAL_FINDINGS);
7869
+ const prioritized = [...findings].sort((a, b) => {
7870
+ const pa = SEVERITY_PRIORITY[(a.severity || "").toLowerCase()] ?? 5;
7871
+ const pb = SEVERITY_PRIORITY[(b.severity || "").toLowerCase()] ?? 5;
7872
+ return pa - pb;
7873
+ });
7874
+ const toReview = prioritized.slice(0, MAX_TOTAL_FINDINGS);
7875
+ const overflow = prioritized.slice(MAX_TOTAL_FINDINGS);
7838
7876
  const totalBefore = findings.length;
7839
7877
  const byFile = /* @__PURE__ */ new Map();
7840
7878
  for (const f of toReview) {