fix(infra+liquidations): harden Dockerfile and use unambiguous time_ms#4
Merged
Conversation
…s in liquidation ingestion - Liquidation persistence: `time: new Date(liq.time)` parsed a TZ-naive ISO string and silently interpreted it as host local time. Switch both ingestion and backfill to `new Date(liq.time_ms)` (already on the payload) to remove TZ ambiguity and protect the time-bucketed analytics. - Dockerfile: drop production root user (add `USER node` + `--chown=node:node` on COPY), drop the unused `ARG/ENV DATABASE_URL` (prisma generate does not need it), and add a HEALTHCHECK hitting `/api/health/ready`. - Add `.dockerignore` so `COPY . .` no longer ships `.git`, local `.env*`, dev tooling and logs into the production image. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Two HIGH findings from the 2026-05-31 LT audit, plus a Dockerfile cleanup pass.
HIGH — Liquidation time parsing TZ-fragile
liq.timeis a naive ISO string ("2026-01-08T10:28:36", noZ).new Date(...)of that interprets it as host-local time. Today Railway is UTC so it accidentally works, but any TZ env change silently shifts the persistedtimecolumn and invalidates time-bucketed analytics + keyset pagination cursors. Switch tonew Date(liq.time_ms)which is the canonical ms-since-epoch already present on the payload. Fix applied in bothliquidations.ingestion.service.tsandliquidations.backfill.service.ts.HIGH — Production container ran as root
No
USERin either Dockerfile stage. Container-escape now elevates tonodeinstead of root. AddedUSER node+--chown=node:nodeon the production COPYs.MEDIUM — Dockerfile hygiene
ARG DATABASE_URL/ENV DATABASE_URL=$DATABASE_URL(prisma generate doesn't need it; runtime URL is read from env via Railway).HEALTHCHECKhitting/api/health/ready..dockerignoresoCOPY . .stops shipping.git, local.env*, dev tooling and logs into the image.Test plan
docker build .succeeds with new.dockerignore/api/health/readyreturns 200time=timeMsepoch (sanity check via Prisma Studio)