feat(audit): 收口领域写接口权限审计
This commit is contained in:
@@ -29,7 +29,7 @@ export class AuthContextService {
|
||||
|
||||
const headerUser: CurrentUser = {
|
||||
id: userId,
|
||||
name: headerValue(request, 'x-ftb-user-name'),
|
||||
name: decodeHeader(headerValue(request, 'x-ftb-user-name')),
|
||||
username: headerValue(request, 'x-ftb-user-username'),
|
||||
roleId: headerValue(request, 'x-ftb-user-role-id') || '',
|
||||
email: headerValue(request, 'x-ftb-user-email'),
|
||||
@@ -60,3 +60,11 @@ function headerValue(request: AuthenticatedRequest, name: string): string {
|
||||
if (Array.isArray(value)) return value[0] ?? '';
|
||||
return value ?? '';
|
||||
}
|
||||
|
||||
function decodeHeader(value: string): string {
|
||||
try {
|
||||
return decodeURIComponent(value);
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user