claw-guard
claw-guard is the security, session, and policy engine for ClawDB. It provides API key management, JWT-backed sessions, TOML policy loading, risk-aware authorization, batched audit logging, and field masking over a SQLite-backed control plane.
Features
- API key creation, validation, revocation, and listing with BLAKE3 hashing.
- Session issuance and validation with HS256 JWTs and revocation checks.
- Policy evaluation with allow, deny, and mask rules loaded from SQLite or TOML files.
- Batched audit persistence with filtering and CSV export.
- JSON masking with redact, hash, truncate, email, and nested field masking strategies.
- Optional gRPC service for remote authorization and administration.
Installation
[]
= "0.1.2"
Configuration
GuardConfig::from_env() reads these variables:
CLAW_GUARD_JWT_SECRET(required)CLAW_GUARD_DB_PATH(default:claw_guard.db)CLAW_GUARD_POLICY_DIR(optional)CLAW_GUARD_SENSITIVE_RESOURCES(comma-separated)CLAW_GUARD_AUDIT_FLUSH_INTERVAL_MS(default:100)CLAW_GUARD_AUDIT_BATCH_SIZE(default:500)CLAW_GUARD_BUSINESS_HOURS_START(default:8)CLAW_GUARD_BUSINESS_HOURS_END(default:18)
Quick Start
use ;
use SecretString;
use PathBuf;
async
Policy Files
Policy files support single-policy or multi-policy TOML documents. Example:
[[]]
= "deny-finance-during-scheduling"
= 100
[[]]
= "deny_if"
= "Finance data not accessible during scheduling tasks"
[]
= [{ = "scheduling" }, { = "finance_records" }]
Supported condition operators are task_matches, role_is, scope_contains, risk_above, resource_is, workspace_is, and, or, and not.
Development
License
Apache-2.0. See LICENSE.