Misleading "invalid algorithm" error on malformed public key
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- authentication, backend, security
Hướng nghiên cứu
Bắt đầu tại dòng 123 của verify.js và tái hiện trường hợp khóa công khai không hợp lệ bằng project jsonwebtoken-invalid-alg-repro được liên kết, sử dụng các phiên bản Node.js đã được báo cáo. Theo dõi cách lỗi crypto được xử lý và coi issue là hoàn tất khi lỗi crypto ban đầu được hiển thị thay vì lỗi gây hiểu lầm "invalid algorithm".
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
On 9.0.0, we get the following error when trying to verify a JWT using a malformed public key:
JsonWebTokenError: invalid algorithm
In 8.x, we would get an error that would look something like:
Error: error:1E08010C:DECODER routines::unsupported
{
library: 'DECODER routines',
reason: 'unsupported',
code: 'ERR_OSSL_UNSUPPORTED'
}
The latter points us to a crypto error and suggests an issue parsing the key.
The former misleads the developer from the root issue.
The library should at least throw the original crypto error. Here is the line of code responsible for eating the error: https://github.com/auth0/node-jsonwebtoken/blob/master/verify.js#L123
Reproduction
https://github.com/Drew-Kimberly/jsonwebtoken-invalid-alg-repro
(uses dummy jwt/key from https://jwt.io)
Environment
- Version of this library used: 9.0.0
- Other relevant versions (language, server software, OS, browser): NodeJS 16.19.0 and 18.12.1
- Ngôn ngữ chính
- JavaScript
- Star
- 18.2k
- Fork
- 1.3k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của auth0/node-jsonwebtoken
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
auth0/node-jsonwebtoken#1042 · 1 bình luận ·
-
`jwt.sign()` callback is executed twice for "The payload already has an "..." property" errors Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
auth0/node-jsonwebtoken#1000 · 2 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 65/100
auth0/node-jsonwebtoken#1046 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
auth0/node-jsonwebtoken#1034 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
auth0/node-jsonwebtoken#1032 ·
Tất cả issue của auth0/node-jsonwebtoken
Issue tương tự
-
Update HugeIcons library Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
antfu-collective/icones#398 ·
-
ECmail.com Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
wesbos/burner-email-providers#554 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
radiantearth/stac-browser#1023 ·
-
HMR stops working Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
components-web-app/docs#92 ·