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.cjs
CHANGED
|
@@ -9746,12 +9746,16 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
|
|
|
9746
9746
|
if (/demo-data|example-vulnerable|code-sample/i.test(filePath)) return findings;
|
|
9747
9747
|
const vendoredFile = isVendoredPath(filePath);
|
|
9748
9748
|
const ruleset = tier === "pro" && extraRules.length > 0 ? [...freeRules, ...extraRules] : freeRules;
|
|
9749
|
+
const silenceableLines = /-OK\b/i.test(content) ? content.split("\n") : null;
|
|
9749
9750
|
for (const rule of ruleset) {
|
|
9750
9751
|
if (disabledRules.includes(rule.id)) continue;
|
|
9751
9752
|
const matches = rule.check(content, filePath, project);
|
|
9752
9753
|
const compliance = complianceMap[rule.id];
|
|
9753
9754
|
const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
|
|
9754
9755
|
for (const match of matches) {
|
|
9756
|
+
if (silenceableLines && isLineSilenced(silenceableLines, match.line - 1, match.rule)) {
|
|
9757
|
+
continue;
|
|
9758
|
+
}
|
|
9755
9759
|
findings.push({
|
|
9756
9760
|
...vendored ? { vendored: true } : {},
|
|
9757
9761
|
id: `${match.rule}-${match.file}:${match.line}`,
|