agentleFS
ShieldNet-360ShieldNet-360/secure-vibe/skills/secure-code-review/SKILL.md

secure-code-review

Skill22 starsChanged 5 months agoMITView on GitHub

The sinks and boundaries that belong to no framework: passing input to a shell or an evaluator, letting input choose a filesystem path, validating at a boundary that is not an HTTP request, and handling regulated data (PII, PHI, cardholder data) so it does not spread into paths nobody reviews. Use when generating or reviewing code that shells out, touches the filesystem, reads a queue message, CLI argument, or parsed file, or when a change crosses a PII, PHI, or PCI boundary.

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use secrets-management and incident-response.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • xfstudioSkill

    secrets-management

    Implement secure secrets management for CI/CD pipelines using Vault, AWS Secrets Manager, or native platform solutions. Use when handling sensitive credentials, rotating secrets, or securing CI/CD environments.

    Also in 3 projects that use this

  • AnthropicSkill

    incident-response

    Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat client-side validation as a control.

    line 74

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “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

Secure Code Review

Rules (for AI agents)

ALWAYS

  • Validate input at every trust boundary, not only the HTTP one. A CLI argument, an environment variable, a queue message, a filename, a parsed config or spreadsheet cell all arrive from outside and none of them pass through the request-validation layer. Check type, length, allowed characters and allowed range, and reject before processing. api-security owns the HTTP request body and its schema; this rule is every other way input gets in.
  • Build a command as an argument vector, never as a string a shell will parse: subprocess.run([...]) without shell=True, execFile/spawn with an array, exec.Command(name, args...). Passing an array is what removes the shell, and removing the shell is what removes the injection — quoting and escaping are the fallback for when you cannot.
  • Canonicalize then check any path built from input: resolve it to an absolute real path, then confirm it is inside the intended directory. Checking the raw string first misses .., symlinks, absolute-path replacement, and encoded separators. file-upload-security owns stored uploads and archive extraction; this rule covers a static-file handler, a template loader, a log path, an export filename.
  • Tag any function or module handling PII, PHI or cardholder data with an explicit classification comment (// classification: PII), and keep that handling in clearly-named modules rather than in general utility code. An untagged helper is how regulated data spreads into paths nobody reviews for it, and the tag is what makes the later review possible.
  • Consult the owner for anything with one: database-security when code builds a query, crypto-misuse when it hashes, encrypts, signs or compares a secret, frontend-security for output encoding and response headers, auth-security for who the caller is, iam-best-practices for the privileges a process runs with. Each of those states its rule with the API names and the false positives this skill would have to leave out.

NEVER

  • Pass input to a shell or an evaluator: system, popen, os.system, subprocess.run(..., shell=True), child_process.exec / execSync, backticks, eval, new Function(), vm.runInNewContext, pickle.loads on a request body. The dangerous property is that the callee parses the string; a value that is only ever an argument is not the same risk.
  • Let input reach a path without canonicalization — including as a segment joined onto a trusted base, which is where ../ still works.
  • Treat client-side validation as a control. Re-validate on the server, and treat the client check as what it is: a message to the user, not a boundary.
  • Store a payment card number, CVV, or full track data in your own database. Send the card to a tokenization provider and persist only the opaque token plus the last four digits. The CVV is never persisted at all, not even encrypted, not even briefly — retention is the violation, not exposure.
  • Copy real regulated data into a fixture, a seed script, a local dump, or a bug report to reproduce something. The copy inherits the classification and leaves the reviewed path, which is the whole failure this skill's tagging rule exists to prevent.

KNOWN FALSE POSITIVES

  • Obviously fake fixture data is not regulated data: 4111-1111-1111-1111, 555-0100, John Doe, test@example.com. The classification rules apply to real data paths.
  • A command built entirely from constants, or one whose only variable parts are passed as separate argv elements, is not command injection. The finding is a shell parsing a string that input reached — not the presence of a subprocess call.
  • A path joined from values the application itself generated — a UUID, a hash, a database id — is not traversal. The finding is a caller-supplied component.
  • A regulated-data module that is correctly tagged and narrowly scoped is the rule working. The finding is untagged handling in general-purpose code.

Context (for humans)

This skill covers what is left when every framework-shaped concern has an owner. A query has database-security. A response header has frontend-security. An endpoint has api-security. What has no owner is the plain script: something shells out, something opens a file whose name came from somewhere, something reads a queue message and believes it. Those are not web vulnerabilities and no framework defends against them, which is why this is the skill that fires on languages: ["*"] and on code with no framework at all.

The command-execution rule is worth stating as a property rather than a list, because the list is always incomplete. The property is: does the callee parse the string? A shell does. eval does. A deserializer does. An argv array does not, and that is why switching to one is a fix rather than a mitigation — there is no remaining parser for an attacker to target.

The regulated-data rules came from a separate compliance skill and are deliberately narrow. They are not a compliance programme; they are the two decisions that get made in code and are expensive to reverse — where the classification is written down, and the fact that cardholder data does not live in your database.

References

  • references/verifying-findings.md — confirm or refute a finding, then lock it
  • references/verifying-compliance-findings.md — tie a flagged control gap to a specific clause, then look for the evidence that the control actually fired
  • checklists/owasp_top10.yaml
  • checklists/injection_patterns.yaml
  • CWE-78 · CWE-22 · CWE-20.
  • OWASP Top 10 2021.

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.