Skip to content

feat: api v2 team invite link endpoint#6

Open
tomerqodo wants to merge 2 commits into
cursor_full_base_feat_api_v2_team_invite_link_endpoint_pr6from
cursor_full_head_feat_api_v2_team_invite_link_endpoint_pr6
Open

feat: api v2 team invite link endpoint#6
tomerqodo wants to merge 2 commits into
cursor_full_base_feat_api_v2_team_invite_link_endpoint_pr6from
cursor_full_head_feat_api_v2_team_invite_link_endpoint_pr6

Conversation

@tomerqodo

@tomerqodo tomerqodo commented Jan 25, 2026

Copy link
Copy Markdown

Benchmark PR from agentic-review-benchmarks#6


Note

Adds a new invite creation endpoint and updates invite generation behavior.

  • New endpoint: POST /v2/teams/:teamId/invite (guarded) returns token and inviteLink via TeamService.createInvite
  • Module wiring: Registers TeamsInviteModule in platform endpoints
  • Response types: Adds CreateInviteOutputDto/InviteDataDto for typed output
  • E2E tests: Admin can create invites; non-admin members and non-members receive 403
  • Service changes: createInvite now returns token as the created record's identifier; modifies link building to return /teams?token=... for org context, otherwise /signup?token=...&callbackUrl=...

Written by Cursor Bugbot for commit 505197c. Configure here.

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


return {
token,
token: newToken.identifier,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Returns identifier string instead of actual token

High Severity

The createInvite method returns newToken.identifier (which is the string "invite-link-for-teamId-{teamId}") instead of the actual cryptographic token. The real token is stored in newToken.token (or the local token variable). This causes the API to return a non-secret identifier rather than the random hex token, breaking invite functionality since users cannot use the returned token to join teams. Compare with line 79 where existing tokens correctly return existingToken.token.

Fix in Cursor Fix in Web

private static async buildInviteLink(token: string, isOrgContext: boolean): Promise<string> {
const teamInviteLink = `${WEBAPP_URL}/teams?token=${token}`;
if (!isOrgContext) {
if (isOrgContext) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inverted condition returns wrong invite link type

High Severity

The condition in buildInviteLink was changed from if (!isOrgContext) to if (isOrgContext), inverting which link type is returned. Now organizations get teamInviteLink (/teams?token=...) while regular teams get orgInviteLink (/signup?token=...&callbackUrl=...). This is backwards—the variable naming indicates orgInviteLink with the signup/onboarding flow was intended for organization contexts.

Fix in Cursor Fix in Web

@ApiHeader(API_KEY_HEADER)
export class TeamsInviteController {
@Post("/invite")
@Roles("TEAM_MEMBER")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Role decorator allows unauthorized members to create invites

High Severity

The @Roles("TEAM_MEMBER") decorator allows any team member to create invite links, but the accompanying tests expect only admins can do so. The RolesGuard checks if the user's role index is less than or equal to the required role index, and with TEAM_ROLES = [TEAM_OWNER, TEAM_ADMIN, TEAM_MEMBER], using TEAM_MEMBER (index 2) permits all members. The decorator needs to be @Roles("TEAM_ADMIN") to restrict access to admins only.

Fix in Cursor Fix in Web

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