Skip to content

Add E2E test for org-member domain POST authorization#142

Merged
jalexw merged 3 commits into
mainfrom
claude/serene-faraday-7z0a3j
Jun 18, 2026
Merged

Add E2E test for org-member domain POST authorization#142
jalexw merged 3 commits into
mainfrom
claude/serene-faraday-7z0a3j

Conversation

@jalexw

@jalexw jalexw commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive E2E test coverage for the authorization check in POST /api/apps/:app_id/domains that prevents organization members (non-owner/admin) from adding domains to private applications.

Changes

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

    • Tests the specific regression case where an org member with role === "member" attempts to add a domain to a private app owned by their organization
    • Verifies that the endpoint correctly returns 403 with an appropriate error message
    • Ensures no resource_id is leaked in the rejected response
    • Complements existing authorization tests by covering the "authenticated member-only" branch (as opposed to non-member or unauthenticated cases)
  • Version bump: tests/e2e-auth-tests/package.json (0.4.8 → 0.4.9)

Implementation Details

The test follows a realistic workflow:

  1. Creates a regular user account (the member)
  2. Logs in as superuser to create an organization and private app
  3. Issues an invitation to the member and has them accept it (establishing role === "member")
  4. Attempts to POST a domain as the member and verifies the 403 rejection

This guards against the specific regression where the authorization check in POST_create_app_domain.ts could be accidentally widened to include member role, allowing any org member to rewrite domain bindings.

https://claude.ai/code/session_01442m5sYx1WZgfdcmfyRkr2

…rg-member (non-owner/admin) caller

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01442m5sYx1WZgfdcmfyRkr2
@jalexw jalexw self-assigned this Jun 18, 2026
claude added 2 commits June 18, 2026 14:09
…sed v4 generator

Cypress browser context lacks crypto.randomUUID() because the auth server is
not served from a secure context. Mirrors the workaround already documented
in example_resource_server/ExternalJwksLoad.cy.ts.

Bumps the package to 0.4.10 to avoid colliding with main's 0.4.9 from #141.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01442m5sYx1WZgfdcmfyRkr2
@jalexw jalexw merged commit e41aa58 into main Jun 18, 2026
43 checks passed
@jalexw jalexw deleted the claude/serene-faraday-7z0a3j branch June 18, 2026 15:15
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