Feat/issue 1122 - #1209
Feat/issue 1122#1209rewrite0w0 wants to merge 2 commits into
Conversation
✅ Deploy Preview for fedify-json-schema canceled.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesPublic-key cache
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to Signing keys are now reused across requests, and a key that no longer verifies is refetched. Tests cover reuse, unavailable keys, and rotation. No merge-blocking risk was found. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Key reuse reduces remote lookups, but a previously trusted key can continue verifying requests after it is withdrawn. Refreshing after a signature mismatch supports rotation but does not detect requests signed with the old private key. Exposure depends on cache lifetime and the application's subsequent ownership checks. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❓ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
2chanhaeng
left a comment
There was a problem hiding this comment.
Please use the title to summarize the intent of the change, and note which issue the PR addresses in the body. If the title only includes the issue number, GitHub cannot link the issue to the PR.
I think this PR needs a changelog entry because the number of remote lookups and the timing of key updates will change. These changes are visible to users.
I also think users should have an option to disable the cache. However, it doesn’t need to be implemented right away, so you can create a separate issue.
The PR description says AI was used, but the only commit that changed the code, 3ff6fa0, doesn’t have Assisted-by trailers in its message. Please add them.
Background
RequestContext.getSignedKey()currently callsverifyRequest()without akeyCache, so signing keys are fetched again across requests using the same key ID.This change wires the existing
KvKeyCacheintoRequestContext.getSignedKey()so that signing keys can be reused across requests while preserving the existing key rotation behavior.Changes
Update
RequestContext.getSignedKey()inpackages/fedify/src/federation/middleware.ts:KvKeyCacheusing the federation's public key KV prefix and TTL.verifyRequest().Add regression tests in
packages/fedify/src/federation/middleware.test.ts:Testing
deno test -A packages/fedify/src/federation/middleware.test.tsmise check && mise fmt && mise testQuestion
The issue mentions the possibility of adding an opt-out to
GetSignedKeyOptionsfor callers that need a fresh key lookup.Would an opt-out be useful here, or is using the key cache unconditionally the preferred behavior?
AI assistance
This PR description and test implementations were drafted with AI assistance (ChatGPT) and finalized after human review and testing.