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

Define base encoding in x509.serial_number #2383

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

haesbaert
Copy link

@haesbaert haesbaert commented Sep 17, 2024

This proposes enforcing the base encoding of x509.serial_number to be 16.

The current definition is too loose and leaves room for interpretation, base 16 is also more common and it will help users correlate the value with existing tools. This change was prompted by elastic/sdh-beats#5089 where a customer expected to see it in the same format as other tools.

Particularly relevant comment from @andrewkroh here: https://github.com/elastic/sdh-beats/issues/5089#issuecomment-2349046226
Narrow the definition of x509.serial_number to be encoded in hexadecimal, otherwise we end up with integrations choosing their own encoding, as noted below, Zeek uses base 16 while the rest of beats is using base 10.

Narrow the definition of x509.serial_number to be encoded in hexadecimal,
otherwise we end up with integrations choosing their own encoding, as noted
below, Zeek uses base 16 while the rest of beats is using base 10.

Related to elastic/sdh-beats#5089.
Reasoning in: elastic/sdh-beats#5089 (comment)
@haesbaert haesbaert requested a review from a team as a code owner September 17, 2024 20:19
Copy link

Documentation changes preview: https://ecs_bk_2383.docs-preview.app.elstc.co/diff

@@ -52,8 +52,8 @@
type: keyword
short: Unique serial number issued by the certificate authority.
description: >
Unique serial number issued by the certificate authority. For consistency, if this value is alphanumeric, it should be
formatted without colons and uppercase characters.
Unique serial number issued by the certificate authority. For consistency, this should be
Copy link
Contributor

Choose a reason for hiding this comment

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

Given this is should, it implies this encoding is still optional, which might not really completely resolve the original problem. Is that what you intend? But if the wording is changed to something stronger, it could be considered a breaking change.

If you want it to be enforced, what do you think of having should in ECS v8, and changing to must in the next major release?

Copy link
Member

Choose a reason for hiding this comment

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

I agree, that making it a MUST would be breaking for v8 so I think it needs to remain a SHOULD.

About changing it in the next major, sounds like a good idea.

Copy link
Author

Choose a reason for hiding this comment

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

I'm fine with that, I'm not familiar with the process at all.
For the next release, shouldn't we restrict it even more? I'd prefer to have something that is strict on case, semi-colons and base.

Comment on lines +55 to +56
Unique serial number issued by the certificate authority. For consistency, this should be
encoded in base 16 and formatted without colons and uppercase characters.
Copy link
Member

@andrewkroh andrewkroh Sep 17, 2024

Choose a reason for hiding this comment

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

"without colons and uppercase characters" is ambiguous. Does it mean "without colons and without uppercase"? Or does it mean "without colons and with uppercase"? 😄

Suggested change
Unique serial number issued by the certificate authority. For consistency, this should be
encoded in base 16 and formatted without colons and uppercase characters.
Unique serial number issued by the certificate authority. For consistency, this should be
encoded in base 16 and formatted as uppercase characters without colons.

(edited to leave "base 16" as is)

Copy link
Author

Choose a reason for hiding this comment

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

Ha! Good point, my brain didn't spot that.
I think it should still be base 16, not base-16, as it's consistent with the other cases that use space, as in:
https://github.com/elastic/ecs/blob/main/schemas/dns.yml#L98
grep -r 'base-' doesn't return any other uses.

Copy link
Author

Choose a reason for hiding this comment

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

If all agree, I'd bring thid PR to 8.x with the wording changes from @andrewkroh, and then open a second PR to do the breaking/must changes.

Copy link
Member

Choose a reason for hiding this comment

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

SGTM. If we haven't already created an 8.x branch then we should do that before you merge the second PR.

@@ -52,8 +52,8 @@
type: keyword
short: Unique serial number issued by the certificate authority.
description: >
Unique serial number issued by the certificate authority. For consistency, if this value is alphanumeric, it should be
formatted without colons and uppercase characters.
Unique serial number issued by the certificate authority. For consistency, this should be
Copy link
Member

Choose a reason for hiding this comment

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

I agree, that making it a MUST would be breaking for v8 so I think it needs to remain a SHOULD.

About changing it in the next major, sounds like a good idea.

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.

3 participants