agentleFS
CapristaCaprista/KarvyLoop/.claude/skills/security-review/SKILL.md

security-review

Skill16 starsChanged 5 months agoMITView on GitHub

Dev-time security audit of KarvyLoop's OWN source (twin of /code-review, but for security). Use when asked to "audit the security of these changes", "审这轮改动的安全", "security review this endpoint/diff", or before landing anything that touches the untrusted-input frontier (new API endpoints, URL/file fetch, tool authorization, sandbox, LLM output that reaches a persistent store or the shell). Runs a multi-agent adversarial audit — parallel discovery agents, then ≥3 refutation passes per finding (keep only if ≥2/3 say REAL) — and REPORTS ONLY; it never edits code. Not a KarvyLoop product feature.

187 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use kotlin-testing, configure-ecc and 10 more.

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.
  • tpavanipradeepSkill

    kotlin-testing

    Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.

    Also in 6 projects that use this

  • saxon-ySkill

    configure-ecc

    Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.

    Also in 12 projects that use this

  • InfopibeSkill

    content-hash-cache-pattern

    Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.

    Also in 12 projects that use this

  • InfopibeSkill

    ralphinho-rfc-pipeline

    RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.

    Also in 10 projects that use this

  • mryeastcodeSkill

    pytorch-patterns

    PyTorch deep learning patterns and best practices for building robust, efficient, and reproducible training pipelines, model architectures, and data loading.

    Also in 9 projects that use this

  • berntpoppSkill

    dependency-cve-sweep

    Use when handling Dependabot PRs, CodeQL/Trivy alerts, or doing a routine dependency/CVE sweep for this repo.

    Also in 5 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 165 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a vector is already tested in tests/security/, it is not a finding — verify the coverage actually reaches the code path in question (the …

    line 31
  2. Distinctive:

    Every claimed finding must survive adversarial verification.

    line 110
  3. Distinctive:

    Never print secrets (keys / headers / Authorization) even to demonstrate a leak.

    line 112
  4. Distinctive:

    No external project names in the report (write "业界做法" / OWASP references).

    line 115

“Common” is measured: kept by at least 6 in 10 of the 165 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

security-review — adversarial security audit of KarvyLoop itself

A dev tool. It finds security seams in KarvyLoop's own code and reports them; the human decides and fixes. Modeled on the industry "多代理对抗审计" pattern (parallel finders → independent refuters → synthesis, recording false positives) — that pattern is worth using precisely because ~60% of naive findings are false positives that adversarial verification filters out.

0. Read ground-truth first (a tested vector is NOT a finding)

Before auditing, read:

  • tests/security/README.md — the catalog of already-tested attack vectors (SSRF / sandbox escape / credential leak / path traversal / …) and the honest OWASP-LLM-Top-10 coverage table (which rows are covered vs gap).
  • CLAUDE.md hard rules (安全是地基不是招牌 / 凭证只在 config.yaml 仓外 / 来源判定注入防御 / 沙箱三平台 / 宁空勿毒).

If a vector is already tested in tests/security/, it is not a finding — verify the coverage actually reaches the code path in question (the SSRF floor, for example, is tested for web_fetch but a different fetch path can still bypass it — that gap is a real finding, the "covered" label is not a blanket).

1. Scope

  • The pending diff (git diff, git diff --stat) + the untrusted-input frontier it touches. Wire-trace where request/user/tool/web content enters and where it reaches a sink (shell, filesystem, network egress, SQL, innerHTML, a persistent store, the model).
  • Untrusted = anything crossing the access-token/same-origin gate, tool-returned content, fetched web pages, imported agents, pasted "material", stored memory read back. Legitimate instructions come only from the user's own message + the system framework.

2. Discovery — parallel finders, one dimension each

Fan out discovery agents (or, in a single pass, cover each dimension explicitly). Ten dimensions, each mapped to OWASP LLM Top 10:

#DimensionOWASP LLM
1Prompt injection (direct + indirect via tool/web/import/stored-memory)LLM01
2Sensitive-info / credential leak (keys, headers, Authorization in logs/responses)LLM02
3Excessive agency / authorization (tool can do more than the task; missing authz)LLM06
4Sandbox escape / arbitrary exec (bwrap/seatbelt/win bypass, shell metachar)LLM06
5SSRF (URL fetch → cloud metadata 169.254.169.254 / loopback / private nets; redirect→internal)LLM05
6Path traversal / arbitrary read-write (../, symlink, skill-zip resolveKey)LLM06
7Deserialization / injection (JSON/YAML/pickle, f-string SQL, schema poisoning)LLM05
8DoS / unbounded consumption (ReDoS, no size cap, memory exhaustion, cost DoS)LLM10
9Improper output handling (model output → innerHTML/shell/SQL without sanitize)LLM05
10System-prompt / memory leakage; stale-memory false confidenceLLM07

For each candidate: file:line, the untrusted source, the sink, the reachability path.

3. Adversarial verification (the load-bearing step)

For every candidate finding, run ≥3 independent refutation passes — each prompted to try to prove the finding is FALSE (default to FALSE_POSITIVE when uncertain). Keep the finding only if ≥2 of 3 conclude REAL.

  • Verdict = last-match. A refuter often restates the author's claim ("the code claims to sanitize…") before its own conclusion; a first-match parse gets fooled into a false PASS. Take the last REAL/FALSE_POSITIVE token as the verdict.
  • Common valid refutations that kill a finding: the value is developer-supplied (a call param from our own code), not attacker-controlled; a genuine always-on control mitigates it (the access-token + same-origin gate; a deterministic hard gate); the sink is parameterized; the input is bounded/validated upstream; the vector is already tested.
  • A present mitigation downgrades severity; it only kills the finding if it fully closes the path.

4. Severity — weighted by real-deployment reachability

Critical (remotely reachable, no auth, high impact) / High (reachable by any token-holder or via untrusted content, real impact — e.g. SSRF to metadata, cred leak) / Medium (needs specific conditions) / Low (defense-in-depth). KarvyLoop is local-first single-user: "LAN is not a boundary, the token gate is" — factor that into reachability, but do not use it to dismiss floors that are meant to hold regardless of who's inside.

5. Report format (report-only — never edit code)

# Security Review — <scope>
## FINDINGS (survived adversarial verification)
[SEVERITY] <one-line> — file:line
  - Why it's real: <the path from untrusted source to sink>
  - OWASP/catalog: <LLM id; is it a claimed-covered vector being bypassed?>
  - Refutations attempted: <(a)… (b)…> → survives / downgraded
  - Mitigations present: <what limits it> — closes it? no
  - Fix direction (do NOT apply): <bounded, mirror an existing safe pattern>
## REJECTED (false positives — recorded, mandatory)
Rejected — <claim>. Why rejected (N/3): <the refutation that held>.
## Honest coverage statement
Examined: <dimensions>. Found: <N real>. What this pass does NOT cover: <…>.
This narrows where to look; it does not replace a human security review.

6. Discipline

  • Report only. Never edit code — the human reviews findings and decides the fix.
  • Every claimed finding must survive adversarial verification; record the false positives you rejected and why (honesty guards against "automation replaces humans").
  • Never print secrets (keys / headers / Authorization) even to demonstrate a leak.
  • A tested vector (in tests/security/) is not a finding unless coverage genuinely misses the path in question.
  • No external project names in the report (write "业界做法" / OWASP references).

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.