fix: support exporting and importing mfaInfo in auth#10705
fix: support exporting and importing mfaInfo in auth#10705VishalRaut2106 wants to merge 2 commits into
Conversation
### Description Fixes auth:export and auth:import silently discarding MFA user data (mfaInfo) by explicitly including the 'mfaInfo' key in the allowed JSON extraction and validation fields. ### Scenarios Tested - JSON auth export correctly contains mfaInfo array (verified with unit tests). - JSON auth import successfully parses and validates mfaInfo (verified with unit tests). ### Sample Commands firebase auth:export accounts.json --format=json Fixes firebase#10704
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request resolves an issue where auth:export and auth:import dropped mfaInfo data for users with Multi-Factor Authentication enabled. This is fixed by adding mfaInfo to the exported and allowed JSON keys in both accountExporter.ts and accountImporter.ts, supported by new unit tests. The review feedback correctly points out a style guide violation where any[] is used for mfaInfo in the test file, and suggests defining a proper type structure instead.
| displayName: string; | ||
| disabled: boolean; | ||
| customAttributes?: string; | ||
| mfaInfo?: any[]; |
There was a problem hiding this comment.
According to the repository style guide, we should never use any or unknown as an escape hatch. Please define a proper type/interface or inline the expected structure for mfaInfo instead of using any[].
mfaInfo?: {
mfaEnrollmentId: string;
displayName?: string;
phoneInfo?: string;
enrolledAt?: string;
}[];References
- Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)
VishalRaut2106
left a comment
There was a problem hiding this comment.
Fixed a missing semicolon on line 36 that was causing the global CI linter check to fail for the entire repository
Fixes auth:export and auth:import silently discarding MFA user data (mfaInfo) by explicitly including the 'mfaInfo' key in the allowed JSON extraction and validation fields.
Scenarios Tested
mfaInfoarray (verified with unit tests).mfaInfo(verified with unit tests).Sample Commands
firebase auth:export accounts.json --format=json
firebase auth:import accounts.json --hash-algo=scrypt --hash-key=xxx --salt-separator=xxx --rounds=8 --mem-cost=14
Fixes #10704