Performs quality control. Checks for security vulnerabilities, errors, and code quality using ESLint. Detects buffer overflow errors and validates input for validity and size.
- ESLint Analysis - Static code analysis for errors and best practices
- Security Scanning - Detection of security vulnerabilities (SQL Injection, XSS, etc.)
- Buffer Overflow Detection - Validate input sizes
- Input Validation - Checks for missing length, type, and range validations
opencode skill install code-guardian-
Clone this repository or copy the
code-guardianfolder to:- Project:
.opencode/skills/code-guardian/ - Global:
~/.config/opencode/skills/code-guardian/
- Project:
-
Install the required npm packages:
npm install --save-dev eslint @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-securitytask(
load_skills=["code-guardian"],
...
)# With config file
npx eslint --config .eslint.code-guardian.json --ext .ts,.js,.tsx,.jsx .
# With auto-fix
npx eslint --config .eslint.code-guardian.json --fix .
# TypeScript check
npx tsc --noEmitThis skill includes a pre-configured .eslint.code-guardian.json file that you can use in your project.
Or create your own .eslint.code-guardian.json:
{
"root": true,
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:security/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "security"],
"rules": {
"no-console": "warn",
"no-debugger": "warn",
"security/detect-object-injection": "off"
}
}| Issue | Severity |
|---|---|
| eval() with dynamic expressions | High |
| File system access without path validation | High |
| Regex from user input | Medium |
| Object injection vulnerabilities | Medium |
| Timing attacks | Medium |
| Weak random number generators | Medium |
| Issue | Severity |
|---|---|
| Unsafe Buffer constructors | High |
| Unsafe Buffer creation | High |
| Code | Meaning |
|---|---|
| 0 | No problems found |
| 1 | ESLint errors present |
| 2 | Configuration error |
MIT