Skip to content

Add E2E test for non-org-member app deletion authorization#136

Merged
jalexw merged 1 commit into
mainfrom
claude/serene-faraday-J0bPu
Jun 8, 2026
Merged

Add E2E test for non-org-member app deletion authorization#136
jalexw merged 1 commit into
mainfrom
claude/serene-faraday-J0bPu

Conversation

@jalexw

@jalexw jalexw commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive E2E test coverage for the app deletion authorization check that prevents non-organization members from deleting apps, even when authenticated.

Changes

  • New test file: tests/e2e-auth-tests/cypress/e2e/apps/NonOrgMemberCannotDeleteApp.cy.ts

    • Tests that DELETE /api/apps/:app_id returns 403 when the authenticated caller is neither a global admin nor a member of the app's owner organization
    • Verifies the authorization check in auth-server/src/app/api/apps/[app_id]/DELETE_app_handler.ts that validates isUserInOrganizationWithRole(..., "owner")
    • Creates a test organization and app as a superuser, then attempts deletion as an unrelated regular user
    • Validates both the HTTP status code (403) and response body (success: false, message includes "owner")
  • Version bump: tests/e2e-auth-tests/package.json (0.4.4 → 0.4.5)

Implementation Details

  • Fills a critical gap in authorization test coverage: the authenticated-non-owner branch is the most common authorization path a real caller would hit
  • Complements existing coverage:
    • Unauthenticated (401) case covered by misc/UnauthenticatedApiRequests.cy.ts
    • Hardcoded-app protection covered by resource_management/HardcodedResourceDeletionProtection.cy.ts
  • Uses existing Cypress helpers for test setup (superuser login, organization creation, app creation, regular user creation)
  • Properly isolates test data with random codes to avoid conflicts

https://claude.ai/code/session_013GmrB4yjJDNFVmm7oTjTFW

…-member callers

Adds NonOrgMemberCannotDeleteApp.cy.ts in the apps suite to exercise the
"Only organization owners or global admins can delete apps" branch in
DELETE_app_handler. Previously only the unauthenticated (401) and
hardcoded-app (403) paths were covered.
@jalexw jalexw self-assigned this Jun 8, 2026
@jalexw jalexw merged commit ba03022 into main Jun 8, 2026
43 checks passed
@jalexw jalexw deleted the claude/serene-faraday-J0bPu branch June 8, 2026 14:59
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