Repository navigation
Conversation
Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
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.
crl.NewCRLFromFileand the gencrl API handler ignore the result ofbig.Int.SetString, so a serial that does not parse as a decimal integer still ends up in the CRL, with a value of 0 or the leading digits of the input. For example, a serial list of1,2,0x03,28:35:69:0ayields CRL entries 1, 0, 0 and 28. The certificates that were meant to be revoked are not, and no error is shown.NewCRLFromFilealso checks for blank lines with a trimmed copy of the line but parses the untrimmed one, so a leading or trailing space is enough to trigger this.This change trims each serial before parsing and returns an error when
SetStringfails: a plain error fromNewCRLFromFile, and a 400 response from the API handler. Valid decimal input is handled as before. Accepting hex serials (#979) is left for a separate change.Testing: added
TestNewCRLFromFileCRLFAndWhitespace(CRLF line endings and surrounding spaces give the right serials) andTestNewCRLFromFileInvalidSerial(an invalid line returns an error) incrl/crl_test.go, andTestCRLInvalidSerial(expects a 400 for an invalid serial) inapi/gencrl/gencrl_test.go. All three fail on master and pass with this change.go test ./crl/ ./api/gencrl/ ./cli/gencrl/passes.Fixes #1460