Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Default `EventScrubber` uses `recursive=False`, so nested denylist keys are not scrubbed |

未關閉
#7,620 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
65/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
security

研究方向

The issue is in sentry_sdk/scrubber.py where EventScrubber.init sets recursive=False by default. Review sentry_sdk/client.py to see how the scrubber is instantiated. Write a test that creates an event with a nested denylist key (like under 'extra') and verify it's not scrubbed with the default, then is scrubbed after setting recursive=True. Check if there are performance concerns with deep recursion and consider limiting to known containers.

由索引模型根據 Issue 內容生成。

描述

Bug Python Waiting for: Product Owner

Static review of public source at commit 85e7ce66fcca. No traffic was sent to any Sentry environment.

EventScrubber only walks nested dict/list values when recursive=True, and that flag defaults to False:

sentry_sdk/scrubber.py:

class EventScrubber:
    def __init__(
        self,
        denylist: "Optional[List[str]]" = None,
        recursive: bool = False,
        ...
    ) -> None:

if isinstance(k, str) and k.lower() in self.denylist:
    d[k] = AnnotatedValue.substituted_because_contains_sensitive_data()
elif self.recursive:
    self.scrub_dict(v)
    self.scrub_list(v)

The default client wires a scrubber without enabling recursion:

sentry_sdk/client.py:

rv["event_scrubber"] = EventScrubber(
    send_default_pii=False
    if rv["send_default_pii"] is None
    else rv["send_default_pii"]
)

Top-level keys such as authorization are scrubbed; the same key nested under extra, request.data, or breadcrumb data is not. Integrators who assume “Sentry scrubs secrets by default” get shallow coverage only.

Suggested change:

  • Default recursive=True on EventScrubber, or pass recursive=True from the client bootstrap.
  • If recursion cost is the concern, recurse only into known containers (extra, request.data, breadcrumb data, frame vars) rather than the whole event.
  • Document the flag next to send_default_pii in the scrubbing guide.

Severity: low–medium data-protection hardening (secret leakage via nested event fields). No proof-of-concept; no events were submitted.

Happy to send a focused PR + regression test with a nested denylist key if useful.

主要語言
Python
星號
2.2k
分支
672
平均合併
22 小時 47 分鐘
30 天內合併 PR
224

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

getsentry/sentry-python 的其他 Issue

查看 getsentry/sentry-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。