|
|
Created:
4 years, 4 months ago by Rob Percival Modified:
4 years, 3 months ago CC:
chromium-reviews, rsleevi+watch_chromium.org, certificate-transparency-chrome_googlegroups.com, cbentzel+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionImprove documentation and readability of CTLogVerifier tests
BUG=631087
Committed: https://crrev.com/716ab65db70d4786e04cdf8cf343567b91c49bc7
Cr-Commit-Position: refs/heads/master@{#414741}
Patch Set 1 #
Total comments: 6
Patch Set 2 : Rebase #Patch Set 3 : Better documentation of the VerifiesValidConsistencyProof test #Patch Set 4 : Rebase #Messages
Total messages: 17 (4 generated)
robpercival@chromium.org changed reviewers: + eranm@chromium.org, rsleevi@chromium.org
PTAL - minor documentation and code changes to improve readability. Extracted from https://codereview.chromium.org/2182533002/.
lgtm
I'm trying to refrain from commenting too strongly, in the event I've misread something. Please see below, though, to see if I've made a fundamental error. https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... File net/cert/ct_log_verifier_unittest.cc (left): https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... net/cert/ct_log_verifier_unittest.cc:120: kSHA256EmptyTreeHash.length_bytes); Wait, so this whole time, the empty tree hash was truncated by 32-bytes, and nothing failed?
https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... File net/cert/ct_log_verifier_unittest.cc (left): https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... net/cert/ct_log_verifier_unittest.cc:120: kSHA256EmptyTreeHash.length_bytes); On 2016/07/26 18:25:14, Ryan Sleevi (extremely slow) wrote: > Wait, so this whole time, the empty tree hash was truncated by 32-bytes, and > nothing failed? Turns out it wasn't, because of a bug in the HexToBytes variant that takes a (const char*, size_t): It constructed hex_data_input of type std::string using only half the hex bytes (truncating it), but never used the hex_data_input string, passing the input const char* instead to base::HexStringToBytes (which presumably constructed a std::string with the entire hex string as it is null-terminated).
https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... File net/cert/ct_log_verifier_unittest.cc (left): https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... net/cert/ct_log_verifier_unittest.cc:120: kSHA256EmptyTreeHash.length_bytes); On 2016/07/26 18:32:08, Eran Messeri wrote: > On 2016/07/26 18:25:14, Ryan Sleevi (extremely slow) wrote: > > Wait, so this whole time, the empty tree hash was truncated by 32-bytes, and > > nothing failed? > > Turns out it wasn't, because of a bug in the HexToBytes variant that takes a > (const char*, size_t): > It constructed hex_data_input of type std::string using only half the hex bytes > (truncating it), but never used the hex_data_input string, passing the input > const char* instead to base::HexStringToBytes (which presumably constructed a > std::string with the entire hex string as it is null-terminated). So why does this CL leave the bug in place then? (Line 112) My gripe is that from a reviewers point, there's something that very glaringly seems a behaviour change (the *2), without documenting in the CL description or reviewer notes. Even if it's benign, that's totally something that *should* have been documented, to avoid the first set of questions. Arguably, however, if we're saying it's a bug, we shouldn't add a workaround for the bug (line 118) and not even fix the bug (line 112) - pick one or the other. Either we should remove the length variant from HexToBytes or properly use hex_data_input
> > So why does this CL leave the bug in place then? (Line 112) > > My gripe is that from a reviewers point, there's something that very glaringly > seems a behaviour change (the *2), without documenting in the CL description or > reviewer notes. Even if it's benign, that's totally something that *should* have > been documented, to avoid the first set of questions. Arguably, however, if > we're saying it's a bug, we shouldn't add a workaround for the bug (line 118) > and not even fix the bug (line 112) - pick one or the other. Either we should > remove the length variant from HexToBytes or properly use hex_data_input I agree, no reason to leave this bug in place.
https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... File net/cert/ct_log_verifier_unittest.cc (right): https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... net/cert/ct_log_verifier_unittest.cc:498: MAYBE_VerifiesValidConsistencyProofsFromReferenceGenerator) { Since you're improving documentation, this test is woefully under-documented as to what's being tested. It came up on the caching CL that it's not entirely obvious what's being tested (it looks like you're testing the path from every possible leaf to the root, but it's entirely probable I'm misreading this.
Poke? Once updated let me know :)
PTAL - there's not much to this any more. https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... File net/cert/ct_log_verifier_unittest.cc (left): https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... net/cert/ct_log_verifier_unittest.cc:120: kSHA256EmptyTreeHash.length_bytes); On 2016/07/26 18:36:24, Ryan Sleevi (slow) wrote: > On 2016/07/26 18:32:08, Eran Messeri wrote: > > On 2016/07/26 18:25:14, Ryan Sleevi (extremely slow) wrote: > > > Wait, so this whole time, the empty tree hash was truncated by 32-bytes, and > > > nothing failed? > > > > Turns out it wasn't, because of a bug in the HexToBytes variant that takes a > > (const char*, size_t): > > It constructed hex_data_input of type std::string using only half the hex > bytes > > (truncating it), but never used the hex_data_input string, passing the input > > const char* instead to base::HexStringToBytes (which presumably constructed a > > std::string with the entire hex string as it is null-terminated). > > So why does this CL leave the bug in place then? (Line 112) > > My gripe is that from a reviewers point, there's something that very glaringly > seems a behaviour change (the *2), without documenting in the CL description or > reviewer notes. Even if it's benign, that's totally something that *should* have > been documented, to avoid the first set of questions. Arguably, however, if > we're saying it's a bug, we shouldn't add a workaround for the bug (line 118) > and not even fix the bug (line 112) - pick one or the other. Either we should > remove the length variant from HexToBytes or properly use hex_data_input I've broken out a fix for this into https://codereview.chromium.org/2275353002. I'll rebase this change on top of that, so that this is pretty much just a documentation change. https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... File net/cert/ct_log_verifier_unittest.cc (right): https://codereview.chromium.org/2183073002/diff/1/net/cert/ct_log_verifier_un... net/cert/ct_log_verifier_unittest.cc:498: MAYBE_VerifiesValidConsistencyProofsFromReferenceGenerator) { On 2016/07/26 18:40:29, Ryan Sleevi (slow) wrote: > Since you're improving documentation, this test is woefully under-documented as > to what's being tested. > > It came up on the caching CL that it's not entirely obvious what's being tested > (it looks like you're testing the path from every possible leaf to the root, but > it's entirely probable I'm misreading this. Done.
lgtm
The CQ bit was checked by robpercival@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from eranm@chromium.org, rsleevi@chromium.org Link to the patchset: https://chromiumcodereview-hr.appspot.com/2183073002/#ps60001 (title: "Rebase")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== Improve documentation and readability of CTLogVerifier tests BUG=631087 ========== to ========== Improve documentation and readability of CTLogVerifier tests BUG=631087 Committed: https://crrev.com/716ab65db70d4786e04cdf8cf343567b91c49bc7 Cr-Commit-Position: refs/heads/master@{#414741} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/716ab65db70d4786e04cdf8cf343567b91c49bc7 Cr-Commit-Position: refs/heads/master@{#414741} |