-
-
Notifications
You must be signed in to change notification settings - Fork 84
feat: orgs integration with supertokens #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: orgs integration with supertokens #453
Conversation
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 21355900 | Triggered | Generic Password | 371cd7b | api/internal/features/supertokens/auth.go | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
WalkthroughAdds organization-scoped roles and invite flows: passwordless invites, SuperTokens org-bound role/permission handling, RBAC changes to require X-Organization-Id, new invite endpoints and frontend invite page, refactors organization service/storage/types/validation, removes legacy organization handlers, and wires routes/UI/Redux for invites and role management. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant FE as Frontend (Invite Page)
participant ST as SuperTokens (Passwordless)
participant API as API (Overrides)
participant EM as Email Provider
U->>FE: Open invite link (org_id, role, email)
FE->>ST: consumeCode(userContext: org_id, role, email)
ST-->>API: Invoke overrides (Create/Consume)
API->>API: Upsert user, ensure org membership
API->>API: Create org-scoped role (orgid_<org>_<role>) if needed
API->>API: Assign role to user
API-->>ST: Return success
ST-->>FE: Session + claims updated
FE-->>U: Redirect to /dashboard
note over API,ST: Email magic link is sent via ST during CreateCode
sequenceDiagram
autonumber
participant C as Controller (UpdateUserRole)
participant V as Validator
participant S as OrgService
participant ST as SuperTokens
participant Cache as Cache
C->>V: Validate UpdateUserRoleRequest
V-->>C: OK or 400
C->>S: UpdateUserRole(request)
S->>S: Verify org, user, membership
S->>ST: Remove old org-scoped roles
S->>ST: Create/ensure role with permissions
S->>ST: Add role to user
S->>Cache: Invalidate org-membership cache
S-->>C: Result
sequenceDiagram
autonumber
participant MW as RBAC Middleware
participant Sess as Session
participant API as Handler
MW->>MW: Read X-Organization-Id
MW->>Sess: Get roles/permissions claims
MW->>MW: Filter roles by orgid_<org>_
MW->>MW: Check required permission
alt Allowed
MW->>API: Proceed
else Denied
MW-->>API: 403 Forbidden
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (48)
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 |
|
@coderabbitai summary and title |
🧩 Analysis chain🏁 Script executed: Unrecoverable error: Sandbox execution failed: max_buffer, terminated 🏁 Script executed: Length of output: 670 🏁 Script executed: Length of output: 268653 @raghavyuva, I'll generate a summary and update the title for this PR. Suggested TitleSummaryThis PR implements comprehensive multi-tenant organization functionality integrated with SuperTokens for authentication and authorization. The changes span both backend API and frontend UI to provide a complete team management system. Backend Changes (API)Organization Management:
SuperTokens Integration:
Invitation System:
API Endpoints Added:
Frontend Changes (View)Team Settings UI:
State Management:
Components:
Infrastructure
This implementation provides a foundation for multi-tenant SaaS functionality with proper authentication, authorization, and user management capabilities. Files Changed: 50 files (+1,811 / -676 lines) ✅ Actions performedSummary regeneration triggered. |
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
Summary by CodeRabbit
New Features
Improvements
Chores