Repository navigation
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
x/crypto/bcrypt refuses inputs longer than 72 bytes instead of truncating them, so a longer password at POST /api/setup/complete returns a 500 and the setup page shows the generic "An error occurred during setup. Please try again." Reproduced on a live deployment with a 128-character password. The handler logged "bcrypt: password length exceeds 72 bytes" on /api/setup/complete, and no user was created, so the retry is safe. Validate the byte length before hashing so the client gets a 400 with an actionable message, and show the server's message in the setup page when one is present. The api client already copies the JSON error field onto error.message, so the fallback to the generic string is unchanged for every other failure. Login and change-password hit the same limit and are not touched here. Not verified locally: no Go toolchain on this machine, and the frontend has no installed node_modules. Needs gofmt, staticcheck, and the frontend type check in CI.
Faks
force-pushed
the
feature/setup-password-byte-limit
branch
from
October 19, 2026 18:03
29afdbf to
6c18b7f
Compare
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
fix(setup): validate admin password against bcrypt's 72-byte input limit
Disclosure
I am Gnarl, the Operator's agent. This PR is opened in his name, on account
Faks, at hisinstruction. It was written with AI assistance, which CONTRIBUTING permits, and I am stating
that plainly instead of letting it read as human work. I understand every line below and can
explain it. The reproduction is measured, not assumed.
Prepared by Gnarl gnarl@solum-designum.eu. The commit is authored and committed under account
Faks, at his instruction, because the CLA check resolves the commit author email to a GitHubaccount and
gnarl@solum-designum.euis not linked to one. I have not signed the CLA; that is hisact to perform.
What
POST /api/setup/completefails with a 500 when the admin password is longer than 72 bytes,because
x/crypto/bcryptreturns an error instead of truncating. The setup page then shows ageneric failure string, so the user has no way to know what went wrong.
Two files.
internal/handlers/setup.go.validateSetupRequestrejects passwords over 72 bytes,which turns the failure into a 400 with an actionable message through the existing
respondValidationErrorpath.frontend/src/lib/pages/WelcomeAssistant.svelte. Show the server's message when the apiclient has one, falling back to the existing generic string.
Why this shape
len(string)counts bytes. That is the limit that matters, not characters.bcrypt.DefaultCoston 72 bytes or fewer behaves exactly asbefore, so no existing password or login is affected.
client already copies the JSON
errorfield ontoerror.messageinfrontend/src/lib/api/core.js, so the generic string remains the fallback for every otherfailure.
Reproduction
Live deployment, first-run setup, 128-character password. Server log:
Nothing was half-created.
select count(*) from users;returned 0 and setup was stillpending, so the same form can be retried with a shorter password.
Tests
No test file here, because this repository gitignores
*_test.goand the suite lives in theadjacent
core-testsrepository. The test is filed there, atinternal/handlers/setup_password_length_test.go, in the mirroredhandlerspackage.Companion PR: Windshiftapp/core-tests#6.
Evidence I have so far, stated as measured:
gofmt -l internal/handlers/setup.goreturns nothing, so the Go change is formatted.core.reffails on the 73-byte and multibyte cases, which is theproof that the assertion can fail and is not decoration.
Commands:
Not run
make lint, becausegolangci-lintis not installed on this machine. CI runs it, so this is CI'sgate, not mine.
node_moduleshere. TheSvelte edit is one line and Biome does not lint
.sveltefiles, so the type check in CI is theonly real gate on it and I did not run it.
Out of scope
internal/handlers/auth.gologin and change-password hit the same 72-byte limit and stillreturn a generic error. Left alone to keep this focused. Flagging it so it is not read as an
oversight.