getsentry / getsentry/sentry-python

match_regex_list raises IndexError when a pattern list contains an empty string

未關閉
#6,504 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Bug Python
主要語言
Python
星號
2.2k
分支
669
平均合併
1 天 40 分鐘
30 天內合併 PR
212

描述

`sentry_sdk.utils.match_regex_list` iterates a user-supplied list of patterns and, with the default `substring_matching=False`, checks `item_matcher[-1] != "$"`. If any element is the empty string, `""[-1]` raises `IndexError: string index out of range`.

```python
from sentry_sdk.utils import match_regex_list
match_regex_list("anything", [""])
```

This is reachable from the Celery integration (`CeleryIntegration.exclude_beat_tasks` is passed to `match_regex_list` with the default mode), so an empty string in that user-configured list crashes instead of being handled.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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