Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Misleading "invalid algorithm" error on malformed public key

オープン
#882 コメント 0 件 リアクション 3 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
javascript, node.js

調査の方向性

verify.js の 123 行目から始め、報告された Node.js バージョンを使用して、リンクされた jsonwebtoken-invalid-alg-repro プロジェクトで不正な公開鍵のケースを再現します。crypto の失敗がどのように処理されるかを追跡し、誤解を招く "invalid algorithm" エラーではなく元の crypto エラーが表面化した時点で issue の完了とみなします。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
JavaScript
スター
18.2k
フォーク
1.3k
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

auth0/node-jsonwebtoken のほかの issue

auth0/node-jsonwebtoken の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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