API testing

Test cross-tenant access is blocked

Hard120 pts
  • Multi-tenancy
  • Broken object-level authorization
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/api-testing-test-cross-tenant-access-is-blocked

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Prove a user can read their own tenant's invoices but not another tenant's.

Your Task

  1. 1POST BASE_URL + "/auth/token" with viewer credentials { "username": "viewer@target.dev", "password": "Viewer@123" } (tenant "globex") and extract access_token.
  2. 2GET BASE_URL + "/tenants/globex/invoices" with Authorization: Bearer <access_token> → assert 200.
  3. 3GET BASE_URL + "/tenants/acme/invoices" with the same token → assert 403 and error.code "FORBIDDEN".

Validation Checks

  • Own tenant returns 200
  • Other tenant returns 403
  • At least 2 assertions pass

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · API Testing Practice Track · Authorization & negative testing