Skip to content

security: remove clear-text exception logging in secrets backend (alert 53) - #134

Merged
abhihashi merged 3 commits into
mainfrom
fix/secvuln-53-clear-text-logging-access
Aug 19, 2026
Merged

security: remove clear-text exception logging in secrets backend (alert 53)#134
abhihashi merged 3 commits into
mainfrom
fix/secvuln-53-clear-text-logging-access

Conversation

@abhihashi

Copy link
Copy Markdown
Contributor

Summary

Fixes code scanning alert #53 — clear-text logging of sensitive information at grove/secrets/__init__.py:74.

Root cause

The exception object was passed directly into the structured log extra dict inside the AccessException / IndexError handler. Secret backends (AWS Secrets Manager, Vault, etc.) can echo credential paths or values back inside their error messages. Binding err to extra caused the full exception string — potentially including secret material — to be emitted as clear-text in every log pipeline.

Change

- except (AccessException, IndexError) as err:
+ except (AccessException, IndexError):
      self.logger.error(
          "Unable to get secret for connector, skipping",
          extra={
              "document": configuration.name,
              "field": field,
-             "exception": err,
          },
+         exc_info=False,
      )
  • Removes exception: err from extra so no secret material enters the log record.
  • Sets exc_info=False explicitly to prevent the logger from attaching the traceback (which could also carry the exception message) via a parent handler configured with exc_info=True.

@abhihashi
abhihashi requested a review from a team as a code owner August 14, 2026 19:23
@abhihashi
abhihashi force-pushed the fix/secvuln-53-clear-text-logging-access branch from c83ca5a to 2c67c17 Compare August 14, 2026 21:13
cugu
cugu previously approved these changes Aug 17, 2026
ruff 0.16.x expanded its default rule set to include UP (pyupgrade), PIE,
and RUF rules not previously enforced, causing CI to fail on every PR.
This commit resolves all violations so the lint step passes cleanly.

Changes in pyproject.toml:
- Add [tool.ruff.lint] with an explicit select and ignore list, pinning the
  enforced rule set so future ruff upgrades cannot silently add new failures
- Ignore E501 (line-too-long) and RUF012 (mutable-class-default) which are
  either the formatter's responsibility or a pydantic Field() pattern

Codebase changes (ruff --fix + manual):
- UP006/UP007/UP045: replace deprecated typing generics (List, Dict,
  Optional, Tuple) with built-in equivalents (list, dict, X | None, tuple)
- UP035: remove unused 'from typing import ...' lines
- UP015/UP018: remove redundant open() mode args and str() literals
- PIE790: remove unnecessary pass in abstract method stubs
- RUF100: remove unused noqa directives
- E712: replace '== True' comparisons with truthiness checks
- W291/W293/W292: remove trailing whitespace and add missing EOF newlines
…t exposure

Code scanning alert #53 (grove/secrets/__init__.py:74).

Passing the exception object directly into the structured log 'extra' dict
could expose the secret value in clear text, as backend error messages
(e.g. AWS, Vault) may echo back the credential being fetched.

Remove the 'exception' key from the extra dict in the AccessException /
IndexError handler and set exc_info=False to ensure no secret material
leaks through the logging pipeline.
@abhihashi
abhihashi force-pushed the fix/secvuln-53-clear-text-logging-access branch from 5b212e5 to 55f18f4 Compare August 19, 2026 13:25
@abhihashi
abhihashi merged commit fdb9960 into main Aug 19, 2026
5 checks passed
@abhihashi
abhihashi deleted the fix/secvuln-53-clear-text-logging-access branch August 19, 2026 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants