Skip to content

fix(credential-groups): harden cursor and cache isolation - #6731

Open
TheodoreSpeaks wants to merge 2 commits into
stagingfrom
fix/credential-group-review-followups
Open

fix(credential-groups): harden cursor and cache isolation#6731
TheodoreSpeaks wants to merge 2 commits into
stagingfrom
fix/credential-group-review-followups

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • bind and sign Credential Group enrollment cursors so replayed or modified boundaries fail closed
  • keep dynamic option cancellation isolated from the shared Credential Group list cache

Type of Change

  • Bug fix

Testing

  • Credential Group enrollment tests
  • Dynamic subblock option tests
  • bun run lint
  • bun run lint:check
  • bun run type-check
  • bun run check:audits

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 15, 2026 10:25am

Request Review

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes enrollment pagination security and shared query cancellation behavior; existing unsigned cursors will be rejected after deploy, which is intentional fail-closed behavior.

Overview
Enrollment list pagination now issues signed, scope-bound cursors instead of plain base64 payloads. Each nextCursor is an HMAC over the boundary (id, invitedAt) and a scope derived from workspace, credential group, email filter, and status filters—replaying a cursor on another group, different filters, or a tampered boundary returns 400 Enrollment cursor is invalid. API validation allows longer cursors via CREDENTIAL_GROUP_ENROLLMENT_CURSOR_MAX_LENGTH (256).

On the Credential Groups workflow block, dynamic dropdown fetchOptionById paths no longer forward abort signals into the shared React Query credential-group list fetch, so option-resolution cancellation does not interfere with the workspace list cache; list loading still uses the query client’s signal.

Reviewed by Cursor Bugbot for commit f4c8f10. Bugbot is set up for automated code reviews on this repo. Configure here.

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/lib/credential-groups/enrollments.ts
@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR signs and scope-binds Credential Group enrollment cursors, raises the request bound to accommodate the new token format, and prevents caller cancellation from affecting the shared Credential Group cache.

  • Adds versioned, HMAC-authenticated enrollment cursors bound to workspace, group, and normalized filters.
  • Uses a shared 256-character cursor limit and verifies emitted cursors against the request schema.
  • Isolates shared cached list requests from dynamic-option cancellation.

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported cursor-length failure is fixed, and no blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/lib/credential-groups/enrollments.ts Introduces versioned HMAC-signed cursors bound to workspace, group, and normalized enrollment filters.
apps/sim/lib/api/contracts/credential-groups.ts Replaces the insufficient 128-character enrollment cursor limit with the shared 256-character bound.
apps/sim/lib/credential-groups/enrollments.test.ts Covers request-schema compatibility, cross-scope replay rejection, and signed-boundary tampering.
apps/sim/blocks/blocks/credential-group.ts Ensures dynamic-option cancellation does not cancel the shared Credential Group list query.
apps/sim/lib/credential-groups/types.ts Defines the shared enrollment cursor length limit used by the API contract.

Sequence Diagram

sequenceDiagram
  participant Client
  participant Schema as Request Schema
  participant Enrollment as Enrollment Service
  participant DB
  Client->>Schema: Request first page
  Schema->>Enrollment: Validated filters
  Enrollment->>DB: Query enrollments
  Enrollment-->>Client: Results + signed, scope-bound nextCursor
  Client->>Schema: Request next page with cursor
  Schema->>Enrollment: Cursor within shared length bound
  Enrollment->>Enrollment: Verify HMAC and request scope
  Enrollment->>DB: Query after authenticated boundary
  Enrollment-->>Client: Next page
Loading

Reviews (2): Last reviewed commit: "fix(credential-groups): accept signed en..." | Re-trigger Greptile

Comment thread apps/sim/lib/credential-groups/enrollments.ts
Comment thread apps/sim/lib/credential-groups/enrollments.ts
@TheodoreSpeaks
TheodoreSpeaks force-pushed the fix/credential-group-review-followups branch from a9aeb9a to f4c8f10 Compare August 15, 2026 10:24
@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@greptile

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit f4c8f10. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant