Skip to content

feat(deps): upgrade Prisma to 7.10.1 to clear the high-severity deepmerge-ts advisory - #151

Merged
afeezorobsco-cyber merged 4 commits into
DocForum:mainfrom
Hikmaholadele:feat/upgrade-prisma-clear-high-severity
Oct 19, 2026
Merged

afeezorobsco-cyber merged 4 commits into
DocForum:mainfrom
Hikmaholadele:feat/upgrade-prisma-clear-high-severity

Conversation

@Hikmaholadele

@Hikmaholadele Hikmaholadele commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What this does

Clears the high-severity production-dependency advisory tracked in #47, and adds a CI gate so it cannot regress.

npm audit --omit=dev reported prisma -> @prisma/config -> deepmerge-ts < 8.0.0 (GHSA-ggr8-5vv4-36mx). npm audit fix --force offers exactly one remedy and flags it breaking: prisma@7.10.1.

Why 7.10.1 and not a 6.x patch: there is no 6.x backport. Every published stable 6.x @prisma/config pins deepmerge-ts@7.1.5; the fix shipped in @prisma/config@7.10.1 (verified against the npm registry - the only stable versions declaring deepmerge-ts@8.0.2 are 7.10.1 and unreleased 8.1.0-dev.*). npm's latest tag for prisma is still 8.0.0-rc.23, a prerelease, so 7.10.1 is the lowest stable release that clears

Closes #47

…erge-ts advisory

`npm audit --omit=dev` reported a high-severity finding in the production
dependency tree (prisma -> @prisma/config -> deepmerge-ts < 8, GHSA-ggr8-5vv4-36mx).
The only remedy npm offers is a breaking Prisma upgrade, and there is no 6.x
backport: every stable 6.x pins deepmerge-ts@7.1.5, and the `latest` tag is
still a 8.0.0-rc prerelease. 7.10.1 is the lowest stable release that ships the
patched @prisma/config.

Prisma 7 removed the Rust query engine, so a driver adapter is now mandatory —
`new PrismaClient()` throws without one. @prisma/adapter-pg + pg are added and
src/db/prisma-client.ts builds the client with one, keeping a 5s connect timeout
because node-postgres defaults to none. The CLI's datasource URL moved out of
the schema into a new backend/prisma.config.ts, which also loads .env itself
since v7 stopped doing that. The prisma-client-js generator is kept on purpose:
the client still generates into node_modules/@prisma/client and this backend
stays CommonJS, so none of the 14 existing import sites changed.

Also adds a high-severity production-dependency audit gate to CI, a repeatable
migration-drift check, and a hermetic BigInt round-trip test for
PaymentIntent.amountStroops — the field the upgrade most risked, whose previous
coverage (the testnet payment test) cannot run without platform secrets.

Verified: migration drift empty, typecheck and build clean, 30 unit + 25
integration tests passing, and the audit gate confirmed to fail when a
knowingly vulnerable package is added. The testnet payment test is the one
check that could not be completed here — it needs PLATFORM_PAYER_SECRET,
PLATFORM_RELEASER_SECRET and a funded payer identity.

Closes DocForum#47

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@Hikmaholadele Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

@Hikmaholadele fix CI

@afeezorobsco-cyber

Copy link
Copy Markdown
Contributor

CI is failing on this PR. main itself is green, so the cause is in this branch:

Integration tests fail (16 of 131), all in tests/integration/audit.test.mts from #158, with audit.record() must run inside the transaction of the change it describes. The likely cause is that the audit module's check for an active transaction client behaves differently under Prisma 7.10.1, so every audited write throws. Start with how modules/audit detects the tx client. Upgrading Prisma is the right move for the advisory, but #158's audit tests need to pass too.

Please push a fix and CI will re-run. Before pushing, run npm run prisma:generate && npm run typecheck && npm test && npm run test:integration in backend/.

…ction client

Since prisma@7 the interactive-transaction client exposes `$transaction`,
identical to the root client's. `audit.record()` refused what it believed
was the root client by checking `typeof tx.$transaction === 'function'`,
so after the upgrade it refused every *legitimate* in-transaction call —
aborting the audited change with it (16 integration-test failures across
audit, booking and email-verification; all real product paths that book,
verify or fund inside a transaction).

The guard now recognises the root client by its lifecycle methods
(`$connect`/`$disconnect`) — present on the root client, absent on the
transaction client in both v6 and v7. The guarantee is unchanged and
verified: passing the real root client still throws, an event still
exists iff its change committed, and the DB-trigger append-only checks
are untouched. A regression test pins the v7 transaction-client shape
(has `$transaction`, no lifecycle methods) as accepted, and ADR 0006
records the behavioural consequence of the upgrade.

Verified: tsc --noEmit clean; 81 unit + 131 integration tests pass;
audit:prod gate passes; build passes.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>

@afeezorobsco-cyber afeezorobsco-cyber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: the Prisma 7 driver adapter keeps v6 behaviour (5s connect timeout, TLS left to the URL), CLI config moved to prisma.config.ts, the migration-drift script is a good addition, and the audit gate fails on any high/critical advisory except the documented, upstream-owned axios chain. LGTM.

Deploy note: watch the first Render deploy for P1010 (the v7 TLS certificate-validation change called out in ADR 0006).

@afeezorobsco-cyber
afeezorobsco-cyber merged commit ed5054d into DocForum:main Oct 19, 2026
1 check passed
Oluwaferanmi18 added a commit to Oluwaferanmi18/docforum-core that referenced this pull request Oct 19, 2026
…ng-and-facility-location

Brings in upstream DocForum#151 (Prisma 7.10.1 + driver adapter), DocForum#155 (patient
data export), DocForum#150 (field-level encryption), DocForum#147 (access-control tests).

Conflicts resolved in backend/src/app.ts (kept /facilities and
/pharmacy-orders mounts alongside /patients) and docs/api/README.md
(kept the new Facilities/Pharmacy-orders tables; facilities and
pharmacy-orders come out of the "no routes yet" list since this branch
gives them routes).

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Phase 8] Upgrade Prisma to clear the high-severity deepmerge-ts advisory

3 participants