xploitscan-shared-rules 1.32.0 → 1.33.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 +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9439,12 +9439,16 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
|
|
|
9439
9439
|
if (/demo-data|example-vulnerable|code-sample/i.test(filePath)) return findings;
|
|
9440
9440
|
const vendoredFile = isVendoredPath(filePath);
|
|
9441
9441
|
const ruleset = tier === "pro" && extraRules.length > 0 ? [...freeRules, ...extraRules] : freeRules;
|
|
9442
|
+
const silenceableLines = /-OK\b/i.test(content) ? content.split("\n") : null;
|
|
9442
9443
|
for (const rule of ruleset) {
|
|
9443
9444
|
if (disabledRules.includes(rule.id)) continue;
|
|
9444
9445
|
const matches = rule.check(content, filePath, project);
|
|
9445
9446
|
const compliance = complianceMap[rule.id];
|
|
9446
9447
|
const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
|
|
9447
9448
|
for (const match of matches) {
|
|
9449
|
+
if (silenceableLines && isLineSilenced(silenceableLines, match.line - 1, match.rule)) {
|
|
9450
|
+
continue;
|
|
9451
|
+
}
|
|
9448
9452
|
findings.push({
|
|
9449
9453
|
...vendored ? { vendored: true } : {},
|
|
9450
9454
|
id: `${match.rule}-${match.file}:${match.line}`,
|