Let the shell fetch its org from the session, not the host

FeatureSecurityService
Shipped
August 24, 2026 at 9:28 PM UTC
Author
Kamo
Commit
f5f2fbe

kamo-internal's root layout reads the Host header, strips "internal." and fetches /org/domain/<that>. On a host serving one tenant that is the same question as "which org am I"; on a shared host it is a different question with a wrong answer -- it returns whoever owns the host, so a member who entered a domainless org would be handed KamoCRM Inc.'s branding, features and flags. Adds GET /api/security/org/current, returning the projected record for the organization the caller's SESSION is in. The layout can reach it because it already forwards the Cookie header and a *** cookie exists, so the server can see a session even though sessionStorage is invisible to a document request. Takes no parameter, deliberately. The first draft accepted an id or alias and **************** correctly refused it: that shape makes every org's record enumerable by guessing an alias, and aliases are guessable. The session already knows which org it is in, so a parameter could only ever ask about a different one. With the session resolved the ratchet passes on its own rather than needing a baseline entry. The projection is extracted rather than copied. Two endpoints returning two shapes of the same record is the failure worth preventing -- a client cannot tell which it holds, and they drift the first time only one is updated. 928 tests pass.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing