Skip to content

reject signing certificates not marked for code signing#648

Open
Support-itecz wants to merge 1 commit into
sigstore:mainfrom
Support-itecz:cert-code-signing-eku
Open

reject signing certificates not marked for code signing#648
Support-itecz wants to merge 1 commit into
sigstore:mainfrom
Support-itecz:cert-code-signing-eku

Conversation

@Support-itecz

Copy link
Copy Markdown

Summary

_verify_certificates decides a signing certificate is usable when it has the digitalSignature key usage bit or a code-signing extended key usage, treating the two as alternatives. An extended key usage is restrictive when present (RFC 5280 4.2.1.12), so a certificate whose only EKU is serverAuth (an ordinary TLS certificate) is still accepted as long as digitalSignature is set. Because the default trust roots are the certifi bundle, any holder of a publicly trusted TLS certificate can produce a signature this verifier accepts.

The fix rejects a certificate whose extended key usage lists neither code signing nor anyExtendedKeyUsage, even when the key usage bit is set. Keeping the check inside the verifier covers every certificate-based verification path without callers validating the chain themselves. Added a regression test that mints a serverAuth-only leaf under a private root and confirms it is now rejected, along with positive cases for a code-signing leaf and a leaf with no EKU.

To reproduce before the fix: build a leaf with ExtendedKeyUsage([serverAuth]) and KeyUsage(digital_signature=True) chaining to a root in the verifier's store, then verify a signature made with its key. Verification passes.

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

@Support-itecz
Support-itecz requested review from a team as code owners July 16, 2026 10:43
_verify_certificates treated the digitalSignature key usage bit and a code-signing extended key usage as alternatives, so a certificate whose extended key usage is serverAuth only was accepted as long as digitalSignature was set. A present extended key usage is restrictive per RFC 5280, so a TLS certificate chaining to a trusted root (the default is the certifi bundle) could be used to sign a model that the verifier then accepts.

Reject a certificate whose extended key usage lists neither code signing nor anyExtendedKeyUsage, even when the key usage bit is set. Keeping the check in the verifier means every certificate-based verification path is covered without callers validating the chain themselves.

Signed-off-by: Itecz Solution <support@itecz.au>
@Support-itecz
Support-itecz force-pushed the cert-code-signing-eku branch from 7cb0871 to a3bf123 Compare July 16, 2026 10:43
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.

1 participant