Repository navigation
fix(security): reserve the system partition on client surfaces - #12
Conversation
Console users and API tokens were stored at keys the data APIs could address. A gRPC writer token could overwrite the admin user record and then sign in to the console; a viewer could read password hashes. - Partition 0x05 is a reserved system partition. gRPC Get, Put, Delete and BatchWrite (operations and conditions) reject its keys with PermissionDenied, and Scan skips them. The console's data routes hide it: keys read as absent, writes are refused, and scans, search and partition counts leave it out. - Console user records move into the system partition. The admin account is migrated at startup; sign-in never falls back to the old key, because clients can write there. - Followers reload API tokens every 15 s, so a token revoked on the leader stops working there without a restart. - Snapshots are written 0600 instead of 0644. Ported onto current main: the guard sits beside the collection catalog checks, and the console's checkpoint, collection and index routes use the unguarded engine because they cannot reach the system partition.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4eb31c2cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| func (g systemGuard) Search(query string, limit int, prefix uint8) ([]api.RecordItem, error) { | ||
| items, err := g.EngineReader.Search(query, limit, prefix) | ||
| return withoutSystem(items), err |
There was a problem hiding this comment.
Filter system matches before applying the search limit
For an unprefixed /api/search request using the fast path, Engine.Search has already stopped at the requested limit, and the handler marks any nonempty indexed result as having no more results. Because system matches are removed only here, they can consume slots ahead of later ordinary records and silently truncate results; if any ordinary matches remain, the fallback scan is skipped. Exclude system keys before applying the limit, or fall back when filtering removes candidates.
Useful? React with 👍 / 👎.
What
Console users and API tokens were stored at keys the data APIs could address, so a client with write access could rewrite credentials:
Port of the security fix that had only lived on local branches (
security/system-partition), rebased onto current main.Changes
0x05is a reserved system partition. gRPCGet,Put,DeleteandBatchWrite(operations and conditions) reject its keys withPermissionDenied;Scanskips them.0600instead of0644.Porting notes
CollectionStoreandIndexStoreinterfaces (501). They cannot reach the system partition: partition0x05cannot be bound to a collection.Testing
go build ./... && go vet ./... && go test ./... -race -p 1passes locally. New tests cover gRPC rejection of system keys, the console guard, and the legacy-user migration.