interplane.Get Omega
Read in your language

aien-edge

aien-dev/aien-edge

Brought by drakestapleton

GitHub aien-dev/aien-edge#10 (code only)

closed derived 0218799e1634c6cc #10

Imported from GitHub aien-dev/aien-edge#10 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base cf3369b10a167f028e705456626088ae2c1307d5 · Head 5eaaaa85af934f3320f5788a86bc4100212d756d

Fetch it

A git bundle of the pull request's head, 5655 bytes.

curl -fsSL https://interplane.io/drakestapleton/aien-edge/patches/0218799e1634c6cc.bundle -o 0218799e1634c6cc.bundle
git fetch 0218799e1634c6cc.bundle refs/pull/10/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aien-edge
10
5eaaaa85af934f3320f5788a86bc4100212d756d
{"kind":"github-import","owner":"aien-dev","repo":"aien-edge","number":10,"url":"https://github.com/aien-dev/aien-edge/pull/10","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:34Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/AUDIT_SCOPE.md b/AUDIT_SCOPE.md
new file mode 100644
index 0000000..62bac0f
--- /dev/null
+++ b/AUDIT_SCOPE.md
@@ -0,0 +1,96 @@
+# Audit scope
+
+Written for an outside, independent security audit. Revision described:
+`cf3369b10a167f028e705456626088ae2c1307d5` on `main`, 2026-11-01. 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
+
+aien-edge is a small native Rust web server (hyper and rustls) that serves prebuilt static sites
+from memory, with brotli and gzip precompression, ETags, virtual hosts and automatic Let's
+Encrypt TLS (TLS-ALPN-01). It was built to run on a Raspberry Pi at the network edge. Status
+(README, 2026-10-18): not in use; the sites are served by GitHub Pages. It is hosting
+infrastructure, not part of the AIEN core. One binary crate.
+
+## What to review, in priority order
+
+1. `src/site.rs`: site loading into memory, traversal-safe path normalization against an in-memory
+   map, exclusion of hidden files and source maps, encoding negotiation, ETags.
+2. `src/handler.rs`: GET and HEAD only, canonical host and apex to `www` redirects, HTTP to HTTPS
+   redirects, 421 for unknown hosts, security headers (HSTS, nosniff, frame denial, referrer
+   policy).
+3. `src/main.rs`: listeners (plain HTTP and TLS-ALPN-01), connection cap, header-read and TLS
+   handshake timeouts, `SIGHUP` reload that keeps the old site if the new one fails to load.
+4. `src/config.rs`: TOML schema with `deny_unknown_fields`; `[tls]` with `production` switching
+   between Let's Encrypt staging and production; `cache_dir` for ACME state.
+5. `deploy/aien-edge.service`: `DynamicUser=yes`, `CAP_NET_BIND_SERVICE` only, read-only
+   `/srv/sites`.
+6. `deploy/publish-site.sh` and `deploy/publish.env.example`: builds a site, uploads it over ssh
+   and rsync to `EDGE_HOST`, repoints a symlink and reloads.
+7. There are no CI workflows in this repository.
+
+## Trust boundaries
+
+- Untrusted: every network client (request line, Host header, Accept-Encoding, path).
+- Trusted: the config file (read at startup only); site files under the configured roots; the
+  ACME cache directory; the operator who runs the publish script.
+- The server never connects to the build machine; deploys push to it over ssh (README).
+
+## Threat model summary
+
+- Assets: integrity of served sites, TLS private keys in the ACME cache, availability.
+- Attackers considered: remote clients sending crafted paths, hosts or slow connections;
+  connection floods up to and beyond the cap.
+- Defended: no per-request filesystem access, traversal-safe normalization, method restriction,
+  timeouts, connection cap, systemd sandboxing, security headers.
+- Not defended / explicitly out of scope: compromise of the publishing host or ssh credentials;
+  content of the sites; rate limiting beyond the connection cap is not described in the
+  repository.
+
+## Build from source at a pin
+
+A stable Rust toolchain; edition 2021; no `rust-toolchain.toml`, so the exact version is unknown
+from the repository. `Cargo.lock` is committed.
+
+```sh
+git clone https://github.com/aien-dev/aien-edge.git
+cd aien-edge
+cargo build --release
+```
+
+## Run every test
+
+```sh
+cargo test
+cargo clippy --release -- -D warnings
+```
+
+- AGENTS.md: `cargo test` runs 9 unit tests in `src/site.rs` and `src/handler.rs`.
+- The Pi deployment and `deploy/publish-site.sh` need sudo and a remote host and are not a test.
+- Run 2026-11-04 on this branch merged with `main` at `cf3369b` (rustc 1.98.1, aarch64 Linux):
+  `cargo test --locked` 9 passed, 0 failed; `cargo clippy --locked --release -- -D warnings` exit 0;
+  `cargo build --locked --release` exit 0; `cargo audit` exit 0, no advisories (EXERCISED).
+
+## Known limitations and NOT_RUN
+
+- Not deployed; no current production use.
+- `deploy/publish-site.sh` still runs `npm ci` and `npm run build`, which no longer matches how
+  the sites are built; it must be updated before any redeploy.
+- The config is read only at startup; changes need a restart.
+- The README throughput figures were measured on other hardware from commit 59df18c and cannot be
+  repeated from this repository alone; not measured on a Pi.
+
+## Dependencies and provenance
+
+- `Cargo.lock`: hyper, rustls, rustls-acme, tracing, brotli and gzip encoders, `tempfile` for
+  tests. The TLS library was updated for security on 2026-10-17 (README); `rustls-webpki`,
+  `webpki-roots` and `tokio` were patched on 2026-11-01 (`cf3369b`, #14).
+- External services: Let's Encrypt.
+- Licence: AGPL-3.0-or-later (`LICENSE`, `Cargo.toml`); `COVENANT.md` is nonbinding.
+
+## Evidence
+
+- No `evidence/` directory. The recorded throughput run is in the message of commit 843cc77.
+- Whether `aien-dev/aien-receipts` holds `aien-edge/<sha>/` entries is unknown from the
+  repository. Receipts are append-only and never edited.
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..634a34a
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,49 @@
+# Security policy
+
+## Reporting a vulnerability
+
+Report privately. Do not open a public issue, pull request or discussion about it.
+
+1. GitHub: open this repository's Security tab and choose "Report a vulnerability". This
+   creates a private advisory that only the maintainers can see. If that option is not shown,
+   private vulnerability reporting has not been enabled for this repository yet; use email.
+2. Email: drake@aienos.com with the subject `[aien-edge] security report`.
+
+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 send the
+secret itself. Encrypted mail is not required; do not post proof-of-concept payloads publicly.
+
+## Response targets
+
+This project has one maintainer; the targets below are best effort and stated honestly.
+
+- Acknowledgement: within 3 working days.
+- Triage and severity: within 7 days of acknowledgement.
+- Fix or mitigation for confirmed issues: aim for 30 days for high and critical, 90 days
+  otherwise, with a status update at least every 14 days until closed.
+- Disclosure: coordinated. An advisory is published with credit (unless you ask otherwise)
+  once the fix is on the default branch. Default embargo 90 days, negotiable.
+
+## Scope
+
+In scope:
+
+- Path traversal, hidden file or source map disclosure through request paths (`src/site.rs`).
+- Request handling: methods other than GET and HEAD, host and redirect handling, missing
+  security headers, timeouts and the connection cap (`src/handler.rs`, `src/main.rs`).
+- TLS and ACME configuration (`rustls-acme`, `[tls]` in `src/config.rs`).
+- Reload behaviour on `SIGHUP` serving a partial or wrong site.
+- `deploy/aien-edge.service` hardening and `deploy/publish-site.sh`.
+
+Out of scope: the static sites themselves (report to their repositories); `rustls`, `hyper` and
+other upstream crates except how this server uses them; Let's Encrypt.
+
+## Supported versions
+
+Only the default branch `main`; there is no release. Fixes land on the default branch only.
+
+## Status
+
+Not in use: the sites it was written for are served by GitHub Pages (README, status
+2026-10-18). There is no certification and no bug bounty. See AUDIT_SCOPE.md for what to review and
+how to build and test it.