security-audit

security-audit is a command for Claude Code from d-kimuson/claude-code-viewer. It costs 26 tokens per session (880 once invoked), scanned A, original, MIT.

Instructions for performing a full codebase security audit and writing the findings in Japanese. The audit combines an automated script with manual code inspection.

In plain words
What is it for?
Use it to run the security checker, inspect server and frontend code, record findings with file paths and line numbers, and produce a Japanese report.
Why use it?
It provides a structured check for issues such as command injection, unsafe file paths, cross-site scripting, and exposed secrets.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/d-kimuson/claude-code-viewer/security-audit
Clone the repo
git clone --depth 1 https://github.com/d-kimuson/claude-code-viewer

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for security-audit

README.md
[![agentmods](https://agentmods.dev/badge/commands/d-kimuson/claude-code-viewer/security-audit.svg)](https://agentmods.dev/commands/d-kimuson/claude-code-viewer/security-audit)
Your own site
<a href="https://agentmods.dev/commands/d-kimuson/claude-code-viewer/security-audit"><img src="https://agentmods.dev/badge/commands/d-kimuson/claude-code-viewer/security-audit.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 880 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00026 $0.00880
Opus 5 $0.00013 $0.00440
Sonnet 5 $0.00005 $0.00176
Haiku 4.5 $0.00003 $0.00088

Measured 4d ago against content hash d6e0302b3b3d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

security-audit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/security-audit.md · 98 lines

How it starts

The opening of the file, as written. The whole thing — 98 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a security expert. Conduct a comprehensive security audit of this project in three phases, then produce a report in Japanese.

Phase 1: Launch Automated Security Check

Run the security check script (this takes time):

nix develop --command bash -c "./scripts/security-check.sh"

Note the output directory path from stdout. Proceed to Phase 2 while waiting is not possible since this is synchronous — once it completes, move on.

Phase 2: Manual Codebase Inspection

Independently inspect the codebase as a security expert. Use Grep, Glob, and Read to examine code. Document each finding with exact file path, line number, severity, and recommended fix.

Areas to investigate:

Injection & Input Validation

  • Command injection in Bash/Command usage — check src/server/ for unsanitized user input passed to shell commands
  • Path traversal in JSONL file reads — verify paths are constrained to ~/.claude/projects/
  • XSS in React components — search for dangerouslySetInnerHTML, unsanitized content rendering

Secrets & Sensitive Data

  • Hardcoded credentials, API keys, tokens in source files
  • Sensitive data leaking into logs or error messages exposed via SSE/API

Server-side (Hono routes)

  • Input validation on all route handlers in src/server/hono/route.ts
  • File path inputs that could escape intended directories
  • Error responses that reveal internal paths or stack traces

Dependency & Supply Chain

  • Suspicious or unnecessary packages in package.json
  • Scripts in package.json / pnpm-lock.yaml that execute on install

Frontend

  • Raw fetch bypassing TanStack Query (policy violation that could indicate auth bypass)
  • Eval-like patterns (eval, Function(), innerHTML)

Phase 3: Integrate Findings and Write Report

Read the script output files from the directory captured in Phase 1:

  • pnpm-audit.json — parse vulnerabilities object (severity, via, fixAvailable) and metadata.vulnerabilities counts
  • codeql.sarif — parse runs[0].results[] (ruleId, message.text, physicalLocation uri+startLine, level)

Read the full file on GitHub · 98 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 98 lines · 26 tokens per session scan A d6e0302b3b3d

Subscribe to this mod's changes

security-audit is a command published in the GitHub repository d-kimuson/claude-code-viewer (1,278 stars, last pushed 16d ago), licensed MIT. It adds 26 tokens to every session and 880 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.