fix(admin): secure proxied model mutations
Staging Backend Quality Gate / validate (push) Successful in 19m41s
Staging Backend Quality Gate / publish (push) Successful in 28m13s

This commit is contained in:
Jesse_Chen
2026-08-08 01:26:21 +08:00
parent c30b4b906b
commit 99e2abe9bc
9 changed files with 275 additions and 58 deletions
+2 -2
View File
@@ -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";