Skip to content

Security Policy

Canontra is built to run safely on untrusted repositories, CI runners, and offline air-gapped networks (Canontra.Security.Path, Canontra.Cache.SlabV7, Canontra.Harness.*).

  • Zero Network Libraries: canontra.cabal imports no HTTP, socket, TLS, or RPC packages.
  • Zero Telemetry: No source code, file paths, or metrics ever leave the local machine.
  • Zero C-FFI Dependencies: All parsers and graph engines run in pure, memory-safe Haskell without libtree-sitter or native dynamic libraries.
  • Root Containment: Target paths pass through canonicalizeSafePath to ensure they stay inside the project root. Sequences like ../../etc/passwd or cross-drive jumps fail immediately with Exit Code 4.
  • Null-Byte Rejection: Paths with embedded \0 bytes are rejected before calling OS filesystem APIs.
  • Symlink & Junction Cycle Breaking: Directory walks track FileNodeIdentity (fniVolumeID, fniFileID) to stop circular symlinks and Windows NTFS junctions before stack overflow can occur.
  • Maximum File Size: 50 MB (52,428,800 bytes) per source file.
  • Maximum Directory Depth: 64 directory levels.
  • Bounded Graph Passes: Dominator-tree, RPO, and CSR multi-source BFS allocations stay strictly bounded by vertex count |V|.

4. CNTR\x07 (SlabV7) Cache & Git Subprocess Safety

Section titled “4. CNTR\x07 (SlabV7) Cache & Git Subprocess Safety”
  • 4KB CRC-32C Integrity: Every payload page storing 9-tier bundles and FileGraphSummary data carries an IEEE 802.3 CRC-32C checksum (decodeSlabV7Resilient / readSlabV7FileResilient). Damaged pages are dropped and recomputed without crashing.
  • Atomic Swap with Retry: Cache writes stage to .tmp.<pid> and rename via atomicSwapWithRetry / atomicSwapWithRetry_ (exponential backoff with jitter) to survive Windows Defender or SearchIndexer locks.
  • Shell-Free Read-Only Git Calls: git diff, git ls-tree, and git show run via System.Process.readProcessWithExitCode with explicit argument arrays (never invoking sh, cmd.exe, or powershell.exe), and returned paths pass through canonicalizeSafePath.
  • Zero .git Changes & Auto-Ignore: .canontra/snaps/ stores local blobs (objects/), manifests (manifests/), HEAD, and ledger.jsonl without running git write commands; ensureSnapStore creates .canontra/.gitignore automatically.
  • ID & Path Validation: isSafeSnapId rejects .., /, \, and leading dots with Exit Code 4; snap rewind validates every path with both isSafeRelativeFilePath and canonicalizeSafePath before touching disk.
  • Preflight SHA-256 Verification: preflightRewind reads and SHA-256 verifies every object via readVerifiedBlob before modifying or deleting any workspace file; tampered objects abort with zero partial disk changes.
  • Untracked File Preservation: Rollbacks only delete files tracked in HEAD that do not exist in the target snapshot, leaving unrelated user files untouched.

6. Automated CI Security Checks (.github/workflows/security.yml)

Section titled “6. Automated CI Security Checks (.github/workflows/security.yml)”

Every Pull Request and push to main runs automated security checks in .github/workflows/security.yml:

  • Zero-Trust Architectural Gate: Confirms zero networking or C-FFI imports exist in Haskell source or .cabal dependencies.
  • Gitleaks OSS: Scans commit history and diffs for leaked secrets or tokens.
  • Google OSV-Scanner: Checks dependencies against known open-source vulnerability advisories.
  • zizmor: Audits GitHub Actions workflows for script-injection, over-privileged tokens, and unpinned action risks.