- Accept the private-console transport with an exact Origin/Host match; the http console is not a secure context, so Chrome sends no Sec-Fetch-Site and that requirement made every real write 400. - Reject bracketed non-IPv6 host spellings, including ported forms, instead of normalising them to loopback. - Show the plaintext-warning copy or the disabled state from a tri-state capability field; old APIs keep the legacy message. - Document WEKNORA_ALLOW_PRIVATE_HTTP in .env.example and the operations runbook.
This commit is contained in:
@@ -39,11 +39,13 @@ describe('knowledgeBaseBindings', () => {
|
||||
data: {
|
||||
environments: [binding('test'), binding('production')],
|
||||
storage_ready: true,
|
||||
secret_entry_allowed: true,
|
||||
},
|
||||
})
|
||||
expect(parsed.test.base_url).toBe('https://test.example')
|
||||
expect(parsed.production.internal_kb_name).toBe('内部资料')
|
||||
expect(parsed.storage_ready).toBe(true)
|
||||
expect(parsed.secret_entry_allowed).toBe(true)
|
||||
const asRecord = parsed.test as unknown as Record<string, unknown>
|
||||
expect(asRecord.api_key).toBeUndefined()
|
||||
expect(asRecord.key_ciphertext).toBeUndefined()
|
||||
@@ -53,6 +55,24 @@ describe('knowledgeBaseBindings', () => {
|
||||
expect(() => parseKBBindingSnapshot({ data: { environments: [binding('test')], storage_ready: true } })).toThrow()
|
||||
})
|
||||
|
||||
it('leaves the capability absent when an older API does not report it', () => {
|
||||
const parsed = parseKBBindingSnapshot({
|
||||
data: { environments: [binding('test'), binding('production')], storage_ready: true },
|
||||
})
|
||||
expect(parsed.secret_entry_allowed).toBeUndefined()
|
||||
})
|
||||
|
||||
it('keeps an explicit refusal distinguishable from a missing field', () => {
|
||||
const parsed = parseKBBindingSnapshot({
|
||||
data: {
|
||||
environments: [binding('test'), binding('production')],
|
||||
storage_ready: true,
|
||||
secret_entry_allowed: false,
|
||||
},
|
||||
})
|
||||
expect(parsed.secret_entry_allowed).toBe(false)
|
||||
})
|
||||
|
||||
it('shows a short id next to the name so same-name bases are distinguishable', () => {
|
||||
expect(shortKnowledgeBaseID('0b217e8a-1234-5678')).toBe('0b217e8a…')
|
||||
expect(knowledgeBaseLabel('0b217e8a-1234-5678', '客户帮助中心')).toBe('客户帮助中心(0b217e8a…)')
|
||||
|
||||
Reference in New Issue
Block a user