fix(deploy): preserve credential blocking through hosting parser
This commit is contained in:
@@ -6,10 +6,10 @@ try {
|
||||
const index = line.indexOf('='); return [line.slice(0, index), line.slice(index + 1)];
|
||||
}));
|
||||
for (const key of ['POSTGRES_PASSWORD', 'PGADMIN_DEFAULT_PASSWORD', 'APP_DATABASE_PASSWORD', 'MIGRATION_DATABASE_URL']) {
|
||||
if (process.env[key] || main[key]) throw new Error('Administrative credential reached the app.');
|
||||
if ((process.env[key] && process.env[key] !== 'unavailable-in-app') || main[key]) throw new Error('Administrative credential reached the app.');
|
||||
}
|
||||
// Configured global/legacy URLs must not expose an administrative login either.
|
||||
if (process.env.DATABASE_URL) throw new Error('Hosting injected a legacy database URL.');
|
||||
if (process.env.DATABASE_URL && process.env.DATABASE_URL !== 'unavailable-in-app') throw new Error('Hosting injected a legacy database URL.');
|
||||
if (new URL(main.DATABASE_URL).username !== 'kita_runtime') throw new Error('Wrong application database role.');
|
||||
prisma = new PrismaClient({ datasourceUrl: main.DATABASE_URL });
|
||||
const [row] = await prisma.$queryRawUnsafe('SELECT current_user');
|
||||
|
||||
Reference in New Issue
Block a user