Features marked with [ROADMAP] are architecturally defined but not yet available in the current release.
Security Layers Overview
Layer 1: Guardian AST
The Guardian AST module performs a zero-latency static inspection of WebAssembly modules before compilation. It leveragesWebAssembly.Module.imports() to enumerate all host-bound import requests and validate them against a strict allowlist.
WASI Function Allowlist
Only the following 14wasi_snapshot_preview1 functions are permitted:
SandboxViolation error. A hard cap of 128 total imports per module prevents resource exhaustion via logic-bomb payloads.
Layer 2: WASI Sandbox
The SDK provides a dual-path execution engine that routes payloads to the appropriate isolation mechanism:V8 Global Poisoning
Twenty-five attack vectors are neutralized by setting each toundefined and sealing them as non-writable:
Object.freeze(), preventing any runtime modification of the execution environment.
Prototype Pollution Defense
Inside the sandbox IIFE, eleven core JavaScript prototypes are frozen before user code executes to satisfy strict PCI-DSS and HIPAA logical isolation requirements:Function and other global namespaces are explicitly poisoned (set to undefined) in the global scope to eliminate execution escapes, Function.prototype cannot be frozen directly. The SDK resolves it dynamically via Object.getPrototypeOf(function(){}) to apply the freeze.
The entire guest execution is wrapped inside a block containing "use strict";. Consequently, any attempt by the injected code to write or assign properties to these frozen prototypes (e.g., Object.prototype.polluted = "leak") will immediately throw a hard TypeError, halting execution and preventing prototype pollution vulnerabilities.
CPU Fuel Limits
Microtask Escape Defense
In V8 context execution, microtasks (like resolved Promises) scheduled during evaluation can sometimes outlive the script execution boundary or bypass simple synchronous limits. To prevent this, the SDK enforces:microtaskMode: 'afterEvaluate' option instructs Node.js to immediately run all microtasks queued by the script before returning. This guarantees that no async logic survives outside the 5,000 ms sandbox execution limit, neutralizing potential asynchronous logic-bomb bypasses.
Safe Host Environment Variables (allowEnv)
By default, the WASI sandbox completely isolates the guest environment. If your business logic strictly requires environment variables, you can enable safe host environment propagation:
AWS_SECRET_ACCESS_KEY or NPM_TOKEN), the SDK filters environment variables through a strict safe allowlist via getDefaultEnvironment():
- Windows Host Allowlist:
APPDATA,HOMEDRIVE,HOMEPATH,LOCALAPPDATA,PATH,PROCESSOR_ARCHITECTURE,SYSTEMDRIVE,SYSTEMROOT,TEMP,USERNAME,USERPROFILE,PROGRAMFILES. - Unix/Linux Host Allowlist:
HOME,LOGNAME,PATH,SHELL,TERM,USER.
() is immediately rejected to prevent remote code execution vectors.
Post-Execution Cleanup
The sandbox destroys all temporary artifacts after every execution cycle:Layer 3: PII Egress Shield
The PII Scanner intercepts all sandbox output before results are returned to the caller. Starting from v3, it operates a four-stage detection pipeline that combines structural analysis, pattern matching, and natural language processing. Each stage is independent — the system blocks data if any stage detects a violation.Detection Pipeline
Stage 1–2: Key Analysis
Exact match uses aSet<string> for O(1) constant-time lookup against a configurable list of forbidden keys.
Fuzzy match extends protection to aliases and variations using two algorithms:
- Short tokens (< 4 chars, e.g.,
id): Boundary-aware regex that detectspatientId,record_id,user-idbut allowsgrid,video,android - Long tokens (≥ 4 chars, e.g.,
name,phone): Substring containment that detectsfirstName,accountName,names
diagnosis, medication, image_id, or timestamp.
Stage 3: Pattern Validators
Stage 4: Named Entity Recognition (NER)
WhenenableNerScanning is set to true, the scanner leverages the compromise NLP library to detect person names, geographic locations, and organization names embedded in output values — regardless of the key used to store them.
NER scanning is opt-in during the alpha phase. It adds approximately 10ms of latency for typical output sizes (< 10KB). The
compromise library operates entirely in-process with no external API calls.Regional Presets
The SDK ships with three preconfigured pattern sets tailored to common regulatory frameworks:Anti-Bypass Protections
- Nested JSON Defense: Recursive parsing of JSON-encoded strings defeats obfuscation through
JSON.stringify()wrapping - Circular Reference Guard:
WeakSettracking prevents infinite recursion on self-referencing objects - Aggregation-First Policy: Blocks raw row-level data export — only aggregated results (counts, averages, summaries) pass through
- Output Schema Enforcement: When a
Zodoutput schema is defined,.strict()mode is automatically applied, rejecting any keys not explicitly allowed in the schema - Cryptographic & Envelope Unwrapping: Automatically isolates and extracts the raw business data payload from MCP/LIOP envelopes and gRPC proxied responses (via
unwrapForAggregationPolicyScan) before scanning. This prevents false positives from binary metadata and cryptographic seals (like HMAC-SHA256 ZK-Receipt signatures). - Recursive In-Memory Numerical Sanitization: Before scanning, all numeric values inside the returned payload are processed recursively: positive floats are clamped to a maximum of 4 decimal places, and negative values are safely clamped to
0(viasanitizeOutput()). This is executed fully in-memory to prevent float-representation side-channels and avoids redundant string conversions. - K-Anonymity on Small Datasets: For micro-datasets or synthetic demos (dataset size < 10), the Egress Shield applies a strict K-Anonymity filter. Any output returned by the sandbox is rejected if it contains more than 3 scalar keys (flat properties) or if it has any arrays or nested objects. This blocks attempts to rebuild datasets key-by-key or through nested structure side-channels.
Differential Privacy & 3-Tier Query Budget (NIST SP 800-226)
To prevent reconstruction and statistical differentiation attacks (where an agent performs multiple overlapping queries to isolate a single record’s values), the SDK implements a tiered query budget system coupled with Laplace differential privacy.3-Tier Query Budget Session Limits
During a secure PQC-negotiated session, the SDK tracks query access to data fields. In compliance with NIST SP 800-226 guidelines, fields are classified into three sensitivity tiers, each with its own strict query limit per session:- Forbidden Tier (Max 3 queries/session): Applies to fields declared in
forbiddenKeys(e.g.,ssn,password,email). Any attempt to query these fields beyond the limit triggers an immediate egress block. - Sensitive Tier (Max 8 queries/session): Applies to fields declared in global or tool-level
sensitiveKeys(e.g.,balance,diagnosis,ticker). - Public Tier (Max 25 queries/session): Applies to any public fields not registered as sensitive or forbidden.
Persistent Query Budgets & Concurrency Controls
To maintain zero-trust security invariants across server restarts, server crashes, or in multi-instance clusters (such as multiple parallel local bridge processes), the SDK supports filesystem-backed persistence of active query budgets:- Configuring Persistence: Operators can provide
budgetStorePatheither globally in theLiopServerconstructor options or locally inside a tool-levelLogicExecutionPolicy. - Client Identity Binding (Anti-Bypass): The budget limits are strictly bound to the client’s cryptographic identity (
agentDidderived from their persistent Ed25519 PeerID, orclientIdfrom JWT tokens authorized by the Nexus OAuth 2.1 server). By auditing the actual client identity rather than ephemeral transport tokens (such as gRPCsession_token), the SDK prevents adversaries from resetting their query budgets by spawning new handshakes or reconnecting. - Atomic File Locking: Under the hood, the SDK enforces cross-process synchronization and atomic updates to the budget JSON store using file-system locking (
.lockfiles). This prevents race conditions where parallel LLM requests execute concurrently on separate worker threads/instances to exceed budget caps. - Fail-Safe In-Memory Fallback: If filesystem write permissions fail, if the storage directory is read-only, or if a locking deadlock occurs, the SDK automatically reports the error to system logs and falls back to session-isolated in-memory budget tracking, ensuring continued node serviceability without dropping security enforcement.
Laplace Mechanism & Field Sensitivity
When the dataset size falls belowdpSmallDatasetThreshold (default: 50), the DP Engine applies calibrated Laplace noise () to all numeric outputs.
The engine automatically calibrates the sensitivity () based on field naming conventions:
- Count fields (
count,length,size,num): Sensitivity is locked to . - Average fields (
avg,mean): Sensitivity is dynamically calculated as . - Sum & general fields: Sensitivity is set to the tool’s configured
dpSensitivity.
Layer 4: ZK-Receipts
Every sandbox execution produces a cryptographic receipt that binds the output to the exact logic that generated it, providing tamper-evident proof of honest computation.Receipt Structure (Binary v1)
Cryptographic Pipeline
- ImageID Generation: A
SHA-256hash of the original logic payload fingerprints the exact code that was executed - Dataset Hash: A
SHA-256hash of the serialized dataset anchors the data state at execution time (SOX audit trail compliance) - Differential Privacy: Laplace noise is applied to numeric outputs before commitment, ensuring the ZK-Receipt matches the noisy data the client receives. Supports DDP mode (seeded PRNG via
dataset_hash + image_id) for audit reproducibility. - Journal Assembly: A JSON object containing
image_id,dataset_hash,output_hash(SHA-256 of the post-DP result),fuelconsumed, andts(timestamp) - HMAC Seal:
crypto.createHmac("sha256", sessionSecret).update(journal).digest()— the session secret is derived from the ML-KEM-768 (Kyber) key exchange - Verification & Replay Mitigation: The verifier validates the HMAC seal in constant-time (
crypto.timingSafeEqual). In addition, to prevent Man-in-the-Middle (MITM) reply manipulation and replay attacks, the verifier computes a local SHA-256 hash of the received result (expectedOutput) and strictly asserts that it is identical toJournal.output_hash(viaverifyZkReceipt). - Balanced-Brace Proxy Extractor: If the tool call was delegated via proxy (
__liop_proxy_tool), the verifier utilizes an in-process balanced-brace state machine to isolate and extract raw proxy arguments from the response before hashing, avoiding validation false positives when host layers append metadata.
Transport Security
Post-Quantum Key Encapsulation (ML-KEM-768)
The SDK uses themlkem package (FIPS 203 compliant) for key encapsulation:
Nonce Isolation
Each encrypted payload uses a fresh 12-byte random nonce (crypto.randomBytes(12)) prepended to the ciphertext. This prevents AES-GCM nonce reuse when multiple payloads are encrypted under the same session key.
Production TLS Hardening
While LIOP’s PQC layer encrypts all application-level payloads end-to-end, transport-level encryption (TLS/mTLS) is critical for preventing metadata eavesdropping and ensuring node identity. To prevent silent failures in production, the SDK implements a strict fail-safe check:- In development/testing environments, missing or misconfigured certificate files trigger a warning and gracefully fall back to insecure gRPC channels.
- In production (
process.env.NODE_ENV === 'production'), any failure to resolve or load configured TLS certificates (rootCert,certChain, orprivateKey) throws a fatal error, forcing the process to crash immediately instead of silently degrading to an unencrypted channel.
Zero-Trust Bridge Authentication
TheLiopStreamBridge enforces mandatory Bearer token authentication on all HTTP endpoints:
- If
ZERO_TRUST_TOKENis not set, a secure ephemeral token is auto-generated viarandomUUID() - Every request to
/mcprequires a validAuthorization: Bearer <token>header - Per-IP rate limiting on session creation (default: 10 concurrent sessions)
- Automatic eviction of idle sessions (TTL: 30 minutes)
P2P Network Security
Worker Pool Isolation
Computationally intensive cryptographic operations are dispatched to OS-level threads via Piscina worker pools, preventing blocking of the main V8 event loop:
Default configuration: 2–8 threads (production), 0–1 threads (test),
FixedQueue scheduling, 5s idle timeout.
Heap Bomb Defense
Each worker thread is constrained via V8’sresourceLimits.maxOldGenerationSizeMb (default: 64 MB, configurable via workerPool.maxHeapMb or the LIOP_WORKER_MAX_HEAP_MB environment variable). If injected logic attempts to allocate memory beyond this limit, the worker is terminated immediately with a WorkerPoolError, preventing denial-of-service attacks that target Node.js heap exhaustion.
Worker Pool Async Warmup
To avoid initial CPU latency spikes and mitigate V8/WASI cold-starts (~820k fuel units), the SDK features an asynchronous thread-pool warmup strategy. On server initialization (or verifier creation), background “warmup” tasks (isWarmup: true or action: "warmup") are dispatched to pre-warm the Piscina worker instances. This ensures worker threads are initialized, V8 isolate contexts are allocated, and WASI handles are pre-cached before processing real client payloads.
Aggregation-First Policy
The SDK enforces an Aggregation-First heuristic that blocks raw row-level data from leaving the sandbox. This is the last computational defense before the ZK-Receipt layer.How It Works
After execution, the output is recursively scanned for arrays containing objects. If the number of object elements exceeds the configured threshold, the response is blocked:Conditional Error Normalization
The SDK implements environment-aware error reporting for policy violations:
This is controlled automatically via
process.env.NODE_ENV. In production deployments, always ensure NODE_ENV=production is set to activate full error opacity.
Protocol-Native Directive Channels
To ensure that LLM clients generate compliant JavaScript code that respects sandbox limits without trial-and-error latency, the SDK broadcasts structured, protocol-native instructions at three levels:- JSON Schema Metadata (
$comment): The data dictionary automatically injects a$commentfield containing sandbox directives directly into the active JSON schema representation. - Execution Guidelines Resource: A dynamic resource (
liop://schema/guidelines) details the exact workarounds (e.g., date filtering via ISO 8601 strings) and constraints (K-Anonymity rules, Laplace suffixes) required by the node. - Cross-AI System Prompts: The prompt adapter system normalizes constraints across models (Claude, OpenAI, Gemini) to prevent hallucinated API calls.
Post-Quantum Cryptography & Session Lifecycle
LIOP combines ML-KEM-768 (Kyber768) for quantum-resistant key encapsulation with ML-DSA-65 (Dilithium65) for quantum-resistant digital signatures and manifest sealing:1-Hour Strict Session Expiration
To prevent replay attacks and minimize the vulnerability window of derived symmetric keys, all PQC sessions enforce a hard 1-hour lifetime limit:- Sessions automatically expire 3600 seconds after the initial ML-KEM-768 key exchange.
- Expired sessions reject subsequent RPC invocations and trigger an automatic re-negotiation handshake without dropping the underlying P2P connection.
Mutual TLS (mTLS) & Hot-Reloading (CertManager)
For enterprise environments requiring X.509 cryptographic client verification alongside PQC, CertManager manages dynamic certificate rotation without service restarts:
- Monitors CA, server, and client certificate paths on disk.
- Automatically swaps in-memory TLS contexts when renewed certificates are detected.
- Rejects untrusted client certificates at the transport handshake.
Industrial Compliance & Observability (SOC 2 Type II / HIPAA)
Immutable Audit Trail (AuditLogger)
Every logic execution, schema discovery, and security rejection is committed to an append-only, cryptographically verifiable Hash-Chain:
- Tamper Evidence: Modifying or deleting any historical log record breaks the SHA-256 chain integrity, instantly flagging compliance auditors.
- Data Sovereignty: Log entries record cryptographic digests and token consumption metrics without ever persisting raw confidential data.
Deterministic AST Fuel Metering
To defend against CPU exhaustion attacks that execute hidden computational loops, the engine statically analyzes JavaScript Abstract Syntax Trees viacalculateAstInstructionFuel:
- Analyzes AST complexity (loop depth, branching factor, function declarations) before execution.
- Injects a strict deterministic fuel budget into the V8 isolate runner.