Skip to main content

tatu-hook

A security hook that evaluates security rules locally and reports events to the Tatu DevSecOps dashboard.

What it does

tatu-hook runs as a Claude Code hook on developer machines. It intercepts tool calls (file writes, shell commands, etc.) and evaluates them against security rules — blocking secrets, destructive commands, PII exposure, and code vulnerabilities in real time.

  • Secrets detection — AWS keys, GitHub tokens, Stripe keys, private keys, passwords
  • PII/LGPD compliance — Brazilian CPF/CNPJ, email addresses, credit cards
  • Destructive command blockingrm -rf, DROP TABLE, git push --force
  • SAST scanning — SQL injection, XSS, command injection patterns
  • YARA rules — Advanced multi-condition pattern matching

Install

pip install tatu-hook

# With YARA rule support:
pip install "tatu-hook[yara]"

Quick start

Create an API key in the Tatu dashboard (Settings > API Keys), then:

tatu-hook init --api-url https://tatu.your-domain.com --api-key tatu_xxxxx

This creates ~/.tatu/manifest.json, syncs the latest rules, and registers hooks in ~/.claude/settings.json automatically.

Options:

  • --scope project — register hooks in .claude/settings.json (current directory) instead of globally
  • --no-register — skip hook registration (for users who manage settings externally)

How it works

  1. SessionStart — Syncs rules from the Tatu API (version check, downloads only if outdated)
  2. PreToolUse / PostToolUse — Evaluates content against cached rules (regex + optional YARA)
  3. Policy modes:
    • audit (default) — Logs what would be blocked, never denies. Safe for onboarding.
    • strict — Actively blocks Claude Code operations that match rules.
  4. Events are reported asynchronously to the dashboard (fire-and-forget, non-blocking)

Local cache

Rules are cached at ~/.tatu/ for offline resilience:

~/.tatu/
├── manifest.json    # Version, API URL, API key
├── rules/           # Synced YAML rule templates
└── yara/            # Synced YARA rules

If the API is unreachable, tatu-hook falls back to cached rules silently.

CLI reference

tatu-hook --version                          # Show version
tatu-hook init --api-url URL --api-key KEY   # Initialize configuration
tatu-hook run --event session-start          # Sync rules on session start
tatu-hook run --event pre                    # Evaluate PreToolUse hook
tatu-hook run --event post                   # Evaluate PostToolUse hook

Requirements

  • Python 3.10+
  • PyYAML 6.0+
  • (Optional) yara-python 4.5+ for YARA rule evaluation

License

MIT

Release files for tatu-hook 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tatu-hook 1.0.0
File Size Uploaded
tatu_hook-1.0.0.tar.gz 20.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tatu-hook 1.0.0
File Interpreter ABI Platform
tatu_hook-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.1 kB

Release files / tatu_hook-1.0.0.tar.gz

Download URL tatu_hook-1.0.0.tar.gz
Size 20.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cae85a050e2e96686724dcafdab979c904dc2ed741c30ab21d32f1c8819308f8
BLAKE2b-256 checksum
How to use checksums
c1062a4305fafaa3136dfd2013a6bfcc66755a9e4c3dc55b43139978be651ff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release files / tatu_hook-1.0.0-py3-none-any.whl

Download URL tatu_hook-1.0.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
361daeea0720a9542f3dd032cb1e82b6dfdacf2cb4c31ab9b28f3dec73cbc9aa
BLAKE2b-256 checksum
How to use checksums
2a863a74d9de38c3798ff8d9e92a0156601779c46abc42b3d1cadf1ae09d3d6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page