Skip to content

fix: reject expired and not-yet-valid certificates during signing and verification - #664

Open
sampras343 wants to merge 1 commit into
sigstore:mainfrom
sampras343:fix/reject-expired-certificates
Open

fix: reject expired and not-yet-valid certificates during signing and verification#664
sampras343 wants to merge 1 commit into
sigstore:mainfrom
sampras343:fix/reject-expired-certificates

Conversation

@sampras343

Copy link
Copy Markdown
Contributor

Summary

  • Signing now rejects leaf certificates that are expired or not yet valid, per OMS spec v1.0 §8.2 and standard PKI practice
  • Verification no longer pins the X509 store time to not_valid_before, which was causing expired certificates to pass chain validation tautologically
  • Added tests covering all certificate validity scenarios including boundary cases and regression tests

Closes #663

Checklist
  • All commits are signed-off, using DCO
  • All new code has docstrings and type annotations
  • All new code is covered by tests. Aim for at least 90% coverage. CI is configured to highlight lines not covered by tests.
  • Public facing changes are paired with documentation changes
  • Release note has been added to CHANGELOG.md if needed

@sampras343
sampras343 requested review from a team as code owners September 4, 2026 14:24
… verification

The certificate-based signing flow accepted expired and not-yet-valid
leaf certificates without any temporal validation. The verification flow
pinned the X509 store time to the certificate's not_valid_before,
causing the validity check to pass tautologically — even for
certificates that expired years ago.

Signing:
- Added validity period check in Signer.__init__ that rejects leaf
  certificates whose not_valid_after is in the past or not_valid_before
  is in the future

Verification:
- Removed set_time(not_valid_before) call so pyOpenSSL evaluates the
  certificate chain against the current time, correctly rejecting
  expired or not-yet-valid certificates at any position in the chain

Per OMS spec v1.0 §8.2: "The leaf certificate MUST be within its
validity period."

Signed-off-by: Sachin Sampras M <sampras343@gmail.com>
@sampras343
sampras343 force-pushed the fix/reject-expired-certificates branch from 0f4104c to c1140f3 Compare September 4, 2026 14:28
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.

Certificate signing and verification accept expired certificates

2 participants