Conversation
The client built EventScrubber with recursive left off, so a password under extra or request data stayed in the event. The default scrubber now walks nested dicts and lists. Fixes getsentry#7620.
Recursive scrubbing was writing into the caller's dicts. Nested containers are copied first. PyMongo's operation_ids.session is an id, not a secret, so it stays.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ac1726e. Configure here.
| # walking them so scrubbing the event does not change that data. | ||
| if isinstance(v, (dict, list)): | ||
| v = copy.deepcopy(v) | ||
| d[k] = v |
There was a problem hiding this comment.
Deepcopy can skip remaining secrets
Medium Severity
copy.deepcopy runs on every nested dict or list before that subtree is walked. Extra and request payloads often hold ordinary Python objects that cannot be deep-copied, and that exception is swallowed by capture_internal_exceptions, so the rest of that scrub pass never runs and later denylist keys in the same section are sent unfiltered.
Reviewed by Cursor Bugbot for commit ac1726e. Configure here.
| # Nested containers are often the caller's objects. Copy before | ||
| # walking them so scrubbing the event does not change that data. | ||
| if isinstance(v, (dict, list)): | ||
| v = copy.deepcopy(v) |
There was a problem hiding this comment.
I don't think it's wise to start copying every event


Fixes #7620.
The client built
EventScrubberwithrecursiveleft at its default ofFalse. A top-levelpasswordwas removed. The same key underextra,request.data, or a breadcrumb was not.The default scrubber now walks nested dicts and lists.
EventScrubber(recursive=False)still does the shallow pass if you construct one yourself.