Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #22640

Closed (moved)
(moved)
Open
Created Jun 17, 2017 by Karsten Loesing@karsten

Change encoding of microdescriptor digests in network status entries from hex to base64

CollecTor's ReferenceChecker is acting up again, reporting tons of missing microdescriptors, basically all of them. Today I found out why.

Turns out that neither NetworkStatusEntry#getMicrodescriptorDigests() nor NetworkStatusEntry#getMicrodescriptorDigestsSha256Base64() returns base64-encoded digests but hex-encoded ones. The former exists since 1.0.0, the latter was added in 1.7.0 in an attempt to streamline digest method names, deprecating the former.

Neither of the two methods says in its JavaDocs that it returns base64-encoded digests, though the latter indicates that in its method name. The original digest string contained in votes and microdesc consensuses is base64-encoded, too. All in all it seems like we should change both methods to return base64-encoded strings and document that.

This issue is related to the bug we fixed in 1.8.0 where Microdescriptor#getMicrodescriptorDigest() and Microdescriptor#getDigestSha256Base64() return a hex string rather than a base64 string. In that case we even claimed in the JavaDocs that we'd return a base64-encoded string, which we didn't.

The current issue is not a regression, it's just an oversight of a very similar bug that was introduced far before 1.8.0 or even 1.7.0. That's why I suggest to fix it in 1.9.0 next week and not put out a third patch release for 1.8.0 this weekend. I can just ignore CollecTor's warnings for a few more days.

I'll attach a branch in a minute. That branch also prevents similar bugs in the future by changing ParseHelper method signatures to return void if we don't plan to use the result and add new methods for parsing, verifying, and converting to another encoding.

I tested this branch in a local CollecTor instance and can confirm that it does silence the ReferenceChecker.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking