From 46d737f89941e86a7cd2a261418e9fee7a9f24f2 Mon Sep 17 00:00:00 2001 From: Jangseowoo Date: Thu, 22 Oct 2026 11:59:14 +0900 Subject: [PATCH 1/6] docs(examples): add an index README for examples/ (#276) List every example with its command and data prerequisites (Git LFS data, generators, a local database), and link the index from the root README. --- README.md | 6 +++++ examples/README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 examples/README.md diff --git a/README.md b/README.md index f3305f8..f55e9a4 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,12 @@ Every image below is captured from this repository: the binaries in `target/rele --- +## Examples + +Runnable `.xzz` pipelines live in [`examples/`](examples/README.md) — from the smallest bar chart to differential privacy, Burn training, DuckDB/PostgreSQL sources, and the security guardrail demos. The index lists each example's command and data prerequisites (Git LFS data, generators, or a local database). CI checks and runs all of them in the `Example smoke` job. + +--- + ## Architecture Xazz is a modularized Rust workspace. The CLI stays a 2–5 MB binary; heavyweight engines live behind the `xazz-runner` subprocess boundary. diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..f5c08a5 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,58 @@ +# Xazz examples + +Every pipeline here is checked and run by `scripts/smoke_examples.py` (wired into +CI as the **Example smoke** job, #266). Paths below are relative to the repository +root. Build the CLI and its execution binaries first: + +```bash +cargo build -p xazz -p xazz-runner -p xazz-exec +``` + +Some examples read data that is **not committed** — it is either Git LFS data or +produced by a generator. See the *Data* column. + +| Example | What it shows | Run | Data / prerequisites | +|---|---|---|---| +| `examples/hello/main.xzz` | Smallest pipeline: load → filter → `groupBy` → bar chart | `cd examples/hello && ../../target/debug/xazz run main.xzz` | `sales.csv` (in the directory) | +| `examples/preprocessing/poc_*.xzz` | Preprocessing operators (`cast`, `filter`, `select`, `count`, `fillNull`) and the Dynamic Schema Bridge | `target/debug/xazz run examples/preprocessing/poc_script.xzz` (from root) | `examples/data/seoul_air_*.csv` (Git LFS) | +| `examples/privacy/dp_aggregation.xzz` | Differential privacy: `withDp(epsilon: …)` noise on aggregates | `target/debug/xazz run examples/privacy/dp_aggregation.xzz` | `examples/data/seoul_air_2026.csv` (Git LFS) | +| `examples/deep_learning/air_pipeline.xzz` | Declarative Burn model + `train`/`predict` pipeline operators | `target/debug/xazz run examples/deep_learning/air_pipeline.xzz` | `examples/data/seoul_air_2024.csv` (Git LFS). Slow: trains a 228K-row dataset | +| `examples/deep_learning/air_quality_predictor.xzz` | Dense/ReLU model, training diagnostics | `target/debug/xazz run examples/deep_learning/air_quality_predictor.xzz` | same as above. Slow | +| `examples/end_to_end/air_quality_full.xzz` | Load → clean → aggregate → chart → train end to end | `target/debug/xazz run examples/end_to_end/air_quality_full.xzz` | `examples/data/seoul_air_2024.csv` (Git LFS). Slow | +| `examples/visualization/viz_bar_chart.xzz` | Bar chart | `target/debug/xazz run examples/visualization/viz_bar_chart.xzz` | none — inline `duckdb://:memory:` source | +| `examples/visualization/viz_line_chart.xzz` | Line chart | `target/debug/xazz run examples/visualization/viz_line_chart.xzz` | none — inline DuckDB | +| `examples/visualization/viz_pie_chart.xzz` | Pie chart | `target/debug/xazz run examples/visualization/viz_pie_chart.xzz` | none — inline DuckDB | +| `examples/visualization/viz_scatter_chart.xzz` | Scatter chart (no direct identifiers) | `target/debug/xazz run examples/visualization/viz_scatter_chart.xzz` | none — inline DuckDB | +| `examples/duckdb/hello_duckdb.xzz` | DuckDB source connector (`duckdb://…?sql=…`) | `target/debug/xazz run examples/duckdb/hello_duckdb.xzz` | none — in-memory DuckDB | +| `examples/duckdb/postgres_demo.xzz` | PostgreSQL source connector | `target/debug/xazz run examples/duckdb/postgres_demo.xzz` | **Needs a local PostgreSQL** (`createdb mydb`). Expected to fail in the smoke harness | +| `examples/semiconductor/main.xzz` | Etch SPC: clean → X-bar chart → control-limit count | `cd examples/semiconductor && python3 generate_wafer_data.py && xazz run main.xzz` | Generate `data/wafer_metrology.csv` first | +| `examples/security/patient_safe.xzz` | Guardrail demo that **passes** the policy check | `target/debug/xazz run examples/security/patient_safe.xzz` | `examples/security/data/patients.csv` (generate with `python3 examples/security/generate_patients.py`) | +| `examples/security/patient_unsafe.xzz` | Guardrail demo **blocked** by policy (`xazz policy` / `xazz run` exit 1) | `target/debug/xazz policy examples/security/patient_unsafe.xzz` | `patients.csv` (generator). Expected to fail on purpose | +| `examples/security/patient_secret_leak.xzz` | Hardcoded-secret violation (`XZP010`/`XZP011`) | `target/debug/xazz policy examples/security/patient_secret_leak.xzz --fix` | none. Expected to fail on purpose | +| `examples/security/prompt_safe.xzz` | GenAI input gate: a safe prompt passes | `target/debug/xazz run examples/security/prompt_safe.xzz` | none — inline DuckDB | +| `examples/security/prompt_unsafe.xzz` | GenAI input gate: injection/jailbreak/exfiltration blocked | `target/debug/xazz policy examples/security/prompt_unsafe.xzz` | none. Expected to fail on purpose | +| `examples/stdlib_import.xzz` | Importing embedded stdlib modules (`import "std/…"`) | `target/debug/xazz run examples/stdlib_import.xzz` | `visual-ide/data/seoul_air_quality.csv` (Git LFS) | + +## Data and prerequisites + +- **Git LFS.** `*.csv` is tracked with Git LFS (`.gitattributes`). Run `git lfs pull` + after cloning, or the example data will be pointer files. +- **Generators.** `examples/security/generate_patients.py` and + `examples/semiconductor/generate_wafer_data.py` write synthetic CSVs that are + intentionally not committed. The CI smoke job runs both before checking examples. +- **Server / database.** `examples/duckdb/postgres_demo.xzz` needs a local + PostgreSQL; it is listed as an expected failure in the smoke harness. +- **GPU / ONNX features.** None of these examples need `--features wgpu/cuda/onnx`; + they run on the default CPU backend. + +## Running the smoke check locally + +```bash +python3 examples/security/generate_patients.py +python3 examples/semiconductor/generate_wafer_data.py +python3 scripts/smoke_examples.py --xazz target/debug/xazz --timeout 60 +``` + +Training-heavy examples (`deep_learning/`, `end_to_end/`) are skipped by default; +add `--include-heavy` to run them. Examples that are *supposed* to fail are +reported as `XFAIL` and only fail the run if they unexpectedly pass (`XPASS`). From 41e95141432dc182ccc830689b36aaccec650d6b Mon Sep 17 00:00:00 2001 From: Jangseowoo Date: Thu, 22 Oct 2026 11:59:33 +0900 Subject: [PATCH 2/6] docs: clarify emitter/benchmark notes and the --tenant no-op (#271, #272, #269) - README: the emitted predict code needs serde_json and the checkpoints/.stats.json sidecar (#271). - README + run_readme_benchmark.py: record the runner spawn/boot delta (startup_ms) so the pipeline-only figure is not confused with wall time (#272). - cli/README: document that --tenant is a no-op on a single-token server (#269). --- README.md | 6 ++++-- benches/run_readme_benchmark.py | 13 ++++++++++--- src/cli.rs | 22 +++++++++++----------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index f55e9a4..869570b 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ Same 4-stage pipeline (drop nulls → dual filter → group-by aggregates → fi - **Faster at every scale**: 2.04× vs pandas at 228K rows (76 ms vs 155 ms), 3.84× at 912K rows (143 ms vs 548 ms) and 2.14× at 4.09M rows (1,148 ms vs 2,457 ms) — with lower peak RSS at every scale (405 MB vs 635 MB at 4.09M rows). The gap is widest at 912K rows and narrows again at 4.09M rows. -- Both sides are measured as **pipeline execution only** — the Python interpreter boot (~0.3–0.7 s) is excluded from pandas, and Xazz reports its own `[xazz:timing]` pipeline marker, so the comparison is apples-to-apples. Peak RSS uses the process tree for both engines. +- Both sides are measured as **pipeline execution only** — the Python interpreter boot (~0.3–0.7 s) is excluded from pandas, and Xazz reports its own `[xazz:timing]` pipeline marker, so the comparison is apples-to-apples. Peak RSS uses the process tree for both engines. Xazz's marker also excludes the `xazz-runner`/`xazz-exec` process spawn and boot, so at the smallest (228K) scale the reported pipeline figure is smaller than the wall time you would see from a shell; the benchmark records that startup delta separately (`startup_ms`) so a rerun keeps it visible. - Source comes from Apache Arrow columnar memory + Polars LazyFrame query optimization + multithreaded native execution. - **Out-of-core execution:** `load()` now returns a lazy scan (`scan_csv`/`scan_parquet`/`scan_ipc`), so sources stay on disk until the terminal collect — no full-file materialization upfront. For very large workloads set `XAZZ_STREAMING=1` to collect through Polars' streaming engine (unsupported plans fall back to in-memory automatically). See [docs/ROADMAP.md](docs/ROADMAP.md) Track A2. - Honest footnote: Polars' multithreading trades higher peak RSS for latency — pandas holds more rows per thread, Polars parallelizes across them. Note the benchmark data itself is not committed (it is built from the Seoul air-quality sources). @@ -341,6 +341,8 @@ python benches/run_readme_benchmark.py --xlarge | `xazz sanitize` | Fine-tuning data sanitization — PII scan, duplicate & bias checks (Track F3) | Stable | | Model provenance | Policy registry gate — `hf://` model references, license/unknown-weights blocking (Track F5) | Stable | +> **Note on `--tenant`.** The tenant-scoped commands above (`xazz registry`, `xazz policy-status`, `xazz policy-ttl`, `xazz dp`) accept `--tenant`, but when the server runs in single-token mode (`XAZZ_SERVER_TOKEN`) it ignores `X-Xazz-Tenant` and operates on an empty tenant — so `--tenant` is accepted but has no effect. The flag stays accepted for forward compatibility; see [docs/SERVER.md](docs/SERVER.md). + --- ## Limitations & Non-goals @@ -352,7 +354,7 @@ Xazz is pre-1.0. We would rather state what is **not** verified than let you dis - `burn-cuda` compiles and fails closed to CPU when no driver is present, but its gated parity test has **not** run on a CUDA-driver host yet. - ONNX Runtime export/inference is wired, but its gated acceptance test has **not** passed on a standard toolchain: `ort-sys` ships prebuilt binaries only for `*-windows-msvc` (the Windows GNU toolchain fails), and the macOS `coreml` run is pending. See [docs/GPU_BACKENDS.md](docs/GPU_BACKENDS.md). - **No native Python extension yet.** `import xazz` is a pure-Python adapter over the CLI, not a PyO3 module — it returns the same diagnostics as the CLI but pays a subprocess boundary. The PyO3 path and the NumPy/Pandas → Arrow handoff are deferred. See [docs/ROADMAP.md](docs/ROADMAP.md) Track C4. -- **`xazz emit rust` is a reference emitter, not a second runtime.** New language features land in `xazz-exec` first; the emitted Rust can lag on some training options (e.g. single-run `validation_split` / early stopping, per-epoch sweep columns). `xazz run` is the source of truth — treat the emitted code as readable reference output. +- **`xazz emit rust` is a reference emitter, not a second runtime.** New language features land in `xazz-exec` first; the emitted Rust can lag on some training options (e.g. single-run `validation_split` / early stopping, per-epoch sweep columns). `xazz run` is the source of truth — treat the emitted code as readable reference output. When the pipeline trains or predicts, the generated file also needs the `serde_json` crate, and a `predict` stage additionally reads the `checkpoints/.stats.json` sidecar written during training — running that file on its own without the sidecar fails. The generated header lists the required Cargo dependencies; the exact output shape is pinned by the emitter tests in `xazz-compiler/src/emitter.rs`. - **The container image and clean-host smoke are pending the next tag.** The `Dockerfile` and `docker compose up` demo work from a local build, but the GHCR multi-arch image is published only on a `v*` tag, and the [clean-host smoke checklist](docs/DOCKER.md#smoke-checklist-clean-host) has not been recorded against a published tag yet. - **Benchmarks are single-host.** The numbers in [Performance](#performance) are provenance-stamped but come from one Windows laptop; they have not been reproduced on a second host or on Linux/macOS yet, so read the ratios as representative, not as a guarantee. - **Not a sandbox.** `xazz-runner` is process isolation with an execution timeout, not an OS-level sandbox. Policy-as-Code blocks known-bad pipeline shapes before execution; see [docs/SECURITY_GUARDRAIL.md](docs/SECURITY_GUARDRAIL.md) for the `PATH`-shadowing deployment caveat. diff --git a/benches/run_readme_benchmark.py b/benches/run_readme_benchmark.py index 50d5c26..f0b89f7 100644 --- a/benches/run_readme_benchmark.py +++ b/benches/run_readme_benchmark.py @@ -235,8 +235,13 @@ def summarize(runs: list[dict]) -> dict: latency = round(statistics.median(run["latency_ms"] for run in runs), 1) if latency <= 0: raise RuntimeError("지연 중앙값을 기존 0.1ms 결과 해상도로 표현할 수 없습니다") - return {"latency_ms": latency, - "peak_mb": round(statistics.median(run["peak_mb"] for run in runs), 1), "runs": runs} + result = {"latency_ms": latency, + "peak_mb": round(statistics.median(run["peak_mb"] for run in runs), 1), "runs": runs} + # xazz 실행에만 있다 — wall-clock에서 파이프라인 마커를 뺀 러너 스폰/부팅 비용. + startups = [run["startup_ms"] for run in runs if "startup_ms" in run] + if startups: + result["startup_ms"] = round(statistics.median(startups), 1) + return result def parse_xazz_collections(stdout: str, streaming: str) -> list[dict]: @@ -287,7 +292,7 @@ def bench_xazz(csv: Path, *, xazz_bin: Path = XAZZ_BIN, streaming: str = "auto", warmup_collections = [] try: for index in range(runs + 1): - _, peak, stdout = measure_tree([str(xazz_bin), "run", script.name], csv.parent, + wall_ms, peak, stdout = measure_tree([str(xazz_bin), "run", script.name], csv.parent, capture=True, env={"XAZZ_BACKEND": "cpu", "XAZZ_STREAMING": {"auto": None, "on": "1", "off": "0"}[streaming], "XAZZ_COLLECT_DIAGNOSTICS": "1", @@ -300,6 +305,8 @@ def bench_xazz(csv: Path, *, xazz_bin: Path = XAZZ_BIN, streaming: str = "auto", collections = parse_xazz_collections(stdout, streaming) if index: samples.append({"latency_ms": latency, "peak_mb": peak, + "wall_ms": wall_ms, + "startup_ms": max(0.0, wall_ms - latency), "fallback_to_wallclock": False, "collections": collections}) else: warmup_collections = collections diff --git a/src/cli.rs b/src/cli.rs index 4910890..a3c5496 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -203,7 +203,7 @@ pub enum Commands { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -288,7 +288,7 @@ pub enum PolicyTtlAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -312,7 +312,7 @@ pub enum PolicyTtlAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -343,7 +343,7 @@ pub enum DpAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -365,7 +365,7 @@ pub enum DpAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -390,7 +390,7 @@ pub enum DpAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -423,7 +423,7 @@ pub enum DpWindowAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -447,7 +447,7 @@ pub enum DpWindowAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -467,7 +467,7 @@ pub enum DpWindowAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -553,7 +553,7 @@ pub enum RegistryAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, @@ -580,7 +580,7 @@ pub enum RegistryAction { #[arg(long, default_value = "http://127.0.0.1:8005")] server: String, - /// Target tenant namespace (sent as X-Xazz-Tenant) + /// Target tenant namespace (sent as X-Xazz-Tenant). No-op when the server uses a single token (XAZZ_SERVER_TOKEN): it runs with an empty tenant (see docs/SERVER.md) #[arg(long)] tenant: String, From b6e4764add4ee8bce0241b4b6da184d3ff097f88 Mon Sep 17 00:00:00 2001 From: Jangseowoo Date: Thu, 22 Oct 2026 11:59:33 +0900 Subject: [PATCH 3/6] docs: mark the Japanese and Chinese READMEs as possibly outdated (#277) The English README changed after e8db438 (limitations, DuckDB/Polars, examples index) and the translations cannot be reviewed here, so per docs/TRANSLATING.md their status note now warns instead of silently advancing the source commit. --- README_ja.md | 2 +- README_zh.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README_ja.md b/README_ja.md index 7d16488..270f436 100644 --- a/README_ja.md +++ b/README_ja.md @@ -2,7 +2,7 @@ [English](README.md) · [한국어](README_kr.md) · [日本語](README_ja.md) · [简体中文](README_zh.md) -> 翻訳ステータス: [英語版 README](README.md) の `e8db438` (2026-09-24) を基にした入門用の要約です。機能やコマンドの最新情報は英語版を確認してください。更新方法は[翻訳ガイド](docs/TRANSLATING.md)にあります。 +> 翻訳ステータス: ⚠ この翻訳は古くなっている可能性があります。[英語版 README](README.md) の `e8db438` (2026-09-24) を基にした入門用の要約で、以降の変更(「Limitations & Non-goals」セクション、DuckDB/Polars の比較、[examples インデックス](examples/README.md))は反映されていません。機能やコマンドの最新情報は英語版を確認してください。更新方法は[翻訳ガイド](docs/TRANSLATING.md)にあります。 Xazz は Rust で実装された AI パイプライン向けのガバナンス層です。`.xzz` スクリプトを実行前に解析し、型・null 値・セキュリティポリシーを確認します。データ処理には Polars、学習には Burn を使用します。 diff --git a/README_zh.md b/README_zh.md index 9e71372..15effc0 100644 --- a/README_zh.md +++ b/README_zh.md @@ -2,7 +2,7 @@ [English](README.md) · [한국어](README_kr.md) · [日本語](README_ja.md) · [简体中文](README_zh.md) -> 翻译状态:本文是根据[英文 README](README.md) 的 `e8db438`(2026-09-24)编写的入门摘要。功能和命令的最新说明以英文版为准。更新流程见[翻译指南](docs/TRANSLATING.md)。 +> 翻译状态:⚠ 本翻译可能已过时。本文是根据[英文 README](README.md) 的 `e8db438`(2026-09-24)编写的入门摘要,尚未反映其后的变更(“Limitations & Non-goals”章节、DuckDB/Polars 对比、[示例索引](examples/README.md))。功能和命令的最新说明以英文版为准。更新流程见[翻译指南](docs/TRANSLATING.md)。 Xazz 是用 Rust 构建的 AI 流水线治理层。它在运行 `.xzz` 脚本之前检查类型、空值和安全策略;数据处理使用 Polars,模型训练使用 Burn。 From fe917c981f9e3569f763c6081485f8d42ce9ceb7 Mon Sep 17 00:00:00 2001 From: Jangseowoo Date: Thu, 22 Oct 2026 11:59:41 +0900 Subject: [PATCH 4/6] docs(security): add an OS sandbox plan and milestones (#312) Define the platform matrix (landlock/seccomp/rlimit/cgroup/seatbelt/AppContainer), a minimal-intrusion path (M1 landlock -> M2 rlimit -> M3 seccomp -> M4 cgroup), per-milestone acceptance, and the formal security-review requirements, while keeping the 'process isolation' vs 'sandbox' distinction. --- docs/design/security-model.md | 51 ++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/docs/design/security-model.md b/docs/design/security-model.md index 0a0baa6..0bb891d 100644 --- a/docs/design/security-model.md +++ b/docs/design/security-model.md @@ -27,18 +27,51 @@ --- -## OS 샌드박스(후속 마일스톤) — 구현 시 요구사항 +## OS 샌드박스 계획 — 마일스톤 -진짜 샌드박스로 가려면 운영체제 수준에서 다음을 제한한다: +"프로세스 격리"에서 "샌드박스"로 넘어가는 경로를 플랫폼별로 정의한다. 원칙은 +**최소 침습(minimal intrusion)**: root 자격 증명이나 커널 설정 변경 없이 +비특권으로 적용 가능한 제한부터 켠다. -- **filesystem restriction** — 작업 디렉터리 고정, 읽기 범위 한정 (landlock) -- **network restriction** — outbound block (seccomp filter) -- **CPU / memory limit** — rlimit / cgroup -- **process / resource isolation** — 별도 uid/gid, 프로세스 수 제한 -- **syscall restriction** — seccomp allowlist +### 플랫폼별 가용 수단 -각 항목은 플랫폼 의존적이며 정식 보안 리뷰가 필요하다. 그 전까지는 -"프로세스 격리"라는 표현을 고수한다. +| 제한 | Linux | macOS | Windows | 비고 | +|------|-------|-------|---------|------| +| 파일시스템 | landlock LSM (5.13+, 비특권) | seatbelt `sandbox_init` (비공개 API) | AppContainer / low-integrity token | landlock이 이식성·안정성 우위 | +| syscall | seccomp-bpf (비특권, `no_new_privs`) | seatbelt profile | — (Job Object는 syscall 필터가 아님) | seccomp allowlist는 유지비용 큼 | +| 네트워크 | seccomp로 `socket`/`connect` 차단, 또는 netns | seatbelt | AppContainer network capability | 실행 엔진은 기본 네트워크 불필요 | +| CPU / 메모리 | rlimit(`RLIMIT_AS`/`RLIMIT_CPU`) 또는 cgroup v2 | rlimit | Job Object 메모리/CPU 회계·상한 | Windows는 이미 Job Object 회계 사용(#128) | +| 프로세스 수 | rlimit `RLIMIT_NPROC` / cgroup pids | rlimit | Job Object active-process limit | | +| 자격 증명 | 별도 uid/gid (`setuid`) — root 필요 | — | AppContainer SID | 최후순위(특권 필요) | + +### 최소 침습 경로 (권장 순서) + +1. **M1 — Linux landlock(파일시스템).** 실행 디렉터리 밖 읽기/쓰기를 차단한다. + 비특권, 커널 5.13+. 구커널/미지원이면 경고 후 미적용(현 동작 유지, fail-closed 아님). +2. **M2 — rlimit(CPU/메모리/프로세스).** 전 플랫폼 공통 상한. 벽시계 + `XAZZ_EXEC_TIMEOUT_SECS`와 별개로 `RLIMIT_AS`/`RLIMIT_CPU`/`RLIMIT_NPROC` 추가. +3. **M3 — seccomp-bpf(네트워크/syscall).** `no_new_privs` + allowlist로 outbound 차단. + 네트워크가 불필요한 파이프라인에 opt-in. +4. **M4 — cgroup v2 / Job Object 하드 상한.** 컨테이너·서버 배포용. + +### 완료 기준(마일스톤별) + +- **M1**: 작업 디렉터리 밖 `load()`가 실패하고, 정상 파이프라인은 그대로 통과. +- **M2**: 메모리 폭주 파이프라인이 OOM kill 대신 명시적 오류로 종료. +- **M3**: 네트워크 접근 파이프라인이 차단되고, 허용 모드에서만 통과. +- **M4**: cgroup/Job Object 상한 초과가 런타임 오류로 보고. + +### 정식 보안 리뷰 요건 + +landlock/seccomp/seatbelt/AppContainer는 **플랫폼 의존적이고 우회 표면이 넓다**. +구현 시 다음을 요구한다. + +- 플랫폼별 위협모델과 우회 시나리오 문서화. +- 제한의 적용/미적용 상태를 실행 결과(`resources`/로그)에 명시(fail-open 금지). +- 각 제한의 "적용됨/미적용"을 검증하는 회귀 테스트. +- 외부 보안 리뷰(최소 1인) 통과 전에는 사용자 문서에서 "샌드박스" 표현 금지. + +그 전까지는 "프로세스 격리"라는 표현을 고수한다. --- From e85b7b3a501a7c23f0ca1bdcd24abfd33e690555 Mon Sep 17 00:00:00 2001 From: Jangseowoo Date: Thu, 22 Oct 2026 11:59:41 +0900 Subject: [PATCH 5/6] docs(governance): state the licensing boundary, add TRADEMARK and DCO (#311) - licensing.md/NOTICE: a code key is contract evidence and does not restrict the rights Apache-2.0 grants to the source. - Add TRADEMARK.md. - Adopt the DCO (git commit -s) in CONTRIBUTING/GOVERNANCE with the planned CI check noted, and add the contributor ladder to GOVERNANCE. --- CONTRIBUTING.md | 19 +++++++++++++++ GOVERNANCE.md | 23 ++++++++++++++++++ NOTICE | 5 ++++ TRADEMARK.md | 50 ++++++++++++++++++++++++++++++++++++++++ docs/design/licensing.md | 4 ++++ 5 files changed, 101 insertions(+) create mode 100644 TRADEMARK.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e81b9c3..8167248 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -155,6 +155,25 @@ Maintainers curate `good first issue` items: - A maintainer leaves a short "where to start" note in the issue. - If the issue turns out larger than advertised, say so and split it rather than leaving a newcomer stuck. +## Developer Certificate of Origin (DCO) + +Xazz uses the [Developer Certificate of Origin](https://developercertificate.org/) +instead of a CLA. It is lightweight: by signing off your commits you certify that +you wrote the change or otherwise have the right to submit it under the project's +license. + +- Sign off every commit with `git commit -s`, which appends: + + ``` + Signed-off-by: Your Name + ``` + + The name and email must be real and match the commit author. +- To sign off a branch you already committed, use `git rebase --signoff main` (or + `git commit --amend -s` for the last commit). +- CI enforcement is planned as a check on pull-request commits; until it lands, + reviewers ask for the sign-off during review. Dependabot commits are exempt. + ## Releasing Release cadence, the checklist, and the release-note template live in [docs/RELEASING.md](docs/RELEASING.md). diff --git a/GOVERNANCE.md b/GOVERNANCE.md index 17f0b05..d9d27df 100644 --- a/GOVERNANCE.md +++ b/GOVERNANCE.md @@ -31,6 +31,29 @@ and is expected to evolve as the contributor base grows. The current maintainer is the project author (`@x1zzdev`). Additional maintainers are added from sustained, high-quality contributors. +## Contributor ladder + +Roles are earned by doing the work, not by asking for the title. The rungs and +the promotion criteria are: + +| Level | What they do | How they get there | +|-------|--------------|--------------------| +| **User** | Bug reports, feature requests, discussions, usability feedback. | — | +| **Contributor** | File issues, open PRs, join Discussions. | First merged pull request. | +| **Regular contributor** | Repeated reviewed contributions; help triage issues and review others' PRs. | A track record of merged PRs and useful reviews. | +| **Reviewer** | Review PRs in an area and approve them. | Nominated by a maintainer after sustained ownership of an area. | +| **Maintainer** | Merge rights, releases, security triage, roadmap. | Invited by existing maintainers. | + +Promotion is proposed in the contributor's area of ownership and recorded when +the role changes. `CONTRIBUTING.md` holds the contributor-facing version of this +ladder. + +## Developer Certificate of Origin + +All contributions are accepted under the [Developer Certificate of Origin](https://developercertificate.org/), +not a CLA. Commits must carry a `Signed-off-by` line (`git commit -s`); see +[`CONTRIBUTING.md`](CONTRIBUTING.md#developer-certificate-of-origin-dco). + ## Decision making - **Lazy consensus:** most changes proceed if no blocking objection is raised on diff --git a/NOTICE b/NOTICE index ebbf943..ec53447 100644 --- a/NOTICE +++ b/NOTICE @@ -3,6 +3,11 @@ Copyright 2026 Jangseowoo (ax1s.xazz.com) and the Xazz contributors This product is licensed under the Apache License, Version 2.0 (see LICENSE). +Commercial code keys (where offered) are evidence of a support/distribution +contract only. They do not restrict the rights Apache-2.0 grants to the source: +use, reproduction, modification and distribution of the source follow LICENSE +alone, with or without a key. See docs/design/licensing.md. + This product includes third-party open-source software. The authoritative, machine-checked dependency set lives in Cargo.lock and visual-ide/package-lock.json; its licenses are enforced in CI by cargo-deny (deny.toml) and enumerated in the diff --git a/TRADEMARK.md b/TRADEMARK.md new file mode 100644 index 0000000..f33bb44 --- /dev/null +++ b/TRADEMARK.md @@ -0,0 +1,50 @@ +# Trademark Policy + +The Apache-2.0 license covers the **source code** of Xazz. It does **not** grant +rights to the Xazz name or logo. This policy explains what you may and may not do +with the project's marks. + +## Marks + +- The name **"Xazz"** and the Xazz logo. +- Related word marks used by the project (for example "xazz-guardrail" for the + reference model). + +These are trademarks of the project author (`Jangseowoo`, `ax1s.xazz.com`). The +Apache-2.0 grant in [`LICENSE`](LICENSE) does not imply any trademark license. + +## You may (no permission needed) + +- Use the name to refer to the project truthfully: "built with Xazz", "an Xazz + pipeline", "Xazz 0.4". +- Redistribute unmodified copies of the software under the name Xazz. +- Use the name in articles, talks, tutorials, and comparisons, as long as you do + not imply endorsement. + +## You may not (without written permission) + +- Use the marks in a way that suggests your fork or product **is** the official + Xazz, or is endorsed by the project. +- Use the marks in a company, product, or domain name in a way that is likely to + confuse users about the source of the software. +- Modify the software and continue to call the result "Xazz" without marking it + as a modified fork (for example, "Xazz — FooCorp fork"). + +## Forks + +A fork may keep the name only while it is a faithful redistribution. If you +change behavior, add features, or ship it as part of a product, use your own name +and add a clear notice such as "Based on Xazz, an independent fork; not +affiliated with the Xazz project." + +## Reporting misuse + +Open an issue or contact the maintainer (see [`SECURITY.md`](SECURITY.md) for the +private channel). We prefer to resolve trademark questions by clarification +first. + +## Relationship to the license + +This policy governs names and branding only. It does not change, and is not a +condition of, the rights granted by Apache-2.0 for the source code. See +[`docs/design/licensing.md`](docs/design/licensing.md) for the licensing boundary. diff --git a/docs/design/licensing.md b/docs/design/licensing.md index 1d13714..9415642 100644 --- a/docs/design/licensing.md +++ b/docs/design/licensing.md @@ -24,6 +24,10 @@ Xazz의 소스는 Apache-2.0이다. 제품화 시 상용 배포에 부여하는 상업 권리는 계약(법적)으로, 소스 오픈은 Apache-2.0으로 별도 표기한다. - 향후 중앙 호스팅 검증(옵션 2)은 호스팅 계획이 설 때 별도 문서에서 정의한다. 그 전까지 서버 쪽 검증은 구현하지 않는다. +- **키는 Apache-2.0이 부여한 권리를 제약하지 않는다.** 사용·복제·수정·배포는 + 키의 유무와 무관하게 `LICENSE`(Apache-2.0) 조건만 따른다. 키는 상용 지원·배포 + 계약의 **증거**일 뿐, 소스 라이선스를 좁히는 장치가 아니다. `NOTICE`도 같은 + 경계를 표기한다. ## 배포 From 43dffceac2803c282d940de4aaa9eedd64874e76 Mon Sep 17 00:00:00 2001 From: Jangseowoo Date: Thu, 22 Oct 2026 11:59:41 +0900 Subject: [PATCH 6/6] docs(compliance): document the regulatory mapping and disclaimer (#310) Add docs/design/regulatory-mapping.md: framework priority (domestic law -> NIST AI RMF -> EU AI Act -> ISO 42001), per-rule coverage/confidence, the verification procedure, and the 'not legal advice' disclaimer. Surface the disclaimer in README and SECURITY_GUARDRAIL.md. --- README.md | 2 +- docs/SECURITY_GUARDRAIL.md | 8 ++- docs/SUMMARY.md | 1 + docs/design/regulatory-mapping.md | 86 +++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 docs/design/regulatory-mapping.md diff --git a/README.md b/README.md index 869570b..2ad849b 100644 --- a/README.md +++ b/README.md @@ -287,7 +287,7 @@ python benches/run_readme_benchmark.py --xlarge ## Security & Privacy -**Policy-as-Code guardrails** scan the pipeline *before* execution — PII patterns (RRN, phone, card numbers with Luhn validation), secrets, and custom rules. Violations are blocked with structured JSON reports; an optional local sLM hook (Ollama, e.g. Qwen2.5-Coder) proposes safe corrections that are re-verified by the same policy engine before adoption — your code stays on the machine by default. See [docs/SECURITY_GUARDRAIL.md](docs/SECURITY_GUARDRAIL.md). +**Policy-as-Code guardrails** scan the pipeline *before* execution — PII patterns (RRN, phone, card numbers with Luhn validation), secrets, and custom rules. Violations are blocked with structured JSON reports; an optional local sLM hook (Ollama, e.g. Qwen2.5-Coder) proposes safe corrections that are re-verified by the same policy engine before adoption — your code stays on the machine by default. See [docs/SECURITY_GUARDRAIL.md](docs/SECURITY_GUARDRAIL.md). The regulatory basis attached to each rule is an audit-trail reference, **not legal advice**; the mapping priority, coverage/confidence and verification procedure are in [docs/design/regulatory-mapping.md](docs/design/regulatory-mapping.md). **Differential privacy** — Laplace/Gaussian mechanisms with ε **and δ** composition accounting. Each query records `(εᵢ, δᵢ)`; `PrivacyBudget` accumulates `Σεᵢ`, `Σδᵢ` and refuses queries that would exceed either budget. Budget state is visible in the IDE monitor. See [docs/design/dp-spec.md](docs/design/dp-spec.md). diff --git a/docs/SECURITY_GUARDRAIL.md b/docs/SECURITY_GUARDRAIL.md index 57a6305..80c8e95 100644 --- a/docs/SECURITY_GUARDRAIL.md +++ b/docs/SECURITY_GUARDRAIL.md @@ -3,7 +3,13 @@ > Xazz statically detects and blocks PII leaks and security-compliance violations **before** a `.xzz` pipeline runs. The Type Checker asks "does this code run?"; the guardrail asks "is it safe to run this code?" Related: [ARCHITECTURE.md](ARCHITECTURE.md) · [WORKSPACE.md](WORKSPACE.md) · -[design/security-model.md](design/security-model.md) · [experiments/slm_guardrail](../experiments/slm_guardrail/README.md) +[design/security-model.md](design/security-model.md) · [design/regulatory-mapping.md](design/regulatory-mapping.md) · [experiments/slm_guardrail](../experiments/slm_guardrail/README.md) + +> ⚠️ The regulatory basis recorded in each violation's `source_ref` is an +> **audit-trail reference, not legal advice**. The framework priority order, +> per-reference coverage/confidence, and the verification procedure live in +> [design/regulatory-mapping.md](design/regulatory-mapping.md). Override the +> basis per organization with `rule_source_refs` in the policy file. --- diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 70bf4ae..bf8a959 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -37,6 +37,7 @@ - [Service blueprint](design/service-blueprint.md) - [Alternatives considered](design/alternatives.md) - [Licensing](design/licensing.md) +- [Regulatory mapping](design/regulatory-mapping.md) - [Asset ledger](design/asset-ledger.md) - [IDE governance brief](design/ide-governance-brief.md) - [Review & verification](design/review-verification.md) diff --git a/docs/design/regulatory-mapping.md b/docs/design/regulatory-mapping.md new file mode 100644 index 0000000..28de005 --- /dev/null +++ b/docs/design/regulatory-mapping.md @@ -0,0 +1,86 @@ +# 규제 매핑 — 우선순위 · 커버리지 · 신뢰도 + +상태: 문서 v1 (issue #310) · 관련: [`xazz-compiler/src/policy/mod.rs`](../../xazz-compiler/src/policy/mod.rs) `default_source_ref`, [`docs/SECURITY_GUARDRAIL.md`](../SECURITY_GUARDRAIL.md) + +> ⚠️ **법률 자문이 아니다.** 아래 매핑은 각 규칙이 어느 규범에 근거했는지 감사 +> 추적(audit trail)하기 위한 참조다. 실제 적용 법령은 조직·도메인·관할에 따라 +> 다르므로 정책 파일의 `rule_source_refs`로 덮어쓴다. 이 문서와 정책 팩은 +> 컴플라이언스를 보증하지 않는다. + +## 프레임워크 우선순위 + +정책 팩은 다음 순서로 규범을 정렬한다. 위에 있을수록 먼저 매핑하고, 아래는 +필요할 때만 보강한다. + +| 순위 | 프레임워크 | 적용 범위 | 현재 상태 | +|------|-----------|-----------|-----------| +| 1 | **국내법** — 개인정보 보호법, 가명정보 처리 가이드라인, 개인정보의 안전성 확보조치 기준 | PII·민감정보·재식별·안전조치 규칙의 기본 참조 | 매핑됨(기본 정책 팩) | +| 2 | **NIST AI RMF** (GEN-4.3) | GenAI 입력/출력 게이트, 모델 출처·라이선스 | 부분 매핑 | +| 3 | **EU AI Act (GPAI)** | 해외 배포 시 투명성·문서화 의무 | 미매핑(백로그) | +| 4 | **ISO/IEC 42001** | 조직 AI 관리체계 | 미매핑(백로그) | + +국내법을 우선하는 이유: 현재 정책 팩(healthcare/finance/public-sector)이 국내 +도메인을 대상으로 하고, 조항 대응을 국내 전문가가 검증할 수 있기 때문이다. +EU AI Act·ISO는 해외 배포·기업 도입 시 별도 정책 팩으로 추가한다. + +## 커버리지 · 신뢰도 정의 + +각 매핑은 두 축으로 표기한다. + +- **coverage** — 조항이 규칙의 판단을 얼마나 포괄하는가 + - `mapped`: 규칙 전체를 직접 규율하는 조항 + - `partial`: 규칙의 일부 측면만 규율(해석·보강 필요) +- **confidence** — 조항↔규칙 대응의 확실성 + - `high`: 조항 문언이 규칙과 직접 대응 + - `medium`: 해석의 여지가 있음 + - `low`: 방향성 참조(정량 기준 아님) + +`low`/`partial` 항목은 감사 근거로는 유효하나, 컴플라이언스 주장의 근거로 쓰지 +않는다. 검증(아래 절차)을 통과하면 confidence를 올린다. + +## 규칙별 매핑 (기본값) + +| rule_id | 근거(source_ref) | coverage | confidence | +|---------|------------------|----------|------------| +| `XZP001` DIRECT_IDENTIFIER_EXPOSED | 개인정보 보호법 제24조(고유식별정보) · 제3조(최소수집) | mapped | high | +| `XZP002` SENSITIVE_ROW_LEVEL | 개인정보 보호법 제23조(민감정보 처리 제한) | mapped | high | +| `XZP003` QUASI_COMBINATION | 개인정보 보호법 제28조의5 · 가명정보 처리 가이드라인(재식별 위험) | partial | medium | +| `XZP004` AGGREGATE_WITHOUT_DP | 가명정보 처리 가이드라인 — 통계값 공개 시 재식별 완화 | partial | medium | +| `XZP005` EPSILON_TOO_LARGE | 가명정보 처리 가이드라인 — 프라이버시 보호 강도 | partial | low | +| `XZP010` PII_LITERAL | 개인정보 보호법 제29조(안전조치) · 안전성 확보조치 기준 | mapped | high | +| `XZP011` HARDCODED_SECRET | 안전성 확보조치 기준 제6조·제7조 · 국가정보원 보안 기준 | mapped | high | +| `XZP012` SENSITIVE_PATH | 안전성 확보조치 기준 제6조(접근 통제) | partial | medium | +| `XZP013` PATH_TRAVERSAL | 안전성 확보조치 기준 제6조(접근 통제) | mapped | high | +| `XZP014` UNRESOLVED_SCHEMA | 내부 통제 기준 — 검증되지 않은 처리 계획 실행 금지(fail-closed) | mapped | high | +| `XZP000` PARSE_FAILED | 내부 통제 기준(fail-closed) | mapped | high | +| `XZP999` POLICY_LOAD_FAILED | 내부 통제 기준(fail-closed) | mapped | high | +| `XZP020` PROMPT_INJECTION | NIST AI RMF(GEN-4.3) · 국가정보원 생성형 AI 보안 가이드라인 | partial | medium | +| `XZP021` PROMPT_JAILBREAK | NIST AI RMF(GEN-4.3) · 국가정보원 생성형 AI 보안 가이드라인 | partial | medium | +| `XZP022` PROMPT_EXFILTRATION | NIST AI RMF(GEN-4.3) · 국가정보원 생성형 AI 보안 가이드라인 | partial | medium | +| `XZP030` MODEL_LICENSE_BLOCKED | NIST AI RMF(GEN-4.3) · AI 학습데이터 정책(출처·라이선스) | partial | medium | +| `XZP031` MODEL_PROVENANCE_UNKNOWN | NIST AI RMF(GEN-4.3) · AI 학습데이터 정책(출처·라이선스) | partial | medium | + +정책 팩은 `rule_source_refs`로 위 기본값을 덮어쓸 수 있다(예: +`examples/security/*_policy.json`). 덮어쓴 참조도 같은 coverage/confidence +기준으로 표기한다. + +## 검증 절차 + +1. **원문 대조** — 조항 원문과 규칙의 판단 조건을 나란히 두고 대응을 확인한다. +2. **도메인 리뷰** — 해당 분야 전문가(법무/컴플라이언스)가 coverage/confidence를 + 승인한다. 언어 리뷰만으로는 불충분하다. +3. **회귀 고정** — 정책 팩 테스트(`xazz policy`)가 위반 `source_ref`를 그대로 + 내보내는지 확인한다. +4. **메타데이터 갱신** — 승인된 coverage/confidence와 검증일·검증자를 기록한다. + 근거가 바뀌면 `default_source_ref`와 이 표를 같은 PR에서 함께 고친다. + +## 면책 문구가 노출되는 표면 + +- 감사 증거: 위반 리포트의 `source_ref`(감사 로그에 체인됨). +- CLI: `xazz policy` 리포트. +- 문서: 이 문서, [SECURITY_GUARDRAIL.md](../SECURITY_GUARDRAIL.md), + `README.md` 보안 절. +- IDE: 정책 위반 패널. + +면책은 "법률 자문이 아님"을 명시하며, 검증되지 않은 매핑은 컴플라이언스 주장의 +근거로 표기하지 않는다.