Upgrade to Prisma 7 and clear npm audit advisories
- Prisma 5.22 -> 7.10 using the @prisma/adapter-pg driver adapter; the datasource URL moves to backend/prisma.config.js. All clients are built in src/config/db.js, and index.js reuses the shared client. - Backend: patch follow-redirects, drop nodemon for `node --watch`, and use js-yaml 4 for the Jest coverage loader. npm audit reports 0. - Frontend: override postcss-selector-parser to 7.1.7 (Tailwind 3 output is unchanged). braces has no patched release and stays, build/lint only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,20 @@ and this project follows [Semantic Versioning](https://semver.org/).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Upgraded Prisma from 5.22 to 7.10. Prisma 7 connects through the `@prisma/adapter-pg` driver adapter (node-postgres) instead of the Rust query engine. The database URL moved from `schema.prisma` to the new `backend/prisma.config.js`, which loads `backend/.env` itself. All Prisma clients are now created in `src/config/db.js`, and the server shares one client instead of opening two connection pools. No schema or migration changes.
|
||||||
|
- Prisma 7 checks TLS certificates on database connections. A `DATABASE_URL` that uses SSL with a self-signed or otherwise invalid certificate now fails to connect where Prisma 5 accepted it.
|
||||||
|
- `npm run dev` in the backend now uses Node's built-in `node --watch` instead of `nodemon`.
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
- Backend `npm audit` now reports 0 vulnerabilities:
|
||||||
|
- Patched `follow-redirects` (pulled in by `axios`) to 1.16.1, which fixes leaking credential headers on cross-origin redirects.
|
||||||
|
- Removed `nodemon`, the only backend package that pulled in `braces`.
|
||||||
|
- Jest's coverage loader now uses `js-yaml` 4, which drops the `sprintf-js` advisory.
|
||||||
|
- Frontend: overrode `postcss-selector-parser` to 7.1.7, used by the Tailwind 3 build. The generated CSS is byte-identical. The remaining frontend findings (7 high) are all the same `braces` advisory (GHSA-vfj7-8cjw-p6xm). It has no patched release, comes in only through build and lint tools (Tailwind 3 and `eslint-config-next`), and only ever handles glob patterns from our own config, never user input.
|
||||||
|
|
||||||
## [1.25.1] - 2026-10-20
|
## [1.25.1] - 2026-10-20
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
Generated
+1663
-369
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/index.js",
|
"start": "node src/index.js",
|
||||||
"dev": "nodemon src/index.js",
|
"dev": "node --watch src/index.js",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"postinstall": "prisma generate",
|
"postinstall": "prisma generate",
|
||||||
"prisma:generate": "prisma generate",
|
"prisma:generate": "prisma generate",
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
"migrate:env-to-db:dry": "node scripts/migrate-env-to-db.js --dry-run"
|
"migrate:env-to-db:dry": "node scripts/migrate-env-to-db.js --dry-run"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@prisma/client": "^5.4.2",
|
"@prisma/adapter-pg": "^7.10.1",
|
||||||
|
"@prisma/client": "^7.10.1",
|
||||||
"@sentry/node": "^10.71.0",
|
"@sentry/node": "^10.71.0",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"bcryptjs": "^2.4.3",
|
"bcryptjs": "^2.4.3",
|
||||||
@@ -37,16 +38,18 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jest": "^30.4.2",
|
"jest": "^30.4.2",
|
||||||
"nodemon": "^3.0.1",
|
"prisma": "^7.10.1"
|
||||||
"prisma": "^5.4.2"
|
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"uuid": "^11.1.1"
|
"uuid": "^11.1.1",
|
||||||
|
"@istanbuljs/load-nyc-config": {
|
||||||
|
"js-yaml": "^4.1.1"
|
||||||
|
},
|
||||||
|
"follow-redirects": "^1.16.1"
|
||||||
},
|
},
|
||||||
"allowScripts": {
|
"allowScripts": {
|
||||||
"prisma@5.22.0": true,
|
"prisma@7.10.1": true,
|
||||||
"@prisma/client@5.22.0": true,
|
"@prisma/engines@7.10.1": true,
|
||||||
"@prisma/engines@5.22.0": true,
|
|
||||||
"unrs-resolver@1.12.2": true,
|
"unrs-resolver@1.12.2": true,
|
||||||
"@parcel/watcher": false
|
"@parcel/watcher": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// Prisma CLI config (migrate, generate, studio). Prisma 7 no longer reads the
|
||||||
|
// datasource URL from schema.prisma or auto-loads .env, so both happen here.
|
||||||
|
require('dotenv/config');
|
||||||
|
const { defineConfig } = require('prisma/config');
|
||||||
|
|
||||||
|
module.exports = defineConfig({
|
||||||
|
schema: 'prisma/schema.prisma',
|
||||||
|
migrations: {
|
||||||
|
path: 'prisma/migrations',
|
||||||
|
},
|
||||||
|
datasource: {
|
||||||
|
// process.env rather than env() so `prisma generate` still works on a
|
||||||
|
// machine with no DATABASE_URL (generate never connects).
|
||||||
|
url: process.env.DATABASE_URL,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -7,7 +7,6 @@ generator client {
|
|||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
url = env("DATABASE_URL")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum UserRole {
|
enum UserRole {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const dotenv = require('dotenv');
|
|||||||
// Load .env from the backend root
|
// Load .env from the backend root
|
||||||
dotenv.config({ path: path.resolve(__dirname, '../.env') });
|
dotenv.config({ path: path.resolve(__dirname, '../.env') });
|
||||||
|
|
||||||
const { PrismaClient } = require('@prisma/client');
|
const { createPrismaClient } = require('../src/config/db');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
const DRY_RUN = process.argv.includes('--dry-run');
|
const DRY_RUN = process.argv.includes('--dry-run');
|
||||||
@@ -90,7 +90,7 @@ const MAPPINGS = [
|
|||||||
// ─── Main ─────────────────────────────────────────────────────────────────────
|
// ─── Main ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const prisma = new PrismaClient();
|
const prisma = createPrismaClient();
|
||||||
|
|
||||||
console.log(`\n${'─'.repeat(60)}`);
|
console.log(`\n${'─'.repeat(60)}`);
|
||||||
console.log(' Settings migration: .env → DB');
|
console.log(' Settings migration: .env → DB');
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
* Run: node scripts/seed-users.js
|
* Run: node scripts/seed-users.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const { PrismaClient } = require('@prisma/client');
|
require('dotenv').config({ path: require('path').resolve(__dirname, '../.env') });
|
||||||
|
const { createPrismaClient } = require('../src/config/db');
|
||||||
const bcrypt = require('bcryptjs');
|
const bcrypt = require('bcryptjs');
|
||||||
|
|
||||||
const prisma = new PrismaClient();
|
const prisma = createPrismaClient();
|
||||||
|
|
||||||
const firstNames = [
|
const firstNames = [
|
||||||
'Liam', 'Olivia', 'Noah', 'Emma', 'James', 'Ava', 'Elijah', 'Sophia',
|
'Liam', 'Olivia', 'Noah', 'Emma', 'James', 'Ava', 'Elijah', 'Sophia',
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
const { PrismaClient } = require('@prisma/client');
|
const { PrismaClient } = require('@prisma/client');
|
||||||
|
const { PrismaPg } = require('@prisma/adapter-pg');
|
||||||
|
|
||||||
const prisma = new PrismaClient();
|
// Prisma 7 talks to Postgres through the node-postgres driver adapter instead of
|
||||||
|
// the old Rust engine. pg has no connect timeout by default; 5s matches Prisma 5.
|
||||||
|
function createPrismaClient() {
|
||||||
|
const adapter = new PrismaPg({
|
||||||
|
connectionString: process.env.DATABASE_URL,
|
||||||
|
connectionTimeoutMillis: 5000,
|
||||||
|
});
|
||||||
|
return new PrismaClient({ adapter });
|
||||||
|
}
|
||||||
|
|
||||||
|
const prisma = createPrismaClient();
|
||||||
|
|
||||||
module.exports = prisma;
|
module.exports = prisma;
|
||||||
|
module.exports.createPrismaClient = createPrismaClient;
|
||||||
|
|||||||
@@ -24,13 +24,10 @@ const express = require('express');
|
|||||||
const { version: API_VERSION } = require('../package.json');
|
const { version: API_VERSION } = require('../package.json');
|
||||||
const cors = require('cors');
|
const cors = require('cors');
|
||||||
const rateLimit = require('express-rate-limit');
|
const rateLimit = require('express-rate-limit');
|
||||||
const { PrismaClient } = require('@prisma/client');
|
const prisma = require('./config/db');
|
||||||
const { notFound, errorHandler } = require('./middleware/errorMiddleware');
|
const { notFound, errorHandler } = require('./middleware/errorMiddleware');
|
||||||
const getRawBody = require('raw-body');
|
const getRawBody = require('raw-body');
|
||||||
|
|
||||||
// Initialize Prisma client
|
|
||||||
const prisma = new PrismaClient();
|
|
||||||
|
|
||||||
// Initialize Express app
|
// Initialize Express app
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = process.env.PORT || 3000;
|
const PORT = process.env.PORT || 3000;
|
||||||
|
|||||||
Generated
+3
-3
@@ -8478,9 +8478,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/postcss-selector-parser": {
|
"node_modules/postcss-selector-parser": {
|
||||||
"version": "6.1.4",
|
"version": "7.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.1.7.tgz",
|
||||||
"integrity": "sha512-bIoJLOmjCO1S9XdY/DcnR5hJxvrDir1PbGChrzXG3vw0/FOliy/fA3dmdhQ441kah4gKv+TwckGzex6wNS5cnQ==",
|
"integrity": "sha512-wWBro/7hJ40ye6TPiXkUQoXKCw23xSsjriUvqd7Uls9Sso3oLiON1flc18cCdnjgCRXw4fBVqUJJeOdDTh3P3g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cssesc": "^3.0.0",
|
"cssesc": "^3.0.0",
|
||||||
|
|||||||
@@ -62,7 +62,8 @@
|
|||||||
"overrides": {
|
"overrides": {
|
||||||
"next": {
|
"next": {
|
||||||
"postcss": "^8.5.23"
|
"postcss": "^8.5.23"
|
||||||
}
|
},
|
||||||
|
"postcss-selector-parser": "^7.1.7"
|
||||||
},
|
},
|
||||||
"allowScripts": {
|
"allowScripts": {
|
||||||
"@sentry/cli@2.58.6": true,
|
"@sentry/cli@2.58.6": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user