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

Fix regex domain name validation #5

Merged
merged 1 commit into from May 19, 2023
Merged

Fix regex domain name validation #5

merged 1 commit into from May 19, 2023

Conversation

inteon
Copy link

@inteon inteon commented May 17, 2023

In TPP, we are used to specifying ".example.com" in the allowed domains, this restriction matches all subdomains of example.com, without matching example.com itself.
vCert does however not translate this rule into regex correctly, causing errors like the following:

Failed to request venafi certificate: common name test.example.com is not allowed in this policy: [^([\p{L}\p{N}-*]+\.)*\.example\.com$]

This PR fixes the regex generation logic and adds a test for this fix.

@inteon inteon changed the title Fix regex validation Fix regex domain name validation May 17, 2023
@hawksight
Copy link

Helps resolve this open-source issue

@wallrj wallrj self-assigned this May 18, 2023
Copy link
Member

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

Thanks @inteon

This PR seems useful in its own right.
Why not separate it from the duration PR, which I think is less useful?

pkg/venafi/tpp/tpp.go Show resolved Hide resolved
…tch all subdomains, but not the domain itself)

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

@wallrj wallrj left a comment

Choose a reason for hiding this comment

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

Thanks Tim,

/lgtm

@inteon inteon merged commit 219f317 into master May 19, 2023
@wallrj wallrj deleted the fix_regex_validation branch May 19, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants