Skip to content

Certain security.txt files can cause parser to hang indefinitely #74

Description

@mxsasha

Some specific examples to follow by mail, but certain security.txt files can hang indefinitely in the call to pgpy, specifically in the regex. For example:

  File "/Users/sasha/.virtualenvs/internet.nl/lib/python3.9/site-packages/pgpy/types.py", line 198, in from_blob
    po = obj.parse(bytearray(blob))
  File "/Users/sasha/.virtualenvs/internet.nl/lib/python3.9/site-packages/pgpy/pgp.py", line 1270, in parse
    unarmored = self.ascii_unarmor(packet)
  File "/Users/sasha/.virtualenvs/internet.nl/lib/python3.9/site-packages/pgpy/types.py", line 121, in ascii_unarmor
    m = Armorable.__armor_regex.search(text)
KeyboardInterrupt

Some attempts at isolating this issue to a smaller sample have not shown any particular content that triggers the issue. It may also be dependent on specific Python patch versions or platforms. In some cases, the hang is indefinite, in some cases the parsing is only very slow (several seconds).

Suggestion: consider removing the PGP parsing check until we're certain this issue is resolved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions