T-9: Multi-host MongoDB URI bypasses the dev QA-Mongo guard
This commit is contained in:
parent
677658a32f
commit
4b46e809be
5 changed files with 134 additions and 7 deletions
|
|
@ -599,6 +599,22 @@ describe('Config Schemas', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should accept empty port spellings for mongodb:// in hostname and bracketed IPv6 forms', () => {
|
||||
const hostEmptyPort = mongodbConfigSchema.parse({
|
||||
uri: 'mongodb://mongo.prod.internal:/stock',
|
||||
readUri: 'mongodb://[::1]:/stock',
|
||||
database: 'stock',
|
||||
});
|
||||
expect(hostEmptyPort.uri).toBe('mongodb://mongo.prod.internal:/stock');
|
||||
expect(hostEmptyPort.readUri).toBe('mongodb://[::1]:/stock');
|
||||
|
||||
const seedListEmptyPort = mongodbConfigSchema.parse({
|
||||
uri: 'mongodb://u:p@mongo1.prod.internal:,[::1]:/stock',
|
||||
database: 'stock',
|
||||
});
|
||||
expect(seedListEmptyPort.uri).toBe('mongodb://u:p@mongo1.prod.internal:,[::1]:/stock');
|
||||
});
|
||||
|
||||
it('should validate URI format', () => {
|
||||
const invalidUris = [
|
||||
'invalid-uri',
|
||||
|
|
@ -606,7 +622,13 @@ describe('Config Schemas', () => {
|
|||
'mongodb://',
|
||||
'mongodb://u:p@',
|
||||
'mongodb://u:p@localhost:27017,',
|
||||
'mongodb://u:p@:27017/stock',
|
||||
'mongodb://u:p@localhost:0/stock',
|
||||
'mongodb://u:p@localhost:99999/stock',
|
||||
'mongodb://u:p@[::1]:0/stock',
|
||||
'mongodb://u:p@[::1]:99999/stock',
|
||||
'mongodb://u:p@localhost:abc/stock',
|
||||
'mongodb+srv://u:p@localhost:/stock',
|
||||
'mongodb+srv://u:p@localhost:27017/stock',
|
||||
'mongodb+srv://u:p@host1.example.com,host2.example.com/stock',
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue