fix(32.2): WR-06 check the consent provider's redirect against the request's redirect URI
cabana loads the pending request on both decisions and refuses (500) a Decide answer whose scheme, user info, host, path or opaque part differ from the registered redirect URI. The admin SPA also refuses blob:, file:, about: and filesystem: and a destination that does not return to the host the consent card showed. Regenerated the admin OpenAPI document and rebuilt modules/boardwalk/dist.
This commit is contained in:
@@ -258,13 +258,22 @@ describe('no auto-allow and the decision navigation (UI backstop)', () => {
|
||||
expect(wrapper.find('[data-action="allow"]').exists()).toBe(false)
|
||||
expect(document.activeElement).toBe(card.find('h1').element)
|
||||
|
||||
const custom = await open('/connect?request=req1', routes(consentView(), ok({ redirect_uri: 'myagent:/callback?code=1' })))
|
||||
const customView = consentView({ client: { id: 'client-1', name: 'Acme Agent', redirect_host: 'myagent:/callback', logo_url: '' } })
|
||||
const custom = await open('/connect?request=req1', routes(customView, ok({ redirect_uri: 'myagent:/callback?code=1' })))
|
||||
await custom.wrapper.find('[data-connect-state="ready"]').trigger('submit')
|
||||
await flushPromises()
|
||||
expect(assign).toHaveBeenLastCalledWith('myagent:/callback?code=1')
|
||||
const returning = custom.wrapper.find('[data-connect-state="returning"]')
|
||||
expect(returning.find('[data-connect-continue]').exists()).toBe(false)
|
||||
expect(returning.find('h1').text()).toBe('Returning to agent.example.test')
|
||||
expect(returning.find('h1').text()).toBe('Returning to myagent:/callback')
|
||||
})
|
||||
|
||||
it('leaves for a redirect whose host matches the shown one as the browser compares hosts', async () => {
|
||||
const view = consentView({ client: { id: 'client-1', name: 'Acme Agent', redirect_host: 'Agent.Example.Test:443', logo_url: '' } })
|
||||
const { wrapper } = await open('/connect?request=req1', routes(view))
|
||||
await wrapper.find('[data-connect-state="ready"]').trigger('submit')
|
||||
await flushPromises()
|
||||
expect(assign).toHaveBeenCalledWith(REDIRECT)
|
||||
})
|
||||
|
||||
it('disables both buttons and the scopes while a decision is in flight', async () => {
|
||||
@@ -290,7 +299,21 @@ describe('no auto-allow and the decision navigation (UI backstop)', () => {
|
||||
})
|
||||
|
||||
describe('submit failures', () => {
|
||||
it.each(['javascript:alert(1)', 'data:text/html,<script>x</script>', 'vbscript:msgbox(1)', 'JavaScript:alert(1)', 'not a uri'])(
|
||||
it.each([
|
||||
'javascript:alert(1)',
|
||||
'data:text/html,<script>x</script>',
|
||||
'vbscript:msgbox(1)',
|
||||
'JavaScript:alert(1)',
|
||||
'not a uri',
|
||||
'blob:https://agent.example.test/0b7c',
|
||||
'file:///etc/passwd',
|
||||
'about:blank',
|
||||
'filesystem:https://agent.example.test/temporary/x',
|
||||
'https://evil.example.test/callback?code=abc123',
|
||||
'https://agent.example.test.evil.example/callback?code=abc123',
|
||||
'https://agent.example.test:8443/callback?code=abc123',
|
||||
'myagent:/callback?code=1',
|
||||
])(
|
||||
'treats the redirect %j as a submit failure',
|
||||
async (uri) => {
|
||||
const { wrapper, push, replace } = await open('/connect?request=req1', routes(consentView(), ok({ redirect_uri: uri })))
|
||||
|
||||
Reference in New Issue
Block a user