raystack / raystack/frontier

Disabled orgs are still granted permissions through the Check API

Open
#1,863 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
344
Forks
47
Avg merge
4d 4h
Merged PRs (30d)
26

Description

The disabled-org gate added in #1860 covers the management and resource RPCs (the authorization map), but the SpiceDB Check API is deliberately out of its scope:

  • CheckResourcePermission
  • BatchCheckPermission
  • CheckFederatedResourcePermission

These are on the authorization skip list and answer purely from SpiceDB tuples. Because disabling an org leaves its tuples in place (by design, so re-enable restores access), these endpoints keep returning allowed = true for resources of a disabled org. External services that gate their own access on these checks will keep serving a disabled org's resources.

Two ways to close it

  1. Handler/service guard (Postgres read): resolve each checked resource to its org and return false when the org is disabled. Simple, no migration, but adds 1–3 point reads per check on a hot path, and overloads "denied" to also mean "suspended".
  2. SpiceDB marker relation (preferred): add a suspended relation on the org that every permission subtracts (- org->suspended); write the tuple on disable, remove it on enable. Reflects org state in every check — single, batch, and federated — with no extra Postgres reads, since it rides the existing permission traversal. Requires a schema migration, disable/enable flow changes, and a backfill for currently-disabled orgs. Care needed so platform/superuser permissions are not subtracted (admins must still manage and re-enable).

Recommendation: option 2.

Relates to #1585.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing CheckResourcePermission, BatchCheckPermission, and CheckFederatedResourcePermission, then follow the existing disable and enable flows and authorization schema. Implement the recommended SpiceDB suspended relation, including schema migration, tuple updates, and a backfill for currently disabled organizations. Done means all three checks deny disabled-org resources while platform and superuser permissions still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgres
Domain
api, authorization, database, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.