@aspidasec/custom-rules
v0.1.0
Published
Custom rule authoring engine for AspidaSec
Downloads
65
Maintainers
Readme
@aspidasec/custom-rules
Custom rule engine for AspidaSec. It loads YAML or inline rule definitions, validates them with Zod, applies regex patterns to matching files, and emits NormalizedFinding results through the CustomRuleScanner adapter.
Installation
pnpm add @aspidasec/custom-rulesUsage
import { CustomRuleScanner, RuleLoader } from "@aspidasec/custom-rules";
const loader = new RuleLoader();
const validation = loader.validateDirectory(".aspidasec/rules");
const scanner = new CustomRuleScanner(loader);
const findings = await scanner.scan({ repoRoot: process.cwd() });From the AspidaSec CLI:
aspidasec rules list
aspidasec rules validateAPI
RuleLoader— loads.ymland.yamlfiles from a directory, validates inline config rules, and reports validation errors per file.aspidasecRuleSchema— Zod schema forAspidaSecRuledefinitions.CustomRuleScanner— scanner adapter withname = "custom-rules"; loads configured rules plus.aspidasec/rulesand matches them against source files.AspidaSecRule— rule definition with bilingual title/description/remediation, severity, category, regexpattern,fileGlob, optional OWASP category, and optional CWE list.CustomRulesConfig— config shape for inline custom rules.RuleValidationResult— validation result containing validity, parsed rule, errors, and file path.
License
Apache-2.0
