Redact secrets when logging config and warn user when changing categories#19966
Merged
Redact secrets when logging config and warn user when changing categories#19966
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 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: