Commit bcb6936
Fix custom claims flattening in dashboard 'Act as User' feature (#38306)
Fix custom claims flattening in dashboard "Act as User" feature to match real JWT behavior.
**Problem**: When using the dashboard's "Act as User" feature, custom claims specified in the `customClaims` field were not being flattened to the root level of the user identity object returned by `ctx.auth.getUserIdentity()`. This caused a mismatch between real JWT tokens (where custom claims are flattened to root level) and dashboard impersonation (where custom claims remained nested), preventing users from testing functions that rely on custom claims like `scopes` arrays for authorization.
**Solution**: Modified the `onImpersonatedUserChange` function in `FunctionTester.tsx` to extract `customClaims` from the parsed user object and flatten them to the root level using object spread syntax, ensuring dashboard impersonation behavior matches real JWT processing.
**Changes**:
- Modified `npm-packages/dashboard-common/src/features/functionRunner/components/FunctionTester.tsx`
- Added custom claims flattening logic in `onImpersonatedUserChange` function
- Maintains existing validation and error handling
**Testing**: Code passes all linting checks (`just lint-js`) and formatting standards (`just format-js`). Local testing was blocked by PostgreSQL environment setup issues, relying on CI for comprehensive testing.
GitOrigin-RevId: 3148656bf496df84da21579a8c8f58f130609b101 parent e1d07a8 commit bcb6936
File tree
1 file changed
+8
-1
lines changed- npm-packages/dashboard-common/src/features/functionRunner/components
1 file changed
+8
-1
lines changedLines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
478 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
479 | 486 | | |
480 | 487 | | |
481 | 488 | | |
| |||
0 commit comments