Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Misleading "invalid algorithm" error on malformed public key

Đang mở
#882 0 bình luận 3 reaction 0 người được giao Xem trên GitHub

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

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

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của auth0/node-jsonwebtoken

Tất cả issue của auth0/node-jsonwebtoken

Issue tương tự

Thêm issue về JavaScript

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.