Redact secrets when logging config and warn user when changing categories#19966
Merged
Conversation
seanbudd
commented
Apr 17, 2026
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Sean Budd <seanbudd123@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces an opt-in mechanism to redact detected secrets from log output (notably for config dumps), backed by the detect-secrets dependency, and wires it into config logging plus developer-facing documentation.
Changes:
- Add
redactSecretskwarg support to NVDA’s customLogger._logimplementation and perform secret detection/redaction on the formatted message. - Use
redactSecrets=Truewhen logging config state during load/upgrade to reduce risk of leaking secrets into logs. - Add
detect-secrets==1.5.0to dependencies/lockfile and document the new logging parameter in the changelog.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
source/logHandler.py |
Adds redactSecrets kwarg to _log and integrates detect-secrets scanning/redaction into the logging path. |
source/config/__init__.py |
Enables redaction for config dump log messages during load/upgrade. |
pyproject.toml |
Adds detect-secrets as a runtime dependency. |
uv.lock |
Locks detect-secrets and updates dependency lists accordingly. |
source/setup.py |
Ensures detect_secrets is included in build packaging (function-scoped import). |
user_docs/en/changes.md |
Documents the new redactSecrets logging parameter and its intended usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
huh - seems like the module still isn't being included correctly |
seanbudd
commented
Apr 21, 2026
seanbudd
commented
Apr 21, 2026
seanbudd
commented
Apr 21, 2026
CyrilleB79
reviewed
Apr 21, 2026
CyrilleB79
reviewed
Apr 21, 2026
Co-authored-by: Cyrille Bougot <cyrille.bougot2@laposte.net>
Co-authored-by: Cyrille Bougot <cyrille.bougot2@laposte.net>
Member
Author
|
unit tests are failing |
SaschaCowley
approved these changes
Apr 22, 2026
This was referenced May 19, 2026
Merged
seanbudd
pushed a commit
that referenced
this pull request
May 19, 2026
Link to issue number: Fix-up of #19966 Summary of the issue: #19966 introduces secrets logging level. Though, manually testing, we can see that secrets are never masked, no matter the log level. Description of user facing changes: Secrets are now masked in log for log levels higher than "secrets". Description of developer facing changes: N/A Description of development approach: Fixed comparison logic bug. Also fixed unit tests which passed only by chance in Redact secrets when logging config and warn user when changing categories #19966, setting default test log level to INFO instead of NOTSET
seanbudd
pushed a commit
that referenced
this pull request
May 20, 2026
Closes #20125 (discussion) Follow-up of #19966 Summary of the issue: The log level with unredacted secrets was called "secrets". This name was not found to be the most suitable. Description of user facing changes: The lower log level with unredacted secrets is now called "debug (unredacted)" People running alpha / beta who have saved SECRET level as their logging level will have their logging level unrecognized and restored to default (INFO). This is acceptable during alpha/beta phase. Description of developer facing changes: N/A Description of development approach: Updated code. I have not implemented a config upgrade from SECRET to DEBUG_UNREDACTED, since the drawback (level restored to INFO) is acceptable during alpha/beta phase; and implementing a config upgrade step would add just more code to avoid a not very penalizing issue for alpha / early beta tester.
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.
Link to issue number:
Closes #19465
Summary of the issue:
Secrets stored in NVDA config are often unintentionally logged in debug mode by NVDA
Description of user facing changes:
logging will attempt to redact secrets when the developer decides to sanitise risky log messages.
Added a new log level: secrets, to disable redactions for required debug logging.
Added a warning whenever selecting a log level below info.
Description of developer facing changes:
A new
redactSecretsparameter for logging, which searches for and replaces secrets in the log message.Description of development approach:
Use https://github.com/Yelp/detect-secrets
This pull request introduces secret redaction support in logging, ensuring that sensitive information is masked in log outputs when requested.
A new log level is added so you can view unredacted logs if needed.
Secret Redaction in Logging
redactSecretsparameter to theLogger._logmethod inlogHandler.pythat, when enabled, uses thedetect-secretslibrary to scan and mask detected secrets in log messages.source/config/__init__.pyto useredactSecrets=Truewhen logging potentially sensitive configuration data.redactSecretsparameter and recommend its use for sensitive data.Dependency and Packaging Support
detect-secretsas a dependency inpyproject.tomland ensured all relevant submodules are included in frozen builds for dynamic plugin loadingmultiprocessingin bundle - needed for import, seems to functionally work?Testing strategy:
tests/unit/test_logHandler.py, covering both normal and edge cases.Known issues with pull request:
Code Review Checklist: