Return the error when a CRL file fails to parse - #304
Closed
arpitjain099 wants to merge 1 commit into
Closed
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
Signed-off-by: Arpit Jain <arpitjain099@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.
Fixes #300.
SetupCrlslogged a CRL parse failure and carried on, and the next statement ranges overcertList.TBSCertList.ExtensionswithcertListstill nil. A malformed file passed to--tls-crl-filetherefore takes the proxy down at boot rather than being rejected as bad configuration. The function already returns an error for an unreadable file, so this returns one for an unparseable file too, with the path and the underlying error wrapped in.Two tests in a new
pkg/smokescreen/crl_test.go: a file of non-CRL bytes has to come back as an error naming the file, and a path that does not exist still errors. On master the first one panics withruntime error: invalid memory address or nil pointer dereferenceinsideSetupCrls.go vetis clean and the unit tests in the package pass. I did not get a fullgo test ./pkg/smokescreen/to finish locally; the proxy tests insmokescreen_test.gosit waiting on connections in my sandbox, with or without this change.One thing I deliberately left alone:
x509.ParseCRLis deprecated in favour ofx509.ParseRevocationList, and the surrounding code readsTBSCertListfields that the newer type exposes differently. That is a larger change than this bug needs.