Repository navigation
Conversation
frahlg
force-pushed
the
agent/lan-api-trust-boundary
branch
from
July 20, 2026 07:22
03f1a75 to
1a2e9a3
Compare
frahlg
force-pushed
the
agent/lan-api-trust-boundary
branch
from
July 20, 2026 07:28
1a2e9a3 to
2df1b9f
Compare
This was referenced Jul 20, 2026
Member
Author
|
Superseded by the semantic P0 integration in #602. The access boundary is now on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
GET/HEADrequests that start discovery, begin OAuth, or force an external update checkOrigin,Host,Sec-Fetch-Site, and the actual client addressFTW_API_TOKENBearer credential for protected requests addressed through public IPs or fully qualified hostnamesHTTP surface audit
The central policy wraps the complete Core handler before bootstrap/normal handler swapping, so new Core routes inherit it automatically. The separate CalDAV listener remains independently fail-closed behind its mandatory protocol authentication; applying the JSON API middleware there would break valid CalDAV methods and bodies. The updater control socket is Unix-domain-only and remains outside this LAN/API change.
Why
The LAN API previously returned wildcard CORS headers and had no central trust boundary for state-changing endpoints. Browser-originated cross-site requests could therefore reach privileged controls, while exposure beyond the trusted LAN had no mutation credential gate.
Operator impact
Existing loopback and private-LAN clients continue to work without a token when both the addressed host and actual client are local. Public/FQDN protected requests fail closed unless
FTW_API_TOKENis configured and supplied as a Bearer token.The built-in browser UI does not store API tokens. Browser deployments on public/FQDN origins must use an operator-managed authenticated HTTPS reverse proxy that injects the Bearer header. Read-only dashboard data is not covered by this migration token and FTW must not be exposed directly to the public internet. Recovery remains available through localhost, a private IP, or
.local.Future remote expansion point
This PR implements no tunnel, passkey, naming, or machine-identity provider. It documents the central request policy as the future proof-verification point for a simple outbound-only design: local FTW passkey verification, a resolved hardware-backed or software-fallback P-256 machine identity as authoritative site identity and tunnel challenge signer, one long-lived TLS connection with a small versioned stream-multiplex contract, short-lived site-and-scope-bound proofs, and read-only access first. Relay state is limited to rotatable domain alias mapping, public site identity, routing/status, and timestamps; it stores no user credential. No cloud account authentication, shared tunnel credential, peer-to-peer/NAT-traversal layer, or browser-managed site directory is introduced. Core safety remains authoritative for every later mutation.
Gateway names are never selectable: adjective-color-animal is derived deterministically from the stable gateway ID with exact compatibility for existing Sourceful Energy Gateways. Names and DNS aliases are not authenticators. Compatible hardware must use its existing non-exportable P-256 key plus normalized 18-hex serial identity; other hosts persist a software P-256 identity with the same public-key/signature wire contract and stable-ID format. The future access layer may depend only on public identity and a narrow signer, never a private-key file representation.
Integration gate with #592
#592 currently creates a dedicated file-backed
ftw-site-controller.keyand explicitly separates it from the existing gateway identity. That provider choice conflicts with the secure-element-first identity invariant above. Later integration must retain the useful narrow signer contract while resolving identity selection, exact legacy name mapping, stable-ID normalization/fallback derivation, and recovery/rotation in a focused identity ADR. #591 deliberately does not resolve or import #592's implementation.Validation
go test ./internal/api ./cmd/ftwmake verify-allmake verifymake verify-all