fix(registration): keep stored credentials valid during refresh - #977
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughWebServer now stages regenerated credentials separately from active credentials. Registration serializes overlapping attempts, commits pending credentials after success, and discards them after failure. Tests cover authentication during rotation and both registration outcomes. ChangesCredential registration flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Registration
participant ServerHealth
participant WebServer
Registration->>ServerHealth: Check server health
ServerHealth-->>Registration: Health result
alt Registration succeeds
Registration->>WebServer: Commit pending credentials
else Registration fails
Registration->>WebServer: Discard pending credentials
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/io/cryostat/agent/WebServer.java`:
- Around line 372-377: Update the credential regeneration and registration flow
around WebServer.regenerate(), Registration.tryRegister(),
commitPendingCredentials(), and discardPendingCredentials() so stale
registration attempts cannot commit or discard a newer pending credential.
Either serialize complete registration attempts or associate each pending
snapshot with a generation identifier and require both commit and discard
operations to match that generation.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c35dbda9-0728-4abb-9b09-e46e1fa2cab5
📒 Files selected for processing (4)
src/main/java/io/cryostat/agent/Registration.javasrc/main/java/io/cryostat/agent/WebServer.javasrc/test/java/io/cryostat/agent/RegistrationTest.javasrc/test/java/io/cryostat/agent/WebServerTest.java
see #876
Summary by CodeRabbit