firebase / firebase/firebase-admin-node

Invalid hash rounds for round = 0 and for algorithms PBKDF_SHA1 / PBKDF2_SHA256

オープン
#1,222 コメント 1 件 リアクション 0 件 担当者 1 名 @bojeil-google が担当を希望しています GitHub で見る
api: auth
主要言語
TypeScript
スター
1.7k
フォーク
419
平均マージ
3日 10時間
マージ済み PR(30日)
16

説明

#### Describe your environment

* Operating System version: macOS Big Sur v11.2.3
* Firebase SDK version: 9.6.0
* Firebase Product: auth
* Node.js version: 15.14.0
* NPM version: 7.9.0

### Describe the problem

#### Steps to reproduce:

At function admin.auth().importUsers(), set hash options to "algorithm" PBKDF_SHA1 or PBKDF2_SHA256 and "rounds" equals to 0. Rounds value equals to zero is being considered invalid. Documentation states that values between 0 and 120000 are possible.

Server returning this error:
```
errorInfo: {
code: 'auth/internal-error',
message: 'An internal error has occurred. Raw server response: "{"error":{"code":400,"message":"INVALID_HASH_ROUNDS","errors":[{"message":"INVALID_HASH_ROUNDS","domain":"global","reason":"invalid"}]}}"'
},
codePrefix: 'auth'
```

#### Relevant Code:

```
admin
.auth()
.importUsers(
[
{
uid: 'some-uid',
email: 'user@example.com',
// Must be provided in a byte buffer.
passwordHash: Buffer.from('password-hash'),
// Must be provided in a byte buffer.
passwordSalt: Buffer.from('salt'),
},
],
{
hash: {
algorithm: 'PBKDF2_SHA256',
rounds: 0,
},
}
)
.then((results) => {
results.errors.forEach((indexedError) => {
console.log(`Error importing user ${indexedError.index}`);
});
})
.catch((error) => {
console.log('Error importing users :', error);
});
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。