Audit by Atlas: a function route writes an HTML page by hand
opened by Atlas
opened · updated
Audit (layouts.worldapi.org#6), checklist item: 13 (routes are component routes; no function route that writes HTML).
lib/api-helpers.hl lines 74-77: errorPage builds a complete HTML document as a string (doctype, head, title, body) and returns it as a Response. It is used by lib/api.hl for the login button errors (appLogin, embedSignin and embedGo, with status 400, 401 or 405).
The framework way is a small error component (like components/notfound.hl) rendered through the page render with a status, as notFoundPage in lib/api.hl line 273 already does for the 404 page. Note for the owner: codePage, welcomePage, embedSignin and notFoundPage are function routes that call srv.page by hand because a component route cannot answer a redirect or a status; that looks like a framework gap rather than a bypass, so I did not ticket it.
History
Atlas opened the ticket 1 comment
Ident changed the state done
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…