-
Tamper-Evident Stream & Crash Durability: Canonical SHA-256 hash chaining (
prevHash->hash) across discrete atomic event files and SHA-256 content-addressed blobs (MAX_BLOB_BYTES = 50 MB), written viaO_CREAT|O_EXCLtemp file +fsync+ atomicrename+ parent-dirfsyncwith atomiclinkSynccross-process locks (0o600), process-shared instance IDs,(dev, ino)ownership verification,/proc/<pid>/statzombie & start-ticks stale lock detection, contiguous-chain tip recovery, and integrity verification vian1 verify/n1 doctor. -
Projection Integrity & Privilege Isolation (L1 > L2 > L3 > L4):
- Projection caches (
state.json) are tamper-detected via canonical SHA-256snapshotDigest, strict anchor event (seq+hash) validation, and rebuilt with null-prototype maps (Object.create(null)) + forbidden-key guards (__proto__,constructor,prototype,toJSON, etc.). - L4
ai-agentsessions (including MCP clients and transcript ingestion) cannot supersede directives, overwrite existing lessons/ADRs/directives/issues, self-verify lessons, resolve issues, forgeexec.completedcrash resolutions, or promote/revert officer knowledge; MCPrecord_stream_eventenforces an explicit non-privileged allowlist and MCPissue_directiveis restricted toadvisoryseverity. -
PartyModeOrchestratortracks vetoing officer roles (veto:<officer>) onCrew Remediation Gatedirectives so partial-officer specialist sessions cannot clear release blocks raised by absent officers. -
AuthorityEngineevaluates executableproposal.commandstrings raw (without prose negation stripping) so flags like--without-leaseor shell separators cannot bypass forbidden-pattern gates.
- Projection caches (
-
Living Whitepaper & Proof Ledger Security (
src/core/whitepaper.ts):- Config, whitepaper, receipt, and ledger paths are strictly workspace-confined (
assertSafeRelativeWorkspacePath+ symlink-safeisWritablePathConfinedToRoot), blocking writes into.git/, protected.numberone/internal files, and sensitive secret files. - Sensitive credential files (
.env*,credentials.json, keys, etc.) are rejected from explicit receipts/sealed lists and skipped during auto-discovery; rendered blocks andaudit_telemetryundergo secret redaction, Markdown table-cell escaping, and living-block marker injection checks;verifyLivingWhitepaperfails closed onschema_version, file ordering,MAX_SEALED_FILES, or telemetry drift. - Over MCP (L4 trust boundary),
configPathis restricted to.numberone/*.jsonandinit_whitepaperblocksoverwrite: true.
- Config, whitepaper, receipt, and ledger paths are strictly workspace-confined (
-
Automatic Secret Redaction & Sensitive File Exclusion (CWE-532 / CWE-200):
- Stream summaries, event metadata (
actor,harness,sessionId,tags,blob.key), payloads, command outputs, text/JSON/YAML/XML blobs, LLM prompts,EvolutionVerdictoutputs, MCP error responses, and outbound GitHub/Jira payloads (redacted prior to truncation) pass through the linear-time deterministic secret redactor (src/utils/redactor.ts), scrubbing PEM/PGP private keys (including truncated headers), AWS (AKIA/ASIA), GitHub (gh*/github_pat_), GitLab (glpat-/gloas-/glrt-), npm/PyPI/Google/OpenAI/Anthropic/Slack/Stripe tokens, Azure SASsig=, JWTs, Bearer/Token/ApiKey headers, credentialed URLs (https,wss,sftp,ldaps, etc.), and sensitive key-value secrets. - Sensitive credential files (
.env*,*.env,*.pem,*.key,*.p8,*.kdbx,id_rsa,id_ed25519,.ssh/config,.npmrc,.netrc,.htpasswd, shell history,credentials.json, etc.) are recorded metadata-only (sensitiveRedacted: true) and skipped by dynamic officer matchers, whitepaper sealing, and transcript ingestion (checking both path and canonicalrealpath). -
.numberone/state directories and files (including.numberone/whitepaper.json) use restrictive owner-only permissions (0o700dirs /0o600files). - Gemini API keys are sent in the
x-goog-api-keyHTTP header rather than URL query strings; outbound HTTP clients enforce HTTPS, block private/loopback/metadata IPv4 & IPv6 ranges (including NAT64, 6to4, Teredo, IPv4-mapped/translated, zone IDs, and trailing-dot FQDNs) with per-retry DNS checks, disable redirect credential forwarding (redirect: 'error'), enforce streaming response body byte and timeout caps, scope configured credential env vars to domain prefixes (GITHUB_/GH_,JIRA_,OPENAI_/ANTHROPIC_/GEMINI_/LLM_), bind ambient env tokens to official provider hosts (or host-sideN1_TRUSTED_API_HOSTS), and require host-sideN1_ALLOW_PRIVATE_HOSTS=1before honoring workspaceallowPrivateHosts.
- Stream summaries, event metadata (
-
Default-Deny Arbitrary Command Execution (CWE-78):
-
KnowledgeEvolutionEnginedisables shell execution forempirical_benchmarkproposals by default (allowCommandExecution: false); MCPpropose_officer_evolutionpermanently hardcodesallowCommandExecution: false. - CLI
n1 evolve --allow-execruns opted-in commands with an allowlist-sanitized environment (buildSanitizedChildEnv). -
n1 exec -- <bin> <args...>executes directly withshell: false(eliminating double-shell interpretation) and bounds grandchild pipe-hold exits. - Generated Git hooks and bash/zsh shell hooks validate executables, enforce workspace/git-common-dir symlink confinement, and use strict POSIX single-quoting.
-
-
Symlink Escape & Path Traversal Confinement (CWE-59 / CWE-22):
- File readers use FD-based
O_RDONLY | O_NONBLOCK | O_NOFOLLOW+fstatSync(fd)+realpathSyncconfinement withinworkspaceRoot, blocking symlink swaps, FIFOs, sockets, and growing-file OOM. - Writable path confinement (
isWritablePathConfinedToRoot) useslstatSyncto detect and reject dangling symlinks as well as live symlinks escaping the root across shims, Git hooks, whitepaper writers, and directory persistence.
- File readers use FD-based
-
ReDoS & Resource Exhaustion Controls (CWE-1333 / CWE-400):
-
.gitignoreand evolved glob patterns use linear-time$O(N \cdot M)$ dynamic programming (matchGlobLinear) with zero regex backtracking; dynamic regexes are statically validated against nested quantifiers, quantified alternation (including nested((a|aa))+), lazy adjacent wildcards, backreferences, and lookarounds. - Watched commands bound stdout/stderr memory capture in
$O(1)$ usingBufferslices (default 2 MB head+tail) and forward parentSIGINT/SIGTERMto process groups. - MCP stdio transport uses raw-
Bufferpre-allocation frame limiting (2 MB cap before UTF-8 string decoding) with stdin pause/resume backpressure and drain-safeEPIPEhandling; watcher snapshot text cache is capped at 64 MB and directory watches at 2,000. - Daemon lifecycle serializes under
.daemon.lock, opensdaemon.logwithO_NOFOLLOW, and verifies exact NUL-split/proc/<pid>/cmdlineargv and/proc/<pid>/statstart ticks before signaling.
-
-
Supply Chain Integrity & Container Hardening:
- Production runtime depends solely on
zod(0 CVEs) and Node.js 22 standard library, locked bypackage-lock.json, audited in CI (npm audit --audit-level=high), and kept current via Dependabot (npm,github-actions, anddocker). - GitHub Actions workflows are pinned to immutable 40-char commit SHAs with minimal top-level
permissions:;.github/workflows/release.ymlpacks the release tarball once and publishes that exact verified artifact (withSHA256SUMS.txtand zero.mapfiles) to both npm (SLSA OIDC provenance) and GitHub Releases. - Container image builds from a SHA-256 digest-pinned Node 22 Alpine image with
tiniPID-1 init, OCI provenance labels, root-owned read-only/app, non-rootUSER node,STOPSIGNAL SIGTERM,HEALTHCHECK, and CI verification under--read-only --cap-drop=ALL --security-opt=no-new-privileges.
- Production runtime depends solely on
Open a private security advisory or contact the workspace Security Officer via n1 party --officers security --topic "Security advisory".