Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PGP Dash-Escaped Text is still parsed for pgp #54

Closed
Tracked by #56
bwbroersma opened this issue Jul 17, 2023 · 1 comment
Closed
Tracked by #56

PGP Dash-Escaped Text is still parsed for pgp #54

bwbroersma opened this issue Jul 17, 2023 · 1 comment

Comments

@bwbroersma
Copy link
Contributor

PGP Dash-Escaped Text is still parsed for the PGP signature. Note that the File Format Description and ABNF Grammar of RFC 9116 explicitly only allows - in the cleartext part, not the signature. Specific problematic code that currently only checks if it's signed and not still reading the hash-header:

sectxt/sectxt/__init__.py

Lines 135 to 137 in 79bb386

# signed content might be dash escaped
if self._signed and not self._reading_sig and line.startswith("- "):
line = line[2:]

Solution would be some cleartext variable to be set and reset per line if - is parsed, not to parse - -----END PGP SIGNATURE----- as valid, which is currently the case. There seems to be no need to ever use - escaping in sectxt, since all lined should either start with a field name or # comment. Probably it is there to be compatible with other PGP tooling.

@DigitalTrustCenter
Copy link
Owner

With the new release a pgp formatter checker is added using the PGPy module which checks the OpenPGP message specification in accordance with RFC 4880.
A dash escape within the signature will result in a pgp_data_error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants