You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 75f14d1
Browse filesBrowse the repository at this point in the historyBrowse files
fix(config): build datastore URLs from escaped components
Compose interpolated POSTGRES_PASSWORD and POSTGRES_READONLY_PASSWORD
straight into DATABASE_URL, and REDIS_PASSWORD into REDIS_URL. The
documented generator is `openssl rand -base64 24`, whose output contains
'/', '+' and '='; an RFC 3986 parser ends the authority at the first '/',
so the remainder of the password becomes the path and the connection
resolves to a database that does not exist. SQLAlchemy's parser is
lenient about '/' but truncates the secret at an '@'.
Credentials are now configured as components (POSTGRES_HOST/PORT/USER/
PASSWORD/DB plus POSTGRES_READONLY_*), and build_postgres_url() renders
the URL through SQLAlchemy's URL.create() so each component is escaped.
resolve_postgres_url() is the single precedence rule - an explicit
DATABASE_URL/DATABASE_READONLY_URL wins verbatim, then the components,
then the documented development default - and both Settings and the
deploy credential guard call it, so the guard audits exactly the URLs
the application uses. Compose passes components only and pins the
datastore host/port to the service names, so a host-side .env pointing
at localhost cannot leak into a container.
Verified against live PostgreSQL 16 and Redis 7 started with a password
containing '/', '+' and '=': both connect, and coverage, ruff, mypy and
the full suite stay green.
Closes AUDIT-19; recorded in ADR-019.
Copy file name to clipboardExpand all lines: docs/AUDIT.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,3 +94,12 @@ Follow-up on the same stack: the hardened Redis required a password that nothing
94
94
consumed, so the live tier failed at fixture setup (`HELLO must be called with the client already
95
95
authenticated`, 18 errors). `REDIS_PASSWORD` now completes a credential-less `REDIS_URL` for the
96
96
application and the suite (`fix/real-infra-redis-auth`, ADR-018).
97
+
98
+
### Review follow-ups on PR #84 (AUDIT-19, AUDIT-20)
99
+
100
+
The pull request was reviewed automatically after the first push; two findings were valid and are
101
+
fixed on top of the same stack rather than in a separate follow-up.
102
+
103
+
| Finding | Severity | Branch | Resolution |
104
+
|:---|:---:|:---|:---|
105
+
| AUDIT-19 Datastore credentials interpolated into URLs | High/Deployment |`fix/pg-url-credentials`| Credentials configured as components and percent-encoded by `URL.create()`; an explicit URL still wins |
0 commit comments