agentleFS
Baba01hacker666Baba01hacker666/dummyskills/skills/general-engineering/security-vulnerability-fixer/SKILL.md

security-vulnerability-fixer

Skill0 starsChanged 2 months agoMITView on GitHub

Guides agents through patching security vulnerabilities (SQL injection, path traversal, command injection, CVE audit alerts) cleanly.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 7 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when:

    line 14
  2. Very specific:

    Do not use for routine bug fixes without security impact.

    line 20
  3. Distinctive:

    If file is unspecified: ask for file and line number.

    line 27
  4. Distinctive:

    Never "fix" security issues by disabling validation or turning off authentication.

    line 28
  5. Distinctive:

    Follow these numbered actions:

    line 31
  6. Distinctive:

    Use language standard parameterized APIs.

    line 37
  7. Distinctive:

    Always reject user-supplied file paths that resolve outside the intended root directory.

    line 44
  8. Very specific:

    Never use eval() or exec() with unsanitized arguments.

    line 45
  9. Distinctive:

    Stop and ask the user when:

    line 76
  10. Very specific:

    if (!safePath.startsWith(BASE_DIR)) {

    line 100

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Security Vulnerability Fixer

Applies surgical security remediations for common OWASP vulnerabilities: SQL injection, path traversal, command injection, SSRF, and dependency CVEs.

1. Purpose

Eliminate security vulnerabilities without breaking legitimate application workflows.

2. When to Use

Use this skill when:

  • Fixing static analysis security alerts (SonarQube, CodeQL, Snyk).
  • Replacing string concatenation in SQL queries with parameterized statements.
  • Sanitizing file paths to prevent directory traversal (../).

3. When Not to Use

  • Do not use for routine bug fixes without security impact; use minimal-bug-fix.

4. Required Inputs

  • vulnerability_type: SQLi, Path Traversal, Command Injection, XSS, or Insecure Dependency.
  • target_file: Source file containing the vulnerability.

5. Missing-Input Behavior

  1. If file is unspecified: ask for file and line number.
  2. Never "fix" security issues by disabling validation or turning off authentication.

6. Procedure

Follow these numbered actions:

  1. Action 1: Identify Flawed Pattern
    • SQLi: query("SELECT ... " + id) -> Parameterized query.
    • Path Traversal: open(path) -> Path.resolve() and verify prefix within base dir.
    • Command Injection: exec("cmd " + arg) -> execFile(["cmd", arg]).
  2. Action 2: Apply Standard Remediation
    • Use language standard parameterized APIs.
  3. Action 3: Run Automated Tests
    • Confirm legitimate inputs continue to work.
  4. Action 4: Emit Security Report
    • Format per Section 8.

7. Decision Rules

  • Always reject user-supplied file paths that resolve outside the intended root directory.
  • Never use eval() or exec() with unsanitized arguments.

8. Output Format

Emit the report using this template:

### Security Vulnerability Patch: [Vulnerability Type]

- **Target File**: `[path:line]`
- **Severity**: [Critical | High | Medium]
- **Status**: PATCHED & VERIFIED

#### Remediation Diff
```diff
[Diff showing parameterized or sanitized fix]

Verification Evidence

  • [Test results showing fix works and blocks payload]

## 9. Verification Checklist
- [ ] Parameterized API or path resolution used.
- [ ] No regression on legitimate inputs.
- [ ] Test suite passes.

## 10. Common Failures and Recovery
| Failure Symptom | Cause | Recovery Action |
| :--- | :--- | :--- |
| Incomplete path sanitization | Stripping `../` with regex | Use canonical path resolution (`path.resolve()`) and check `startsWith(baseDir)`. |

## 11. Stop or Escalation Conditions
Stop and ask the user when:
- Remediation requires architectural overhaul of database communication layer.

## 12. Examples

### Example 1: Successful Execution
**Input:**
```text
File: src/files.ts:14
Vulnerability: Path traversal in readFile(req.query.path)

Output:

### Security Vulnerability Patch: Path Traversal

- **Target File**: `src/files.ts:14`
- **Severity**: High
- **Status**: PATCHED & VERIFIED

#### Remediation Diff
```diff
- const fullPath = path.join(BASE_DIR, req.query.path);
+ const safePath = path.resolve(BASE_DIR, req.query.path);
+ if (!safePath.startsWith(BASE_DIR)) {
+   throw new ForbiddenError("Path traversal detected");
+ }

Verification Evidence

  • Verified path outside BASE_DIR throws 403 Forbidden.

### Example 2: Ambiguous or Missing Input
**Input:**
```text
Fix security.

Output:

### Security Vulnerability Patch: Halted - No Target

- **Status**: Halted

Please provide the vulnerability type, target file, and line number.

Example 3: Expected Final Output

Output:

### Security Vulnerability Patch: SQL Injection

- **Target File**: `src/db.py:22`
- **Severity**: Critical
- **Status**: PATCHED & VERIFIED

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.