Skip to content

Return the error when a CRL file fails to parse - #304

Closed
arpitjain099 wants to merge 1 commit into
stripe:masterfrom
arpitjain099:fix/crl-parse-error
Closed

arpitjain099 wants to merge 1 commit into
stripe:masterfrom
arpitjain099:fix/crl-parse-error

Conversation

@arpitjain099

Copy link
Copy Markdown

Fixes #300.

SetupCrls logged a CRL parse failure and carried on, and the next statement ranges over certList.TBSCertList.Extensions with certList still nil. A malformed file passed to --tls-crl-file therefore 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 with runtime error: invalid memory address or nil pointer dereference inside SetupCrls.

go vet is clean and the unit tests in the package pass. I did not get a full go test ./pkg/smokescreen/ to finish locally; the proxy tests in smokescreen_test.go sit waiting on connections in my sandbox, with or without this change.

One thing I deliberately left alone: x509.ParseCRL is deprecated in favour of x509.ParseRevocationList, and the surrounding code reads TBSCertList fields that the newer type exposes differently. That is a larger change than this bug needs.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
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.

Malformed --tls-crl-file causes a nil-pointer panic at startup instead of a config error

1 participant