📝 Add note about FIRST_SUPERUSER_PASSWORD needing to be 40 characters or less#1683
Closed
tylermilner wants to merge 2 commits intofastapi:masterfrom
Closed
📝 Add note about FIRST_SUPERUSER_PASSWORD needing to be 40 characters or less#1683tylermilner wants to merge 2 commits intofastapi:masterfrom
FIRST_SUPERUSER_PASSWORD needing to be 40 characters or less#1683tylermilner wants to merge 2 commits intofastapi:masterfrom
Conversation
… that it should be <= 40 characters
FIRST_SUPERUSER_PASSWORD needing to be 40 characters or lessFIRST_SUPERUSER_PASSWORD needing to be 40 characters or less
YuriiMotov
reviewed
Sep 3, 2025
Member
YuriiMotov
left a comment
There was a problem hiding this comment.
How about changing it this way?
| - `secret_key`: (default: `"changethis"`) The secret key for the project, used for security, stored in .env, you can generate one with the method above. | ||
| - `first_superuser`: (default: `"admin@example.com"`) The email of the first superuser (in .env). | ||
| - `first_superuser_password`: (default: `"changethis"`) The password of the first superuser (in .env). | ||
| - `first_superuser_password`: (default: `"changethis"`) The password of the first superuser (in .env). Must be 40 characters or less. |
Member
There was a problem hiding this comment.
Suggested change
| - `first_superuser_password`: (default: `"changethis"`) The password of the first superuser (in .env). Must be 40 characters or less. | |
| - `first_superuser_password`: (default: `"changethis"`) The password of the first superuser (in .env). Default length constraints: 8–40 characters. |
40 is default max size limit, but it can be configured.
Also, there is a min length limit (8 by default).
| first_superuser_password: | ||
| type: str | ||
| help: The password of the first superuser (in .env) | ||
| help: The password of the first superuser (in .env), must be 40 characters or less |
Member
There was a problem hiding this comment.
Suggested change
| help: The password of the first superuser (in .env), must be 40 characters or less | |
| help: The password of the first superuser (in .env). Default length constraints: 8–40 characters. |
| * `SECRET_KEY`: The secret key for the FastAPI project, used to sign tokens. | ||
| * `FIRST_SUPERUSER`: The email of the first superuser, this superuser will be the one that can create new users. | ||
| * `FIRST_SUPERUSER_PASSWORD`: The password of the first superuser. | ||
| * `FIRST_SUPERUSER_PASSWORD`: The password of the first superuser. Must be 40 characters or less. |
Member
There was a problem hiding this comment.
Suggested change
| * `FIRST_SUPERUSER_PASSWORD`: The password of the first superuser. Must be 40 characters or less. | |
| * `FIRST_SUPERUSER_PASSWORD`: The password of the first superuser. Default length constraints: 8–40 characters. |
Contributor
|
As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR. |
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.
The value of the
FIRST_SUPERUSER_PASSWORDenvironment variable needs to be <= 40 characters or else the prestart logic will fail with a "String should have at most 40 characters" error. See below prestart output when launching usingdocker compose upand aFIRST_SUPERUSER_PASSWORDthat's > 40 characters:I ran into this after following the instructions in
deployment.mdto generate secret keys using this command:I know that
FIRST_SUPERUSER_PASSWORDisn't technically a "key", but it does have a default value ofchangethisin.env, so it was assumed it should be safe to just go ahead and use the above command to generate a secure password for it.This PR adds notes about the
FIRST_SUPERUSER_PASSWORDneeding to be <= 40 characters to the documentation.Optionally, we could also update the above Python snippet to produce 40 character secrets by default, which would further help mitigate the issue:
Let me know if we also want to make that update.