Alternative to the 120k limit on rounds for hashed password imports using auth.UserImportHash.pbkdf2_sha256
@bojeil-google 已經在處理了。
開始於 2020年12月8日。
評估
這個 Issue 還沒有評估資料。
描述
I'm looking to migrate users from Django to firebase, below is the code I'm using for testing. The issue I'm facing is that it seems that the passwords have been hashed using 150k rounds when the firebase docs says the maximum is 120k for SHA256: https://firebase.google.com/docs/auth/admin/import-users#python
Is there an alternative?
Here is the error I get:
ValueError: rounds must not be larger than 120000.
import firebase_admin
from firebase_admin import auth, exceptions
from passlib.utils import to_bytes
server_path = ''
fb_credentials = firebase_admin.credentials.Certificate(server_path + 'files/serviceAccount.json')
firebase_admin.initialize_app(fb_credentials)
old_hash = 'pbkdf2_sha256$150000$rsWX3Dbbd3K6$EYgXPBAz/Ero9PIgIFs/8pWGmGT+diTOQs1DZv4Ytjw='
email = 'user@gmail.com'
rounds = int(old_hash.split('$')[1])
salt = old_hash.split('$')[2]
users = [
auth.ImportUserRecord(
uid='70sSUptkmkN95QTFJ0gWduzdlpP1',
email=email,
password_hash=to_bytes(old_hash),
password_salt=to_bytes(salt)
),
]
hash_alg = auth.UserImportHash.pbkdf2_sha256(rounds=rounds)
try:
result = auth.import_users(users, hash_alg=hash_alg)
for err in result.errors:
print('Failed to import user:', err.reason)
except exceptions.FirebaseError as error:
print('Error importing users:', error)
- 主要語言
- Python
- 星號
- 1.2k
- 分支
- 359
- 平均合併
- 3 天 9 小時
- 30 天內合併 PR
- 3
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
firebase/firebase-admin-python 的其他 Issue
-
api: remoteconfig
難度 2/5 1-3 小時 新手友好度 75/100
firebase/firebase-admin-python#957 · 1 則留言 ·
-
api: database type: feature request
難度 2/5 1-3 小時 新手友好度 62/100
-
難度 4/5 3-5 天 新手友好度 45/100
firebase/firebase-admin-python#978 · 1 則留言 ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) 未關閉api: auth
firebase/firebase-admin-python#949 · 2 則留言 · 1 個 reaction · 已指派 1 人 ·
-
難度 4/5 3-5 天 新手友好度 43/100
firebase/firebase-admin-python#945 · 1 則留言 · 1 個 reaction ·
查看 firebase/firebase-admin-python 的全部 Issue
相似的 Issue
-
essnmx good first issue
難度 1/5 1 小時以內 新手友好度 95/100
-
難度 2/5 1-3 小時 新手友好度 65/100
syfoud/Simulated_Scepter#174 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
Giskard-AI/giskard-oss#2840 · 1 則留言 ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success 未關閉area: repo bug perceived difficulty: 2
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 75/100
yeti-platform/yeti#1380 ·