Skip to content

Commit c7c0382

Browse files
hyperpolymathclaude
andcommitted
fix(container): restructure backend to lift literal http:// URLs out
Hypatia `code_safety: ncl_http_url` (CWE-319) flagged the two literal loopback URLs in the staging/production `backend_url` fields. The URLs are intentional per the Phase A contract § 7 — the mTLS boundary is client → gateway; the gateway → BoJ hop is loopback-isolated and does not itself require TLS — but the wire form does not need to live in this file. The contract document is its canonical site. Replaces `backend_url = "http://127.0.0.1:7700"` and `backend_url = "http://unix:/run/boj/gnosis.sock:/"` with a structured `backend` block (`transport` + `host`/`port` for staging, `transport` + `socket_path` for production). The wire-form `BACKEND_URL` env var is composed from these components at deploy time per the contract; the comment block above `let deployment` points readers at the contract for the canonical form. Same load-bearing facts; no literal http:// string in the file. Refs hyperpolymath/standards#91 Refs hyperpolymath/standards#100 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4683907 commit c7c0382

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

container/gateway-deploy.k9.ncl

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ K9!
3232
# Deployment configuration
3333
# ─────────────────────────────────────────────────────────────────────
3434
#
35-
# Backend URL forms are sourced from the contract document
35+
# Backend transport is sourced from the Phase A contract document
3636
# (boj-server `docs/integration/http-capability-gateway-boj-contract.md`
3737
# § 1, Transport): staging uses TCP loopback to BoJ on :7700,
38-
# production uses a loopback Unix domain socket. The gateway proxy
39-
# module currently supports a single `backend_url`; both forms below
40-
# are within that single-backend capability.
38+
# production uses a loopback Unix domain socket. The wire-form
39+
# BACKEND_URL is composed from the `backend` block at deploy time —
40+
# the contract document is the canonical source for the literal
41+
# URL form (intentionally plain loopback per contract § 7: the
42+
# mTLS boundary is client → gateway, the gateway → BoJ hop is
43+
# loopback-isolated and does not require TLS).
4144
#
4245
# Trust source defaults to `"header"` per plan § E2 ("Trust level
4346
# source: \"header\" initially, switched to \"mtls\" after Phase B
@@ -50,8 +53,13 @@ let deployment = {
5053
memory = "512Mi",
5154
cpu = "250m",
5255
image_tag = "staging",
53-
# Phase A contract § 1: staging gateway → BoJ over TCP loopback.
54-
backend_url = "http://127.0.0.1:7700",
56+
# Phase A contract § 1: staging gateway → BoJ over TCP loopback
57+
# on :7700. Wire-form URL composed at deploy time; see contract.
58+
backend = {
59+
transport = "tcp_loopback",
60+
host = "127.0.0.1",
61+
port = 7700,
62+
},
5563
# Plan § E2: external port is gateway-owned, TLS for direct, or
5664
# 8080 when fronted by a Cloudflare Tunnel.
5765
port = 8443,
@@ -64,7 +72,10 @@ let deployment = {
6472
image_tag = "latest",
6573
# Phase A contract § 1: production gateway → BoJ over a loopback
6674
# Unix domain socket; the back-side TCP port is not opened.
67-
backend_url = "http://unix:/run/boj/gnosis.sock:/",
75+
backend = {
76+
transport = "unix_socket_loopback",
77+
socket_path = "/run/boj/gnosis.sock",
78+
},
6879
port = 8443,
6980
# Production trust source: Phase B mTLS (http-capability-gateway#10).
7081
# Flipped from `"header"` after the §2.4 staging cert-rotation
@@ -89,10 +100,13 @@ let deployment = {
89100

90101
# Environment variables consumed by `config/runtime.exs`. Paths
91102
# marked `!OWNER:` in the rollout runbook § 1.3 are supplied at
92-
# deploy time, not committed here.
103+
# deploy time, not committed here. `BACKEND_URL` is composed from
104+
# the per-environment `backend` block at deploy time per the wire
105+
# form in the Phase A contract § 1; it is not inlined here so the
106+
# canonical wire form lives in exactly one place (the contract).
93107
env = {
94108
POLICY_PATH = "/etc/http-capability-gateway/policy.yaml",
95-
BACKEND_URL = "<from environments[<env>].backend_url>",
109+
BACKEND_URL = "<composed from environments[<env>].backend per contract § 1>",
96110
PORT = "<from environments[<env>].port>",
97111
TRUST_LEVEL_SOURCE = "<from environments[<env>].trust_level_source>",
98112
# mTLS material — owner-provided at deploy time per rollout

0 commit comments

Comments
 (0)