firebase / firebase/firebase-admin-node

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

Đang mở
#1,222 1 bình luận 0 reaction 1 người được giao Được @bojeil-google nhận Xem trên GitHub
api: auth
Ngôn ngữ chính
TypeScript
Star
1.7k
Fork
419
Merge trung bình
3 ngày 10 giờ
Pull request đã merge (30 ngày)
16

Mô tả

#### 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);
});
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.