[BOUNTY] Validate required production secrets in config generator (#1)#22
Closed
leo202000 wants to merge 2 commits into
Closed
[BOUNTY] Validate required production secrets in config generator (#1)#22leo202000 wants to merge 2 commits into
leo202000 wants to merge 2 commits into
Conversation
Add focused validation for required production secrets before a production
config is accepted. The generator now fails fast when database.password,
redis.password, or auth.jwt_secret is empty, missing, or placeholder-like.
- validate_required_secrets() returns human-readable errors identifying the
key path but never the secret value
- generate_config('production') raises SecretValidationError on invalid secrets
- load_secret_overrides() reads TOT_DATABASE_PASSWORD / TOT_REDIS_PASSWORD /
TOT_JWT_SECRET so production configs can be generated from a vault/env
- Non-production environments skip validation so sample generation is unchanged
- Add tests/test_config_secret_validation.py (valid, missing, placeholder,
non-prod compatibility, no-value-leak, env-var loading)
- Document the validation behavior in docs/OPERATIONS.md
Owner
|
Closing this PR because the linked fork issue is only a closed payout tracker for an already submitted upstream PR. This fork is not an active bounty intake or payment authority, and it is not accepting external submissions or payment details here. |
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 #1. Adds focused validation for required production secrets so a production config is never accepted with empty or placeholder-like secret values.
Changes
tools/config_generator.py:validate_required_secrets(config, env)returns human-readable errors that identify the offending key path but never print the secret valuegenerate_config("production")raisesSecretValidationErrorwhen any required secret is empty, missing, or placeholder-like (e.g.changeme,placeholder,todo,<set-me>, or values shorter than 8 chars)load_secret_overrides()readsTOT_DATABASE_PASSWORD/TOT_REDIS_PASSWORD/TOT_JWT_SECRETso production configs can be generated from env vars / a vaultdevelopment,staging) skip validation so sample config generation stays compatibletests/test_config_secret_validation.py: 16 tests covering valid, missing, placeholder-like, short, non-prod compatibility, no-value-leak, and env-var loadingdocs/OPERATIONS.md: documents the validation behavior and required env vars under the Security sectionTesting
Ran locally (Windows, Python 3.14):
python -m unittest tests.test_config_secret_validation-> 16 passedpython -m unittest discover -s tests-> 24 passed (no regressions in existing tests)python tools/config_generator.py --env production --stdout-> fails fast listing the 3 missing secrets (no traceback)python tools/config_generator.py --env development --format json --stdout-> succeeds (non-prod compatible)TOT_*env vars set, production generation succeeds and secrets are masked by default (--show-sensitivereveals them)build.pyand included atdiagnostic/build-e3f58e84.logdChecklist