fix(server): prevent one caller exhausting the global live-team registry
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 152
- Forks
- 16
- Avg merge
- 14h 48m
- Merged PRs (30d)
- 536
Description
Problem
Service.CreateTeam limits the live-team registry only with the process-wide MaxTeams check (len(s.teams)). One authenticated tenant can create cheap zero-member teams up to that limit and leave them uncleaned, preventing every other tenant from creating a team until registry entries are removed or the process restarts.
Caller ownership is being addressed separately in acc/caller-separation. This issue must follow that work so quota accounting uses the verified owner identity (Issuer, Subject), not Subject alone or an ad-hoc team-specific identity.
Scope
- Add a configurable per-owner live-team limit keyed by verified
(Issuer, Subject). - Retain
MaxTeamsas the process-wide circuit breaker. - Maintain per-owner accounting atomically under
Service.muacross successful creation, cleanup, and shutdown removal paths. - Define the compatibility behavior when
OwnershipEnforcedis false; do not silently aggregate all legacy callers as one authenticated owner. - Add regressions proving:
- one caller is rejected after exhausting its own quota;
- another caller can still create a team when the first caller has exhausted only its quota;
- the same subject from different issuers has independent quota buckets; and
- cleanup frees capacity only for the owning caller.
Out of scope
- The ownership/authorization fix itself (owned by
acc/caller-separation). - TTL-based reaping.
- The similar global
ErrTooManySessionEnginescap, which needs separate scoping.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Service.CreateTeam and Service.mu, then follow the cleanup and shutdown removal paths alongside the acc/caller-separation work to verify the owner identity used for quota accounting. Done means the listed regressions pass: per-owner rejection, independent callers and issuers, and cleanup freeing capacity only for the owner.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100