Skip to content

Conversation

@jclapis
Copy link
Collaborator

@jclapis jclapis commented Aug 13, 2025

This is a cherry-pick of the TLS support that @ManuelBilbao added in #297. It builds on top of #354 / #353 / #356 which obviate the nonce in the jti, but it's important to keep TLS support in as part of the audit finding as well.

Note that PR hasn't been updated in a bit, so it's a good idea to get some eyes on this one to ensure it got ported over properly and doesn't need any modernization changes.

While this is in draft review I'll look at adding an --insecure variant to the configuration that lets the user run without TLS if they want to (better for unit testing, anyway).

ltitanb and others added 30 commits May 13, 2025 17:17
@jclapis
Copy link
Collaborator Author

jclapis commented Aug 26, 2025

should explicitly state what TLS version is supported no?

Done in 1e4122f.

@jclapis
Copy link
Collaborator Author

jclapis commented Aug 26, 2025

i would also add a link or short guide on how to generate the certs files?

Done in 1e4122f.

Base automatically changed from add-payload-hash-to-jwt to sigp-audit-fixes September 2, 2025 03:57
Comment on lines 490 to 502
if !certs_path.join(SIGNER_TLS_CERTIFICATE_NAME).try_exists()? ||
!certs_path.join(SIGNER_TLS_KEY_NAME).try_exists()?
{
let (cert, key): (String, String) =
generate_simple_self_signed(vec!["cb_signer".to_string()])
.map(|x| (x.cert.pem(), x.key_pair.serialize_pem()))
.map_err(|e| {
eyre::eyre!("Failed to generate TLS certificate: {e}")
})?;

std::fs::write(certs_path.join(SIGNER_TLS_CERTIFICATE_NAME), &cert)?;
std::fs::write(certs_path.join(SIGNER_TLS_KEY_NAME), &key)?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

In case there's only one of the two files required, this will override the existing one. Not saying this is wrong, but should we add a mention in the docs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've removed the auto-generation of self-signed certs in 4260f17 now that there's an Insecure option; if users want to use TLS mode, they need to generate it and its key out-of-band as per the documentation (and preferably include the CA in their trusted CA list if it's not already there).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice. With this change I think we can also remove rcgen from crates/cli/Cargo.toml and crates/common/Cargo.toml

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's still used in one of the test cases for testing TLS I think, so it does still have some relevance unless we just get rid of that test case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tested removing it from those files and it's working. Note that the crate would still be included in root's Cargo.toml and tests/Cargo.toml

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good, I'll remove them in another PR since you approved this already just so we can start rolling on the next step. Thank you!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done in #370.

@jclapis jclapis marked this pull request as ready for review September 3, 2025 18:55
@jclapis jclapis merged commit 6b14d77 into sigp-audit-fixes Sep 3, 2025
1 of 3 checks passed
@jclapis jclapis deleted the add-tls-to-signer branch September 3, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

signer Signer module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants