Skip to content

match_regex_list raises IndexError when a pattern list contains an empty string #6504

@devteamaegis

Description

@devteamaegis

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.

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.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    Status
    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions