Skip to content

fix(org): allow string orgId in deleteTeamMember to fix CI build - #8

Merged
JOY (JOY) merged 1 commit into
mainfrom
dev
Aug 26, 2026
Merged

JOY (JOY) merged 1 commit into
mainfrom
dev

Conversation

@JOY

@JOY JOY (JOY) commented Aug 26, 2026

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix & CI/CD stability

Why was this change needed?

Fixes a TypeScript type mismatch error in OrganizationService.deleteTeamMember where DosOrgSyncWebhookController passed a string orgId while the method originally strictly expected an Organization object.

Other information:

  • Unblocks the GitHub Actions Build and Build & Publish Crove Containers workflows.

Checklist:


Note

Medium Risk
The new string overload skips in-service role checks for webhook-driven removals; callers must be trusted, while the user-facing delete path is unchanged.

Overview
OrganizationService.deleteTeamMember now accepts either an Organization or an org id string, fixing the TypeScript mismatch when DosOrgSyncWebhookController removes members with targetOrg.id.

When the first argument is a string, the service delegates straight to the repository (no membership/role-level checks). The existing settings flow still passes a full Organization and keeps the same permission checks, with optional chaining on users?.[0]?.role so role reads don鈥檛 blow up if users is missing.

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

Fix TypeScript compilation error in CI by supporting both Organization object and string orgId in OrganizationService.deleteTeamMember.

Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor

cursor Bot commented Aug 26, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_799da80d-6af1-49a2-a253-0978fa7ff666)

@JOY
JOY (JOY) merged commit 39ce53e into main Aug 26, 2026
11 checks passed

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the deleteTeamMember method in OrganizationService to accept either an Organization object or a string representing the organization ID, while also adding optional chaining to user role checks. The review highlights a significant security risk with this change, as overloading the method to accept a string allows authorization and role checks to be bypassed. It is recommended to keep deleteTeamMember strictly typed to Organization and introduce a separate, explicitly named method for system-level deletions.

Comment on lines +161 to +164
async deleteTeamMember(org: Organization | string, userId: string) {
if (typeof org === 'string') {
return this._organizationRepository.deleteTeamMember(org, userId);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

Overloading deleteTeamMember to accept either an Organization object or a string orgId introduces a significant security risk (authorization bypass). When a string is passed, all permission and role checks are silently bypassed. If a developer in a user-facing controller accidentally passes a string orgId instead of the full Organization object, any user could delete team members without authorization.

To prevent this, keep deleteTeamMember strictly typed to Organization to enforce permission checks, and expose a separate, explicitly named method (e.g., deleteTeamMemberByOrgId) for system/webhook actions that are allowed to bypass these checks.

Suggested change
async deleteTeamMember(org: Organization | string, userId: string) {
if (typeof org === 'string') {
return this._organizationRepository.deleteTeamMember(org, userId);
}
async deleteTeamMemberByOrgId(orgId: string, userId: string) {
return this._organizationRepository.deleteTeamMember(orgId, userId);
}
async deleteTeamMember(org: Organization, userId: string) {

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