Repository navigation
crl: reject invalid serial numbers in gencrl input - #1459
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
NewCRLFromFile ignored the result of big.Int.SetString, so a serial number that is not plain decimal (for example the hex form printed by openssl, or a line with leading whitespace) was added to the CRL as a different serial number without any error. A hex serial such as 1a2b revoked serial 1. Trim whitespace around each line and return an error when a line is not a valid decimal serial number.
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.
NewCRLFromFileparses each line of thecfssl gencrlserial list withbig.Int.SetString(value, 10)but ignores whether parsing succeeded. A line that is not plain decimal produces a CRL entry for a different serial number, and the command exits 0:1a2b(hex, as printed byopenssl x509 -serial, see gencrl uses base10 instead of base16 #979) revokes serial1.4660(leading whitespace) revokes serial0.The certificate you meant to revoke stays valid.
Changes
invalid serial number "1a2b": serial numbers must be decimalwhen a line does not parse.TestNewCRLFromFileInvalidSerialandTestNewCRLFromFileTrimsWhitespace.Input format is unchanged: serial numbers are still decimal.
Testing
Without the
crl/crl.gochange, both new tests fail (five invalid-serial cases accepted, padded serials parsed as0). With it, all tests pass.Fixes #1458