fix: Endpoint /upgradeToRevocableSession ignores _Session protectedFields#10408
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a test for upgrading a legacy session to a revocable session with protected fields configured as non-exempt, and refactors the revocable-session upgrade handler to async/await and to re-fetch the created Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant SessionsRouter
participant Database
participant Auth
participant RestFind
Client->>SessionsRouter: POST /upgradeToRevocableSession (sessionToken, installationId)
SessionsRouter->>Database: createSession() (master auth)
Database-->>SessionsRouter: new _Session record
SessionsRouter->>Database: clear legacy _User.sessionToken
Database-->>SessionsRouter: deletion ack
SessionsRouter->>Auth: build non-master Auth from caller context
Auth-->>SessionsRouter: non-master Auth instance
SessionsRouter->>RestFind: rest.find(_Session, query, non-master Auth)
RestFind->>Database: query _Session
Database-->>RestFind: results (filtered by protectedFields/CLP)
RestFind-->>SessionsRouter: filtered session result
SessionsRouter-->>Client: { response: filtered session }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Routers/SessionsRouter.js`:
- Around line 92-101: Guard against empty or missing results from the rest.find
call before indexing into response.results[0]; in the SessionsRouter.js flow
where you call rest.find with config, userAuth, '_Session', and
sessionData.sessionToken, check that response and response.results exist and
have at least one element, and return a safe value or throw a controlled error
(e.g., return null or an explicit error/401) instead of directly returning
response.results[0].
🪄 Autofix (Beta)
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 92d0984d-c755-44ed-9986-fa56ef0d52c5
📒 Files selected for processing (2)
spec/RevocableSessionsUpgrade.spec.jssrc/Routers/SessionsRouter.js
|
@coderabbitai review your feedback conversations and resolve where you found a consensus |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 1114 🏁 Script executed: Length of output: 260
🧠 Learnings used |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha #10408 +/- ##
==========================================
- Coverage 92.49% 92.49% -0.01%
==========================================
Files 192 192
Lines 16732 16736 +4
Branches 229 229
==========================================
+ Hits 15477 15480 +3
- Misses 1233 1234 +1
Partials 22 22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# [9.8.0-alpha.8](9.8.0-alpha.7...9.8.0-alpha.8) (2026-04-07) ### Bug Fixes * Endpoint `/upgradeToRevocableSession` ignores `_Session` `protectedFields` ([#10408](#10408)) ([c136e2b](c136e2b))
|
🎉 This change has been released in version 9.8.0-alpha.8 |
Pull Request
Issue
Endpoint
/upgradeToRevocableSessionignores_SessionprotectedFieldsTasks