Skip to content

Improvement: ORG_SLUG_REQUIRED / ORG_SLUG_INVALID never tell an authenticated API caller their own valid org slugs #3097

Closed

Description

@larryro

Problem

When an authenticated API caller belongs to multiple organizations, ORG_SLUG_REQUIRED tells them to provide X-Organization-Slug — but nothing tells them which slugs are valid. A caller who mistypes gets the deliberately ambiguous ORG_SLUG_INVALID and is left guessing.

Evidence — one authenticated API caller's 3-minute struggle on 2026-08-25 (GlitchTip, demo.tale.dev)

  1. 10:32:28 TALE-PROJECT-11T — ORG_SLUG_REQUIRED: User belongs to multiple organizations. Provide X-Organization-Slug header.
  2. 10:32:58 TALE-PROJECT-11U — ORG_SLUG_INVALID: Organization not found: vatplus
  3. 10:35:14 TALE-PROJECT-11V — … not found: vat_plus
  4. 10:35:18 TALE-PROJECT-120 — … not found: vatplus-ch

Then silence — gave up, or found the slug somewhere else. All via organizations/resolve_user_organization:resolveUserOrganization, the resolver shared by every API-key-authenticated HTTP surface (services/platform/convex/organizations/resolve_user_organization.ts).

Read

The resolver's anti-probing design (see the file's header note: an explicit slug always requires a current membership, so foreign slugs can't be probed) is right and must stay. But when the caller is already authenticated and the failure is "you belong to multiple orgs, pick one", listing the caller's own membership slugs discloses nothing — it's their data — and would have ended this in one round-trip.

Proposed fix

  • ORG_SLUG_REQUIRED throw (~line 137): include the caller's member org slugs in the error data/message, e.g. … Provide X-Organization-Slug header. Your organizations: acme, vatplus-gmbh.
  • ORG_SLUG_INVALID throw (~line 54): keep the deliberately ambiguous Organization not found: <slug> (anti-probe), but append the same own-memberships list for authenticated callers — it reveals nothing about the probed slug beyond what the message already does.
  • Check that the API docs / the settings surface where API keys are issued show the org slug to copy.

Acceptance

A multi-org API caller who omits or mistypes the header learns their valid slugs from the error response itself; nothing about non-member orgs is disclosed.


Filed by the GlitchTip triage sweep of demo.tale.dev (2026-08-28). Tracked on the tale board as TAL-20 — "API org resolution demands X-Organization-Slug but never says which slugs are valid" (status: backlog).

Activity

  1. added
    priority: low
    improvement
    service: platform
    automated
    on Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    automatedimprovementpriority: lowservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions