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

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

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
security

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).

Ngôn ngữ chính
PHP
Star
954
Fork
119
Merge trung bình
48 phút
Pull request đã merge (30 ngày)
17

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 web-token/jwt-framework

Tất cả issue của web-token/jwt-framework

Issue tương tự

Thêm issue về PHP

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.