RFC dan proposal mencatat rancangan. Untuk kemampuan yang benar-benar dapat dipakai, lihat matriks kapabilitas runtime dan catatan rilis.
YAZA Security Threat Model
Version: 1.2 Reviewed against repository state: 2026-10-28
Scope: YAZA compiler and CLI, generated native programs, the API runtime, PostgreSQL client, local build/test workflow, and declared target status.
This document records the current security boundary and the work still required before YAZA can make production-safety claims. A control is considered present only for the code path and platform named here; a test on macOS is not evidence for Linux, Windows, WebAssembly, or mobile.
For the proposed risk register, current security trends, and phased security work plan, see the YAZA Security Assurance Proposal. The proposal does not replace this evidence-based threat model.
2026-10-28 review note: The updated proposal incorporates the supplied source-review candidates, current JWT/Host policy, source traceability, and a trend/future-risk horizon. The Linux epoll listener event is a high-priority source-level candidate with a source fix and regression assertion, not a reproduced exploit; Linux API end-to-end behavior remains unverified. No claim of zero vulnerabilities or CVE-free status is made.
2026-10-28 verification note: Fatal UBSan is now enabled in both fuzz build modes and is checked with a signed-overflow probe. The local deterministic macOS sanitizer fuzz run passed 10,000 mutations over the six-seed corpus; hosted Ubuntu/libFuzzer remains unverified. The current general web-risk mapping is OWASP Top 10:2025, with API risks mapped separately to 2023.
2026-10-28 child-process update: process_env, process_timeout_env, and process_capture_env now provide explicit child-environment APIs with dynamic-loader variable rejection and absolute, traversal-free explicit PATH values. The process test and runnable example pass on macOS arm64. Legacy process APIs still inherit ambient environment, and child execution is not sandboxed; the new variants reduce environment leakage but do not make untrusted code safe to run.
Security goals and assets
| Asset | Security goal |
|---|---|
| Application records and PostgreSQL data | Preserve confidentiality and integrity; reject unauthorized or malformed operations. |
| API tokens, database credentials, and other secrets | Prevent disclosure through responses, logs, generated documentation, and diagnostics. |
| Developer source and host files | Keep compiler/build/test execution within the user's explicit trust boundary; prevent path escape in rooted file APIs. |
| Compiler and release artifacts | Preserve source-to-binary integrity and make the origin of distributed binaries verifiable. |
| Service availability | Bound memory, open connections, request duration, and queued output under hostile traffic. |
| User-supplied text and bytes | Validate encoding, framing, and context-specific output before processing or rendering. |
Actors and trust boundaries
| Actor or component | Trust assumption |
|---|---|
| Remote API caller | Untrusted. Can send arbitrary bytes, headers, paths, query strings, and bodies and can disconnect or send slowly. |
Application author and .yz source |
Trusted to request the intended program behavior. Compiling or running untrusted source is unsafe because test processes are not OS-sandboxed. |
| API process | Part of the trusted computing base. The compiler currently emits C, and runtime C helpers remain inside the memory-safety boundary. |
| PostgreSQL server and network path | The server is an external dependency. Remote connections require certificate and hostname verification; explicit plaintext is restricted to verified loopback peers. |
| Environment, filesystem, and build tools | Trusted only to the extent controlled by the developer or release operator. Environment values and local build tools can influence builds and runtime behavior. |
| Future package registry, CI identity, and release signer | Not currently established as trusted YAZA infrastructure. Package provenance and trusted publishing are not implemented. |
| Future WASM, edge, Windows, and mobile hosts | Not supported release targets. Their host imports, sandbox boundaries, permissions, and signing paths require separate review before support is claimed. |
flowchart LR
Client[Untrusted HTTP client] --> Parser[Bounded HTTP and JSON parser]
Parser --> App[Generated API and YAZA runtime]
App -->|Bound parameters; verified TLS for remote peers| DB[(PostgreSQL)]
Source[Project source and manifests] --> Compiler[YAZA compiler and generated C]
Compiler --> Build[Clang and native build tools]
Build --> Program[Native executable]
Env[Environment and local files] --> Program
CI[CI and release identity] -. provenance/signing not implemented .-> Build
The compiler, generated C, runtime helpers, Clang, and the host OS form one native execution boundary. Neither yaza check nor yaza test is a sandbox for hostile projects. The API parser and typed validation are separate boundaries from controller code; database parameter binding protects only the APIs that use the bound-parameter path.
Abuse cases and current mitigations
| Abuse case | Current control and evidence | Residual risk |
|---|---|---|
| Malformed or ambiguous HTTP framing, hostile Host values, path encoding tricks, or oversized JSON | Strict HTTP/1 framing, duplicate framing rejection, bounded headers/body, UTF-8 and JSON validation, duplicate decoded-key rejection, safe path/query decoding, exact YAZA_ALLOWED_HOSTS enforcement, request deadlines, and connection caps. The macOS API smoke rejects an unlisted hostile Host and wildcard configuration and accepts a configured hostname. See http-smoke.sh, json_depth.c, and the configured runtime security workflow. |
Only the macOS kqueue path has been exercised end to end; browser DNS rebinding and Linux behavior remain unverified. The event loop is single-threaded and route/database handlers are synchronous; a slow or expensive handler can delay unrelated requests. Fuzzing is limited; the fatal-UBSan probe and local deterministic fuzz run pass, but hosted Ubuntu CI has not yet been observed. |
| Slow clients, connection exhaustion, or response-buffer exhaustion | Active connection limits, absolute request and response-write deadlines, keep-alive caps, bounded response queues, and readiness-driven reads/writes. HTTP smoke tests include slow-header fairness and keep-alive/pipeline cases. | No OS-level CPU, process-memory, or file-descriptor sandbox is provided. The Linux epoll listener-event identity has a source fix and native regression assertion, but Linux epoll and API end-to-end behavior remain unverified; do not claim Linux API support yet. |
| SQL injection through API inputs | Product CRUD uses PostgreSQL bound parameters; structured SELECT validates and quotes identifiers and binds values. Live PostgreSQL HTTP smoke exercises injection-shaped values. | pg_query remains available for trusted static SQL. Any application that concatenates user input into raw SQL is outside the protected path. General schema-checked query typing is incomplete. |
| TLS downgrade or server impersonation for PostgreSQL | Remote database connections require sslmode=verify-full; plaintext is explicit loopback-only and the connected peer is checked. HTTP/database smokes cover rejection of remote plaintext modes and local protocol behavior. |
Successful remote TLS handshakes and broader CA/server-version cases are not yet integration-tested. Inbound API TLS is not built in; deployments need a trusted TLS boundary. |
| Unauthorized API calls or accidental credential disclosure | Non-loopback IPv4 bind requires configured shared-token auth or JWT-only mode with explicit route policies. Routes support public, shared Bearer, and HS256 JWT policies; JWT pins issuer/audience and checks expiry, optional nbf/iat, and a fixed-time signature. Duplicate Authorization rejection, a 32-byte minimum and optional secondary overlap slot for shared API tokens, exact Host allowlisting, safe typed error envelopes, query-string-free access logs, and SecretText redaction are implemented. See api-route-auth-smoke.sh, secret_text.test.yz, and audit-sarif.sh. |
Authentication is not authorization: there are no typed principals, roles, ownership checks, user-token issuer, central revocation, JWT signing-key rotation, or jti policy; shared-token overlap rotation has local normal and ASan/UBSan smoke evidence, with full API CRUD and private-.env loading regressions passing on macOS. JWT uses one shared HS256 secret and optional sub; loopback routes may be public. Name-based log redaction is heuristic; copied immutable Text and process environment values are not erased. |
Malicious .env file or child-process environment injection |
.env is opened without following symlinks and checked for regular-file type, owner, owner-only mode, size, and embedded NUL; reserved loader/toolchain/runtime keys are ignored. process_env, process_timeout_env, and process_capture_env start from explicit entries and reject selected dynamic-loader variables. Clang is launched with an explicit minimal environment. macOS arm64 dotenv/process tests and the three-stage bootstrap pass. |
Ordinary process, process_capture, and timeout variants still inherit the full environment. Commands remain arbitrary host processes with the caller's OS privileges; no executable allowlist or sandbox exists. These controls are not verified on Linux and do not erase secret copies already present in process memory. |
| Use-after-free, out-of-bounds access, or undefined behavior in generated programs | Checked numeric operations and bounds exist for implemented types; runtime allocation budgets, ASan/UBSan builds, and several C harnesses reduce risk. | YAZA source-level ownership, borrowing, automatic destruction, and complete memory-safety guarantees are not implemented. Generated C and C runtime code remain trusted components. Sanitizers do not prove safety. |
| Module path escapes or symlink substitution | Standard-library import names reject traversal segments; std/fsroot.yz uses rooted operations that reject symlinks, and fsroot.c tests symlink and race cases. |
Compiler module resolution is lexically constrained but is not symlink-aware. General safe filesystem APIs and hostile-workspace compilation are incomplete. |
| Malicious or compromised dependency, compiler, build tool, or release artifact | The local macOS bootstrap rebuilds three native compiler stages and compares generated C from consecutive stages. Dependency/package supply-chain controls are tracked in H.11. | No package registry, lockfile, dependency advisory gate, reproducible independent build, signed provenance, or trusted publishing exists. The current macOS signature is ad hoc and does not establish publisher identity. |
| Unsupported target-specific escape or host compromise | The release matrix below marks targets according to current evidence; unsupported targets are not to be represented as secure or release-supported. | Linux source paths, Windows, WASM, edge, and mobile need native build/runtime conformance, host-permission review, and target-specific security tests before release support. |
Target and release status
| Target | Repository status | Security interpretation |
|---|---|---|
| macOS arm64 | Native compiler/CLI bootstrap and API smokes are exercised locally. | Development target with partial security controls. The current package is provisional; ad-hoc signing is not publisher verification or notarization. Do not infer a production security certification. |
| Linux x86_64 / arm64 | Epoll/OpenSSL source paths and a Linux sanitizer/parser-fuzz workflow exist; the epoll listener descriptor has a source fix and a native regression assertion. Full compiler/API end-to-end verification and a successful hosted workflow run are not recorded. | Not a verified release target. Do not claim equivalent runtime or TLS behavior from macOS or parser-harness tests. |
| Windows x86_64 | No native YAZA compiler/runtime release path is verified. | Unsupported. |
| WASI / browser WebAssembly / edge | Target compiler and host capability boundary are not implemented. | Unsupported. No sandbox or CSP claim is made. |
| Android arm64 / iOS arm64 | ABI and host-shim designs are proposals only; no native app build or platform security test is present. | Unsupported. No permission, storage, rendering, or signing guarantee is made. |
Release gates and maintenance
Do not describe YAZA as memory-safe, production-ready, or supported on a target based on this threat model. Before a stable release, the project still needs at least source-level ownership and broader safety evidence, a maintained dependency/provenance process, hosted native CI for every claimed target, successful remote TLS integration tests, a real vulnerability-reporting contact and response process, and independent security review. The detailed gates remain in Appendix H and RFC 0007.
Re-review this model whenever the compiler/runtime boundary, HTTP/database behavior, dependency mechanism, release process, or supported target set changes; also review it before each stable release and at least annually. Update the abuse-case table with test links when controls change. If evidence is absent or platform-specific, retain the limitation instead of generalizing the claim.