@felixgeelhaar/cclint
Version:
Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.
22 lines • 1.05 kB
JavaScript
import { Violation } from '../../../domain/Violation.js';
import { Severity } from '../../../domain/Severity.js';
/**
* Validates SQL code blocks for `SELECT *` usage and string-interpolation
* patterns that indicate potential SQL injection.
*/
export class SqlValidator {
validate(block, context) {
const violations = [];
const content = block.content.toUpperCase();
// Check for SELECT * in examples
if (!block.metadata.isAntiPattern && content.includes('SELECT *')) {
violations.push(new Violation(context.ruleId, `Avoid SELECT * in examples, specify columns explicitly`, Severity.WARNING, block.location));
}
// Check for potential SQL injection patterns
if (/\$\{.*\}/.test(block.content) || /\+\s*["']/.test(block.content)) {
violations.push(new Violation(context.ruleId, `Potential SQL injection vulnerability - use parameterized queries`, Severity.ERROR, block.location));
}
return violations;
}
}
//# sourceMappingURL=SqlValidator.js.map