feat(server): plan for auth and read-only mode (#312)#334
Open
le-yams wants to merge 3 commits into
Open
Conversation
Replace the prior design doc (server-auth-readonly-design.md) with a single forward-looking plan where each phase pairs code with the tests that lock its behavior. Reflects the final CLI (--enable-auth as the source of truth, --server-config, mandatory plain:/bcrypt: password prefix) and a deliberately small architecture — two modes (Authenticated / Disabled), --enable-auth without creds errors out at startup, password verifier as an enum, require_auth mounted before the /api nest to sidestep OriginalUri pitfalls. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
181bc41 to
a38c29e
Compare
Author
|
Hello again, I've reworked the plan to fold the test strategy in and simplify the CLI. CLI simplification: Single Architecture simplification: Two modes only — |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hello there,
This PR addresses cooklang/cookcli#312 — making the
cook serverwrite operations require authentication, while keeping anonymous read access available by default.What's in here
A single new file:
docs/plans/2026-04-29-server-auth-plan.md, structured as:server.tomlwith mandatoryplain:/bcrypt:prefixed password)and an extensiblewith a plain Password enum (extended later by adding a variant)PasswordVerifiertrait--auth,--no-auth,--auth-config--enable-auth,--server-config, pluscook server hash-passwordsubcommand)ThreeTwoAuthModestates (Authenticated/ReadOnly/Disabled) and a resolution tableAuthModestates (Authenticated/Disabled) and a resolution table;--enable-authwithout credentials is a startup error rather than a thirdReadOnlyvariantAuthContext, hidden write actions, login page)A 7-phase implementation breakdownA 6-phase implementation breakdown where each phase pairs code with the tests that lock its behaviourNotable design decisions (vs. the issue)
Disabled(legacy behavior preserved with a console warning) instead ofReadOnly, to avoid a breaking change for existing users.Switching to read-only requires explicitEnabling protection requires explicit --enable-auth together with credentials in server.toml; passing the flag alone aborts at startup.--auth/api/sync/*flow is unchanged, just protected by the new local auth.Looking for feedback on
Disabledvs strictly following the issue'sReadOnly)Whether thedropped the trait in favor of a plain Password enumPasswordVerifiertrait abstraction is overkill for shipping justplain+bcryptDisclosure
I'm new to Rust, so I'm using Claude Code to help me explore the codebase, design the plan, and (later) write idiomatic Rust. All design decisions and the final wording of this plan are my own — I've reviewed everything carefully — but it's only fair to flag that a coding assistant is in the loop.