fix(admin): secure proxied model mutations
This commit is contained in:
@@ -9,7 +9,7 @@ export interface IdentityAuthHandlers {
|
||||
POST: IdentityRequestHandler;
|
||||
}
|
||||
|
||||
function normalizeHost(value: string | null): string | null {
|
||||
export function normalizeIdentityHost(value: string | null): string | null {
|
||||
if (!value || value !== value.trim() || /[\s,@/\\]/.test(value)) return null;
|
||||
|
||||
try {
|
||||
@@ -33,7 +33,7 @@ export function resolveIdentitySurface(
|
||||
hostHeader: string | null,
|
||||
config: SelfHostedIdentityConfig,
|
||||
): "user" | "admin" | null {
|
||||
const host = normalizeHost(hostHeader);
|
||||
const host = normalizeIdentityHost(hostHeader);
|
||||
if (!host) return null;
|
||||
|
||||
if (host === new URL(config.userOrigin).host.toLowerCase()) return "user";
|
||||
|
||||
Reference in New Issue
Block a user