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(bindings): Apply with_system_certs to Config builder() API #4456

Merged
merged 2 commits into from
Mar 12, 2024

Conversation

goatgoose
Copy link
Contributor

@goatgoose goatgoose commented Mar 12, 2024

Description of changes:

Currently the Config builder() API returns a default Builder:

pub fn builder() -> Builder {
Builder::default()
}

Due to the #[derive(Default]] statement on the Builder struct, this means that the Config set in the Builder contains a fully built default Config:

impl Default for Config {
fn default() -> Self {
Builder::new().build().unwrap()
}
}

We currently load default system certificates into the Config by default, so the Config created with the Config builder() API will always contain default certificates, even if the with_system_certs API is used.

This PR uses Builder::new() to create the Builder's default Config, giving users the opportunity to call with_system_certs before the Config is built.

Testing:

I updated the existing system cert loading test to also create a Config with Config::builder() in addition to Builder::new(). I confirmed that this test failed without the fix applied.

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

@github-actions github-actions bot added the s2n-core team label Mar 12, 2024
@goatgoose goatgoose changed the title fix(bindings): Apply with_system_certs to Config builder fix(bindings): Apply with_system_certs to Config builder() API Mar 12, 2024
@goatgoose goatgoose marked this pull request as ready for review March 12, 2024 18:19
@goatgoose goatgoose enabled auto-merge (squash) March 12, 2024 19:00
@goatgoose goatgoose merged commit dea5534 into aws:main Mar 12, 2024
31 checks passed
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.

3 participants