diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 56be208c..e82705fc 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -44,7 +44,7 @@ which is precisely why the map is now generated rather than typed. **When reporting**: -Use the [bug report template](.github/ISSUE_TEMPLATE/bug_report.md) and include: +Use the [bug report template](ISSUE_TEMPLATE/bug_report.yml) and include: - Clear, descriptive title - Environment details (OS, versions, toolchain) @@ -61,7 +61,7 @@ Use the [bug report template](.github/ISSUE_TEMPLATE/bug_report.md) and include: **When suggesting**: -Use the [feature request template](.github/ISSUE_TEMPLATE/feature_request.md) and include: +Use the [feature request template](ISSUE_TEMPLATE/feature_request.yml) and include: - Problem statement (what pain point does this solve?) - Proposed solution diff --git a/.github/workflows/dogfood-gate.yml b/.github/workflows/dogfood-gate.yml index 1db90e56..be56fb64 100644 --- a/.github/workflows/dogfood-gate.yml +++ b/.github/workflows/dogfood-gate.yml @@ -587,12 +587,16 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: hyperpolymath/hypatia - ref: be98f74ce93df200752f3798efa1305bfa3e0e10 + # The repository-wide Hypatia pin: the same commit as hypatia-scan.yml (HYPATIA_SHA), + # both verdict renderers (--hypatia-ref) and the rule-order policy, so the scanner and + # this oracle cannot grade different rules (docs/HYPATIA-RULE-ORDER.adoc, C2). It contains + # hypatia#1062 (the PinSites miscompile fix, merged as 37b8d01). The earlier pin be98f74 lacks it. + ref: 6693f9aed8e4383f78a3d01b600b32663bf7a45c path: _hypatia persist-credentials: false # OTP 28.x (28.1 to 28.5.0.8) crashes this step with SIGSEGV in # sweep_off_heap, called from the JIT's bs_init_bits, on trees whose - # workflow content trips it (Apodeixis.jl#333). OTP 27.3 scored all + # workflow content trips it (rsr-template-repo#333). OTP 27.3 scored all # of them cleanly. Do not move to 28.x until a pinned 28.x build scores # the #333 trees (af8665c, a55669e, 6ad5378) with no crash. - name: Setup Elixir 1.19.4 / OTP 27.3.4.19 for Hypatia oracle @@ -608,7 +612,7 @@ jobs: _hypatia/_build ~/.hex ~/.mix - key: hypatia-oracle-${{ runner.os }}-otp27.3.4.19-elx1194-be98f74ce93df200752f3798efa1305bfa3e0e10 + key: hypatia-oracle-${{ runner.os }}-otp27.3.4.19-elx1194-6693f9aed8e4383f78a3d01b600b32663bf7a45c - name: Compile the oracle working-directory: _hypatia run: mix local.hex --force && mix local.rebar --force && mix deps.get && mix compile diff --git a/.github/workflows/fork-governance.yml b/.github/workflows/fork-governance.yml index 83094075..b05b55be 100644 --- a/.github/workflows/fork-governance.yml +++ b/.github/workflows/fork-governance.yml @@ -445,7 +445,7 @@ jobs: --hypatia-sarif "$ev/hypatia-scan-findings/hypatia.sarif" --panic "$ev/static-analysis-findings/panic-attack-findings.json" --pons "$ev/static-analysis-findings/pons-findings.json" - --hypatia-ref be98f74ce93df200752f3798efa1305bfa3e0e10 + --hypatia-ref 6693f9aed8e4383f78a3d01b600b32663bf7a45c --panic-ref b5530834a839734d1d181bfe6edb0d43d4233cf4 --pons-ref 51b8920f541782ceb9465ea3f0d33c96104fc1fb ) diff --git a/.github/workflows/hypatia-scan.yml b/.github/workflows/hypatia-scan.yml index f70d7877..b47e02d4 100644 --- a/.github/workflows/hypatia-scan.yml +++ b/.github/workflows/hypatia-scan.yml @@ -51,7 +51,7 @@ jobs: security-events: write vulnerability-alerts: read # Dependabot alerts, for Hypatia's DA rules env: - HYPATIA_SHA: 'be98f74ce93df200752f3798efa1305bfa3e0e10' + HYPATIA_SHA: '6693f9aed8e4383f78a3d01b600b32663bf7a45c' steps: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -61,7 +61,7 @@ jobs: # OTP 28.5.0.8 crashes this job with SIGSEGV (exit 139 in hypatia-cli.sh # scan) on some scanned trees, deterministically per tree - # (Apodeixis.jl#339: 10 of 10 runs on #338's head, 0 of 10 on + # (rsr-template-repo#339: 10 of 10 runs on #338's head, 0 of 10 on # main's); OTP 27.3.4.19 scanned both trees cleanly (0 of 10 each). # Same VM bug as the RSR oracle (#333, #335). Do not move to 28.x until a # pinned 28.x build scans #338's head 7821940 with no crash. diff --git a/.github/workflows/verdict-grid-publish.yml b/.github/workflows/verdict-grid-publish.yml index 465f8df7..910f074d 100644 --- a/.github/workflows/verdict-grid-publish.yml +++ b/.github/workflows/verdict-grid-publish.yml @@ -136,7 +136,7 @@ jobs: --hypatia-sarif "$ev/hypatia-scan-findings/hypatia.sarif" \ --panic "$ev/static-analysis-findings/panic-attack-findings.json" \ --pons "$ev/static-analysis-findings/pons-findings.json" \ - --hypatia-ref be98f74ce93df200752f3798efa1305bfa3e0e10 \ + --hypatia-ref 6693f9aed8e4383f78a3d01b600b32663bf7a45c \ --panic-ref b5530834a839734d1d181bfe6edb0d43d4233cf4 \ --pons-ref 51b8920f541782ceb9465ea3f0d33c96104fc1fb) [ ! -d "$ev/fleet-report-backs" ] || args+=(--report-backs "$ev/fleet-report-backs") diff --git a/.machine_readable/policies/hypatia-rule-order.json b/.machine_readable/policies/hypatia-rule-order.json index d6f53751..eceb08af 100644 --- a/.machine_readable/policies/hypatia-rule-order.json +++ b/.machine_readable/policies/hypatia-rule-order.json @@ -1 +1 @@ -{"SPDX-License-Identifier":"MPL-2.0","clashes":[{"id":"C1","resolution":"single producer; scripts/check-workflow-edges.sh fails on a dead edge","summary":"one scanner, two workflows"},{"id":"C2","resolution":"one pin per tool per repository; the verdict job names the producer's commit","summary":"one tool, two pins"},{"id":"C3","resolution":"panicbot stays unenrolled; the grid's own row is the authority","summary":"panicbot versus the direct panic-attack row"},{"id":"C4","resolution":"every fragment must end on a path boundary","summary":"substring fragments suppress more than they name"},{"id":"C5","resolution":"subsumed entries are refused","summary":"a broad entry makes narrower ones dead"},{"id":"C6","resolution":"the named path must exist in the tree","summary":"an exemption outlives the file it names"},{"id":"C7","resolution":"stated, not worked around; un-suppression is an upstream change","summary":"a repository cannot narrow a built-in default"},{"id":"C8","resolution":"producers own their gates; a failed fleet is orange rows, not a block","summary":"the reporter must not re-gate"}],"concerns":[{"id":"hypatia-execution","owner":".github/workflows/hypatia-scan.yml","rationale":"Two workflows built and ran the same scanner at the same pin (clash C1)."},{"id":"hypatia-gate","owner":".github/workflows/hypatia-scan.yml","rationale":"The producer owns its gate; the verdict grid is not a gate (clash C8)."},{"id":"panic-attack-gate","owner":".github/workflows/static-analysis-gate.yml","rationale":"Blocks on critical exactly once, in the workflow that runs it."},{"id":"pons-asinorum","owner":".github/workflows/static-analysis-gate.yml","rationale":"Advisory by design: pons classifies evidence, it does not prove."},{"id":"verdict-grid-render","owner":".github/workflows/fork-governance.yml","rationale":"The reporter collects evidence and never scans (clash C8)."},{"id":"verdict-grid-comment","owner":".github/workflows/verdict-grid-publish.yml","rationale":"Only the trusted default-branch workflow_run publisher may write the single bot-owned verdict comment; PR rendering remains read-only."},{"id":"fleet-report-backs","owner":".github/workflows/fork-governance.yml","rationale":"The fleet job is the only producer of .gitbot-fleet evidence."},{"id":"exemption-policy","owner":".hypatia-ignore","rationale":"One file, checked by scripts/check-hypatia-ignore.sh."}],"grid":{"commit":"f0b3cd4c464d33e1584f8528c17bce104555e256","library":"scripts/lib/verdict-grid.jq","library_sha256":"36e7aa69afbe8c488b1a313fd9bd0cf2bf6af45d3f34b80afd793f6b20582896","renderer":"scripts/verdict-grid.sh","renderer_sha256":"7c2cac9248fd249f607de827dc8dc9a3f6276bf9ca662be86aa435e9aeca48d7","repository":"metadatastician/standards","specification":"docs/VERDICT-GRID-SPEC.adoc"},"layer_owners":["hypatia","this-repository","the-gate","the-grid"],"layers":[{"description":"Python, Go, Makefile and Gemfile are refused by a dedicated clause; no exemption reaches it.","id":"rule-total-ban","overrides":"nothing: every other layer is unreachable for this rule","owner":"hypatia","rank":1,"repository_can_change":false,"scope":"cicd_rules/banned_language_file"},{"description":"Applied to every rule before any module-specific table.","id":"universal-excludes","overrides":"every layer below it, for the paths it names","owner":"hypatia","rank":2,"repository_can_change":false,"scope":"vendored and generated paths: .git/, node_modules/, _build/, deps/, target/, dist/, .hypatia-baseline.json"},{"description":"Training corpora and fixtures are provenance, not signal.","id":"builtin-defaults","overrides":"every layer below it; a repository cannot narrow it (clash C7)","owner":"hypatia","rank":3,"repository_can_change":false,"scope":"@training_corpus_paths keyed per module, plus benches/ for code_safety only"},{"description":"Scoped, reasoned exemptions. Fragments are substring matches, so each must end on a path boundary.","id":"repository-ignore","overrides":"nothing above it; it may only widen layer 3","owner":"this-repository","rank":4,"repository_can_change":true,"scope":".hypatia-ignore"},{"description":"Line- or file-scoped. The narrowest layer, and the one to use when only one line is affected.","id":"inline-directive","overrides":"layers 3 and 4, for the line that carries it","owner":"this-repository","rank":5,"repository_can_change":true,"scope":"# hypatia: allow / -- "},{"description":"Applied at gate time only. The verdict grid ignores it, so standing debt stays visible.","id":"baseline","overrides":"the gate's decision, never a scanner's output","owner":"the-gate","rank":6,"repository_can_change":true,"scope":".hypatia-baseline.json"},{"description":"Presentation and grading. It never suppresses a finding.","id":"grid-normalisation","overrides":"nothing; it may not change what a scanner reported","owner":"the-grid","rank":7,"repository_can_change":false,"scope":"severity words, suppressed:true, the row's colour"}],"observed_modules":[{"layer":4,"module":"research_extensions","rationale":"RE001/RE005/RE008 are advisory recommendations for workflows that deliberately hold a credential or render an annotation non-fatally; each exemption is file-scoped."},{"layer":4,"module":"workflow_audit","rationale":"wrong_sha_pin compares against a static May-2026 table; authoritative pin verification is actions.lock plus check-lock-sync.sh, which runs on every pull request."}],"scanner":{"commit":"be98f74ce93df200752f3798efa1305bfa3e0e10","repository":"hyperpolymath/hypatia","sources":["lib/hypatia/scanner_suppression.ex","lib/rules/"]},"schema":"hypatia-rule-order/1"} +{"SPDX-License-Identifier":"MPL-2.0","clashes":[{"id":"C1","resolution":"single producer; scripts/check-workflow-edges.sh fails on a dead edge","summary":"one scanner, two workflows"},{"id":"C2","resolution":"one pin per tool per repository; the verdict job names the producer's commit","summary":"one tool, two pins"},{"id":"C3","resolution":"panicbot stays unenrolled; the grid's own row is the authority","summary":"panicbot versus the direct panic-attack row"},{"id":"C4","resolution":"every fragment must end on a path boundary","summary":"substring fragments suppress more than they name"},{"id":"C5","resolution":"subsumed entries are refused","summary":"a broad entry makes narrower ones dead"},{"id":"C6","resolution":"the named path must exist in the tree","summary":"an exemption outlives the file it names"},{"id":"C7","resolution":"stated, not worked around; un-suppression is an upstream change","summary":"a repository cannot narrow a built-in default"},{"id":"C8","resolution":"producers own their gates; a failed fleet is orange rows, not a block","summary":"the reporter must not re-gate"}],"concerns":[{"id":"hypatia-execution","owner":".github/workflows/hypatia-scan.yml","rationale":"Two workflows built and ran the same scanner at the same pin (clash C1)."},{"id":"hypatia-gate","owner":".github/workflows/hypatia-scan.yml","rationale":"The producer owns its gate; the verdict grid is not a gate (clash C8)."},{"id":"panic-attack-gate","owner":".github/workflows/static-analysis-gate.yml","rationale":"Blocks on critical exactly once, in the workflow that runs it."},{"id":"pons-asinorum","owner":".github/workflows/static-analysis-gate.yml","rationale":"Advisory by design: pons classifies evidence, it does not prove."},{"id":"verdict-grid-render","owner":".github/workflows/fork-governance.yml","rationale":"The reporter collects evidence and never scans (clash C8)."},{"id":"verdict-grid-comment","owner":".github/workflows/verdict-grid-publish.yml","rationale":"Only the trusted default-branch workflow_run publisher may write the single bot-owned verdict comment; PR rendering remains read-only."},{"id":"fleet-report-backs","owner":".github/workflows/fork-governance.yml","rationale":"The fleet job is the only producer of .gitbot-fleet evidence."},{"id":"exemption-policy","owner":".hypatia-ignore","rationale":"One file, checked by scripts/check-hypatia-ignore.sh."}],"grid":{"commit":"f0b3cd4c464d33e1584f8528c17bce104555e256","library":"scripts/lib/verdict-grid.jq","library_sha256":"36e7aa69afbe8c488b1a313fd9bd0cf2bf6af45d3f34b80afd793f6b20582896","renderer":"scripts/verdict-grid.sh","renderer_sha256":"7c2cac9248fd249f607de827dc8dc9a3f6276bf9ca662be86aa435e9aeca48d7","repository":"metadatastician/standards","specification":"docs/VERDICT-GRID-SPEC.adoc"},"layer_owners":["hypatia","this-repository","the-gate","the-grid"],"layers":[{"description":"Python, Go, Makefile and Gemfile are refused by a dedicated clause; no exemption reaches it.","id":"rule-total-ban","overrides":"nothing: every other layer is unreachable for this rule","owner":"hypatia","rank":1,"repository_can_change":false,"scope":"cicd_rules/banned_language_file"},{"description":"Applied to every rule before any module-specific table.","id":"universal-excludes","overrides":"every layer below it, for the paths it names","owner":"hypatia","rank":2,"repository_can_change":false,"scope":"vendored and generated paths: .git/, node_modules/, _build/, deps/, target/, dist/, .hypatia-exemptions.md, .hypatia-baseline.json"},{"description":"Training corpora and fixtures are provenance, not signal.","id":"builtin-defaults","overrides":"every layer below it; a repository cannot narrow it (clash C7)","owner":"hypatia","rank":3,"repository_can_change":false,"scope":"@training_corpus_paths keyed per module (security_errors, code_safety, migration_rules, structural_drift, content_patterns, dogfooding), plus benches/ for code_safety only, and for security_errors also .github/workflows/integration.yml and, for secret_detected only, harvested-registry/"},{"description":"Scoped, reasoned exemptions. Fragments are substring matches, so each must end on a path boundary.","id":"repository-ignore","overrides":"nothing above it; it may only widen layer 3","owner":"this-repository","rank":4,"repository_can_change":true,"scope":".hypatia-ignore"},{"description":"Line- or file-scoped. The narrowest layer, and the one to use when only one line is affected.","id":"inline-directive","overrides":"layers 3 and 4, for the line that carries it","owner":"this-repository","rank":5,"repository_can_change":true,"scope":"# hypatia: allow / -- "},{"description":"Applied at gate time only. The verdict grid ignores it, so standing debt stays visible.","id":"baseline","overrides":"the gate's decision, never a scanner's output","owner":"the-gate","rank":6,"repository_can_change":true,"scope":".hypatia-baseline.json"},{"description":"Presentation and grading. It never suppresses a finding.","id":"grid-normalisation","overrides":"nothing; it may not change what a scanner reported","owner":"the-grid","rank":7,"repository_can_change":false,"scope":"severity words, suppressed:true, the row's colour"}],"observed_modules":[{"layer":4,"module":"research_extensions","rationale":"RE001, RE005 and RE008 fire on workflows that deliberately hold a credential or render an annotation non-fatally; each exemption is file-scoped."},{"layer":4,"module":"workflow_audit","rationale":"wrong_sha_pin compares against a static May-2026 table; authoritative pin verification is actions.lock plus check-lock-sync.sh, which runs on every pull request."}],"scanner":{"commit":"6693f9aed8e4383f78a3d01b600b32663bf7a45c","repository":"hyperpolymath/hypatia","sources":["lib/hypatia/scanner_suppression.ex","lib/rules/"]},"schema":"hypatia-rule-order/1"} diff --git a/Apodeixis.jl_chora.deed b/Apodeixis.jl_chora.deed index b6d0338d..2a1e09bd 100644 --- a/Apodeixis.jl_chora.deed +++ b/Apodeixis.jl_chora.deed @@ -225,7 +225,9 @@ (directory :id "automation-unit-forge" :ply 3 :path ".machine_readable/scripts/forge" :description "Internal automation logic for project forge.") (directory :id "automation-unit-lifecycle" :ply 3 :path ".machine_readable/scripts/lifecycle" :description "Internal automation logic for project lifecycle.") (directory :id "automation-unit-verification" :ply 3 :path ".machine_readable/scripts/verification" :description "Internal automation logic for project verification."))) - (directory :id "container-templates" :ply 1 :path "build/container" :version "1.0.0" :description "Container templates for the stapeln container ecosystem. This directory\nprovides Podman-Chainguard-stapeln templates that are customised via\n`just container-init` or `just repo-init` during project bootstrap.\n\nAll files use {{PLACEHOLDER}} tokens that are substituted with project-\nspecific values during initialisation." :purpose "Provide a complete, security-first container deployment story for any\nRSR-compliant repository. The templates cover the full lifecycle:\nbuild, sign, verify, deploy, monitor, and govern." :overview "The stapeln container ecosystem comprises six tools:\n\nselur — Container orchestration with zero-copy IPC. Reads compose.toml.\ncerro-torre — Verified container packaging (.ctp bundles), Ed25519 signing.\nsvalinn — Policy-driven edge gateway (auth, rate limits, CORS, trust).\nvordr — Runtime monitoring (health, crashes, resources, logs).\nrokur — Secrets management (runtime injection, no baked secrets).\nk9-svc — Nickel deployment components (Kennel/Yard/Hunt trust levels)." + (directory :id "container-templates" :ply 1 :path "build/container" :version "1.0.0" :description "Container templates for the stapeln container ecosystem. This directory\nprovides Podman-Chainguard-stapeln templates that are customised via\n`just container-init` or `just repo-init` during project bootstrap.\n\nAll files use {{PLACEHOLDER}} tokens that are substituted with project-\nspecific values during initialisation." + :purpose "Provide a complete, security-first container deployment story for any\nRSR-compliant repository. The templates cover the full lifecycle:\nbuild, sign, verify, deploy, monitor, and govern." + :overview "The stapeln container ecosystem comprises six tools:\n\nselur — Container orchestration with zero-copy IPC. Reads compose.toml.\ncerro-torre — Verified container packaging (.ctp bundles), Ed25519 signing.\nsvalinn — Policy-driven edge gateway (auth, rate limits, CORS, trust).\nvordr — Runtime monitoring (health, crashes, resources, logs).\nrokur — Secrets management (runtime injection, no baked secrets).\nk9-svc — Nickel deployment components (Kennel/Yard/Hunt trust levels)." :context ("https://stapeln.dev/ns/v1") (canonical-locations :build_pipeline "build/container/stapeln/ct-build.sh" :compose "build/container/stapeln/compose.toml" :compose_example "build/container/stapeln/compose.example.toml" :compose_portable "build/container/compose.yaml" :compose_portable_example "build/container/compose.example.yaml" :containerfile "build/container/Containerfile" :containerignore "build/container/.containerignore" :deployment "build/container/stapeln/deploy.k9.ncl" :entrypoint "build/container/entrypoint.sh" :gatekeeper "build/container/stapeln/.gatekeeper.yaml" :just_module "build/just/container.just" :manifest "build/container/stapeln/manifest.toml" :monitoring "build/container/stapeln/vordr.toml" :secrets_gate "build/container/stapeln/rokur.toml") :invariants ("Base images MUST be cgr.dev/chainguard/wolfi-base or cgr.dev/chainguard/static" "Container runtime is Podman — never Docker" "Containerfile — never Dockerfile" "All images run as non-root (appuser or project-specific user)" ".ctp bundles are signed with Ed25519 via cerro-torre" "Health endpoints (/health, /ready) must always be public (no auth)") diff --git a/CLAUDE.md b/CLAUDE.md index e64f889a..1eb6a8b9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -124,3 +124,34 @@ hand; that migration is done per repo (ADR-008 phase P3). In deed files use **ENFORCEMENT:** these rulings are recorded on `standards#787`. Some are ruled but not yet gated: check the gate on `standards` main before relying on it. + +## Proofs — which prover for which obligation + +Normative source: `3-practice/PROOF-POLICY.adoc` in `hyperpolymath/standards`. +Read it there; `verification/proofs/README.adoc` maps it onto this repo. + +| Code or obligation | Verifier | +|---|---| +| Rust code | **Creusot** with **Pearlite** contracts, and **Verus**, by default and on the code (§1.2). Kani for `unsafe`/FFI seams and Aeneas for Rust that implements an Agda theorem run alongside, never instead | +| Ada code | **SPARK** | +| APIs, ABIs, engineering properties | **Idris2** | +| Theory | **Agda**, rechecked in **Rocq** and **Lean** (no Mathlib) | + +Always name Creusot, Pearlite and Verus in Rust verification plans and in +`docs/status/PROOF-STATUS.adoc`. Pearlite is Creusot's specification +language, not a third verifier. Plan scopes for both verifiers, and record +any that is unsupported, inapplicable or not yet run, with its reason; never +present an unexecuted check as a pass. Using both does not make two +independent witnesses (policy §1.2). + +Third-party code (crates such as Bevy, libraries, forks) is **not** converted +or re-proved. State what a proof relies on as an `ASSUMED` boundary +specification, and when choosing between dependencies that fit equally well, +prefer one that carries its own verification. A preference, not a gate. + +Proof grades are policy §8, *Proof Witness Grades*: `PWG-3` < `PWG-2i` < +`PWG-2ii` < `PWG-1`, where `PWG-1` is strongest. A grade is derived from +receipts, never asserted. A "verified" or "machine-checked" claim needs +current receipts. Report a census with its denominator, never a +percentage. Always write the `PWG-` prefix: CRG, TRG, ARG and FRG letters, +and ECHIDNA's `TrustLevel`, are different schemes. diff --git a/LICENSE.adoc b/LICENSE.adoc new file mode 100644 index 00000000..af089d45 --- /dev/null +++ b/LICENSE.adoc @@ -0,0 +1,2 @@ +SPDX-License-Identifier: MPL-2.0 AND CC-BY-SA-4.0 +Code: MPL-2.0. Prose: CC-BY-SA-4.0. diff --git a/build/container/Containerfile b/build/container/Containerfile deleted file mode 100644 index 691ec193..00000000 --- a/build/container/Containerfile +++ /dev/null @@ -1,152 +0,0 @@ -# SPDX-License-Identifier: MPL-2.0 -# Apodeixis.jl Container Image -# -# Multi-stage build template for Chainguard Wolfi base images. -# Customise the builder stage for your language and copy the -# resulting binary/release into the minimal runtime stage. -# -# This is the Tier-A artifact: a plain OCI image, buildable by ANY -# OCI-compliant engine — podman (recommended), nerdctl, or docker. -# It carries no hard dependency on the stapeln tier; the cerro-torre / -# svalinn files under build/container/stapeln/ are referenced only as labels. -# -# Build (engine-agnostic — substitute podman | nerdctl | docker): -# podman build -t apodeixis.jl:latest -f build/container/Containerfile . -# -# Run: -# podman run -p 8080:8080 apodeixis.jl:latest -# -# Run with persistent volume: -# podman run -p 8080:8080 -v apodeixis.jl-data:/data apodeixis.jl:latest -# -# Via the Justfile (auto-detects engine, prefers cerro-torre when present): -# just container-build - -# ============================================================================ -# Stage 1: Builder -# ============================================================================ -# -# Install build tools and compile the application. -# This stage is discarded after the build — only the compiled output -# is copied into the runtime stage. -# -# Language-specific examples (uncomment the one you need): -# -# --- Rust --- -# RUN apk add --no-cache rust pkgconf build-base -# COPY Cargo.toml Cargo.lock ./ -# COPY src/ ./src/ -# RUN cargo build --release -# # Output: /build/target/release/apodeixis.jl -# -# --- Elixir --- -# RUN apk add --no-cache erl27-elixir-1.18 erlang-27 erlang-27-dev git build-base -# COPY mix.exs mix.lock ./ -# COPY lib/ ./lib/ -# COPY config/ ./config/ -# ENV MIX_ENV=prod -# RUN mix local.hex --force && mix local.rebar --force && \ -# mix deps.get --only prod && mix compile && mix release -# # Output: /build/_build/prod/rel/apodeixis.jl/ -# -# --- Zig --- -# RUN apk add --no-cache zig build-base -# COPY build.zig build.zig.zon ./ -# COPY src/ ./src/ -# RUN zig build -Doptimize=ReleaseFast -# # Output: /build/zig-out/bin/apodeixis.jl -# -# Base image: `:latest` is right for a template scaffold (Chainguard rebuilds -# Wolfi daily). For PRODUCTION builds, pin by digest for reproducibility/supply- -# chain integrity, e.g.: -# FROM cgr.dev/chainguard/wolfi-base:latest@sha256: AS builder -# (cerro-torre's .ctp signing in build/container/stapeln/ records the resolved digest.) -FROM cgr.dev/chainguard/wolfi-base:latest AS builder - -# TODO: Install your language toolchain -RUN apk add --no-cache build-base - -WORKDIR /build - -# TODO: Copy source files and build -COPY . . -# RUN - -# ============================================================================ -# Stage 2: Runtime -# ============================================================================ -# -# Minimal production image. Only the compiled binary/release and runtime -# dependencies are included. No compilers, no source code, no build tools. -# -FROM cgr.dev/chainguard/wolfi-base:latest - -# OCI image labels (compatible with cerro-torre .ctp bundle metadata) -LABEL org.opencontainers.image.title="Apodeixis.jl" \ - org.opencontainers.image.description="Research-stage Julia verification toolchain for contracts, compiler analysis, numeric semantics, and verified FFI with independently checked proof targets." \ - org.opencontainers.image.url="https://github.com/hyperpolymath/Apodeixis.jl" \ - org.opencontainers.image.source="https://github.com/hyperpolymath/Apodeixis.jl" \ - org.opencontainers.image.vendor="hyperpolymath" \ - org.opencontainers.image.licenses="MPL-2.0" \ - org.opencontainers.image.authors="Jonathan D.A. Jewell " \ - dev.cerrotorre.manifest="build/container/stapeln/manifest.toml" \ - dev.cerrotorre.gatekeeper="build/container/stapeln/.gatekeeper.yaml" \ - dev.stapeln.compose="build/container/stapeln/compose.toml" - -# Install minimal runtime dependencies. -# Adjust this list for your application: -# - ca-certificates: TLS root certificates -# - curl: health check probe -# - libstdc++: C++ standard library (if needed by native deps) -# - ncurses: terminal UI (if needed, e.g. Elixir IEx) -RUN apk add --no-cache ca-certificates curl - -# Create non-root user for the application. -# Running as root inside containers is a security anti-pattern. -RUN addgroup -S appuser && adduser -S appuser -G appuser - -WORKDIR /app - -# TODO: Copy compiled binary/release from builder stage. -# Examples: -# COPY --from=builder /build/target/release/apodeixis.jl /app/apodeixis.jl -# COPY --from=builder /build/_build/prod/rel/apodeixis.jl /app/release/ -# COPY --from=builder /build/zig-out/bin/apodeixis.jl /app/apodeixis.jl - -# Copy entrypoint script -COPY build/container/entrypoint.sh /app/entrypoint.sh -RUN chmod +x /app/entrypoint.sh - -# OPTIONAL (Tier C — stapeln). A pure OCI image does NOT need these baked in: -# svalinn reads .gatekeeper.yaml from a mounted volume (see stapeln/compose.toml), -# and cerro-torre reads manifest.toml at pack time. Uncomment only if you want -# the policy/manifest embedded in the image itself. -# COPY build/container/stapeln/.gatekeeper.yaml /etc/svalinn/gatekeeper.yaml -# COPY build/container/stapeln/manifest.toml /app/manifest.toml - -# Create data directory for persistent storage (mountable volume) -RUN mkdir -p /data && chown appuser:appuser /data - -# Set ownership of the application directory -RUN chown -R appuser:appuser /app - -# Environment variables — customise for your application -ENV APP_HOST=[::] -ENV APP_PORT=8080 -ENV APP_LOG_FORMAT=json -ENV APP_DATA_DIR=/data - -# Declare /data as a volume for persistent storage -VOLUME ["/data"] - -# Run as non-root -USER appuser - -# Expose the application port -EXPOSE 8080 - -# Health check — the application must respond 2xx at /health -HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ - CMD curl -sf http://localhost:${APP_PORT}/health || exit 1 - -ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/docs/HYPATIA-RULE-ORDER.adoc b/docs/HYPATIA-RULE-ORDER.adoc index e00b55b1..b388784e 100644 --- a/docs/HYPATIA-RULE-ORDER.adoc +++ b/docs/HYPATIA-RULE-ORDER.adoc @@ -8,7 +8,7 @@ This is the repository's statement of *which* rule layer wins when two of them speak about the same file, *which* clashes exist today, and *what resolves each one*. It is local policy about tools that live elsewhere: Hypatia at -`hyperpolymath/hypatia@be98f74ce93df200752f3798efa1305bfa3e0e10` +`hyperpolymath/hypatia@6693f9aed8e4383f78a3d01b600b32663bf7a45c` (`lib/hypatia/scanner_suppression.ex`, `lib/rules/`), and the verdict grid at `metadatastician/standards@f0b3cd4c464d33e1584f8528c17bce104555e256` (`docs/VERDICT-GRID-SPEC.adoc`). @@ -47,11 +47,11 @@ ambiguous: |Hypatia (`scanner_suppression.ex`). Not this repository's to change. A repository cannot exempt it, and must not try. |2 -|**Universal excludes** — `.git/`, `node_modules/`, `_build/`, `deps/`, `target/`, `dist/`, `.hypatia-baseline.json`. +|**Universal excludes** — `.git/`, `node_modules/`, `_build/`, `deps/`, `target/`, `dist/`, `.hypatia-exemptions.md`, `.hypatia-baseline.json`. |Hypatia. Applied to every rule. |3 -|**Built-in default exemptions** — `@training_corpus_paths` (`lib/rules/`, `test/`, `tests/`, `scripts/fix-scripts/`, `.audittraining/`, `integration/fixtures/`) keyed per module, plus `benches/` for `code_safety` only. +|**Built-in default exemptions** — `@training_corpus_paths` (`lib/rules/`, `test/`, `tests/`, `scripts/fix-scripts/`, `.audittraining/`, `integration/fixtures/`) keyed per module (`security_errors`, `code_safety`, `migration_rules`, `structural_drift`, `content_patterns`, `dogfooding`), plus `benches/` for `code_safety` only, and for `security_errors` also `.github/workflows/integration.yml` and, for `secret_detected` only, `harvested-registry/`. |Hypatia. A repository cannot narrow these (see clash C7). |4 diff --git a/docs/architecture/REPOSITORY-MAP.adoc b/docs/architecture/REPOSITORY-MAP.adoc index 90b9fbd7..f8bab496 100644 --- a/docs/architecture/REPOSITORY-MAP.adoc +++ b/docs/architecture/REPOSITORY-MAP.adoc @@ -113,6 +113,10 @@ predecessors did. | optional | forge-facing copy of LICENSES/MPL-2.0.txt. Optional, not required: +| `LICENSE.adoc` +| yes +| the licence (MPL-2.0); renamed from LICENSE to the estate AsciiDoc format 2026-10-26 + | `LICENSES/` | yes | REUSE licence texts, dual-licence model (code MPL-2.0 / docs CC-BY-SA-4.0) diff --git a/docs/troubleshooting.adoc b/docs/troubleshooting.adoc index 402fdffe..27abf651 100644 --- a/docs/troubleshooting.adoc +++ b/docs/troubleshooting.adoc @@ -48,7 +48,7 @@ just log-tail # last N lines of logs and the symptom in plain English. . Linked from the issue: the relevant ADR(s) and any related issues. . For *security*-relevant findings, see - link:./../SECURITY.md[SECURITY.md] — do **not** file public issues. + link:./../.github/SECURITY.md[SECURITY.md] — do **not** file public issues. == Where to look for more help diff --git a/src/interface/ffi/src/main.zig b/src/interface/ffi/src/main.zig index 6f4db637..9b8177d6 100644 --- a/src/interface/ffi/src/main.zig +++ b/src/interface/ffi/src/main.zig @@ -25,6 +25,16 @@ fn clearError() void { last_error = null; } +/// Duplicate a byte slice as a NUL-terminated buffer across Zig 0.15/0.16/0.17 +/// (`Allocator.dupeZ` was removed in Zig 0.17). +/// The caller owns the returned slice and must free it with `allocator`. +/// Propagates allocation failure. +fn dupeZ(allocator: std.mem.Allocator, bytes: []const u8) ![:0]u8 { + const buf = try allocator.allocSentinel(u8, bytes.len, 0); + @memcpy(buf[0..bytes.len], bytes); + return buf; +} + //============================================================================== // Core Types (must match src/abi/Types.idr) //============================================================================== @@ -110,7 +120,9 @@ export fn apodeixis_jl_process(handle: ?*Handle, input: u32) Result { //============================================================================== /// Get a string result (example) -/// Caller must free the returned string +/// Return a NUL-terminated "Example result" owned by the caller; free it with +/// `apodeixis_jl_free_string`. Return null and set the thread-local error for a +/// null or uninitialized handle, or allocation failure. Clear the error on success. export fn apodeixis_jl_get_string(handle: ?*Handle) ?[*:0]const u8 { const h = handle orelse { setError("Null handle"); @@ -123,7 +135,7 @@ export fn apodeixis_jl_get_string(handle: ?*Handle) ?[*:0]const u8 { } // Example: allocate and return a string - const result = h.allocator.dupeZ(u8, "Example result") catch { + const result = dupeZ(h.allocator, "Example result") catch { setError("Failed to allocate string"); return null; }; @@ -180,14 +192,15 @@ export fn apodeixis_jl_process_array( // Error Handling //============================================================================== -/// Get the last error message -/// Returns null if no error +/// Get the last error message. +/// Return an allocated NUL-terminated copy of the current thread's error, or +/// null if no error is set or allocation fails. Leave the stored error unchanged. +/// Caller must free a non-null returned string with `apodeixis_jl_free_string`. export fn apodeixis_jl_last_error() ?[*:0]const u8 { const err = last_error orelse return null; - // Return C string (static storage, no need to free) const allocator = std.heap.c_allocator; - const c_str = allocator.dupeZ(u8, err) catch return null; + const c_str = dupeZ(allocator, err) catch return null; return c_str.ptr; } @@ -258,6 +271,10 @@ test "lifecycle" { defer apodeixis_jl_free(handle); try std.testing.expect(apodeixis_jl_is_initialized(handle) == 1); + + const str = apodeixis_jl_get_string(handle) orelse return error.StringFailed; + defer apodeixis_jl_free_string(str); + try std.testing.expectEqualStrings("Example result", std.mem.span(str)); } test "error handling" { @@ -265,6 +282,7 @@ test "error handling" { try std.testing.expectEqual(Result.null_pointer, result); const err = apodeixis_jl_last_error(); + defer apodeixis_jl_free_string(err); try std.testing.expect(err != null); }