Repository navigation
fix: remove CLI credential timeout and password complexity limits - #20
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes the previous CLI/admin password length/complexity constraints and fixes bcrypt’s 72-byte input limitation by introducing a tagged SHA-256 pre-hash for longer passwords, ensuring long passwords can still be used and verified safely.
Changes:
- Replace legacy password length checks with an
ErrEmptyPasswordsentinel and accept short/long passwords. - Add
hashPassword/comparePasswordhelpers to support passwords longer than bcrypt’s 72-byte limit via a tagged SHA-256 pre-hash. - Remove the CLI menu’s 30s timeout for the reset-credentials flow and update prompts accordingly; extend tests to cover new accepted password shapes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/server/general_api.go | Maps empty-password errors via errors.Is instead of fragile substring matching. |
| internal/auth/service.go | Removes old length rules; introduces tagged pre-hash + compare helpers for long passwords; adds ErrEmptyPassword. |
| internal/auth/service_test.go | Adds coverage to ensure short and long passwords are accepted and can authenticate. |
| cmd/vocat/menu.go | Removes the 30s timeout for reset-admin flow and updates password prompt text. |
| cmd/vocat/bootstrap_admin.go | Removes length validation and the stdin read limit while bootstrapping admin credentials. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+26
to
34
| reader := bufio.NewReader(os.Stdin) | ||
| password, err := reader.ReadString('\n') | ||
| if err != nil && !errors.Is(err, io.EOF) { | ||
| return fmt.Errorf("read password: %w", err) | ||
| } | ||
| password = strings.TrimSuffix(strings.TrimSuffix(password, "\n"), "\r") | ||
| if len(password) < 6 || len(password) > 1024 { | ||
| return errors.New("bootstrap password must contain between 6 and 1024 characters") | ||
| if password == "" { | ||
| return errors.New("bootstrap password cannot be empty") | ||
| } |
MengMengCode
added a commit
that referenced
this pull request
Aug 15, 2026
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.
remove CLI credential timeout and password complexity limits