)]}'
{"specs/queens/approved/glance/multihash.rst":[{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":5,"context_line":" http://creativecommons.org/licenses/by/3.0/legalcode"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":8,"context_line":"Multihash Support"},{"line_number":9,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"https://blueprints.launchpad.net/glance/+spec/multihash"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_00f1c56b","line":8,"updated":"2017-09-26 21:18:25.000000000","message":"To avoid confusion, you should probably change the title to something like \"Secure Hash Algorithm Support\".\n\nI don\u0027t think you need to change the filename or blueprint URL; let\u0027s keep those so we have a continuous history of this proposal.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":11,"context_line":"https://blueprints.launchpad.net/glance/+spec/multihash"},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"This spec provides a future-proof mechanism for providing a"},{"line_number":14,"context_line":"self-describing SHA512 hash for each image."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Problem description"},{"line_number":17,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_a0a8b1da","line":14,"range":{"start_line":14,"start_character":0,"end_line":14,"end_character":27},"updated":"2017-09-26 21:18:25.000000000","message":"I think just say \"secure hash\" here.  It\u0027s not really self-describing.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":27,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This spec proposes adding two new field to the image metadata. The"},{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``. "},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_a011d1ae","line":30,"range":{"start_line":30,"start_character":72,"end_line":30,"end_character":73},"updated":"2017-09-26 21:18:25.000000000","message":"should kill this space at the end of the line on your next edit","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``. "},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":" will allow us to alter the required hash or algorithm at any time."},{"line_number":36,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_0038a59d","line":33,"range":{"start_line":33,"start_character":22,"end_line":33,"end_character":28},"updated":"2017-09-26 21:18:25.000000000","message":"maybe put in single quotes so that it\u0027s clear you\u0027re talking about the sequence of characters, not the algorithm","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"214e3d6b3c1c0a29c006eaf78aa33abe1e678c00","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``. "},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":" will allow us to alter the required hash or algorithm at any time."},{"line_number":36,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_d69ed7b6","line":33,"range":{"start_line":33,"start_character":22,"end_line":33,"end_character":28},"in_reply_to":"7f515b1d_0038a59d","updated":"2017-09-26 22:03:03.000000000","message":"Don\u0027t know if this is worth adding, but hashlib recognizes both \u0027SHA512\u0027 and \u0027sha512\u0027 as identifiers [0], so it would be possible for a client to grab the value of hash_algo and then pass it as an argument to the hashlib.new() function to verify the hash.  So this scheme looks good for python users, at least.\n\n[0] https://github.com/python/cpython/blob/d0b9dc33676bdad217d5074954c1b37d4ca54a10/Lib/hashlib.py#L87","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":" will allow us to alter the required hash or algorithm at any time."},{"line_number":36,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"Adding a new image will set both the ``checksum``, ``hash_algo`` and ``hash_value``"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_806db533","line":35,"range":{"start_line":35,"start_character":0,"end_line":35,"end_character":1},"updated":"2017-09-26 21:18:25.000000000","message":"(this extraneous space is what\u0027s causing jenkins to fail the build)","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":35,"context_line":" will allow us to alter the required hash or algorithm at any time."},{"line_number":36,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."},{"line_number":37,"context_line":""},{"line_number":38,"context_line":"Adding a new image will set both the ``checksum``, ``hash_algo`` and ``hash_value``"},{"line_number":39,"context_line":"fields."},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"Requesting the image metadata of an image without the ``hash_algo/hash_value``"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_40557dc5","line":38,"range":{"start_line":38,"start_character":28,"end_line":38,"end_character":32},"updated":"2017-09-26 21:18:25.000000000","message":"all of","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":43,"context_line":"metadata response."},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"Downloading an image without the ``hash_value`` value set, will result in"},{"line_number":46,"context_line":"the value being populated upon completion."},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"Uploading an image to an existing image location will result in the"},{"line_number":49,"context_line":"``hash_algo`` and ``hash_value`` columns being set / updated."}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_00d4251f","line":46,"range":{"start_line":46,"start_character":0,"end_line":46,"end_character":9},"updated":"2017-09-26 21:18:25.000000000","message":"presumably you\u0027ll also populate the hash_algo field\n\nI forgot about this part.  It\u0027s not really a migration, but it will update the secure hash on those images that are actually being used, which are really the only ones you\u0027d care about anyway.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":55,"context_line":"   different hashing algorithm. This will likely break client-side"},{"line_number":56,"context_line":"   checksum verification code."},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"2. Add a new non-multihash checksum field. This is a less future proof"},{"line_number":59,"context_line":"   approach that will likely result in a new spec in a few years to add"},{"line_number":60,"context_line":"   yet another checksum field. Using the multihash format allows"},{"line_number":61,"context_line":"   changing the algorithm without adding a new field or breaking the API"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_80fa5572","line":58,"range":{"start_line":58,"start_character":3,"end_line":58,"end_character":42},"updated":"2017-09-26 21:18:25.000000000","message":"\"Add only the new hash_value field.\"","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":57,"context_line":""},{"line_number":58,"context_line":"2. Add a new non-multihash checksum field. This is a less future proof"},{"line_number":59,"context_line":"   approach that will likely result in a new spec in a few years to add"},{"line_number":60,"context_line":"   yet another checksum field. Using the multihash format allows"},{"line_number":61,"context_line":"   changing the algorithm without adding a new field or breaking the API"},{"line_number":62,"context_line":"   contract."},{"line_number":63,"context_line":""}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_803ff523","line":60,"range":{"start_line":60,"start_character":41,"end_line":60,"end_character":57},"updated":"2017-09-26 21:18:25.000000000","message":"\"additional hash_algo field\"","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":70,"context_line":"4. Implement a single ``hash_value`` field in the image metadata in which we calculate"},{"line_number":71,"context_line":"   the SHA512 value and then insert the algorithm identifier in a second column."},{"line_number":72,"context_line":"   This would produce a situation in which for every uploaded image we would have"},{"line_number":73,"context_line":"   a \u0027hash_algo\u0027 and \u0027hash_value\u0027 column."},{"line_number":74,"context_line":""},{"line_number":75,"context_line":"Data model impact"},{"line_number":76,"context_line":"-----------------"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_20a84175","line":73,"updated":"2017-09-26 21:18:25.000000000","message":"This sounds a lot like your current proposal, except that the hash_algo is being stored in the DB but not exposed in the image response.  I think what you want here is something like:\n\nImplement a single hash_value field in the image metadata.  The single field could contain a hash digest in the multihash format [0].  The advantage is that you\u0027re only adding one field.  The disadvantage is that a client can\u0027t consume the value directly, it first has to decode it and look up what algorithm is being used.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":173,"context_line":"Developer impact"},{"line_number":174,"context_line":"----------------"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"Any future checksum verification code should use the ``multihash`` field."},{"line_number":177,"context_line":""},{"line_number":178,"context_line":""},{"line_number":179,"context_line":"Implementation"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_40933dfb","line":176,"range":{"start_line":176,"start_character":53,"end_line":176,"end_character":72},"updated":"2017-09-26 21:18:25.000000000","message":"``hash_algo`` and ``hash_value`` fields with a fallback to using the ``checksum`` field.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":192,"context_line":""},{"line_number":193,"context_line":"* Add tests"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"* Update the db to add ``hash_algo`` \u0026 ``hash_value`` column to the images table (including"},{"line_number":196,"context_line":"  expand, migrate, contract, and monolith code)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"* Update the sections of code that calculate the ``checksum`` to also"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_80b25593","line":195,"range":{"start_line":195,"start_character":54,"end_line":195,"end_character":60},"updated":"2017-09-26 21:18:25.000000000","message":"columns","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":210,"context_line":"Dependencies"},{"line_number":211,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"The multihash specification [0]_"},{"line_number":214,"context_line":""},{"line_number":215,"context_line":"Testing"},{"line_number":216,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_4081fd8e","line":213,"updated":"2017-09-26 21:18:25.000000000","message":"This is no longer a dependency.  Since you\u0027re using a guaranteed algorithm in the python hashlib library, I think you can say \"None\" here.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"725894f05dc7d133b2e2ba8437ba9a07ba371dfb","unresolved":false,"context_lines":[{"line_number":215,"context_line":"Testing"},{"line_number":216,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":217,"context_line":""},{"line_number":218,"context_line":"Update the tests to verify multihash"},{"line_number":219,"context_line":""},{"line_number":220,"context_line":""},{"line_number":221,"context_line":"References"}],"source_content_type":"text/x-rst","patch_set":4,"id":"7f515b1d_605bd953","line":218,"range":{"start_line":218,"start_character":27,"end_line":218,"end_character":36},"updated":"2017-09-26 21:18:25.000000000","message":"use of the secure hash algorithm and proper population of image properties.","commit_id":"42a61c435d65cfd1224253049c19e1e63724a212"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"3451dd00fdd68fc9b80cb7c860521e9c1d806d65","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"2. Add only the new ``hash_value`` field. This is a less future proof"},{"line_number":60,"context_line":"   approach that will likely result in a new spec in a few years to add"},{"line_number":61,"context_line":"   yet another checksum field. Using an additional ``hash_value`` field allows"},{"line_number":62,"context_line":"   changing the algorithm without adding a new field or breaking the API"},{"line_number":63,"context_line":"   contract."},{"line_number":64,"context_line":""}],"source_content_type":"text/x-rst","patch_set":6,"id":"7f515b1d_4d4ebf97","line":61,"range":{"start_line":61,"start_character":53,"end_line":61,"end_character":63},"updated":"2017-09-27 14:40:45.000000000","message":"I think you mean hash_algo field here, since that\u0027s what makes this future-proof (i.e., it tells you what kind of hash is contained in the hash_value field)","commit_id":"d780dfe63a2f17af15fefc3eccbdcace900ebeaf"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"3451dd00fdd68fc9b80cb7c860521e9c1d806d65","unresolved":false,"context_lines":[{"line_number":72,"context_line":"   the SHA512 value. The single field will contain just the hash. The advantage is that"},{"line_number":73,"context_line":"   it is only one field being added to the data model and schema. However, having only"},{"line_number":74,"context_line":"   one field would make it difficult to use the hash quickly as the end user would be"},{"line_number":75,"context_line":"   required to look up what algorithm is being used before using the hash."},{"line_number":76,"context_line":""},{"line_number":77,"context_line":"Data model impact"},{"line_number":78,"context_line":"-----------------"}],"source_content_type":"text/x-rst","patch_set":6,"id":"7f515b1d_78481b5b","line":75,"updated":"2017-09-27 14:40:45.000000000","message":"This sounds like #2.  For this alternative, we\u0027d use the \"multihash\" value that was described on the original proposal that you\u0027re revising.  So the single field will contain the hash in the multihash format described in reference [0] .  The advantage is what you say here, the disadvantage is that the end user has to (a) decode the multihash format string to separate the algorithm code from the hex digest, and then (b) look up the code to see what algorithm to use to verify the hash.","commit_id":"d780dfe63a2f17af15fefc3eccbdcace900ebeaf"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"caf6df4bad442e6dbe35f6953481ec0cc71b386e","unresolved":false,"context_lines":[{"line_number":60,"context_line":"   approach that will likely result in a new spec in a few years to add"},{"line_number":61,"context_line":"   yet another checksum field. Using an additional ``hash_algo`` field allows"},{"line_number":62,"context_line":"   changing the algorithm without adding a new field or breaking the API"},{"line_number":63,"context_line":"   contract."},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"3. Use the hexdigest of a different algorithm. Tests using hashlib\u0027s"},{"line_number":66,"context_line":"   sha256 and sha512 algorithms consistently yielded faster times for"}],"source_content_type":"text/x-rst","patch_set":7,"id":"7f515b1d_f3578cc9","line":63,"updated":"2017-09-27 15:08:17.000000000","message":"This would be a good place to point out that we already use this strategy for image signature validation.","commit_id":"6e5ee39a282c3f015e9d3f4868efc7e314249420"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"caf6df4bad442e6dbe35f6953481ec0cc71b386e","unresolved":false,"context_lines":[{"line_number":69,"context_line":"   should be considered collision-resistant for many years."},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"4. Implement a single ``multihash`` field in the image metadata in which we calculate"},{"line_number":72,"context_line":"   the SHA512 value. The single field will contain just the hash. The advantage is that"},{"line_number":73,"context_line":"   it is only one field being added to the data model and schema. However, having only"},{"line_number":74,"context_line":"   one field would make it difficult to use the hash quickly as the end user would be"},{"line_number":75,"context_line":"   required to decode what algorithm is being used before verifying the hash."}],"source_content_type":"text/x-rst","patch_set":7,"id":"7f515b1d_93f738d4","line":72,"range":{"start_line":72,"start_character":51,"end_line":72,"end_character":64},"updated":"2017-09-27 15:08:17.000000000","message":"s/just the hash/hash in multihash format [0]_/\n\n(might as well use the reference!)","commit_id":"6e5ee39a282c3f015e9d3f4868efc7e314249420"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"52132466d171a8a704be16cb8a53ad3831f9ab58","unresolved":false,"context_lines":[{"line_number":60,"context_line":"   approach that will likely result in a new spec in a few years to add"},{"line_number":61,"context_line":"   yet another checksum field. Using an additional ``hash_algo`` field allows"},{"line_number":62,"context_line":"   changing the algorithm without adding a new field or breaking the API"},{"line_number":63,"context_line":"   contract. Using this checksum field is the current method of signature validation."},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"3. Use the hexdigest of a different algorithm. Tests using hashlib\u0027s"},{"line_number":66,"context_line":"   sha256 and sha512 algorithms consistently yielded faster times for"}],"source_content_type":"text/x-rst","patch_set":8,"id":"7f515b1d_59c0c12a","line":63,"range":{"start_line":63,"start_character":13,"end_line":63,"end_character":85},"updated":"2017-09-27 16:12:15.000000000","message":"Actually, this isn\u0027t correct.  The point you want to make here is that the image signature validation workflow uses related image properties, like you are proposing with hash_value and hash_algo (the names of the properties are listed on an earlier comment, something like img_hash and img_hash_method), so there\u0027s a precedent in Glance for using 2 fields instead of one.","commit_id":"dfadf7bb9b205a61d384656f341f5db5890aec76"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"52132466d171a8a704be16cb8a53ad3831f9ab58","unresolved":false,"context_lines":[{"line_number":69,"context_line":"   should be considered collision-resistant for many years."},{"line_number":70,"context_line":""},{"line_number":71,"context_line":"4. Implement a single ``multihash`` field in the image metadata in which we calculate"},{"line_number":72,"context_line":"   the SHA512 value. The single field will contain just the hash[0]_. The advantage is that"},{"line_number":73,"context_line":"   it is only one field being added to the data model and schema. However, having only"},{"line_number":74,"context_line":"   one field would make it difficult to use the hash quickly as the end user would be"},{"line_number":75,"context_line":"   required to decode what algorithm is being used before verifying the hash."}],"source_content_type":"text/x-rst","patch_set":8,"id":"7f515b1d_190da9a0","line":72,"range":{"start_line":72,"start_character":60,"end_line":72,"end_character":64},"updated":"2017-09-27 16:12:15.000000000","message":"strictly speaking, it doesn\u0027t contain the hash, see my comment on PS 7.","commit_id":"dfadf7bb9b205a61d384656f341f5db5890aec76"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"6b4803ee83ee8f9e87e7d242b6086647229d95c7","unresolved":false,"context_lines":[{"line_number":27,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This spec proposes adding two new fields to the image metadata. The"},{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_5e98721a","line":30,"range":{"start_line":30,"start_character":39,"end_line":30,"end_character":71},"updated":"2017-09-29 13:17:30.000000000","message":"should we use prefix \u0027os_\u0027 on these to avoid collisions for any tooling users might have out there utilizing these property names already. Specially the \"hash_value\" vorries me a bit.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"78494b6ca927fa7ecc9fe62ea579ba590e10ccd7","unresolved":false,"context_lines":[{"line_number":27,"context_line":"\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d"},{"line_number":28,"context_line":""},{"line_number":29,"context_line":"This spec proposes adding two new fields to the image metadata. The"},{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_f9b17848","line":30,"range":{"start_line":30,"start_character":39,"end_line":30,"end_character":71},"in_reply_to":"7f515b1d_5e98721a","updated":"2017-09-29 13:38:22.000000000","message":"I agree, the os_ prefix is a good idea","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"3cce054d56db5c686040fc82a147bbb94ca081e8","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_7e70ce08","line":33,"range":{"start_line":33,"start_character":22,"end_line":33,"end_character":28},"updated":"2017-09-29 13:13:06.000000000","message":"For clarity we should use the hash function name from hashlib not accepting md5. FE \"sha512\" or \"sha3_512\".\n\nThis will also make it easily configurable and once the algo is changed we can still support processing images using algo used before.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"554baddf3279ac78e482cb7dafe85076e8a3eac6","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_0f02c26f","line":33,"range":{"start_line":33,"start_character":22,"end_line":33,"end_character":28},"in_reply_to":"7f515b1d_19b454d0","updated":"2017-09-29 15:22:26.000000000","message":"\u003e Really not sure why we want to limit to these\n\nWell, you\u0027re Mr. Interoperability! For interoperability, I\u0027d think you\u0027d only want to use algorithms that were guaranteed available to everybody.  This is what I see on my mac right now:\n\u003e\u003e\u003e hashlib.algorithms_available\nset([\u0027SHA1\u0027, \u0027MDC2\u0027, \u0027SHA\u0027, \u0027SHA384\u0027, \u0027ecdsa-with-SHA1\u0027, \u0027SHA256\u0027, \u0027SHA512\u0027, \u0027md4\u0027, \u0027md5\u0027, \u0027sha1\u0027, \u0027dsaWithSHA\u0027, \u0027DSA-SHA\u0027, \u0027sha\u0027, \u0027sha224\u0027, \u0027dsaEncryption\u0027, \u0027DSA\u0027, \u0027ripemd160\u0027, \u0027mdc2\u0027, \u0027MD5\u0027, \u0027MD4\u0027, \u0027sha384\u0027, \u0027SHA224\u0027, \u0027sha256\u0027, \u0027sha512\u0027, \u0027RIPEMD160\u0027])\n\u003e\u003e\u003e hashlib.algorithms_guaranteed\nset([\u0027sha1\u0027, \u0027sha224\u0027, \u0027sha384\u0027, \u0027sha256\u0027, \u0027sha512\u0027, \u0027md5\u0027])\n\nI have a bunch of available algos from openssl and who knows what else, but someone else might not.  Won\u0027t do me much good to consume an image whose hash is RIPEMD160 if I can\u0027t actually verify the hash.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"aedda43106855cf1ae30932c474b3d5e7c94fad4","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_19b454d0","line":33,"range":{"start_line":33,"start_character":22,"end_line":33,"end_character":28},"in_reply_to":"7f515b1d_59664cc3","updated":"2017-09-29 13:57:48.000000000","message":"\u003e Ok, we could make the legal values one of the set output by\n \u003e hashlib.algorithms_guaranteed (which are available on all platforms\n \u003e and don\u0027t rely on having openssl installed):\n \u003e \u003e\u003e\u003e hashlib.algorithms_guaranteed\n \u003e set([\u0027sha1\u0027, \u0027sha224\u0027, \u0027sha384\u0027, \u0027sha256\u0027, \u0027sha512\u0027, \u0027md5\u0027])\n\nReally not sure why we want to limit to these. As long as it\u0027s discoverable which generally available algo is used in the cloud that should be fine, right? We could literally just pull the algo list from hashlib and verify the config option against that and never need to hardcode any artificial limits when these things changes, no? My point to use the naming with something we can directly call the hashlib with is that it makes the actual code doing this way more simple as we don\u0027t need to hardcode any special casing on any of the algo types.\n\n \u003e \n \u003e I don\u0027t see any reason to reject md5, though.  Actually, a good\n \u003e reason to keep it is that you could do an easy migration to the new\n \u003e fields:\n \u003e \n \u003e os_hash_algo \u003c- \u0027md5\u0027\n \u003e os_hash_value \u003c- current value of checksum field\n \u003e \n \u003e which would make it easier for tooling.  (I don\u0027t think we need to\n \u003e do a migration, though, since we\u0027re keeping the checksum property.)\n\nI was thinking of this. So what we can do as migration path is to have md5 populated from the checksum to algo \u0026 hash on the new values so consumers can move to consuming only the new values and don\u0027t need to check if it\u0027s there and revert. What I mean is that as we calculate that md5 into the checksum already there is no reason what so ever to let the new algo being configured to calculate second md5. getting rid of the insecure md5 was the initial point of this feature, right? I\u0027m talking here single value config option that will be used as algo for any new image calculations, not allowed values in database. The code doing the verification needs to be able to cope with any number different algo types the images has been created with. When the algo type gets changed in the config being it for security, performance, preference or the admins wife\u0027s opinion reasons, we need to be able to deal with the fact that that\u0027s the algo used for new images and the old images still needs to be verified against the algo-hash combination the image has in its records.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"78494b6ca927fa7ecc9fe62ea579ba590e10ccd7","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_59664cc3","line":33,"range":{"start_line":33,"start_character":22,"end_line":33,"end_character":28},"in_reply_to":"7f515b1d_7e70ce08","updated":"2017-09-29 13:38:22.000000000","message":"Ok, we could make the legal values one of the set output by hashlib.algorithms_guaranteed (which are available on all platforms and don\u0027t rely on having openssl installed):\n\u003e\u003e\u003e hashlib.algorithms_guaranteed\nset([\u0027sha1\u0027, \u0027sha224\u0027, \u0027sha384\u0027, \u0027sha256\u0027, \u0027sha512\u0027, \u0027md5\u0027])\n\nI don\u0027t see any reason to reject md5, though.  Actually, a good reason to keep it is that you could do an easy migration to the new fields:\n\nos_hash_algo \u003c- \u0027md5\u0027\nos_hash_value \u003c- current value of checksum field\n\nwhich would make it easier for tooling.  (I don\u0027t think we need to do a migration, though, since we\u0027re keeping the checksum property.)","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"3cce054d56db5c686040fc82a147bbb94ca081e8","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."},{"line_number":37,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_7e49eeb4","line":34,"range":{"start_line":33,"start_character":65,"end_line":34,"end_character":58},"updated":"2017-09-29 13:13:06.000000000","message":"The beauty of this design makes me wonder why should we hardcode this at all. sha512 is just good default value based on the data we have available.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"78494b6ca927fa7ecc9fe62ea579ba590e10ccd7","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."},{"line_number":37,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_996724b8","line":34,"range":{"start_line":33,"start_character":65,"end_line":34,"end_character":58},"in_reply_to":"7f515b1d_7e49eeb4","updated":"2017-09-29 13:38:22.000000000","message":"We could introduce a config option; oslo.config can enforce an enumeration, so we don\u0027t need to worry about an operator misspelling \u0027sha521\u0027, and we can make the default \u0027sha512\u0027.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"aedda43106855cf1ae30932c474b3d5e7c94fad4","unresolved":false,"context_lines":[{"line_number":30,"context_line":"proposed keys for this change would be ``hash_algo`` and ``hash_value``."},{"line_number":31,"context_line":"The proposed value is a hash value that is formatted as a sha512 hexdigest."},{"line_number":32,"context_line":"The hexdigest will be obtained using the current python hashlib library."},{"line_number":33,"context_line":"``hash_algo`` will be SHA512 and ``hash_value`` will be the hex. At this"},{"line_number":34,"context_line":"point in time, the only algorithm available will be SHA512, but this change"},{"line_number":35,"context_line":"will allow us to alter the required hash or algorithm at any time. The ``hash_algo``"},{"line_number":36,"context_line":"field will also allow for users to dynamically pass this value to their python code."},{"line_number":37,"context_line":"We will leave MD5 calculations and checksums for backwards compatibility."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_79e0e8cd","line":34,"range":{"start_line":33,"start_character":65,"end_line":34,"end_character":58},"in_reply_to":"7f515b1d_996724b8","updated":"2017-09-29 13:57:48.000000000","message":"Sorry, see my comment addressing this as well above.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"3cce054d56db5c686040fc82a147bbb94ca081e8","unresolved":false,"context_lines":[{"line_number":43,"context_line":"value set, will result in a null for the ``hash_algo/hash_value`` field in the"},{"line_number":44,"context_line":"metadata response."},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"Downloading an image without the ``hash_value`` value set, will result in"},{"line_number":47,"context_line":"the value being populated upon completion. ``hash_algo`` will also be updated."},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"Uploading an image to an existing image location will result in the"},{"line_number":50,"context_line":"``hash_algo`` and ``hash_value`` columns being set / updated."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_1eff9a67","line":47,"range":{"start_line":46,"start_character":0,"end_line":47,"end_character":78},"updated":"2017-09-29 13:13:06.000000000","message":"I think this might turn out to be quite optimistic statement. As we are dealing always within the context scope of the user doing the request, we cannot just go and do changes into the image metadata. I think this update on download can be only done when the owner of the image is doing the download and we need to be able to provide the owner last call on if the data will be populated or not.\n\nAnother concern is how do we deal with possible corruption during the transfer between the backend and glance-api. We would need to at least verify that the existing MD5 hash matches the data. If neither exists I don\u0027t think we should update any of the hashes as we don\u0027t have even possibility for sophisticated guess that the data going through on download was the same originally provided.\n\nCurrently when the hashing happens on upload, the image owner has possibility to verify the hash with the one calculated locally before using the image, if there is mismatch they can trash the image and recreate it. If we update the hash based on the errorneous data during the download we might render the image, all the snapshots based on it etc. useless as consumers would not accept the image due to hash mismatch. I think this is way worse outcome than not having the hash on the image at all.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"78494b6ca927fa7ecc9fe62ea579ba590e10ccd7","unresolved":false,"context_lines":[{"line_number":43,"context_line":"value set, will result in a null for the ``hash_algo/hash_value`` field in the"},{"line_number":44,"context_line":"metadata response."},{"line_number":45,"context_line":""},{"line_number":46,"context_line":"Downloading an image without the ``hash_value`` value set, will result in"},{"line_number":47,"context_line":"the value being populated upon completion. ``hash_algo`` will also be updated."},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"Uploading an image to an existing image location will result in the"},{"line_number":50,"context_line":"``hash_algo`` and ``hash_value`` columns being set / updated."}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_995de416","line":47,"range":{"start_line":46,"start_character":0,"end_line":47,"end_character":78},"in_reply_to":"7f515b1d_1eff9a67","updated":"2017-09-29 13:38:22.000000000","message":"These are good points. Jesse had me convinced on the original version of this proposal that it would be easy to do this, but now I really wonder.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5202,"name":"Erno Kuvaja","email":"jokke@usr.fi","username":"jokke"},"change_message_id":"3cce054d56db5c686040fc82a147bbb94ca081e8","unresolved":false,"context_lines":[{"line_number":46,"context_line":"Downloading an image without the ``hash_value`` value set, will result in"},{"line_number":47,"context_line":"the value being populated upon completion. ``hash_algo`` will also be updated."},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"Uploading an image to an existing image location will result in the"},{"line_number":50,"context_line":"``hash_algo`` and ``hash_value`` columns being set / updated."},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"Alternatives"}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_7e420ead","line":49,"range":{"start_line":49,"start_character":0,"end_line":49,"end_character":48},"updated":"2017-09-29 13:13:06.000000000","message":"This is not possible at all.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"},{"author":{"_account_id":5314,"name":"Brian Rosmaita","email":"rosmaita.fossdev@gmail.com","username":"brian-rosmaita"},"change_message_id":"78494b6ca927fa7ecc9fe62ea579ba590e10ccd7","unresolved":false,"context_lines":[{"line_number":46,"context_line":"Downloading an image without the ``hash_value`` value set, will result in"},{"line_number":47,"context_line":"the value being populated upon completion. ``hash_algo`` will also be updated."},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"Uploading an image to an existing image location will result in the"},{"line_number":50,"context_line":"``hash_algo`` and ``hash_value`` columns being set / updated."},{"line_number":51,"context_line":""},{"line_number":52,"context_line":"Alternatives"}],"source_content_type":"text/x-rst","patch_set":12,"id":"7f515b1d_f943b840","line":49,"range":{"start_line":49,"start_character":0,"end_line":49,"end_character":48},"in_reply_to":"7f515b1d_7e420ead","updated":"2017-09-29 13:38:22.000000000","message":"Erno is correct.  I misread this as \"uploading image data to an existing image record\" will set the properties.","commit_id":"40cd8e48c41af68c604007e20ee5381a26709691"}]}
