JWK: support the registered secp256k1 curve name for EC keys
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ó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
Start with lib/jwt/jwk/ec.rb, especially to_openssl_curve and keypair_components, then read the existing EC JWK tests and the changelog conventions. Reproduce the reported import and export behavior for secp256k1; done means registered-name JWKS keys work through verification, verify_key, private?, and set export, with the intended export name and compatibility note covered.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
RFC 8812, section 3.1 registers the JWK crv value for the secp256k1 curve as "secp256k1". JWT::JWK::EC only recognises "P-256K", a name from earlier drafts, in lib/jwt/jwk/ec.rb:
to_openssl_curvemaps'P-256K'to'secp256k1'and raisesJWT::JWKError, 'Invalid curve provided'for anything else.keypair_componentsexports secp256k1 keys withcrv: 'P-256K'.
As a result, ES256K tokens can't be verified against a JWKS that uses the registered name, and keys exported by ruby-jwt aren't readable by implementations that only accept "secp256k1".
Reproduction (jwt 3.3.0)
key = OpenSSL::PKey::EC.generate("secp256k1")
jwk = JWT::JWK.new(key)
jwk.export[:crv] # => "P-256K"
token = JWT.encode({ sub: "1" }, key, "ES256K", kid: jwk.kid)
standard = jwk.export.merge(crv: "secp256k1")
JWT.decode(token, nil, true, algorithms: ["ES256K"], jwks: { keys: [standard] })
# => JWT::JWKError: Invalid curve provided
JWT.decode(token, nil, true, algorithms: ["ES256K"], jwks: { keys: [jwk.export] })
# => works with "P-256K"
This also shows up with real JWKS. The Connect2id demo JWKS publishes an EC key with crv: "secp256k1". Importing it works because the key is built lazily, but verify_key, private? and export raise, so JWT::JWK::Set#export fails for the whole set. Looking up other keys by kid isn't affected.
Suggested fix
- Accept both
"secp256k1"and"P-256K"into_openssl_curve. This is backwards compatible and could go into a patch release. - Export secp256k1 keys with
crv: "secp256k1". This changes exported JWKs and their thumbprints for existing secp256k1 keys, so it might fit better in a minor or major release, with a CHANGELOG note.
Posted by Claude on behalf of @anakinj.
- Ngôn ngữ chính
- Ruby
- Star
- 3.7k
- Fork
- 381
- Merge trung bình
- 14 giờ 13 phút
- Pull request đã merge (30 ngày)
- 13
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
- Đọ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 jwt/ruby-jwt
-
Release with release-pleaseĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
jwt/ruby-jwt#743 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
jwt/ruby-jwt#723 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
jwt/ruby-jwt#428 · 7 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Introduce JWE supportĐang mởenhancement feature help wanted up for grabs
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
jwt/ruby-jwt#80 · 11 bình luận · 8 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
palladius/rails8-app-on-gcp#198 ·
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
WikiEducationFoundation/WikiEduDashboard#7258 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
UX/UI verified
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Maintainer thường phản hồi trong vòng 5 ngày
-
Invalid UTF-8 in `MCP-Protocol-Version`, `Mcp-Method` or `Mcp-Name` gives 500 instead of 400Có thể đã có người làm @atesgoral đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
modelcontextprotocol/ruby-sdk#663 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing es-ES translation: components/student/TracksList.tsx:tracksList.searchLanguageTracksĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày