Skip to content

lore-server: refuse raw mutable-store writes of keys a checked RPC owns - #1

Open
TechArtistG wants to merge 1 commit into
feature/v0.8.14-stress-fixesfrom
fix/raw-store-guard
Open

TechArtistG wants to merge 1 commit into
feature/v0.8.14-stress-fixesfrom
fix/raw-store-guard

Conversation

@TechArtistG

@TechArtistG TechArtistG commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

GRID uses Lore to track versions of simulation assets. A writer could change which version a branch pointed to without going through the checks that protect branches and locked files. This PR blocks direct storage writes that bypass those checks when sign-in is required. A separate PR sets the rules for who may publish shared asset packs.

With auth on, the raw MutableStore and MutableCompareAndSwap RPCs (gRPC v1 and QUIC lore-storage/0.4) refuse the key types a checked RPC owns: branch head, branch record, branch id, repository record, repository id.

Before, a writer could move a branch head with a raw store call, past branch protection, file locks and the parent check that BranchPush applies (GenRobo/GRID#3304).

  • The stock client never writes these keys through the raw RPCs: it moves heads with BranchPush. Untyped and instance keys stay writable.
  • The refusal holds only where a key written under one type cannot be read as another. LocalMutableStore stamps the key type into the stored key, so a branch head relabelled Untyped or Instance lands beside it. A remote or plugin mutable store gives no such guarantee, so under auth a server with one refuses every raw mutable write.
  • An auth-off server is unchanged.

Tests

cargo test -p lore-server --lib -- raw_mutable mutable verify_write: 51 passed (Windows, debug). The new test seeds each of the five key types, checks that raw store and CAS are refused with PERMISSION_DENIED and the value is unchanged, and that the same key relabelled Untyped or Instance does not reach it.

Also run on loopback against this code with the stock CLI and raw gRPC calls: GenRobo/GRID sim/lore/TESTING.md, "Managed packs and the native writer" (branch feature/lore-managed-packs).

Not run: Linux, a release build, the QUIC path over a real socket (covered by the handler test in the PR above this one).

Base: v0.8.18 (318f3fd). First of three; the next is the managed-repository policy.

With auth on, the raw MutableStore and MutableCompareAndSwap RPCs (gRPC v1
and QUIC lore-storage/0.4) refuse the key types a checked RPC owns: branch
head, branch record, branch id, repository record, repository id. A writer
could otherwise move a branch head past protection, file locks and the
parent check BranchPush applies. The stock client never writes these
through the raw RPCs; untyped and instance keys stay writable.

The refusal holds only where a key written under one type cannot be read as
another. LocalMutableStore stamps the key type into the stored key, so a
branch head relabelled Untyped or Instance lands beside it. A remote or
plugin mutable store gives no such guarantee, so under auth a server with
one refuses every raw mutable write.

Refs GenRobo/GRID#3304.

Signed-off-by: Geordie Moffatt <geordie.moffatt@generalrobotics.company>
@TechArtistG
TechArtistG added this pull request to stack #5 November 23, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant