Repository navigation
fix: secrets are SecretStr, so logs print them masked at any depth - #425
Merged
Merged
Conversation
… so the create-user forms use UserCreateWritable
HardMax71
enabled auto-merge (squash)
October 20, 2026 19:15
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
HardMax71
disabled auto-merge
October 20, 2026 19:17
…igured rounds, not hardcoded
|
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.



Summary
Closes #308. A secret nested in a logged dict, list or model printed in full, since the log sanitizer only checks top-level values. The secrets are now typed so they can't print, instead of a deeper scrubber.
Changes
The Settings secrets (
SECRET_KEY,MONGO_PASSWORD,MONGODB_URL,REDIS_PASSWORD), the passwords inUserCreate,UserUpdateandPasswordResetRequest,UserDocument.hashed_passwordand the two tokens inLoginResultareSecretStr. They print as**********at any depth. The 13 places that need the value call.get_secret_value(), and Beanie still writes the real hash. The spec marks the three password fieldswriteOnly, so hey-api now generatesUserCreateWritable, and the register page and the create-user form validate with it. The dummy hash that evens out login timing is now computed at startup withBCRYPT_ROUNDS, not hardcoded. Webhook URLs stay plain, since the settings page loads them back.Warning
A password under 8 characters now answers 422 with
password: Value should have at least 8 items after validation, not 5instead ofpassword: String should have at least 8 characters. That's Pydantic's wording for a length check onSecretStr. The frontend checks the length before sending, so only direct API clients see it.Type of Change
Test Plan
cd backend && uv run pytest tests/unit)cd frontend && npm run test)docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')cd frontend && npm run test:e2e)./deploy.sh openapi, then./deploy.sh types), never edited by handValidation: a new unit test logs a user document, a login result and the settings nested in one dict. On main the line holds all six secrets; here it holds none. ruff,
mypy --strict, 574 unit tests, svelte-check, ESLint, Prettier, 870 Vitest tests andmkdocs build --strictpass. The full backend e2e suite with k3s and the worker: 493 passed, 1 skipped, as on main.Checklist
pre-commit run --all-filesand all checks pass