Skip to content

8.9.0: stop publishing the passphrase, and ship in a container - #24

Merged
foursecondfivefour merged 16 commits into
mainfrom
arena/36a4d756-nerveforge
Dec 4, 2026
Merged

foursecondfivefour merged 16 commits into
mainfrom
arena/36a4d756-nerveforge

Conversation

@foursecondfivefour

Copy link
Copy Markdown
Owner

Three commits, one release. Version 8.9.0 — the /api/quick payload changes.

1. The passphrase was published

GET /api/agent-prompt is public by design: it is how a fresh agent learns the protocol. It also answered "full_access_phrase": "yesiknow" to anyone who knew the URL, which made the second step of a two-step switch worth nothing.

The phrase is a loopback credential, the same kind of thing as the token, so it now travels the same way:

Where Before Now
GET /api/agent-prompt (public) full_access_phrase: "yesiknow" a hint saying to ask the operator
GET /api/quick (bearer) phrase: "yesiknow" absent
GET 127.0.0.1:8767/bootstrap (loopback, Origin-checked) {token} {token, phrase}
Terminal banner printed printed, unchanged

The panel reads it from /bootstrap on every boot and does not cache it, so arming full access in the browser still works.

services/system.py held the literal twice next to the real definition in services/full_access.py. Both now import FULL_ACCESS_PHRASE, and a test fails if the string appears anywhere else under src/.

Breaking: GET /api/quick no longer returns phrase.

2. The panel was not in the package

Found by exercising a real pip install instead of a checkout — which is what the container does. static/ and assets/ sat next to the package, so an installed copy resolved them to a directory that does not exist and served 404 for every stylesheet and module. In the container that would have been an empty page.

Both directories moved inside nerveforge/ and are declared in package-data. Verified: an installed copy serves /, /static/app.js and /api/health with 200.

3. Container and Ansible

  • docker/Dockerfile — python:3.12-slim, no runtime dependencies, cloudflared included, non-root uid 10001, tunnel off by default.
  • docker/docker-compose.yml — two named volumes, loopback bootstrap bound to 127.0.0.1 only.
  • ansible/roles/nerveforge — dedicated user, hardened systemd unit (NoNewPrivileges, ProtectSystem=strict, empty capability set, @system-service), optional cloudflared. Never arms full access and never stores the token.
  • docs/DEPLOY.md + RU, with the decisions written down.

CI gains an image job that builds the container and asserts the panel, a module and a brand asset all answer 200 with a non-empty body — the check that would have caught the static/ regression.

Verification

  • 1944 tests OK (skipped=1); ruff clean; check_docs 20 pairs; gen_api_doc --check, bump_version --check ok
  • live server 8.9.0: /api/agent-prompt contains no yesiknow, /api/quick has no phrase, /bootstrap returns both, foreign Origin gets 403
  • installed-package server serves the panel (200 / 200 / 200)
  • ansible-playbook --syntax-check and a local --check run
  • Docker build itself runs in CI; there is no Docker daemon in this sandbox

Closes nothing — this is the work you asked for after the live-server check.

foursecondfivefour and others added 16 commits December 2, 2026 17:55
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
GET /api/agent-prompt is public by design: it is how a fresh agent learns the
protocol. It also answered with "full_access_phrase": "yesiknow" to anyone who
knew the URL, which made the second step of a two-step switch worth nothing.

The phrase is a loopback credential, the same kind of thing as the token, so it
now travels the same way: the panel reads it from 127.0.0.1:8767/bootstrap after
the Origin check and keeps it in memory. /api/quick stops carrying it too — a
public answer is not the place for the second step — and the terminal banner
still prints it for the operator.

services/system.py held the literal twice next to the real definition in
services/full_access.py. Both now import FULL_ACCESS_PHRASE, and a test fails if
the string appears anywhere else under src/.

Breaking: GET /api/quick no longer returns phrase.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
`pip install .` produced a server with an empty panel. The static files and the
brand assets sat next to the package (`parents[2] / "static"`), so an installed
copy resolved them to a directory that does not exist and served 404 for every
stylesheet and module. Nobody noticed because the project is normally run from
its checkout, where the sibling directory is right there.

Found by exercising a real install rather than a checkout, which is what the
container does. static/ and assets/ now live under nerveforge/ and are declared
in package-data; tests follow them.

This also makes the wheel self-describing: an installed NerveForge serves its
own panel without needing the repository around it.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
docker/Dockerfile builds a python:3.12-slim image with no runtime dependencies,
cloudflared included and a non-root uid. docker/docker-compose.yml adds the two
volumes that matter and binds the loopback bootstrap listener to 127.0.0.1 only.
The tunnel is off by default: a container that opens a public address on start is
a surprise with a shell behind it.

ansible/roles/nerveforge covers the long-lived host: dedicated user, data
directory, hardened systemd unit (NoNewPrivileges, ProtectSystem=strict, empty
capability set, @System-service), optional cloudflared. It never arms full access
— that is a runtime decision — and never stores the token, which the bridge
mints itself.

CI gains an image job: it builds the container and asserts that the panel, a
module and a brand asset all answer 200 with a non-empty body. That is the check
that would have caught the static/ regression; it should not need to be found by
hand twice.

docs/DEPLOY.md (EN+RU) explains both paths and the decisions behind them.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The README tree still showed static/ at the repository root — the layout this
release fixed — and did not mention docker/ or ansible/.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Three separate reasons the new image job failed, all of them in the Dockerfile:

- .dockerignore sat in docker/, where Docker does not look for it. The whole
  repository — .git, tests, docs — travelled to the builder. Moved to the root.
- A fresh environment has no `bdist_wheel`, so `pip install .` died in the
  metadata phase. setuptools and wheel are now installed explicitly and the
  install runs with --no-build-isolation.
- cloudflared was fetched with a single unretried curl. A cold runner that fails
  that one request lost the whole build for an optional binary. It now retries,
  and can be skipped entirely with CLOUDFLARED_VERSION=skip.

The install step also asserts that static/index.html shipped inside the package,
so a repeat of the 8.9.0 packaging bug fails the build instead of producing an
image with an empty panel.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
The bridge listens on 127.0.0.1 by default, which inside a container is the
container's own namespace. A published port then reaches a socket nobody is
listening on, and the health check times out — which is exactly what the image
job reported.

NERVEFORGE_BIND=0.0.0.0 in the image. The admin listener on 8767 is untouched
and still loopback-only, and the routes that treat a local caller specially
(_local_ui) require a loopback peer *and* a loopback Host, so widening the main
socket grants nothing extra.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@foursecondfivefour
foursecondfivefour merged commit 2679dc8 into main Dec 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants