Skip to content

[dummy_ci 4/7] Add GET /api/v1/jwks endpoint, server wiring, and local dev server - #5232

Open
ievdokdm wants to merge 1 commit into
197798-3-dummy-ci-kms-configfrom
197798-4-dummy-ci-jwks-endpoint
Open

ievdokdm wants to merge 1 commit into
197798-3-dummy-ci-kms-configfrom
197798-4-dummy-ci-jwks-endpoint

Conversation

@ievdokdm

@ievdokdm ievdokdm commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Adds GET /api/v1/jwks, single-flight TTL caching, server wiring, and a standalone local dev server to dummy_ci, mirroring Cocoon PR #5198.

Summary

  • Implements dummy_ci/lib/src/cache/ttl_cache.dart (TtlCache<V> with injectable clock, single-flight coalescing, and non-caching of errors/empty states).
  • Implements dummy_ci/lib/src/handlers/jwks_handler.dart serving active ENABLED EC_SIGN_ED25519 public keys from Cloud KMS with Cache-Control: public, max-age=300, kid deduplication, 503 when unconfigured/empty, and 500 on KMS failures.
  • Wires DummyCiConfig, CloudKmsService, and GET /api/v1/jwks in dummy_ci/lib/src/server.dart and dummy_ci/bin/server.dart.
  • Adds dummy_ci/tool/local_server.dart preloaded with FakeCloudKmsService and the RFC 8037 Appendix A.1 test key.
  • Adds unit tests in test/cache/ttl_cache_test.dart, test/handlers/jwks_handler_test.dart, and expands test/server_test.dart.

Stack

Testing

  • dart pub get, dart format --set-exit-if-changed ., dart analyze --fatal-infos, dart test --test-randomize-ordering-seed=random --reporter expanded
  • dart compile exe bin/server.dart
  • dart --enable-asserts analyze.dart and dart run dev/cocoon_code_health/bin/check.dart

Towards flutter/flutter#197798

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a single-value in-memory TTL cache (TtlCache) and a new handler (JwksHandler) to serve active Ed25519 JWKS public keys from Cloud KMS at GET /api/v1/jwks. It also updates the local development server and adds comprehensive unit tests. The review feedback highlights two valuable improvements: first, caching the null state when no keys are configured to prevent potential rate-limiting and high latency on Cloud KMS; second, handling individual key-loading errors gracefully in _fetchJwksJson so that a single bad key version does not cause the entire JWKS endpoint to fail.

@ievdokdm
ievdokdm force-pushed the 197798-4-dummy-ci-jwks-endpoint branch from d8fdd6f to 4cc5cc9 Compare December 4, 2026 01:07
@ievdokdm
ievdokdm force-pushed the 197798-3-dummy-ci-kms-config branch from 6f96dd5 to 037a6f7 Compare December 4, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant