Skip to content

Close known limits: replication epoch and rejoin, key sources, online backups, two-factor, secondary indexes - #11

Open
ChromaBeast wants to merge 18 commits into
mainfrom
claude/limits-combined
Open

ChromaBeast wants to merge 18 commits into
mainfrom
claude/limits-combined

Conversation

@ChromaBeast

Copy link
Copy Markdown
Owner

Summary

Closes the first round of known limits from #10. Five branches merged together on top of main:

  • Replication: leader epoch starts logged in the WAL, rejoin of a fenced node (refused if it holds writes the leader lacks; API, audit, beastctl rejoin), Studio add-replica command and replica lag view, follower bearer token.
  • Encryption: environment and exec-hook key sources, rekey --rewrap-only, sealed audit log. Online data-key rotation and rollback detection are designed in the ADR only.
  • Backups: snapshot that does not hold the engine lock for the copy (ADR 0005), off-host destinations, restore into a new directory.
  • Two-factor: TOTP, recovery codes, enrol and sign-in flow, optional "require for admins" runtime setting (ADR 0007).
  • Collections: single-field secondary indexes, filtered Scan, Studio Indexes page and filter builder (ADR 0006).

ADRs were renumbered so each has its own number (0005 backups, 0006 indexes, 0007 two-factor). Generated protobuf code was regenerated from the merged .proto.

Still not built

Automatic leader election, online key rotation, rollback detection, slow-query index suggestions, KMS integrations beyond the exec hook.

Test plan

  • go build ./... && go vet ./... && go test ./... -race
  • bun test, bun run build, govulncheck ./...
  • CI green on all platforms
  • Backups, two-factor and Indexes page exercised in a running server and browser (not yet done)

…fix of the leader's (API, audit, beastctl rejoin)
… log

- crypt: key specs file:/env:/exec: (no shell, timeout, stderr discarded), zeroing of owned key buffers, Rewrap (atomic keyring replace)
- beastctl rekey --rewrap-only; server flags -encryption-key-env/-cmd
- audit: sealed lines (AES-256-GCM, chain unchanged), plaintext and sealed both open, conversion both ways with encrypt/decrypt/rekey, interrupted-conversion recovery
- Settings/Studio report key source kind and audit log state from the running engine
- ADR 0003: online DEK rotation and rollback detection designed, not built; user store and tokens were already inside the engine
- rebuilt embedded Studio bundle
RFC 6238 TOTP (standard library only) with hashed single-use recovery codes,
replay protection, per-account and per-address limiting on the sign-in limiter,
enrolment/disable/regenerate in Studio Settings, admin reset, an optional
require_2fa_admins runtime setting (default off), audit entries that never carry
codes or secrets, and -reset-admin-2fa for lockout recovery. See ADR 0005.
…irectory

- CreateSnapshot holds the engine lock only for the checkpoint; the data file
  copy runs beside traffic. imageMu keeps checkpoints and Close out until the
  copy ends (ADR 0005).
- backup.Destination with a directory and an exec-hook implementation; startup
  flags only, runtime pause switch, audit entries, no credentials held.
- beastctl restore --new-dir: verify, stage, open, then rename into a path that
  must not exist. Studio generates the command and shows readiness.
- Runbook and README corrected to the real beastctl flags.
… follower bearer token (-leader-token); rebuild embedded bundle; ADR update
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T09:55:25.107554Z a7bc4ec PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7bc4ec4f0

ℹ️ 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".

Comment thread cmd/beastctl/rejoin.go
}

body, _ := json.Marshal(map[string]string{"leaderAddr": leader})
resp, err = client.Post(base.String()+"/api/replication/rejoin", "application/json", bytes.NewReader(body))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Complete two-factor authentication before rejoining

When the admin account has TOTP enabled or require_2fa_admins is on, /login returns HTTP 200 with only a pending cookie, not a session. This command discards that response and immediately calls the admin-protected rejoin API, so beastctl rejoin fails with 403 in those deployments. Handle the verification or setup step before making this call.

Useful? React with 👍 / 👎.

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