Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3175d14
Redact secrets when logging
seanbudd Apr 17, 2026
e3a0dea
Apply suggestions from code review
seanbudd Apr 17, 2026
a0702a8
fix inclusion
seanbudd Apr 17, 2026
94c1668
fix up detection and formatting
seanbudd Apr 17, 2026
520d9bc
Pre-commit auto-fix
pre-commit-ci[bot] Apr 17, 2026
098b3cb
document changes
seanbudd Apr 17, 2026
fb2fe7e
review suggestions
seanbudd Apr 17, 2026
9b266b5
Pre-commit auto-fix
pre-commit-ci[bot] Apr 17, 2026
a2551f4
add unit tests
seanbudd Apr 17, 2026
c15a546
Pre-commit auto-fix
pre-commit-ci[bot] Apr 17, 2026
86851a5
Merge remote-tracking branch 'origin/master' into detectSecrets
seanbudd Apr 20, 2026
f58c1f6
fix detect_secrets inclusion
seanbudd Apr 20, 2026
cb35311
fix up
seanbudd Apr 20, 2026
143bd04
Merge remote-tracking branch 'origin/master' into detectSecrets
seanbudd Apr 21, 2026
bec0131
Add log level and warning
seanbudd Apr 21, 2026
cdc846f
Fix behaviour
seanbudd Apr 21, 2026
2d8e7ed
Merge remote-tracking branch 'origin/master' into detectSecrets
seanbudd Apr 21, 2026
0b52053
Pre-commit auto-fix
pre-commit-ci[bot] Apr 21, 2026
3177144
fix elif
seanbudd Apr 21, 2026
43d007b
Add help id
seanbudd Apr 21, 2026
ccc6aa2
Apply suggestion from @seanbudd
seanbudd Apr 21, 2026
00eb8bf
Apply suggestion from @seanbudd
seanbudd Apr 21, 2026
8f54736
restore mathcat?
seanbudd Apr 21, 2026
f0c7c4b
Merge remote-tracking branch 'refs/remotes/origin/detectSecrets' into…
seanbudd Apr 21, 2026
49b2043
Update source/logHandler.py
seanbudd Apr 21, 2026
3924102
Update source/logHandler.py
seanbudd Apr 21, 2026
7c982ff
line end
seanbudd Apr 22, 2026
c71c883
Merge remote-tracking branch 'origin/master' into detectSecrets
seanbudd Apr 22, 2026
85dab52
fix ineq
seanbudd Apr 22, 2026
8a70eba
Merge remote-tracking branch 'origin/master' into detectSecrets
seanbudd Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies = [
"mdx-gh-links==0.4",
"l2m4m==1.0.4",
"pymdown-extensions==10.17.1",
"detect-secrets==1.5.0",
]

[project.urls]
Expand Down
3 changes: 2 additions & 1 deletion source/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ def _loadConfig(self, fn, fileError=False):
profileUpgrader.upgrade(profile, self.validator, writeProfileFunc)
except Exception as e:
# Log at level info to ensure that the profile is logged.
log.info("Config before schema update:\n%s" % profileCopy, exc_info=False)
log.info("Config before schema update:\n%s" % profileCopy, exc_info=False, redactSecrets=True)
raise e
# since profile settings are not yet imported we have to "peek" to see
# if debug level logging is enabled.
Expand All @@ -618,6 +618,7 @@ def _loadConfig(self, fn, fileError=False):
"Config loaded (after upgrade, and in the state it will be used by NVDA):\n{0}".format(
profile,
),
redactSecrets=True,
)
return profile

Expand Down
35 changes: 28 additions & 7 deletions source/logHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,30 @@ class Logger(logging.Logger):

def _log(
self,
level,
msg,
level: int,
msg: str,
args,
exc_info=None,
extra=None,
codepath=None,
activateLogViewer=False,
stack_info=None,
exc_info: _excInfo_t | Literal[True] | BaseException = None,
extra: dict | None = None,
codepath: str | None = None,
activateLogViewer: bool = False,
stack_info: list[traceback.FrameSummary] | bool | None = None,
Comment thread
seanbudd marked this conversation as resolved.
Outdated
redactSecrets: bool = False,
):
"""Logs a message with the given severity level.

:param level: The severity level of the log message.
:param msg: The log message, which may contain format specifiers that will be replaced by the values in `args`.
:param args: The arguments to be merged into `msg` using the `%` operator for string formatting.
:param exc_info: Exception information to be logged, defaults to None
:param extra: Additional information to be logged, defaults to None
:param codepath: The code path where the log was generated, defaults to None
:param activateLogViewer: Whether to activate the log viewer, defaults to False
:param stack_info: Stack information to be logged, defaults to None
:param redactSecrets: Whether to check for and redact secrets in the log message, defaults to False
Comment thread
seanbudd marked this conversation as resolved.
Outdated
:return: The result of the logging operation
Comment thread
seanbudd marked this conversation as resolved.
Outdated
"""
Comment thread
seanbudd marked this conversation as resolved.
Outdated

if not extra:
extra = {}

Expand Down Expand Up @@ -273,6 +288,12 @@ def _log(
"".join(traceback.format_list(stack_info)).rstrip(),
)

if redactSecrets:
from detect_secrets.core.scan import scan_line

for secret in scan_line(msg: str):
Comment thread
github-code-quality[bot] marked this conversation as resolved.
Fixed
msg.replace(secret.secret_value, "****")
Comment thread
seanbudd marked this conversation as resolved.
Outdated

res = super()._log(level, msg, args, exc_info, extra)

if activateLogViewer:
Expand Down
15 changes: 15 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading