)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7353,"name":"Kevin Carter","email":"kevin@cloudnull.com","username":"cloudnull"},"change_message_id":"10b460885931b566a4b57cd9720c300abfd2f8b9","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Make pw-token-gen.py more random"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This script, when ran multiple times would generate the same"},{"line_number":10,"context_line":"password/token. This fix utilizes the urandom method in the os mmodule."},{"line_number":11,"context_line":"This will fix a potential security hole."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-bug: 1732295"},{"line_number":14,"context_line":"Change-Id: I060976d243dfc4ddc7fd67aff36f3a888a0a363e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1f485f77_5c7e7caf","line":11,"range":{"start_line":9,"start_character":0,"end_line":11,"end_character":40},"updated":"2017-11-15 17:42:15.000000000","message":"Being that this is not an actual security vulnerability I\u0027d rephrase this as just improving our overall RNG.","commit_id":"576aaabc834b3eeb4a3797ea531fd42c3a011e72"},{"author":{"_account_id":14288,"name":"Matthew Thode","display_name":"prometheanfire","email":"mthode@mthode.org","username":"prometheanfire"},"change_message_id":"425fd451d25e5722fead29282b691da5118f98f1","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This script, when ran multiple times would generate the same"},{"line_number":10,"context_line":"password/token. This fix utilizes the urandom method in the os mmodule."},{"line_number":11,"context_line":"This will fix a potential security hole."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-bug: 1732295"},{"line_number":14,"context_line":"Change-Id: I060976d243dfc4ddc7fd67aff36f3a888a0a363e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":8,"id":"1f485f77_884cb342","line":11,"updated":"2017-11-15 16:39:04.000000000","message":"Not sure if that\u0027s technically true, iirc the random stuff in python is re-initialized each time the python intrepreter is, but it\u0027s not sutable for cryptographic use in any case.  Using urandom is the correct fix.","commit_id":"576aaabc834b3eeb4a3797ea531fd42c3a011e72"}],"scripts/pw-token-gen.py":[{"author":{"_account_id":14288,"name":"Matthew Thode","display_name":"prometheanfire","email":"mthode@mthode.org","username":"prometheanfire"},"change_message_id":"7f58dd41b8f482946ac5bfa2efbec6aab7396529","unresolved":false,"context_lines":[{"line_number":22,"context_line":"import tarfile"},{"line_number":23,"context_line":"import uuid"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"from random import SystemRandom"},{"line_number":26,"context_line":"try:"},{"line_number":27,"context_line":"    import yaml"},{"line_number":28,"context_line":"except ImportError:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_35a76a52","line":25,"updated":"2017-11-15 03:12:08.000000000","message":"This should be:\n\nfrom random import SystemRandom as Random","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":21314,"name":"Cam J. Loader","display_name":"Cam J. Loader","email":"cameron@loaderusa.net","username":"4-cameron"},"change_message_id":"8bece10857f6d646fea4b2f41ba7fcd788194811","unresolved":false,"context_lines":[{"line_number":22,"context_line":"import tarfile"},{"line_number":23,"context_line":"import uuid"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"from random import SystemRandom"},{"line_number":26,"context_line":"try:"},{"line_number":27,"context_line":"    import yaml"},{"line_number":28,"context_line":"except ImportError:"}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_f008c0d9","line":25,"in_reply_to":"1f485f77_35a76a52","updated":"2017-11-15 03:38:38.000000000","message":"Done","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":14288,"name":"Matthew Thode","display_name":"prometheanfire","email":"mthode@mthode.org","username":"prometheanfire"},"change_message_id":"7f58dd41b8f482946ac5bfa2efbec6aab7396529","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_15646e21","line":72,"updated":"2017-11-15 03:12:08.000000000","message":"I suggested the use of SystemRandom so we get the helper functions along with it, since we only have one usage of random and are already importing os, os.urandom is good too.","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":7353,"name":"Kevin Carter","email":"kevin@cloudnull.com","username":"cloudnull"},"change_message_id":"d6653358f5a208bdcc0f8dbfef25088c9799175c","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_1506aecf","line":72,"updated":"2017-11-15 02:41:59.000000000","message":"This will need to be replaced with `SystemRandom`","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":7353,"name":"Kevin Carter","email":"kevin@cloudnull.com","username":"cloudnull"},"change_message_id":"30142e99fafa51b4a5c9b981c472035e75fb725f","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_15bd8ed7","line":72,"in_reply_to":"1f485f77_1506aecf","updated":"2017-11-15 02:47:46.000000000","message":"It looks like we can just scrap the import Crypto or random and just use os.urandom if we\u0027re going to simply use the system RNG.\n\nsomething like:\n\n  os.urandom(1024)","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":21314,"name":"Cam J. Loader","display_name":"Cam J. Loader","email":"cameron@loaderusa.net","username":"4-cameron"},"change_message_id":"8bece10857f6d646fea4b2f41ba7fcd788194811","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_1006bccf","line":72,"in_reply_to":"1f485f77_15646e21","updated":"2017-11-15 03:38:38.000000000","message":"Done","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":21314,"name":"Cam J. Loader","display_name":"Cam J. Loader","email":"cameron@loaderusa.net","username":"4-cameron"},"change_message_id":"8bece10857f6d646fea4b2f41ba7fcd788194811","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":4,"id":"1f485f77_506e7495","line":72,"in_reply_to":"1f485f77_15bd8ed7","updated":"2017-11-15 03:38:38.000000000","message":"Done","commit_id":"1fc6fad177f152b332b1325383e0a9f3f3645f4f"},{"author":{"_account_id":7353,"name":"Kevin Carter","email":"kevin@cloudnull.com","username":"cloudnull"},"change_message_id":"79075a4305c9d877af90ae7cda8356ee649c6507","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":5,"id":"1f485f77_903f4c24","line":72,"updated":"2017-11-15 03:59:00.000000000","message":"This still needs to change because the function \"get_random_bytes\" does not exists.\n\n\nhttp://paste.openstack.org/show/626316/","commit_id":"773207e0a411d8c7bb4b24319738e5ab83bd2f88"},{"author":{"_account_id":7353,"name":"Kevin Carter","email":"kevin@cloudnull.com","username":"cloudnull"},"change_message_id":"e2d58d80f6caa23005d6e80648c3b417c7cc372c","unresolved":false,"context_lines":[{"line_number":22,"context_line":"import tarfile"},{"line_number":23,"context_line":"import uuid"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"from random import SystemRandom as Random"},{"line_number":26,"context_line":"try:"},{"line_number":27,"context_line":"    import yaml"},{"line_number":28,"context_line":"except ImportError:"}],"source_content_type":"text/x-python","patch_set":6,"id":"1f485f77_96d184fe","line":25,"range":{"start_line":25,"start_character":0,"end_line":25,"end_character":41},"updated":"2017-11-15 06:00:00.000000000","message":"if we use os.urandom we wont need this.","commit_id":"b908f54c6f03df2afa38cd4600baeaeaa112d0b3"},{"author":{"_account_id":8004,"name":"Paul Kehrer","email":"paul.l.kehrer@gmail.com","username":"reaperhulk"},"change_message_id":"f4b994b8add28352e3d69a47b9637c39f8058813","unresolved":false,"context_lines":[{"line_number":69,"context_line":"    @staticmethod"},{"line_number":70,"context_line":"    def _random_bytes():"},{"line_number":71,"context_line":"        \"\"\"Returns 1024 random bytes of data.\"\"\""},{"line_number":72,"context_line":"        return Random.get_random_bytes(1024)"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"    def _encode_bytes(self):"},{"line_number":75,"context_line":"        \"\"\"Builds random strings based on random data."}],"source_content_type":"text/x-python","patch_set":9,"id":"1f485f77_0c0c373f","side":"PARENT","line":72,"updated":"2017-11-16 14:26:11.000000000","message":"This is a lot more random than you need (not that it really matters)","commit_id":"d78e63a67db98e72778fb33256d800f898e982ec"},{"author":{"_account_id":8004,"name":"Paul Kehrer","email":"paul.l.kehrer@gmail.com","username":"reaperhulk"},"change_message_id":"f4b994b8add28352e3d69a47b9637c39f8058813","unresolved":false,"context_lines":[{"line_number":79,"context_line":"        SHA512 and the returned as a **hex** digest."},{"line_number":80,"context_line":"        \"\"\""},{"line_number":81,"context_line":"        random_bytes \u003d self._random_bytes()"},{"line_number":82,"context_line":"        hash_obj \u003d hashlib.sha512(random_bytes)"},{"line_number":83,"context_line":"        return hash_obj.hexdigest()"},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"    def _password_gen(self, encoded_bytes):"}],"source_content_type":"text/x-python","patch_set":9,"id":"1f485f77_2c26d3cf","side":"PARENT","line":82,"updated":"2017-11-16 14:26:11.000000000","message":"There\u0027s no utility in hashing the random value here; you can just hexlify it directly.","commit_id":"d78e63a67db98e72778fb33256d800f898e982ec"},{"author":{"_account_id":8004,"name":"Paul Kehrer","email":"paul.l.kehrer@gmail.com","username":"reaperhulk"},"change_message_id":"f4b994b8add28352e3d69a47b9637c39f8058813","unresolved":false,"context_lines":[{"line_number":87,"context_line":""},{"line_number":88,"context_line":"        :param encoded_bytes: ``str`` must be at least 64 charters long"},{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        return encoded_bytes[:random.randrange(16, 64)]"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    def _token_gen(self, encoded_bytes):"},{"line_number":93,"context_line":"        \"\"\"Returns ``str`` with a length between 48 and 64."}],"source_content_type":"text/x-python","patch_set":9,"id":"1f485f77_20593734","side":"PARENT","line":90,"updated":"2017-11-16 14:26:11.000000000","message":"16 bytes of a hexadecimal value is only 64 bits of actual entropy from your source. Granted only 1 in 48 invocations will have this. As a sidenote, random.randrange is linked to a singleton mersenne twister instance and is vulnerable to manipulation in certain circumstances (although this script invoked once during setup is not one of them).","commit_id":"d78e63a67db98e72778fb33256d800f898e982ec"}]}
