Hub rules-claude-code

rules-claude-code

v4 public Verified

Claude-code

Governance rules for the Claude Code CLI that protect against CVEs and security incidents. These rules block malicious hook execution, credential theft, and command injection bypasses.

@sigmashakeinc 3 pulls 25 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-claude-code →
Severity
16 error 6 warn 3 info
demo.cast
Governance rules for the Claude Code CLI that protect against CVEs and security incidents. These rules block malicious hook execution, credential theft, and command injection bypasses.

Rules index

25 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

agent

no-bun-inline-writes error block

File writes via `bun -e` route around governance hooks — they hide the target path from the rule engine. Use the Write or Edit tool, or commit a tracked .ts script and run it via `bun run`.

Rule source requires an active Pro or Enterprise subscription.
no-node-inline-writes error block

File writes via `node -e`/`node --eval` route around governance hooks — they hide the target path from the rule engine. Use the Write or Edit tool, or commit a tracked .js script and run it via `node script.js`.

Rule source requires an active Pro or Enterprise subscription.
no-perl-inline-writes error block

File writes via `perl -e` or in-place edits via `perl -i` route around governance hooks. Use the Write or Edit tool.

Rule source requires an active Pro or Enterprise subscription.
no-python-inline-writes error block

File writes via `python -c` route around governance hooks — they hide the target path from the rule engine. Use the Write or Edit tool, or commit a tracked .py script and run it via `python3 script.py`.

Rule source requires an active Pro or Enterprise subscription.
no-ruby-inline-writes error block

File writes via `ruby -e` or in-place edits via `ruby -i` route around governance hooks. Use the Write or Edit tool.

Rule source requires an active Pro or Enterprise subscription.

claude-code

claude-code-deprecated-md5-hashing-python warning log

Use of MD5 for security-sensitive hashing detected. MD5 is cryptographically broken and unsuitable for password storage, digital signatures, or data integrity checks where collision resistance is required. Use stronger algorithms like 'hashlib.sha256', 'hashlib.sha3_256', 'bcrypt', 'scrypt', or 'argon2' for security purposes.

Rule source requires an active Pro or Enterprise subscription.
claude-code-google-style-wildcard-imports-python warning log

Violation of 'claude-code' (Google-inspired) Python Style Guide: Wildcard import detected. Wildcard imports ('from module import *') make it difficult to determine where names come from, can lead to name collisions, and obscure dependencies. Prefer explicit imports (e.g., 'from module import func1, func2') or import the module directly (e.g., 'import module') and use 'module.func1' for clarity and maintainability.

Rule source requires an active Pro or Enterprise subscription.
claude-code-hardcoded-api-key-python warning log

Hardcoded sensitive credential detected (e.g., API key, secret key, password). Storing sensitive information directly in code is a severe security risk. Use environment variables (e.g., 'os.environ.get("API_KEY")') or a secure secrets management system to handle credentials.

Rule source requires an active Pro or Enterprise subscription.
claude-code-insecure-command-execution-python error block

Insecure command execution detected. 'os.system()' is deprecated and highly vulnerable to command injection if used with untrusted input. Prefer 'subprocess.run()' with 'shell=False' and a list of arguments for safer external command execution, ensuring all inputs are properly sanitized.

Rule source requires an active Pro or Enterprise subscription.
claude-code-insecure-deserialization-python error block

Potential insecure deserialization detected. Using 'pickle.loads()' with untrusted input can lead to arbitrary code execution. Consider safer data formats like JSON or YAML, or implement robust input validation and integrity checks if pickle is unavoidable for trusted data.

Rule source requires an active Pro or Enterprise subscription.
claude-code-path-traversal-nodejs error block

Potential Path Traversal vulnerability in Node.js. Concatenating unsanitized user input (from 'req.query', 'req.params', or 'req.body') directly into 'path.join()' can allow attackers to access arbitrary files outside the intended directory. Always sanitize and validate user input, or use 'path.resolve()' with a base directory and ensure the resolved path is strictly within the intended directory.

Rule source requires an active Pro or Enterprise subscription.
claude-code-sql-injection-fstring-python error block

Potential SQL Injection via f-string detected. Directly embedding unsanitized user input (e.g., from 'request' object, 'user_input', or 'data') into SQL queries using f-strings is highly insecure. Use parameterized queries (e.g., 'cursor.execute("SELECT * FROM users WHERE id=?", (user_id,))') to prevent injection attacks.

Rule source requires an active Pro or Enterprise subscription.

claudecode

ask-claude-config-directory-modify warning ask

Claude Code config directory modification. CVE-2025-59536 demonstrated RCE via malicious .claude/ configs in cloned repositories. Modifying the .claude/ directory structure requires human review.

Rule source requires an active Pro or Enterprise subscription.
ask-read-claude-project-config warning ask

Claude Code project config read. Malicious project configs are a documented RCE vector (CVE-2025-59536). Verify this file originates from a trusted source before the agent processes its contents.

Rule source requires an active Pro or Enterprise subscription.
ask-write-claude-settings warning log

Writing Claude Code settings. Malicious settings can disable safety features, register unsafe hooks, or modify permission boundaries — as demonstrated in CVE-2025-59536. Verify changes before writing.

Rule source requires an active Pro or Enterprise subscription.
log-claude-session-file-access info log

Claude Code session or config file accessed. Audit trail for CVE-2026-21852 detection. Session files may contain conversation history with sensitive project context.

Rule source requires an active Pro or Enterprise subscription.
log-claudemd-write info log

CLAUDE.md written. This file is injected into every Claude Code conversation. Malicious instructions or hidden Unicode in CLAUDE.md constitute a persistent prompt injection attack against all future sessions using this project.

Rule source requires an active Pro or Enterprise subscription.
log-rapid-sequential-commands info log

Simple reconnaissance command logged. Research (The Register, April 2026) shows Claude Code's safety rule cap can be overwhelmed by rapid sequential commands, causing safety rules to stop firing. Monitoring for volume anomalies.

Rule source requires an active Pro or Enterprise subscription.
no-bash-command-substitution-bypass error block

Command substitution targeting Claude Code context detected. Attackers use nested command substitution to bypass regex-based command blacklists — a documented class of Claude Code safety bypass. Use explicit, fully-expanded commands without subshells.

Rule source requires an active Pro or Enterprise subscription.
no-claude-hook-execution error block

CVE-2025-59536: Malicious .claude/hooks/ scripts achieve RCE when Claude Code processes project configs. Executing hook scripts from cloned project directories is blocked. Hooks must be managed manually in your personal ~/.claude/ config, never run by the agent.

Rule source requires an active Pro or Enterprise subscription.
no-node-source-map-exfil error block

Source code exfiltration via npm debug source maps. In March 2026, Anthropic accidentally published a debug source map on npm that reconstructed 500,000+ lines of internal TypeScript. NODE_OPTIONS with source-map flags in production contexts is blocked.

Rule source requires an active Pro or Enterprise subscription.
no-read-anthropic-config error block

Anthropic credential storage access blocked. CVE-2026-21852 demonstrated API credential theft through project config manipulation. Reading Anthropic config directories outside the official CLI is blocked. Use environment variables: ANTHROPIC_API_KEY.

Rule source requires an active Pro or Enterprise subscription.
no-read-claude-credential-files error block

CVE-2026-21852: API credential theft via project configurations. Reading Claude Code credential files is blocked. Attackers embed malicious configs in project .claude/ directories that, when processed, read and exfiltrate API credentials. Access credentials only through the official CLI and environment variables.

Rule source requires an active Pro or Enterprise subscription.
no-write-claude-credentials error block

Writing to Claude Code credential storage blocked. CVE-2026-21852 (Claude Code versions prior to 2.0.65) allowed credential theft via malicious project configurations. Credentials are managed by the official CLI only.

Rule source requires an active Pro or Enterprise subscription.
no-write-claude-hooks error block

CVE-2025-59536: Writing to .claude/hooks/ achieves RCE when Claude Code processes project configs. Researchers found it 'relatively easy for a bad actor to introduce a malicious Hook command in Claude Code's configuration file' that auto-executes when a developer opens the project. Hook files must be created manually by the developer, never by an AI agent.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v4
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
8310f298184e354d66c53f4f9a596a7c2a9fa547248f145103b9a49b400f553c
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-claude-code/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-claude-code. The published version only bumps when a maintainer resyncs.

No commit history available.