KeyChecker: "key_ops" does not tell content decryption from key unwrapping, and "deriveKey"/"deriveBits" are not accepted on both sides

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
security

調査の方向性

Start by reading KeyChecker::checkKeyUsage() and tracing the encryption and decryption paths for dir and ECDH-ES. The issue specifies the expected dir operations and that deriveKey and deriveBits should both work on either side for key agreement. Check the existing tests for those modes and add coverage showing those cases pass while wrapping-only keys cannot decrypt dir content.

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

説明

enhancement
Version(s) affected

All released versions (3.4.x, 4.0.x, 4.1.x, 4.2.x), and the 4.3.x and 5.0.x branches.

Description

KeyChecker::checkKeyUsage() accepts any of decrypt, unwrapKey and deriveBits for every decryption, and any of encrypt, wrapKey and deriveKey for every encryption, whatever the key management mode. Two consequences:

  • A key restricted to ["wrapKey", "unwrapKey"], meant for key wrapping only, can still decrypt dir content. key_ops therefore does not prevent the key confusion described in #760.
  • The two lists disagree for key agreement: a key restricted to deriveKey can encrypt with ECDH-ES but cannot decrypt, and a key restricted to deriveBits can decrypt but cannot encrypt.
Possible Solution
  • 4.3.0: dir requires encrypt when building and decrypt when decrypting; deriveKey and deriveBits are both accepted on both sides for key agreement.
  • A strict mapping per key management mode would refuse keys exported by WebCrypto (for example AES-GCM keys with encrypt/decrypt used for A*GCMKW, RSA keys with decrypt used for RSA-OAEP, or ECDH public keys exported with an empty key_ops). It is left for 5.0.0, if at all.
Additional Context

Found by the Anthropic OSS Scanner (ANT-2026-Z8KOO4J9).

主要言語
PHP
スター
954
フォーク
119
平均マージ
48分
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

web-token/jwt-framework のほかの issue

web-token/jwt-framework の issue をすべて見る

似ている issue

PHP の issue をもっと見る

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

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