Skip to content

feat: optional feature restrictions based on Cursor roles - #27

Open
alex-pex wants to merge 5 commits into
ofershap:mainfrom
alex-pex:feat/access-control
Open

alex-pex wants to merge 5 commits into
ofershap:mainfrom
alex-pex:feat/access-control

Conversation

@alex-pex

@alex-pex alex-pex commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in way to reserve parts of the dashboard to Cursor owners. Nothing changes unless RESTRICTED_FEATURES is set.

What's new

1. Cursor role badge

The settings member list and the user detail page show each member's Cursor role, with owners highlighted.

2. RESTRICTED_FEATURES

A comma-separated list of features reserved to unrestricted users: insights, anomalies, anomalies.actions, user-details, settings, settings.actions. A value also covers its dotted sub-values, and *.actions covers every .actions value.

  • Cursor owners and free-owners, plus the emails in AUTH_UNRESTRICTED_EMAILS, are unrestricted. The role shown in the UI always comes from Cursor.
  • Everyone else is restricted: Cursor members, emails not in Cursor, and anonymous visitors.
  • The Overview is never restricted.
  • It works with any sign-in (the sign-in email gives the Cursor role) and also without sign-in. With no session, visitors are anonymous and treated as members. There is no way around the restrictions, since there is no identity to claim an exemption from.
  • Restricted pages redirect to the Overview, restricted API calls get a 403, nav links are hidden, links to other members are greyed out, and settings.actions makes Settings read-only.

3. Proxy matcher

The matcher skipped any path containing .svg. The app serves no SVG files, so the exclusion is removed and the proxy now runs on every route. A test is added.

Checks

npm run typecheck, npm run lint and npm test pass.

🤖 Generated with Claude Code

alex-pex and others added 3 commits November 4, 2026 22:26
Display each member's Cursor role as a badge in the settings member list
and on the user detail page, with owners highlighted in orange like the
other badges. getGroupsWithMembers now returns the role from members.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add an opt-in access control that follows Cursor roles. Setting
RESTRICTED_FEATURES to a comma-separated list reserves those features
to unrestricted users. A value also restricts its dotted sub-values and
*.actions covers every .actions value. Nothing is restricted by default.

Cursor owners and free-owners, plus the emails in
AUTH_UNRESTRICTED_EMAILS, are never restricted. Members, emails without
a Cursor account and anonymous visitors are, and the role shown in the
UI is unchanged. The overview and the routes it relies on stay open.

Values: insights, anomalies, anomalies.actions (Ack/Resolve),
user-details (other members' pages, the person's own page stays
available), settings and settings.actions (read-only Settings).

The proxy maps each request to a feature and answers 403 for the API or
redirects pages to the overview. The nav hides restricted pages, links to
other members are greyed out, and the Settings and anomaly actions are
hidden when restricted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The matcher excluded any path containing ".svg" because the pattern was
not anchored, so a request like PATCH /api/incidents/5.svg skipped the
proxy and with it the login redirect and the access checks, while the
incidents route still parsed the id as 5. The app serves no SVG files,
so drop the exclusion and add a regression test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ofershap

ofershap commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Tested this at 1bc33a1. Typecheck, lint, all 31 tests and the production build pass locally on Node 22.

One access-control gap before merging: RESTRICTED_FEATURES=insights blocks /insights, but /api/analytics is unmapped in routeFeature, so it still returns 200 with the same Insights data. Reproduced on the production build with the generated mock database and no session: the page redirects to /, while the API returns model usage, MCP, commands, client versions and versionUsers including names/emails.

Please map /api/analytics to insights and add a regression test that exercises the proxy response, not just the route helper: restricted member and anonymous requests should get 403, while owners/unrestricted users and the default empty restriction list keep working. If any analytics fields must remain available to Overview, split or filter that response rather than leaving the entire Insights payload open.

Leaving this open for that fix. No production access settings have been changed.

alex-pex and others added 2 commits November 13, 2026 10:45
/api/analytics returned the Insights payload (including client version
users) to restricted and anonymous viewers while /insights redirected.
Map it to the insights feature and test the proxy response itself.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The overview fetched /api/analytics, the full Insights payload, only to
filter members by plan exhaustion day. Return the few fields it needs from
getFullDashboard instead, so the filter needs no extra request.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@alex-pex

alex-pex commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Good catch, thanks. Pushed two commits:

  • 07e78c8: /api/analytics now falls under insights, with a test that goes through the proxy itself (403 for anonymous and restricted viewers, owners and the default setup unaffected).
  • a67dd35: the Overview only used that route for the plan-exhaustion filter, so it now reads that from its own data instead of calling /api/analytics.

I haven't rerun the production build. One question: restricted viewers can now see a "days to exhaust" number per email through the Overview. I think that's fine, but tell me if you'd rather gate it.

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.

2 participants