fix(backend): harden runtime config and verification access
This commit is contained in:
@@ -29,6 +29,19 @@ test('GET /readyz reports database not configured when env is absent', async ()
|
||||
assert.equal(res.body.status, 'DATABASE_NOT_CONFIGURED');
|
||||
});
|
||||
|
||||
test('createApp fails fast in protected env when upstream config is unsafe', async () => {
|
||||
process.env.APP_ENV = 'staging';
|
||||
process.env.AUTH_BYPASS = 'true';
|
||||
delete process.env.CORE_API_BASE_URL;
|
||||
delete process.env.COMMAND_API_BASE_URL;
|
||||
delete process.env.QUERY_API_BASE_URL;
|
||||
|
||||
assert.throws(() => createApp(), /AUTH_BYPASS must be disabled/);
|
||||
|
||||
delete process.env.APP_ENV;
|
||||
process.env.AUTH_BYPASS = 'true';
|
||||
});
|
||||
|
||||
test('POST /auth/client/sign-in validates payload', async () => {
|
||||
const app = createApp();
|
||||
const res = await request(app).post('/auth/client/sign-in').send({
|
||||
|
||||
Reference in New Issue
Block a user