-
Notifications
You must be signed in to change notification settings - Fork 9
Fix handleUnauthorized serving old mashlib when mashlibModule configured #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ import { checkAccess, getRequiredMode } from '../wac/checker.js'; | |
| import { AccessMode } from '../wac/parser.js'; | ||
| import * as storage from '../storage/filesystem.js'; | ||
| import { getEffectiveUrlPath } from '../utils/url.js'; | ||
| import { generateDatabrowserHtml, generateSolidosUiHtml } from '../mashlib/index.js'; | ||
| import { generateDatabrowserHtml, generateModuleDatabrowserHtml, generateSolidosUiHtml } from '../mashlib/index.js'; | ||
|
|
||
| /** | ||
| * Check if request is authorized | ||
|
|
@@ -123,10 +123,12 @@ export function handleUnauthorized(request, reply, isAuthenticated, wacAllow, au | |
| // If mashlib is enabled, serve mashlib instead of static error page | ||
| // Mashlib has built-in login functionality via panes.runDataBrowser() | ||
| if (request.mashlibEnabled) { | ||
| // Use SolidOS UI if enabled, otherwise fallback to classic mashlib | ||
| // Use SolidOS UI if enabled, ES module if configured, otherwise classic mashlib | ||
| const html = request.solidosUiEnabled | ||
| ? generateSolidosUiHtml() | ||
| : generateDatabrowserHtml(request.url, request.mashlibCdn ? request.mashlibVersion : null); | ||
| : request.mashlibModule | ||
| ? generateModuleDatabrowserHtml(request.mashlibModule) | ||
| : generateDatabrowserHtml(request.url, request.mashlibCdn ? request.mashlibVersion : null); | ||
| return reply.code(statusCode).type('text/html').send(html); | ||
|
Comment on lines
125
to
132
|
||
| } | ||
| return reply.code(statusCode).type('text/html').send(getErrorPage(statusCode, isAuthenticated, request)); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generateModuleDatabrowserHtmlexpects a string URL (it calls.replace(/\.js$/, ...)).request.mashlibModulecan be a non-string truthy value (e.g.,trueviaJSS_MASHLIB_MODULE=truebecause env parsing coerces"true"to boolean), which would throw a TypeError here and turn 401/403 into a 500. Consider validatingrequest.mashlibModuleis a non-empty string before calling, and/or rejecting invalid config earlier with a clear startup error.