Skip to content

Verify Fulcio's embedded certificate timestamp before signing - #3129

Closed
konsti-openai wants to merge 21 commits into
konsti/sigstore-signingfrom
konsti/sigstore-certificate-timestamp
Closed

konsti-openai wants to merge 21 commits into
konsti/sigstore-signingfrom
konsti/sigstore-certificate-timestamp

Conversation

@konsti-openai

Copy link
Copy Markdown

Verify the timestamp embedded in Fulcio's leaf certificate before signing a statement. If no current certificate transparency log signed it, uv stops before sending anything to Rekor. Valid attestations are unchanged.

The check reconstructs the RFC 6962 precertificate from the leaf and issuer returned by Fulcio and uses the CT keys from the same Sigstore document already fetched for Rekor. No extra network request is needed.

Stacked on #3125.

Comment thread crates/uv-sigstore/src/lib.rs Resolved
Comment thread crates/uv-sigstore/src/lib.rs Resolved
Comment thread crates/uv-sigstore/src/lib.rs Resolved
Comment thread crates/uv-sigstore/src/lib.rs Resolved
Comment thread crates/uv-sigstore/src/lib.rs Resolved
Comment thread crates/uv-sigstore/src/trust.rs Resolved
Comment thread crates/uv-sigstore/src/lib.rs Resolved
Comment on lines +83 to +84
let [sct] = timestamps.as_slice() else {
return Err(TimestampError::Count(timestamps.len()));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Require the SCT parser to consume the entire list

timestamps.as_slice() counts the entries x509-parser successfully parsed, not necessarily all the bytes in the list. A valid SCT followed by a truncated second entry is returned as a one-element vector, while Python’s cryptography parser rejects that list. The merge base did not check SCTs; the new check still lets this malformed certificate reach Rekor. Use a decoder that consumes the full list and each entry, such as the sct feature of the newly added x509-cert dependency, before enforcing the one-SCT rule. (docs.rs)

let token = format!("header.{claims}.signature");
"ctlogs": [log("https://ct.example", CT_KEY)],
"tlogs": [
log(super::REKOR_ORIGIN, CT_KEY),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P3] Keep the CT key out of the Rekor test keyring

Both signing tests put CT_KEY in ctlogs and tlogs. If the signing path used Rekor keys to verify the SCT, the success test would still pass and the corrupted-signature test would still fail as expected. The validity test calls ct_key directly, so it cannot catch that wiring error. Use a distinct key for the first Rekor rotation candidate, as the merge-base fixture did; no additional test is needed.

// A retired key may verify old releases, but must not vouch for a new signature.
.filter(|log| log.public_key.valid_for.contains(signed_at))
.filter(|log| log.public_key.valid_for.contains(now))
.filter_map(|log| log.public_key.decode().ok())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P3] Preserve the cause when no CT key can be decoded

If the only eligible CT key contains invalid base64, .decode().ok() discards the cause and the caller reports the same error as for an unknown log ID. That leaves no indication that the trust document, rather than the certificate, needs attention. As rekor_keys already does, retain the decode error while trying other candidates and surface it if none can be decoded. This diagnostic improvement can follow separately.

…te-timestamp

# Conflicts:
#	crates/uv-sigstore/src/lib.rs
…te-timestamp

# Conflicts:
#	crates/uv-sigstore/src/lib.rs
…te-timestamp

# Conflicts:
#	crates/uv-sigstore/src/lib.rs
…te-timestamp

# Conflicts:
#	crates/uv-sigstore/src/lib.rs
…te-timestamp

# Conflicts:
#	crates/uv-sigstore/src/lib.rs

This branch was successfully deployed

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

Labels

internal A refactor or improvement that is not user-facing security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants