RagLeap
PyPI package (alpha)

ragleap-security

version — loading live from PyPI…

Alpha: small, auditable security primitives for the ragleap libraries. Standard library only. Version 0.1.0. Open source (MIT). Not independently audited: its threat model lists what 0.1.0 defends and what it does not, and the library has had no independent security review.

pypi license
pip install ragleap-security

Highlights

  • Scope: an immutable tenant scope (tenant, subject, agent, session) with an unambiguous key, plus covers, narrow and require_scope. ragleap-memory builds on it
  • AuditLog: an append-only JSON Lines log with a SHA-256 hash chain and verify(). Tamper-evident, not tamper-proof
  • SecretStr, from_env and redact: secrets that do not print themselves, are read from the environment by name, and a heuristic redactor for logs
  • check_size, check_json_shape, bounded_read and Deadline: hard limits for untrusted input
  • Python 3.10 or newer, with no dependencies

Quickstart

from ragleap_security import AuditLog, Scope, SecretStr, from_env, redact

scope = Scope("acme", subject="alice")
log = AuditLog("audit.jsonl")
token = from_env("MY_SERVICE_TOKEN")
log.append("login.ok", {"user": "alice", "token": token}, scope)
assert log.verify().ok
print(redact(f"request failed with {token.reveal()}", [token]))

Verified, and limits

  • Verified in 0.1.0 (from its changelog): 101 tests pass on Python 3.10 and 3.12, the CI test job passes on 3.10, 3.11 and 3.12, and all 30 deliberate breaks of a protection are killed by the mutation check on 3.10 and 3.12. Our own count of the repository on main is on the tests page
  • The threat model covers six threats: a missing or forged tenant scope, a secret printed or serialized by accident, edits to the audit log, forged audit records, hostile input that exhausts memory or CPU, and concurrent writers corrupting the audit chain. The last one is covered by thread and process tests, and the threat model notes it is not mutation-checked
  • Not in 0.1.0: encryption, an SSRF-safe HTTP helper, a policy engine, output detectors and a red-team harness. These are planned (issue 899) and not available
  • Alpha and not independently audited. Read the threat model before relying on it
PyPI page Source Changelog Threat model