Skip to content

CA-404236, gencert: when parsing pems, ignore data between key and certificates #6207

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

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

psafont
Copy link
Member

@psafont psafont commented Jan 2, 2025

CA-404236, gencert: when parsing pems, ignore data between key and crrtificates

This is needed in order to be compliant with RFC 7468:
https://datatracker.ietf.org/doc/html/rfc7468#section-2

Data before the encapsulation boundaries are permitted, and parsers MUST NOT
malfunction when processing such data.

Signed-off-by: Pau Ruiz Safont [email protected]

@psafont psafont force-pushed the private/paus/pimpampem branch from ce46e81 to b3d2e58 Compare January 2, 2025 16:13
Copy link
Contributor

@Vincent-lau Vincent-lau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC this will ignore anything that is present between END----- and -----BEGIN's, but does not handle the situation of things like XXX!! -----BEGIN?

The RFC says

Textual encoding begins with a line comprising "-----BEGIN ",

Not sure if that means -----BEGIN should always be at the start of the line, but maybe it shouldn't

@psafont psafont changed the title CA-404236, gencert: when parsing pems, ignore data between key and crrtificates CA-404236, gencert: when parsing pems, ignore data between key and certificates Jan 6, 2025
Copy link
Contributor

@lindig lindig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see a comment where/how we skip over extra lines.

@psafont
Copy link
Member Author

psafont commented Jan 6, 2025

Not sure if that means -----BEGIN should always be at the start of the line, but maybe it shouldn't

The full sentence is

Textual encoding begins with a line comprising "-----BEGIN ", a label, and "-----", and ends with a line comprising "-----END ", a label, and "-----".

I read it as the line comprises 3 and only 3 elements, excluding others. So the current code would do the right thing

Helpful for debugging pem-parsing issues

Signed-off-by: Pau Ruiz Safont <[email protected]>
@psafont psafont force-pushed the private/paus/pimpampem branch from b3d2e58 to 971d753 Compare January 6, 2025 10:08
…rtificates

This is needed in order to be compliant with RFC 7468:
https://datatracker.ietf.org/doc/html/rfc7468#section-2

Data before the encapsulation boundaries are permitted, and parsers MUST NOT
malfunction when processing such data.

Signed-off-by: Pau Ruiz Safont <[email protected]>
@psafont psafont force-pushed the private/paus/pimpampem branch from 971d753 to 2d84622 Compare January 6, 2025 10:09
@psafont psafont added this pull request to the merge queue Jan 6, 2025
Merged via the queue into xapi-project:master with commit 9a1a547 Jan 6, 2025
15 checks passed
@psafont psafont deleted the private/paus/pimpampem branch February 13, 2025 14:10
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

Successfully merging this pull request may close these issues.

4 participants