-
Tamper-Evident Stream & Crash Durability: Canonical SHA-256 hash chaining (
prevHash->hash) across discrete atomic event files and SHA-256 content-addressed blobs, written viaO_CREAT|O_EXCLtemp file +fsync+ atomicrename+ parent-dirfsyncwith atomiclinkSynccross-process locks (0o600),(dev, ino)ownership verification,/proc/<pid>/statstart-ticks + instance-ID stale lock detection, fail-closed tip validation, 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-256snapshotDigestand rebuilt with null-prototype maps (Object.create(null)) + forbidden-key guards (__proto__,constructor,prototype). - L4
ai-agentsessions (including MCP clients) cannot supersede directives, forgeexec.completedcrash resolutions, or promote/revert officer knowledge; MCPrecord_stream_eventenforces an explicit non-privileged allowlist and MCPissue_directiveis restricted toadvisoryseverity.
- Projection caches (
-
Automatic Secret Redaction & Sensitive File Exclusion (CWE-532 / CWE-200):
- Stream summaries, payloads, command outputs, text/JSON/YAML/XML blobs, LLM prompts, MCP error responses, and outbound GitHub/Jira issue payloads 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 headers, Basic Auth URLs, and key-value secrets. - Sensitive credential files (
.env*,*.pem,*.key,id_rsa,id_ed25519,.npmrc,.netrc,credentials.json, etc.) are recorded metadata-only (sensitiveRedacted: true) and skipped by dynamic officer matchers and transcript ingestion. -
.numberone/state directories and files 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 IP ranges (SSRF protection), disable redirect credential forwarding (redirect: 'error'), cap response body sizes, and scope configured credential env vars to domain prefixes (GITHUB_/GH_,JIRA_,OPENAI_/ANTHROPIC_/GEMINI_/LLM_).
- Stream summaries, payloads, command outputs, text/JSON/YAML/XML blobs, LLM prompts, MCP error responses, and outbound GitHub/Jira issue payloads pass through the linear-time deterministic secret redactor (
-
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). - Generated Git hooks and bash/zsh shell hooks validate executables, enforce 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. - Harness shims, Git hooks, and directory persistence validate writable path confinement and reject symlinks and unsafe keys.
- 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, 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 andEPIPEsafety; 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. - GitHub Actions workflows are pinned to immutable 40-char commit SHAs with minimal
permissions:. - Container image builds from a SHA-256 digest-pinned Node 22 Alpine image with
tiniPID-1 init, 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".