reject signing certificates not marked for code signing#648
Open
Support-itecz wants to merge 1 commit into
Open
reject signing certificates not marked for code signing#648Support-itecz wants to merge 1 commit into
Support-itecz wants to merge 1 commit into
Conversation
_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
force-pushed
the
cert-code-signing-eku
branch
from
July 16, 2026 10:43
7cb0871 to
a3bf123
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_verify_certificatesdecides 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 isserverAuth(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])andKeyUsage(digital_signature=True)chaining to a root in the verifier's store, then verify a signature made with its key. Verification passes.Checklist