clockworklabs / clockworklabs/SpacetimeDB

Cannot use an RLS rule that `JOIN`s with a private table

Open
#2,830 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

Reproduction:

#[table(name=test, public)]
struct Test {
	#[primary_key]
	#[auto_inc]
	id: u64,
}

#[client_visibility_filter]
const TEST_FILTER: Filter = Filter::Sql("SELECT test.* FROM test JOIN test_access ON test.id = test_access.id WHERE user_id = :sender");

#[table(name=test_access)]
struct TestAccess {
	#[primary_key]
	id: u64,
	user_id: Identity,
}

Compiles and publishes successfully, but when querying it fails with:

`test_access` is not a valid table

Should be a pretty obvious case to add a more complex restriction logic based on some private (sensitive) fields.

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 with the client_visibility_filter/RLS path represented by TEST_FILTER and reproduce the published query failure involving test and private test_access. Trace why the private table is rejected at query time despite successful compilation and publication. Done means the JOIN-based filter works while test_access remains private, with coverage for the authorized filtering behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.