vibe-guard
Version:
██ Vibe-Guard Security Scanner - 28 essential security rules to catch vulnerabilities before they catch you! Zero dependencies, instant setup, works everywhere, optimized performance. Detects SQL injection, XSS, exposed secrets, CSRF, CORS issues, contain
38 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseRule = void 0;
class BaseRule {
createIssue(file, line, column, code, message, suggestion, severity) {
return {
rule: this.name,
severity: severity || this.severity,
message,
file,
line,
column,
code: code.trim(),
suggestion
};
}
findMatches(content, pattern) {
const lines = content.split('\n');
const matches = [];
lines.forEach((lineContent, lineIndex) => {
let match;
const globalPattern = new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g');
while ((match = globalPattern.exec(lineContent)) !== null) {
matches.push({
match,
line: lineIndex + 1,
column: (match.index ?? 0) + 1,
lineContent
});
if (!pattern.flags.includes('g'))
break;
}
});
return matches;
}
}
exports.BaseRule = BaseRule;
//# sourceMappingURL=index.js.map