Skip to content

inspect additional sensitive data carriers - #49

Merged
higagan merged 4 commits into
higagan:mainfrom
dyson-025:fix-sensitive-data-filter
Aug 4, 2026
Merged

inspect additional sensitive data carriers#49
higagan merged 4 commits into
higagan:mainfrom
dyson-025:fix-sensitive-data-filter

Conversation

@dyson-025

Copy link
Copy Markdown
Contributor

Description

Extends SensitiveDataFilter to inspect additional value carriers while preserving existing behavior.

Changes

  • Inspect dictionary keys in addition to dictionary values.
  • Inspect bytes and bytearray by decoding them before applying the filter.
  • Traverse set and frozenset recursively like other container types.
  • Added regression tests covering each newly supported carrier.

Related Issues

Closes #48

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • Documentation update
  • New feature
  • Refactoring / performance optimization

Verification Checklist

  • Tests pass (pytest)
  • Code formatted with ruff format
  • Lint passes with ruff check

@higagan higagan left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this locally — the code is right, and thanks for cutting the kwarg-name and fail-closed parts as discussed. Scope is exactly what we agreed.

All five carriers now block, and ordinary calls still work (int, float, Path, callbacks pass through untouched, so nothing breaks):

dict KEY (JSON-native)  -> BLOCKED
bytes / bytearray       -> BLOCKED
set / frozenset         -> BLOCKED
ordinary scalar call    -> ran

102 tests pass, ruff check clean. Decoding bytes with errors="ignore" is the right call — it can only join characters, never split a keyword, so it fails safe.

One thing left before merge: the README Limitations section still says

only str, list, tuple, and dict values are inspected

which your PR makes untrue. That's the last unchecked box on #48. Could you update it to match — something like:

only str, bytes, list, tuple, set, and dict keys and values are inspected

Once that's in, this is good to merge.

(Two unrelated things I hit while reviewing, both pre-existing on main and not yours: ruff format --check flags cli.py/test_scan.py, and cyclic input raises RecursionError. Filed separately.)

@higagan higagan added bug Something isn't working security Security-relevant defect or hardening labels Aug 3, 2026
@higagan

higagan commented Aug 4, 2026

Copy link
Copy Markdown
Owner

@dyson-025 — still happy to merge once the README Limitations line is updated to match the new coverage. That's the only thing outstanding.

@dyson-025

Copy link
Copy Markdown
Contributor Author

just wait 1 hour i will fix this.

@higagan
higagan merged commit e6ff1d1 into higagan:main Aug 4, 2026
5 checks passed
higagan added a commit that referenced this pull request Aug 4, 2026
)

AGENTS.md rule 4 still listed bytes and set as uninspected, which
#49 made false. Updated to match the README: str, bytes, list, tuple,
set, and dict keys and values are now inspected. Also fixes a stray
capital 'Only' in the README Limitations paragraph.
higagan added a commit that referenced this pull request Aug 4, 2026
higagan added a commit that referenced this pull request Aug 4, 2026
* chore: release 0.3.8

* chore: add #49 and #62 to the 0.3.8 changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security Security-relevant defect or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SensitiveDataFilter fails open on dict keys, kwarg names, bytes, and sets

2 participants