Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/oauth-smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,16 @@ export async function testOAuth({
'framework still rejects cross-site admin form posts',
);
const csrf = await consentPage('cms:read');
const unbound = await decide({ ...csrf, cookie: '' }, ['cms:read']);
assert.equal(
(await decide({ ...csrf, cookie: '' }, ['cms:read'])).status,
unbound.status,
400,
'consent cannot be forged without browser cookie',
);
assert.ok(
(await unbound.text()).includes('not started in this browser'),
'a rejected consent explains why, so failures can be diagnosed',
);
const crossOrigin = await consentPage('cms:read');
assert.ok(
(
Expand Down
7 changes: 6 additions & 1 deletion src/routes/admin/oauth/authorize/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ function authorizationFailure(error: unknown) {
status: 302,
headers: { Location: error.redirectTo, 'Cache-Control': 'no-store' },
});
// The library's descriptions are fixed, non-sensitive sentences (e.g. "This authorization was
// not started in this browser; start again"). Only a signed-in admin reaches this page, and
// without the reason a failure cannot be diagnosed (the generic text hid it).
console.warn('OAuth consent rejected', error.code, error.description);
return page(
'<h1>Connection request could not be verified</h1><p>Return to your client and start the connection again.</p>',
`<h1>Connection request could not be verified</h1><p>${escape(error.description)}</p><p>Return to your client and start the connection again.</p>`,
400,
);
}
Expand All @@ -59,6 +63,7 @@ function authorizationFailure(error: unknown) {
'<h1>Client identity is unavailable</h1><p>The client metadata could not be verified. Try again from your client.</p>',
400,
);
console.error('OAuth consent failed', error);
return page(
'<h1>Connection could not be completed</h1><p>Return to your client and try again.</p>',
503,
Expand Down
Loading