Skip to content

Comments

test(integration): add coverage of error types for cert related failures#5755

Open
jmayclin wants to merge 1 commit intoaws:mainfrom
jmayclin:2026-02-18-cert-security-policy-error
Open

test(integration): add coverage of error types for cert related failures#5755
jmayclin wants to merge 1 commit intoaws:mainfrom
jmayclin:2026-02-18-cert-security-policy-error

Conversation

@jmayclin
Copy link
Contributor

Goal

Add integration test coverage of cert related failures

Why

I'm going to be adding some more distinct error types for host name and security policy related failures. But I needed to confirm our current behavior.

So I figured I'd just add these tests as a separate PR because it will make my error change easier to review.

How

Just using our integration test harness to look at the returned error types.

Testing

I did print out the s2n-tls error message and check that I was hitting the expected line numbers for the failures, and not one of the ~14 other places that we return CERT_UNTRUSTED.

// Error encountered in lib/tls/s2n_security_policies.c:2250 - s2n_security_policy_validate_cert_signature
// Error encountered in lib/tls/s2n_security_policies.c:2269 s2n_security_policy_validate_cert_key

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

{
let mut pair = TestPair::from_configs(&client, &server);
let err = pair.handshake().unwrap_err();
// Error {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this comment for?

}
}

/// When a client cert chain is signed with signatures that aren't allowed by the
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why these are all client auth tests?

let server_cert = CertMaterials::from_permutation("rsae_pkcs_3072_sha384");
// The client cert has a valid key (RSA3072) but an invalid signature
// (SHA256 digest)
let client_cert = CertMaterials::from_permutation("rsae_pkcs_3072_sha256");
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a success case using rsae_pkcs_3072_sha384 before the failure case of rsae_pkcs_3072_sha256(same with the curves test) to codify that the failure is due to the digest and not some other reason. Otherwise I don't really know how much assurance these tests are giving us, besides failing with the correct error. But like you've mentioned, we throw that error a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants