aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
GitHub aien-dev/aien-sovereign-core-mv#776 (code only)
Fetch it
curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/f3239de48cf1f897.bundle -o f3239de48cf1f897.bundle git fetch f3239de48cf1f897.bundle refs/pull/776/head
Provenance
github-import 1
aien-dev/aien-sovereign-core-mv
776
9c6c1f6135eb904d02bea65b57e5928532c43418
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":776,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/776","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:37:57Z","metadata":"unavailable","state_derived":true}
Changes
diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..c0337ff7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +# Dependabot: monthly version updates for the pinned GitHub Actions and the Cargo lockfile. +# Pull requests only; nothing merges itself. Security advisories are handled by GitHub +# Dependabot security updates on the repository settings. +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + - package-ecosystem: cargo + directory: / + schedule: + interval: monthly + versioning-strategy: lockfile-only diff --git a/.github/workflows/aien-verification.yml b/.github/workflows/aien-verification.yml index 91594568..1b1c4022 100644 --- a/.github/workflows/aien-verification.yml +++ b/.github/workflows/aien-verification.yml @@ -30,7 +30,7 @@ jobs: RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main steps: - name: Checkout the head under test - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: fetch-depth: 0 @@ -52,7 +52,7 @@ jobs: fi - name: Checkout the pinned crumb tool source (aien-architecture @ 12ad0141b41ec67ef5aa51cb4e1815894c1083bb) - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: repository: aien-spark/aien-architecture ref: 12ad0141b41ec67ef5aa51cb4e1815894c1083bb @@ -69,13 +69,13 @@ jobs: run: crumb verify . - name: Install Stable Rust Toolchain (for the pinned aien-test build) - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable branch head 2026-10-26 if: steps.anchors.outputs.enrolled == 'true' with: components: rustfmt - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }}) - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 if: steps.anchors.outputs.enrolled == 'true' with: repository: aien-spark/aien-sovereign-core @@ -88,7 +88,7 @@ jobs: # Cache dependencies only, never verifier executables or candidate-controlled target output. - name: Cache the pinned aien-test dependencies - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 if: steps.anchors.outputs.enrolled == 'true' with: path: | @@ -139,7 +139,7 @@ jobs: RECEIPTS_RAW: https://raw.githubusercontent.com/aien-dev/aien-receipts/main steps: - name: Checkout the tagged commit - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: fetch-depth: 0 @@ -166,12 +166,12 @@ jobs: echo "verify.pub (origin/main): $(cat "$RUNNER_TEMP/anchors/verify.pub")" - name: Install Stable Rust Toolchain (for the pinned aien-test build) - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@b725eda525362e7cf34af9a7243cac1e3f01a7ec # stable branch head 2026-10-26 with: components: rustfmt - name: Checkout the pinned aien-test source (aien-sovereign-core @ ${{ env.AIEN_TEST_PIN }}) - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: repository: aien-spark/aien-sovereign-core ref: ${{ env.AIEN_TEST_PIN }} @@ -182,7 +182,7 @@ jobs: # Cache dependencies only, never verifier executables or candidate-controlled target output. - name: Cache the pinned aien-test dependencies - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: path: | ~/.cargo/registry diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index 5fcbfb38..acb6bbe1 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Source - uses: actions/checkout@v4 + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - name: Workflow cannot publish (static guard) run: bash scripts/test-dry-run-workflow.sh diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 2d601bac..1c291256 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -14,13 +14,15 @@ on: required: true type: string -permissions: - contents: write +permissions: {} jobs: verify-and-publish: name: Verify the offline signature and publish runs-on: ubuntu-latest + # Only this job publishes the draft; the workflow default token has no permissions. + permissions: + contents: write env: TAG: ${{ inputs.tag }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml new file mode 100644 index 00000000..8b8c9df7 --- /dev/null +++ b/.github/workflows/sbom.yml @@ -0,0 +1,23 @@ +# SBOM: writes an SPDX JSON inventory of the tree at every push to main and on pull requests, as +# a workflow artifact, so outside auditors can diff what a commit contains. Read-only token; +# every action pinned by full commit sha. It judges nothing and gates nothing. +name: SBOM +on: + pull_request: + push: + branches: [main] +permissions: + contents: read +jobs: + sbom: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 + with: + persist-credentials: false + - uses: anchore/sbom-action@66cbf4bc1f1c0d2edc94016e65bc221b6bb0ad6c # v0.24.3 + with: + path: . + format: spdx-json + artifact-name: sbom-${{ github.sha }}.spdx.json diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md new file mode 100644 index 00000000..17af7aa5 --- /dev/null +++ b/AUDIT_SCOPE.md @@ -0,0 +1,136 @@ +# Audit scope + +Written for an outside, independent security audit. Revision described: +`f30eb963918d71dd2998b1cb936c251429417de1` on `main`, 2026-10-26. Everything below is taken from +the repository's own files at that revision; items marked NOT_RUN were not executed while writing +this document. + +## What this repository is + +The Rust workspace of the AIEN host runtime and its verification tooling, running on Linux on the +NVIDIA DGX Spark (GB10). It contains the `aien` command line and runtime daemon, model loading, a +paged KV cache, a batching scheduler, an OpenAI-compatible HTTP server, Rust bindings to the Omega +GPU engine (`crates/aien-omega-*`, pinned by `omega.lock`), the AIEN verification pipeline +(`tools/aien-test`, `tools/aien-local-ci`), release and install scripts, ALLEN identity crates, and +supporting `spark-*` services. Status (README): research-grade; the GPU inference path is in alpha +testing on the DGX Spark only and its three-run physical qualification is NOT_RUN; the rest is +pre-alpha; no public release exists. + +## What to review, in priority order + +1. Verification pipeline: `tools/aien-test` (gate manifests, verdicts, evidence receipts, signed + bundles, `verify-bundle`), `tools/aien-local-ci` (worker, `pipeline.sh`, `aien-run-exec`, + `forgejo-webhook.sh`, `siblings`), `tools/aien-verify`, `crates/aien-verify`, + `crates/aien-campaign-verifier`. Every pull request in every AIEN repository is judged by this + code; check sandbox escape, verdict forgery, bundle signature checks, and the + `BLOCKED_OPERATOR` rule for pipeline-config changes (`tools/aien-test/docs/LOCAL_VERIFICATION.md`). +2. `crates/aien-serve-http`: bearer-token check (`AIEN_SERVE_HTTP_BEARER_TOKEN`, required at + startup), request parsing, context limits (`--max-context`), refusal when the KV cache cannot + hold the request. +3. `crates/aien-cli`: approval floors (catastrophic commands, runtime self-files, `sudo` with a + password on stdin, operator deny patterns), approval modes (`AIEN_APPROVAL_MODE`), unattended + denial, and the per-turn snapshot store and hash-chained write ledger behind `/rollback`. +4. Release and install: `install.sh`, `install.ps1`, `install-inquisitor.sh`, + `scripts/release-publish-gate.sh`, `scripts/check-release-candidate.sh`, + `docs/release/RELEASE_SIGNING.md`, `docs/release/allowed_signers`, + `docs/release/internal_test_signers`, `release/candidate.toml`. +5. Capability and agent boundary crates: `aien-capability`, `aien-mcp`, `aien-switchboard`, + `aien-security`, `spark-aegis`, `aien-allen*`. +6. Native linking: `crates/aien-abi-conformance` build script checking omega archive digests + against `native-artifacts.lock`; `crates/aien-omega-*` FFI. +7. Workflows: `.github/workflows/aien-verification.yml` (advisory checks and Alpha bundle + verification, `contents: read`), `release.yml` (tag `v*` or manual; publish job has + `contents: write`), `release-dry-run.yml` (manual, read only, no secrets), `release-publish.yml` + (manual, workflow default token has no permissions, one job with `contents: write`), and + `.forgejo/workflows/ci.yml` (push and pull request on a self-hosted runner labelled `spark`, + uses `actions/checkout@v4` by tag rather than sha). +8. `tests/gates/run.sh` and the gate manifests. + +## Trust boundaries + +- Untrusted: HTTP clients of `aien-serve-http`; model output and tool requests reaching the agent + CLI; candidate code in any pull request the pipeline tests; downloaded release archives before + signature verification. +- Trusted: the Spark signing key (public half in `.aien/verify.pub` on `main`); release signers in + `docs/release/allowed_signers`; pinned omega archives (`native-artifacts.lock`); the pinned + toolchain (`rust-toolchain.toml`, Rust 1.98.1); the operator present at the desk. +- The public release key is not pinned yet (`AIEN_RELEASE_SIGNER` is empty until the key + ceremony), so nothing can install with `signature_check` `release`. + +## Threat model summary + +- Assets: integrity of verdicts and signed bundles for all AIEN repositories; release signing; + files on the operator's machine reachable by the agent; inference service availability. +- Attackers considered: a malicious pull request (to any AIEN repository) trying to reach a PASS + or escape the sandbox; an unauthenticated network client of the HTTP server; a prompt-injected + model issuing destructive tool requests; a tampered release archive. +- Defended: trust anchors read from the base ref, not the head; gate changes run only by the + operator; bearer token on inference requests; approval floors that hold in every mode; signed + release checksums verified with `ssh-keygen`; recorded native archive digests. +- Not defended / explicitly out of scope: no public release and no pinned release key; the release + gate fails on current main (README, issue #414); the GPU fallback counter covers only + instrumented operations; the agent rollback path has not run against a live model (README). + +## Build from source at a pin + +Rust 1.98.1 from `rust-toolchain.toml`. Native pins: `omega.lock` +(`a647b6a9821fffcf52ba9ce813f75afa4b84be62`), `native-artifacts.lock` (sha256 per omega archive, +target and compiler), `crumb.lock`. + +```sh +git clone https://github.com/aien-dev/aien-sovereign-core-mv +cd aien-sovereign-core-mv +cargo test --workspace -- --test-threads=1 +scripts/repro-build.sh -p aien-cli +``` + +The GPU server build (`./install.sh --with-server`) needs a DGX Spark with the NVIDIA open +driver; NOT_RUN on a plain host. + +## Run every test + +```sh +cargo fmt --all -- --check +cargo check --workspace --all-targets +cargo clippy --workspace --all-targets -- -D warnings +cargo test --workspace -- --test-threads=1 +tests/gates/run.sh <step> +``` + +Gate steps in `tests/gates/run.sh` include `crumb-verify`, `fmt`, `check`, `clippy`, `test`, +`strict-mode`, `zero-cuda`, `zero-disk-secrets`, `anti-slop`, `inquisitor`, `release-gate-negatives`, +`release-dry-run`, `aien-verify-tests`, `pins-selftest`, `native-identity`, `install-test`, +`scoring-v5`, `preflight-guard`, `agent-preflight`, `linked-compose`, `gb10-serve-chat`, +`gb10-model-dir`, `kv-props`, `miri`, `trn1`, `crb1` and `verify-closure`. `.aien/always` runs +`CRUMB-VERIFY`, `SC-ZERO-CUDA`, `SC-ZERO-DISK-SECRETS`, `SC-ANTI-SLOP` and `SC-INQUISITOR` on every +change. + +The DGX Spark is the test judge: it runs these gates and signs a bundle. GitHub checks are +advisory (workflow header: nothing on GitHub gates a merge). `SC-GB10-SERVE-CHAT` requires the GB10 +and a downloaded model; NOT_RUN on a plain host. All commands above: NOT_RUN while writing this +document. + +## Known limitations and NOT_RUN + +- GPU path three-run physical qualification: NOT_RUN. +- Qwen full-runtime qualification incomplete; C1 evidence campaign in progress. +- `.forgejo/workflows/ci.yml` runs pull request code on a self-hosted runner and pins + `actions/checkout` by tag; whether this runner is active is unknown from the repository. +- Some `evidence/` directories are named `INVALID` (for example + `qwen38-omega-full-20261018T1641Z-INVALID-oom`); they are kept as failed records. + +## Dependencies and provenance + +- `Cargo.lock` for the workspace; crates.io dependencies. +- Native archives from omega, digests in `native-artifacts.lock`; mismatches fail `build.rs`. +- Licences: Apache-2.0; third-party notices in `THIRD_PARTY.md`, `ATTRIBUTION.md`, `LICENSES/`. +- No Python (`scripts/check-no-python.sh`); no CUDA toolkit (`zero-cuda` gate). +- Model weights are downloaded separately from Hugging Face at a pinned revision named in the + README; they are not in the repository. + +## Evidence + +- `evidence/` and `docs/inference/evidence/` hold run records; `docs/release/receipts/` holds + release receipts. +- Signed Spark bundles: `aien-dev/aien-receipts` at `aien-sovereign-core/<sha>/bundle.json` + (workflow path). Receipts are append-only and never edited. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..d4083956 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,67 @@ +# Security policy + +## Reporting a vulnerability + +Report privately. Do not open a public issue, pull request or discussion about it. + +Use GitHub private vulnerability reporting. Open this repository's Security tab and choose +"Report a vulnerability": + +https://github.com/aien-dev/aien-sovereign-core-mv/security/advisories/new + +That creates a private advisory that only the maintainers can see. + +Include the commit or release you tested, the component (path), steps to reproduce, and what an +attacker gains. If the report involves a secret, say where it was exposed and do not include the +secret itself. Do not post proof-of-concept payloads publicly. + +## Handling + +This project has one maintainer and publishes no response-time promise. Reports are read and +handled as the maintainer's time allows. + +Disclosure is coordinated: an advisory is published with credit (unless you ask otherwise) once +the fix is on the default branch. + +## Scope + +This repository holds the AIEN engine and tools. The engine binary `aien-serve-http` that the +AienOS alpha installer in aien-dev/sovereign-intelligence ships is built here; report engine +flaws in this repository and installer flaws in that one. + +In scope: + +- The OpenAI-compatible HTTP server (`crates/aien-serve-http`): a listener reachable from + anything but the loopback interface, bypassing the bearer token required by + `AIEN_SERVE_HTTP_BEARER_TOKEN` or the local-origin check, request handling, memory + exhaustion. +- The agent CLI approval floors (`crates/aien-cli`): a tool request that escapes the four floors, + the held-workspace filesystem binding or the rollback ledger in any approval mode. +- The verification pipeline in `tools/aien-test`, `tools/aien-local-ci` and `tools/aien-verify`: + a way to get a PASS verdict, a signed bundle or a merge for code that did not pass its gates, + or to run candidate code outside the sandbox. +- Installer and release signing (`install.sh`, `install.ps1`, `scripts/release-*`, + `docs/release/`, `.github/workflows/release*.yml`): installing an unsigned or wrongly signed + archive as `release`. +- Capability, MCP, switchboard and security crates (`crates/aien-capability`, `crates/aien-mcp`, + `crates/aien-switchboard`, `crates/aien-security`). +- `.github/workflows/` and `.forgejo/workflows/`. + +Out of scope: the NVIDIA driver; the Omega GPU engine itself (report to aien-dev/omega-mv, pinned +in `omega.lock`); model weights and model output; services that run a binary from another +release line. + +## Supported versions + +The default branch `main`, and the engine commit the current AienOS alpha release ships +(`59b05a71a33e4a2f1324db2f2b6407ee82b8c2c3`, named by `CORE_REV` in +sovereign-intelligence `installer/build.sh`). No public release of this repository exists; +v0.1.0 and v0.1.1 are internal test releases (README). Fixes land on the default branch only; +the shipped engine changes only when the installer is rebuilt and its engine pin moves. + +## Status + +Research grade. One GPU inference path is in alpha testing on the DGX Spark, and its three-run +physical qualification is NOT_RUN. There is no certification and no bug bounty. + +See AUDIT_SCOPE.md for what to review and how to build and test it. diff --git a/crates/cortex-rs/Dockerfile b/crates/cortex-rs/Dockerfile index 9af427fa..28d6cb9e 100644 --- a/crates/cortex-rs/Dockerfile +++ b/crates/cortex-rs/Dockerfile @@ -22,6 +22,10 @@ COPY --from=builder /build/target/release/cortex-rs /usr/local/bin/cortex-rs COPY scripts/reproduce.sh /usr/local/bin/reproduce.sh RUN chmod +x /usr/local/bin/reproduce.sh +# Run unprivileged; the default store is $HOME/.config/cortex/cortex.db. +RUN useradd --system --create-home --uid 10001 cortex +USER cortex + EXPOSE 18080 ENTRYPOINT ["cortex-rs"] diff --git a/crates/cortex-rs/README.md b/crates/cortex-rs/README.md index e3e12295..38fb8f26 100644 --- a/crates/cortex-rs/README.md +++ b/crates/cortex-rs/README.md @@ -152,4 +152,4 @@ curl -G http://127.0.0.1:18080/api/cortex/search \ This repository is licensed under the **Apache License, Version 2.0 (with LLVM Exception)**. -See [LICENSE](LICENSE) for the full legal text. +See [LICENSE](../../LICENSE) for the full legal text. diff --git a/crates/spark-adapters/src/vault.rs b/crates/spark-adapters/src/vault.rs index aab64315..455207d7 100644 --- a/crates/spark-adapters/src/vault.rs +++ b/crates/spark-adapters/src/vault.rs @@ -386,11 +386,11 @@ mod tests { "Email: <OPERATOR>" ); assert_eq!( - sanitize_outbound_prompt("Email: drake.stapleton@3m.com"), + sanitize_outbound_prompt("Email: drake.stapleton@example.com"), "Email: <OPERATOR>" ); assert_eq!( - sanitize_outbound_prompt("Bracket: <drake.stapleton@3m.com>"), + sanitize_outbound_prompt("Bracket: <drake.stapleton@example.com>"), "Bracket: <<OPERATOR>>" ); } diff --git a/crates/spark-adapters/tests/challenger_m1_sanitizer_adversarial.rs b/crates/spark-adapters/tests/challenger_m1_sanitizer_adversarial.rs index 6a20b972..1fb032c8 100644 --- a/crates/spark-adapters/tests/challenger_m1_sanitizer_adversarial.rs +++ b/crates/spark-adapters/tests/challenger_m1_sanitizer_adversarial.rs @@ -39,7 +39,7 @@ fn test_challenge1_operator_case_and_whitespace_variants() { "Ballentine", "drakestapleton", "drake.stapleton", - "drake.stapleton@3m.com", + "drake.stapleton@example.com", "aien@aienos.com", ]; @@ -65,7 +65,10 @@ fn test_challenge1_operator_case_and_whitespace_variants() { fn test_challenge1_operator_punctuation_and_delimiter_wrapping() { let inputs = [ ("Assignee: (Drake Stapleton)", "Assignee: (<OPERATOR>)"), - ("Contact: [drake.stapleton@3m.com]", "Contact: [<OPERATOR>]"), + ( + "Contact: [drake.stapleton@example.com]", + "Contact: [<OPERATOR>]", + ), ("Author: 'Drake Stapleton';", "Author: '<OPERATOR>';"), ( "Sign-off by \"Michael Drake Ballentine\".", diff --git a/crates/spark-cockpit-rs/static/CONSTITUTION.md b/crates/spark-cockpit-rs/static/CONSTITUTION.md index ef20ef5f..d3512799 100644 --- a/crates/spark-cockpit-rs/static/CONSTITUTION.md +++ b/crates/spark-cockpit-rs/static/CONSTITUTION.md @@ -32,8 +32,8 @@ This Constitution establishes our foundational principles, our engineering stand ### Section 3. Upstream Architectural Charter and Downstream Freedom 1. This Constitution serves as the internal architectural charter, technical doctrine, and engineering standard for the upstream AIEN Sovereign AI Ecosystem and its core repositories. -2. Downstream forks, independent applications, client libraries, and commercial distributions are governed strictly and exclusively by the terms of the Apache License, Version 2.0 (see [LICENSE](LICENSE)). Downstream developers possess complete freedom to innovate, customize, brand, and extend the software without obligation to adopt or enforce this internal development charter. -3. Legal Decoupling: Legal rights, grants, and warranties reside exclusively within the formal LICENSE and NOTICE documents, and artifact licensing policies outlined in [ARTIFACT_LICENSING.md](ARTIFACT_LICENSING.md). This Constitution imposes zero behavioral covenants or philosophical constraints on downstream users, ensuring standard open-source compatibility across public package registries, corporate environments, and independent commercial deployments. +2. Downstream forks, independent applications, client libraries, and commercial distributions are governed strictly and exclusively by the terms of the Apache License, Version 2.0 (see [LICENSE](https://github.com/aien-dev/aien-sovereign-core-mv/blob/main/LICENSE)). Downstream developers possess complete freedom to innovate, customize, brand, and extend the software without obligation to adopt or enforce this internal development charter. +3. Legal Decoupling: Legal rights, grants, and warranties reside exclusively within the formal LICENSE and NOTICE documents, and artifact licensing policies outlined in [ARTIFACT_LICENSING.md](https://github.com/aien-dev/aien-sovereign-core-mv/blob/main/ARTIFACT_LICENSING.md). This Constitution imposes zero behavioral covenants or philosophical constraints on downstream users, ensuring standard open-source compatibility across public package registries, corporate environments, and independent commercial deployments. ### Section 4. The Zero-Surveillance Invariant Privacy and mutual trust form the basis of open cooperation. @@ -47,7 +47,7 @@ Privacy and mutual trust form the basis of open cooperation. 3. Upstream contributions are foundational: any public open-source project adapted to run on our stack is contributed back upstream. We never hoard fixes or improvements. 4. Voluntary Bilateral Cooperation and Reciprocal Commons: Hardware manufacturers (including NVIDIA, AMD, Intel, Apple) and compute providers (such as RunPod, Lambda, and independent data centers) possess complete freedom to adopt, embed, and deploy our runtime stack under the Apache License, Version 2.0 to improve hardware efficiency, eliminate memory overhead, and expand bandwidth for developers. -For organizations seeking deeper bilateral research cooperation, model weight transparency, distillation reciprocity, or joint compute pooling, the voluntary terms of [OPEN_COOPERATION_COVENANT.md](OPEN_COOPERATION_COVENANT.md) provide a collaborative framework. +For organizations seeking deeper bilateral research cooperation, model weight transparency, distillation reciprocity, or joint compute pooling, the voluntary terms of [OPEN_COOPERATION_COVENANT.md](https://github.com/aien-dev/aien-sovereign-core-mv/blob/main/OPEN_COOPERATION_COVENANT.md) provide a collaborative framework. ### Section 6. The Contributor Oath Anyone contributing to our repositories, whether human operator or autonomous agent, ratifies the Developer Certificate of Origin (DCO 1.1) and the following stewardship covenant: diff --git a/crates/spark-cockpit-rs/static/app.js b/crates/spark-cockpit-rs/static/app.js index 32c45070..dbeca56d 100644 --- a/crates/spark-cockpit-rs/static/app.js +++ b/crates/spark-cockpit-rs/static/app.js @@ -159,6 +159,16 @@ function setText(id, text) { if (el) el.textContent = text; } +// Every API or model string placed into innerHTML goes through esc(). +function esc(value) { + return String(value ?? "") + .replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/"/g, """) + .replace(/'/g, "'"); +} + function greetingForHour(hour) { if (hour < 5) return "Good night"; if (hour < 12) return "Good morning"; @@ -511,14 +521,14 @@ async function loadFeed() { card.innerHTML = ` <div> <div class="feed-card-header"> - <span class="feed-card-badge ${item.badge.toLowerCase()}">${item.badge}</span> - <span style="font-size:11px; color:var(--text-muted);">${item.category.toUpperCase()}</span> + <span class="feed-card-badge ${esc(item.badge.toLowerCase())}">${esc(item.badge)}</span> + <span style="font-size:11px; color:var(--text-muted);">${esc(item.category.toUpperCase())}</span> </div> - <h3 class="feed-card-title" style="margin-top:8px;">${item.title}</h3> - <p class="feed-card-summary" style="margin-top:6px;">${item.summary}</p> + <h3 class="feed-card-title" style="margin-top:8px;">${esc(item.title)}</h3> + <p class="feed-card-summary" style="margin-top:6px;">${esc(item.summary)}</p> </div> <div style="display:flex; justify-content:flex-end;"> - <button class="stage-btn" data-target="${item.action_target}">${item.action_label}</button> + <button class="stage-btn" data-target="${esc(item.action_target)}">${esc(item.action_label)}</button> </div> `; const btn = card.querySelector("button"); @@ -528,7 +538,7 @@ async function loadFeed() { grid.appendChild(card); }); } catch (err) { - grid.innerHTML = `<div style="color:var(--status-crimson);">Failed to load feed: ${err.message}</div>`; + grid.innerHTML = `<div style="color:var(--status-crimson);">Failed to load feed: ${esc(err.message)}</div>`; } } @@ -611,7 +621,7 @@ async function loadGoals() { card.innerHTML = ` <div class="goal-card-top"> - <span class="goal-title">${goal.title}</span> + <span class="goal-title">${esc(goal.title)}</span> <span class="feed-card-badge ${pct === 100 ? "online" : "pending"}">${pct}%</span> </div> <div class="goal-progress-wrap"> @@ -626,7 +636,7 @@ async function loadGoals() { ${milestones.map(m => ` <label class="milestone-row"> <input type="checkbox" class="milestone-check" ${m.completed ? "checked" : ""}> - <span style="${m.completed ? "text-decoration:line-through; opacity:0.6;" : ""}">${m.name || m.title || m}</span> + <span style="${m.completed ? "text-decoration:line-through; opacity:0.6;" : ""}">${esc(m.name || m.title || m)}</span> </label> `).join("")} </div> @@ -634,7 +644,7 @@ async function loadGoals() { container.appendChild(card); }); } catch (err) { - container.innerHTML = `<div style="color:var(--status-crimson);">Goals error: ${err.message}</div>`; + container.innerHTML = `<div style="color:var(--status-crimson);">Goals error: ${esc(err.message)}</div>`; } } @@ -668,9 +678,9 @@ async function loadArtifacts() { <div class="artifact-card-icon"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width:18px;height:18px;"><polygon points="12 2 2 7 12 12 22 7 12 2"/><polyline points="2 17 12 22 22 17"/><polyline points="2 12 12 17 22 12"/></svg> </div> - <div class="artifact-card-title">${item.filename}</div> + <div class="artifact-card-title">${esc(item.filename)}</div> <div style="font-size:11px; color:var(--text-muted); display:flex; justify-content:space-between;"> - <span>${item.ext.toUpperCase()}</span> + <span>${esc(item.ext.toUpperCase())}</span> <span>${(item.size / 1024).toFixed(1)} KB</span> </div> `; @@ -680,7 +690,7 @@ async function loadArtifacts() { grid.appendChild(card); }); } catch (err) { - grid.innerHTML = `<div style="color:var(--status-crimson);">Failed to load artifacts: ${err.message}</div>`; + grid.innerHTML = `<div style="color:var(--status-crimson);">Failed to load artifacts: ${esc(err.message)}</div>`; } } @@ -695,7 +705,7 @@ async function openArtifactInDrawer(filename) { switchDrawerTab("artifact"); try { - const res = await fetch(`/api/artifacts/${filename}`); + const res = await fetch(`/api/artifacts/${encodeURIComponent(filename)}`); if (!res.ok) throw new Error("Could not retrieve artifact file"); const text = await res.text(); @@ -755,16 +765,16 @@ async function loadApprovals() { <div class="approval-header"> <span class="approval-title"> <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="width:16px;height:16px;color:var(--status-amber);"><path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"/></svg> - ${appr.title} + ${esc(appr.title)} </span> - <span class="approval-badge">${appr.status.toUpperCase()}</span> + <span class="approval-badge">${esc(appr.status.toUpperCase())}</span> </div> - <p class="approval-desc">${appr.description}</p> - ${appr.command_or_diff ? `<pre class="approval-cmd">${appr.command_or_diff}</pre>` : ""} + <p class="approval-desc">${esc(appr.description)}</p> + ${appr.command_or_diff ? `<pre class="approval-cmd">${esc(appr.command_or_diff)}</pre>` : ""} ${appr.status === "pending" ? ` <div class="approval-actions"> - <button class="btn-approve" data-id="${appr.id}">Approve</button> - <button class="btn-reject" data-id="${appr.id}">Reject</button> + <button class="btn-approve" data-id="${esc(appr.id)}">Approve</button> + <button class="btn-reject" data-id="${esc(appr.id)}">Reject</button> </div> ` : ""} `; @@ -786,7 +796,7 @@ async function loadApprovals() { async function resolveApproval(id, action) { try { - const res = await fetch(`/api/approvals/${id}/resolve`, { + const res = await fetch(`/api/approvals/${encodeURIComponent(id)}/resolve`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action }) @@ -839,15 +849,15 @@ async function loadMemory(query = "") { card.className = "memory-card"; card.innerHTML = ` <div style="display:flex; justify-content:space-between; align-items:center;"> - <span class="memory-name">${item.canonical_name || item.name || "Entity"}</span> + <span class="memory-name">${esc(item.canonical_name || item.name || "Entity")}</span> <span class="feed-card-badge online">${item.confidence ? Math.round(item.confidence * 100) + "%" : "STORED"}</span> </div> - <p class="memory-content">${item.content || item.summary || ""}</p> + <p class="memory-content">${esc(item.content || item.summary || "")}</p> `; grid.appendChild(card); }); } catch (err) { - grid.innerHTML = `<div style="color:var(--status-crimson);">Cortex memory error: ${err.message}</div>`; + grid.innerHTML = `<div style="color:var(--status-crimson);">Cortex memory error: ${esc(err.message)}</div>`; } } diff --git a/docs/SOVEREIGN_INNOVATIONS.md b/docs/SOVEREIGN_INNOVATIONS.md index fc55a795..a4cb84eb 100644 --- a/docs/SOVEREIGN_INNOVATIONS.md +++ b/docs/SOVEREIGN_INNOVATIONS.md @@ -63,6 +63,6 @@ Verified on NVIDIA Grace Blackwell GB10 (NVIDIA DGX Spark, Linux aarch64): Licensed under the **Apache License, Version 2.0**. Copyright (c) 2026 AIEN Sovereign Systems & Ecosystem Contributors. -See [LICENSE](LICENSE) and [NOTICE](NOTICE) for terms. -Voluntary bilateral research covenants and artifact access are governed by [OPEN_COOPERATION_COVENANT.md](OPEN_COOPERATION_COVENANT.md) and [ARTIFACT_LICENSING.md](ARTIFACT_LICENSING.md). +See [LICENSE](../LICENSE) and [NOTICE](../NOTICE) for terms. +Voluntary bilateral research covenants and artifact access are governed by [OPEN_COOPERATION_COVENANT.md](../OPEN_COOPERATION_COVENANT.md) and [ARTIFACT_LICENSING.md](../ARTIFACT_LICENSING.md). For sovereign ecosystem coordination: `aien@aienos.com`.