Auto-submit an expired consent prompt as a denial - #57
Conversation
A timed out consent prompt left the user stranded: its actions no longer led anywhere, so the flow could not proceed or terminate. Submit on expiry instead, carrying a timeout reason the server uses to discard the decisions and record nothing. Consent decisions now carry a top level approved flag alongside the existing per purpose and per element ones. Approval is hierarchical, so a denial at any level denies everything below it while an approval leaves the decisions below it intact. Also compile the top level flag in the two other places consent decisions are built, guard the permission purposes the server sends with a null essential list, and stop treating an untouched optional claim as approved when accepting an invite. Fixes #4600 Refs #4413
|
Warning Review limit reached
Next review available in: 42 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe PR extends consent decisions with overall approval and reason fields, tightens optional approval checks, handles absent purpose arrays, adds consent decision tests, and auto-submits expired consent prompts with a denial reason. ChangesConsent flow
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant SignIn
participant SubmitAction
participant ConsentDecision
participant Server
SignIn->>SubmitAction: select routable timeout action
SignIn->>ConsentDecision: mark timed-out consent denied
SignIn->>ConsentDecision: add timeout reason
ConsentDecision->>Server: submit compiled consent decision
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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: 2
🤖 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 `@packages/react/src/components/presentation/auth/AuthOptionFactory.tsx`:
- Around line 378-385: Centralize consent-decision compilation in
`@thunderid/javascript` by adding the shared compiler, consent optional-key
helper, and exported ConsentDecisions type. Replace the independent
decision-building logic in AuthOptionFactory.tsx (lines 378-385),
BaseAcceptInvite.tsx (lines 555-563), and SignIn.tsx (lines 767-786) with calls
to the shared compiler, preserving the established approval rules and optional
reason handling at all three sites.
In `@packages/react/src/components/presentation/auth/SignIn/SignIn.tsx`:
- Around line 906-938: The timeout effect around handleTimeout must use the
current flow context when the step changes without changing stepTimeout. Refresh
the callback’s access to components, additionalData consentPrompt, and
handleSubmit by updating the effect dependencies with stable references or
synchronizing the current context through refs, while preserving the existing
timeout and deduplication behavior. Add a regression test covering a step update
that retains the same deadline and verifies the timer submits using the updated
context.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3cfcca98-15db-46a2-8e98-8f0b6d9af0ee
📒 Files selected for processing (5)
packages/javascript/src/models/embedded-flow.tspackages/react/src/components/presentation/auth/AcceptInvite/BaseAcceptInvite.tsxpackages/react/src/components/presentation/auth/AuthOptionFactory.tsxpackages/react/src/components/presentation/auth/SignIn/SignIn.tsxpackages/react/src/components/presentation/auth/__tests__/AuthOptionFactory.test.tsx
The Vue consent paths built decisions without the new top level approved flag, which broke the build, and one of them still treated an untouched optional claim as approved. Bring both in line with the React paths and guard the permission purposes the server sends with a null essential list. Record a reason for an explicit denial too, so a denial and a timeout are told apart by the same field rather than by inference. Both values now live in ConsentConstants in the core package, since five call sites across two framework packages need them. Read the timeout callback's flow context through a ref. The effect is keyed on the deadline alone, so a step arriving with the same deadline would otherwise leave the pending timer holding the previous step's components and submit handler.
Purpose
A timed-out consent prompt left the user stranded because its actions were no longer valid and the flow could neither proceed nor terminate. This change automatically submits the
consent prompt when it expires, carrying a timeout reason so the server can complete the flow without recording consent decisions.
Consent decisions now include a top-level approved flag alongside the existing purpose-level and element-level flags. Approval is hierarchical: denying a level denies everything
below it, while approving a level preserves its child decisions.
The change also:
🔧 Summary of Breaking Changes
ConsentDecisions now requires a top-level approved property.
💥 Impact
Consumers that construct ConsentDecisions directly must provide the new property.
🔄 Migration Guide
Add approved when constructing consent decisions:
Set it to false when the entire consent request is denied.
Approach
Related Issues
Related PRs
Checklist
Followed the contribution guidelines.
Manual test round performed and verified.
Documentation provided. Not applicable.
Tests provided.
Breaking changes.
Security checks
Summary by CodeRabbit