firebase / firebase/firebase-admin-node
Application Credentials are not fully parsed/validated during initializeApp
- 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ả
### [READ] Step 1: Are you in the right place?
Yes
### [REQUIRED] Step 2: Describe your environment
* Operating System version: Linux
* Firebase SDK version: 9.20
* Firebase Product: FCM
* Node.js version: v12.18.4
* NPM version: 6.14.6
### [REQUIRED] Step 3: Describe the problem
#### Steps to reproduce:
1. Copy JSON-encoded Google Application Credentials from a browser based tool like Bitwarden
2. Attempt to use the SDK with those credentials (valid JSON containing a poorly-encoded/formatted PEM)
3. Initialize the app without error
4. Send an FCM message, receive an error: ``` error: {
"library": "PEM routines",
"function": "get_name",
"reason": "no start line",
"code": "ERR_OSSL_PEM_NO_START_LINE"
}```
**What I expect to happen:**
I would like the error to be thrown when I `initializeApp` during the bootstrapping of our application so I can treat it as a configuration error, rather than an error we hit at runtime the first time that a message is sent.
#### Relevant Code:
```javascript
const FCM_TOKEN = JSON.parse(GOOGLE_APPLICATION_CREDENTIALS)
const serviceAccount = {
projectId: FCM_TOKEN.project_id,
clientEmail: FCM_TOKEN.client_email,
privateKey: FCM_TOKEN.private_key
}
// Shouldn't this to throw if the credentials cannot be parsed?
firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.cert(serviceAccount),
databaseURL: 'https://xxxx.firebaseio.com'
})
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Start at the initializeApp and credential.cert entry points shown in the report, and reproduce the malformed PEM credentials described in the steps. Verify that invalid credentials are rejected during initializeApp rather than only when the first FCM message is sent.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- node.js, typescript
- Lĩnh vực
- authentication
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100