Skip to content

fix: structure of nameconstraint in CSR #6542

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

Conversation

tanujd11
Copy link
Member

Pull Request Motivation

This PR is a follow up from #6500. According to #6500 (comment) by @inteon the CSR should follow a proper structure mentioned in the RFC, The self signed certificate was generating correctly but CSR structure was not compatible with the RFC. This PR fixes the issue by using the x509.go to marshal the nameConstraints from the API and https://github.com/golang/go/blob/46ea4ab5cb87e9e5d443029f5f1a4bba012804d3/src/crypto/x509/parser.go#L483 for parsing the nameConstraint extension into a certificate.

Kind

Fix

Release Note

NONE

Signed-off-by: tanujd11 <dwiveditanuj41@gmail.com>
@jetstack-bot jetstack-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 11, 2023
Signed-off-by: tanujd11 <dwiveditanuj41@gmail.com>
@tanujd11 tanujd11 requested a review from inteon December 11, 2023 19:13
@tanujd11
Copy link
Member Author

/retest

Signed-off-by: tanujd11 <dwiveditanuj41@gmail.com>
@tanujd11 tanujd11 requested a review from inteon December 12, 2023 11:36
Signed-off-by: tanujd11 <dwiveditanuj41@gmail.com>
@inteon inteon self-assigned this Dec 12, 2023
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
@inteon
Copy link
Member

inteon commented Dec 12, 2023

/retest

@inteon
Copy link
Member

inteon commented Dec 12, 2023

@tanujd11 I applied some additional cleanup changes, PTAL

@tanujd11
Copy link
Member Author

@inteon LGTM

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
@inteon
Copy link
Member

inteon commented Dec 12, 2023

Thanks for fixing this issue @tanujd11
/approve
/lgtm

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 12, 2023
@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inteon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jetstack-bot jetstack-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2023
@jetstack-bot jetstack-bot merged commit 8da699a into cert-manager:master Dec 12, 2023
return nil, err
}
nameConstraints.PermittedEmailAddresses = crt.Spec.NameConstraints.Permitted.EmailAddresses
nameConstraints.ExcludedURIDomains = crt.Spec.NameConstraints.Permitted.URIDomains

Choose a reason for hiding this comment

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

Shouldn't this be nameConstraints.PermittedURIDomains ? @tanujd11 @inteon

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, good catch!
If this bug is still present on master, could you maybe create a PR to fix this?

Choose a reason for hiding this comment

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

It is, will create a PR

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @martin31821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. lgtm Indicates that a PR is ready to be merged. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants