Skip to content

feat: implement AUTH requirepass (F-02)#34

Merged
phaethix merged 1 commit into
masterfrom
feat/auth-requirepass
Jul 18, 2026
Merged

feat: implement AUTH requirepass (F-02)#34
phaethix merged 1 commit into
masterfrom
feat/auth-requirepass

Conversation

@phaethix

Copy link
Copy Markdown
Owner

Summary

Adds Redis-style connection authentication gated by an optional requirepass password (product-strategy F-02 security baseline).

  • engine: new auth_password: Arc<RwLock<Option<Vec<u8>>>> with set_requirepass / requirepass / authenticate; shared so a runtime CONFIG SET requirepass is visible to already-accepted connections.
  • protocol: Command::Auth variant + AUTH parser arm (arity 1).
  • network: handle_client gates every non-AUTH command with a per-connection authed flag declared once before the read loop (survives packet boundaries and pipelining). auth_reply emits +OK / -WRONGPASS / -ERR. Unauthenticated commands get -NOAUTH.
  • config: requirepass exposed in CONFIG GET * and settable at runtime via CONFIG SET requirepass.
  • cli/config: --requirepass flag and requirepass config-file directive (CLI overrides file).
  • tests: wire-level AUTH gating, WRONGPASS, mid-connection CONFIG SET requirepass, CONFIG GET round-trip, plus parser and CLI unit tests.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets ✅ (all green, including new AUTH wire tests)

Notes

Gates on the same quality gates as F-01. After merge, bump Cargo.toml to 0.5.1 and tag v0.5.1.

Add Redis-style connection authentication gated by an optional
requirepass password. Every command except AUTH is rejected
with -NOAUTH until a successful AUTH is seen on the connection.

- engine: add auth_password state with set_requirepass/requirepass/
  authenticate, shared via Arc<RwLock> so a runtime CONFIG SET
  is visible to already-accepted connections
- protocol: add Command::Auth and the AUTH parser arm (arity 1)
- network: gate non-AUTH commands in handle_client with a
  per-connection authed flag that survives packet boundaries;
  auth_reply emits +OK / -WRONGPASS / -ERR
- config: expose requirepass in CONFIG GET * and support
  CONFIG SET requirepass at runtime
- cli/config: add --requirepass flag and requirepass directive
- tests: wire-level AUTH gating, WRONGPASS, CONFIG round-trip,
  plus parser and CLI unit tests

Implements the security baseline from product-strategy F-02.
@phaethix
phaethix merged commit 06c94e1 into master Jul 18, 2026
3 checks passed
@phaethix
phaethix deleted the feat/auth-requirepass branch July 18, 2026 17:29
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