Skip to content

Conversation

themighty1
Copy link
Member

This PR adds the missing validation of attestation signature.

Closes #622

@themighty1 themighty1 linked an issue Apr 22, 2025 that may be closed by this pull request
@themighty1 themighty1 requested a review from sinui0 April 22, 2025 07:23
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

This is a bit of a tricky problem if we do want to guarantee that an attestation always has a valid signature.

This issue with the approach in this PR is that you are using the default signature verifier provider, which will not work when the user wants to use a custom signature scheme.

Instead of doing this using TryFrom, and during deserialization, I would suggest exposing AttestationUnchecked as a public type (perhaps #[doc(hidden)]) and having a validation method, e.g. Attestation::try_from_unchecked(attestation: AttestationUnchecked, provider: &CryptoProvider) -> Result<Attestation, E>.

tlsn-prover would explicitly use this validation upon receiving the attestation.

@themighty1
Copy link
Member Author

@sinu, ready for review

@themighty1 themighty1 requested a review from sinui0 May 12, 2025 08:57
Copy link
Member

@sinui0 sinui0 left a comment

Choose a reason for hiding this comment

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

lgtm, couple nits

signature_alg: SignatureAlgId,
secret: EncoderSecret,
) -> Attestation {
) -> (Attestation, CryptoProvider) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to couple the attestation fixture to a provider. They can be constructed separately.

.get(&unchecked.signature.alg)
.map_err(|_| {
InvalidAttestation(format!(
"invalid signature algorithm id {:?}",
Copy link
Member

Choose a reason for hiding this comment

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

This isn't quite accurate. The algorithm id isn't necessarily invalid, but rather the provider is not configured with a signature verifier for this id.

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.

Add signature verification during attestation validation
2 participants