feat: make "only the app publishes a port" a binding rule

A published database port puts the data on the public internet, and Docker's
own iptables rules bypass ufw — the server looks firewalled while the port is
open. Previously this was only a comment in compose.yaml, which an agent adding
a db service later is free to ignore.

Anchored at every point where a service could be added or shipped:
- rules/security.md: the rule, the reasoning, and the audit commands
- rules/backend.md + architecture SKILL: constraint when picking the data layer
- agents/backend-dev.md: non-negotiable for any service it adds
- agents/qa-engineer.md: a published port is a Critical finding
- skills/deploy: blocking pre-flight audit
- compose.yaml: db example now uses expose:, with depends_on healthcheck
- docs/DEPLOYMENT.md + README: SSH tunnel instead of publishing for debugging
This commit is contained in:
Florian Wilde
2026-08-09 01:12:06 +02:00
parent e30d02d41a
commit 75e99f75c6
9 changed files with 161 additions and 7 deletions
+4
View File
@@ -36,6 +36,10 @@ The non-negotiables:
as a fallback
- Every new env var lands in `.env.example` in the same change
- Whatever you add must run inside the Docker Compose stack
- **Any service you add to `compose.yaml` gets no `ports:` entry.** Only `app`
publishes a port. A database, cache or queue is reached by service name over the
compose network (`db:5432`) and must stay unreachable from the host. Publishing it
exposes the data to the internet and bypasses the server's firewall.
## Tests
For each route handler, write a Vitest test next to it
+4
View File
@@ -33,6 +33,10 @@ The feature spec path and the list of previously deployed features to regression
fallback rate-limited? A missing or weakened passkey flow is a **High** finding.
- Injection through every user-controlled input (XSS, SQL)
- Secrets or internal detail leaking in API responses, logs or the network tab
- **Published ports:** run `docker compose config | grep -B8 "published:"`. Only the
`app` service may publish, and only on `127.0.0.1`. A database, cache or queue with
a published port — or anything bound to `0.0.0.0` — is a **Critical** finding: it
exposes the service to the internet and bypasses the host firewall.
## Tests you write
- **Unit (Vitest), co-located in `src/`:** hooks with real logic, pure transforms,