[Bug]: Compose rollback deploys inline env credentials as `***`
Existing issue
- I have searched the existing issues and found no duplicate.
Problem description
Rolling back a Compose project to an earlier deployment gives the app container a redacted credential. A DATABASE_URL written inline in the Compose environment: block arrives as postgresql://***@db:5432/app, so the app cannot authenticate and crash-loops. Rollback reports success. Redeploying the source forward works.
Cause, from reading the source at v0.8.0 (234d8a9d). The same lines are unchanged on main as of f1470f7e.
- On success,
deployment-lifecycle.tsrunssanitizeStorableStringsover the whole deployment meta (L446 no-change path, L739 success path). That is the build-log redactor:build-log-sanitize.tsL69-90 replaces URL userinfo with***. Someta.composeServices[].environmentis stored already redacted, and the later encryption (DEPLOYMENT_SECRET_FIELDS) encrypts the redacted value. - Rollback (
rollback-orchestrator.ts,reuseSnapshot: { meta: target.meta, ... }) feeds that meta back, andbuild-pipeline.tsL1120syncFromComposewrites it onto the live service rows. The container is then built from those rows. - Project env vars (
dep.envVars) are not affected. Only Compose inline values containingscheme://user:pass@(or GitHub-token-shaped strings) are.
Backups already avoid this: backup.orchestrator.ts uses sanitizeStorableStringsExceptKeys, and artifact-metadata.ts documents the ://***@ rewrite. Deployment meta still goes through the plain redactor.
Possible fix: exempt composeServices (already an encrypted secret field) from the redactor in both lifecycle call sites. Also guard rollback against snapshots already stored redacted, for example by refusing, or keeping the live value when a value matches the redaction shape. Without the guard, existing deployments stay broken.
Steps to reproduce
- Self-hosted Openship v0.8.0, Compose mode. Create a project from a folder whose docker-compose.yml has:
app(build: .) withenvironment: DATABASE_URL: postgresql://app:secret@db:5432/appdb(postgres:16-alpine) with matching POSTGRES_* env and a named volume
openship deploy --folder --project <id>(deployment A, works).- Change the app and deploy again (deployment B, works).
openship deployment rollback <A>: it reports success.- The app container crash-loops with
fe_sendauth: no password supplied.docker inspectshowsDATABASE_URL=postgresql://***@db:5432/app. - Redeploying the folder forward fixes it.
Environment
- OpenShip version/commit: v0.8.0 (images openship-api 0.8.0 sha256:38bdc73b…); source checked also at main f1470f7e
- Deployment method: self-hosted, Compose mode, CLI folder deploy
- Operating system: Ubuntu 24.04 VM, Docker Engine
- Browser (if applicable): n/a
Logs and screenshots
Additional context
No response
Source: oblien/openship