Refactor: Consolidate JWKS fetching and expose a unified JWT verifier for downstream SDKs
Maintainer thường phản hồi trong vòng 6 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- dart
- Lĩnh vực
- authentication, backend, security
Hướng nghiên cứu
Bắt đầu bằng cách đọc packages/firebase_admin_sdk/lib/src/utils/jwt.dart, đặc biệt là UrlKeyFetcher, JwksFetcher và PublicKeySignatureVerifier, sau đó so sánh các trình xác minh token và firebase_functions/lib/src/identity/token_verifier.dart. Lập bản đồ các khác biệt về cache, clock-skew và xác thực audience trước khi chọn một API dùng chung. Công việc được xem là hoàn tất khi các SDK downstream có thể sử dụng một trình xác minh có thể tái sử dụng mà không cần sao chép việc lấy khóa hoặc xác thực claim.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
Across firebase_admin_sdk and downstream consumers like firebase_functions (which depends on firebase_admin_sdk), there are multiple overlapping implementations of JWT signature verification, JWKS / X.509 certificate fetching, and public key caching.
Currently, firebase_admin_sdk maintains both UrlKeyFetcher (for X.509 PEM certs) and JwksFetcher (for JSON Web Key Sets) in lib/src/utils/jwt.dart.
Current Inconsistencies & Duplication
- Inconsistent Key Caching & TTLs:
UrlKeyFetcherparses HTTPCache-Control: max-ageheaders via string splitting and tracks expiration viaDateTime.JwksFetcherignores HTTPCache-Controlheaders entirely, hardcoding a static 6-hour TTL (6 * 60 * 60 * 1000) and tracking expiration via epoch integer comparison.- Meanwhile, downstream in
firebase_functions,AuthBlockingTokenVerifierhand-rolled a third key fetcher (_getGoogleKeys()) that parsesCache-Control: max-agevia regex and defaults to a 1-hour TTL.
- Inconsistent Clock Skew and Claim Validation:
- Neither
FirebaseTokenVerifiernorAppCheckTokenVerifiersupports clock-skew tolerance on timestamps (iat,exp). However, Auth Blocking events infirebase_functionsrequire a 5-minute clock skew oniat. - Audience (
aud) claim handling varies: ID token verification assumesString, App Check assumesList, and downstream functions must handle bothStringandListpolymorphically.
- Neither
- Lack of Reusability for Downstream Packages:
- Because
PublicKeySignatureVerifierandJwksFetcherare either marked@internalor lack configuration ergonomics (v3 JWKS endpoints, clock skew, polymorphic audience matching),firebase_functionswas forced to duplicate the entire JWT verification stack from scratch.
- Because
Proposed Action Items
- Unify
JwksFetcherandUrlKeyFetcherto share standard HTTPCache-Control: max-ageparsing (with a sensible default fallback like 1 hour). - Support configurable clock-skew tolerance (e.g., an optional
Duration clockSkewparameter) inPublicKeySignatureVerifierand claim validation. - Support polymorphic audience (
aud) matching (Stringvs.List<String>). - Expose a clean, reusable JWT verification primitive (or align with an upstream foundation like
google_cloud_server_auth) so downstream SDKs likefirebase_functionscan delete their custom verifiers and rely directly onfirebase_admin_sdk.
- Ngôn ngữ chính
- Dart
- Star
- 180
- Fork
- 73
- Merge trung bình
- 5 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 firebase/firebase-admin-dart
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
firebase/firebase-admin-dart#367 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
blocked bug
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
firebase/firebase-admin-dart#286 · 4 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Support for Realtime DatabaseĐang mởblocked enhancement package:firebase_admin_sdk
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
firebase/firebase-admin-dart#245 · 1 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 6 ngày
-
blocked enhancement package:google_cloud_firestore
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
firebase/firebase-admin-dart#95 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 6 ngày
Tất cả issue của firebase/firebase-admin-dart
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Study Button croppedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
lichess-org/mobile#4119 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
夜間レビュー: 観点 tests の指摘 (PR #443)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 76/100
Nicolas11Leon/Tunner#278 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày