fix(web): reject unsupported wildcard host

This commit is contained in:
Tianyi Cui
2026-08-13 14:54:15 +08:00
parent 54cc6033a6
commit 6cbf927e0a
8 changed files with 25 additions and 15 deletions

View File

@@ -88,13 +88,13 @@ export const apply = ctx => globalThis.__webStartupApply(ctx)
describe('web command-line provider', () => {
it('publishes each flag and releases direct service expressions', async () => {
const { values, observed } = await bootProvider([
'--host', '0.0.0.0',
'--host', '127.0.0.1',
'--port', '8080',
'--trusted-host', 'lab.internal', 'lab-2.internal',
'--trusted-host', '10.0.0.9',
])
expect(values).toEqual({
host: '0.0.0.0',
host: '127.0.0.1',
port: 8080,
trustedHosts: ['lab.internal', 'lab-2.internal', '10.0.0.9'],
})
@@ -128,4 +128,12 @@ describe('web command-line provider', () => {
expect(observed.readerConfig).toBeUndefined()
expect(observed.exits).toEqual([1])
})
it('rejects the intentionally unsupported all-interfaces host before the consumer activates', async () => {
const { values, observed } = await bootProvider(['--host', '0.0.0.0'])
expect(observed.out).toContain('--host 0.0.0.0 is intentionally not supported yet; use 127.0.0.1 instead')
expect(values).toBeUndefined()
expect(observed.readerConfig).toBeUndefined()
expect(observed.exits).toEqual([1])
})
})