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

internal/dag: reject certificates with CN or SubjectAltName #1985

Merged
merged 1 commit into from
Dec 6, 2019

Conversation

davecheney
Copy link
Contributor

Fixes #1965

During cache insertion reject certificates which lack a Subject
CommonName (CN) or SubjectAltName extension.

This PR uncovered that, well basically, all our TLS fixtures don't fit
this requirement which is extra sadface and thus this PR contains
replacement fixtures for all the previous ones.

This PR also adds a unit test for dag.isValidSecret as we are likely to
continue to add to this function as further validation edge cases are
uncovered. This necessitated a small addition to the internal/assert
comparator logic to be able to compare error values.

Signed-off-by: Dave Cheney [email protected]

@davecheney davecheney added this to the 1.1.0 milestone Dec 5, 2019
@@ -1068,7 +1068,7 @@ func TestListenerVisit(t *testing.T) {

func transportSocket(tlsMinProtoVersion envoy_api_v2_auth.TlsParameters_TlsProtocol, alpnprotos ...string) *envoy_api_v2_core.TransportSocket {
return envoy.DownstreamTLSTransportSocket(
envoy.DownstreamTLSContext("default/secret/28337303ac", tlsMinProtoVersion, alpnprotos...),
envoy.DownstreamTLSContext("default/secret/68621186db", tlsMinProtoVersion, alpnprotos...),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

all the hashes changed because the name of a SDS entry contains the hash of its certificate. I'm not sure if this was a bright idea in retrospect.

Fixes projectcontour#1965

During cache insertion reject certificates which lack a Subject
CommonName (CN) or SubjectAltName extension.

This PR uncovered that, well basically, all our TLS fixtures don't fit
this requirement which is extra sadface and thus this PR contains
replacement fixtures for all the previous ones.

This PR also adds a unit test for dag.isValidSecret as we are likely to
continue to add to this function as further validation edge cases are
uncovered. This necessitated a small addition to the internal/assert
comparator logic to be able to compare error values.

Signed-off-by: Dave Cheney <[email protected]>
Copy link
Contributor

@jpeach jpeach left a comment

Choose a reason for hiding this comment

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

LGTM

@davecheney davecheney merged commit f4cd1cf into projectcontour:master Dec 6, 2019
@davecheney davecheney deleted the fixedbugs/1965 branch December 6, 2019 00:22
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.

Reject TLS secrets with certificate that has no CN or SANs
2 participants