)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6593,"name":"Dirk Mueller","email":"dirk@dmllr.de","username":"dmllr"},"change_message_id":"e746d7b6c39a5c94b9728f590feff60a92a9e9a3","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Sushil Kumar \u003csushil.kumar2@globallogic.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2014-01-25 14:03:41 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Fixes insecure update of /etc/fstab file"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Reasons:"},{"line_number":10,"context_line":"- While updating /etc/fstab in write_to_fstab in"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"AAAAUH%2F%2BOTk%3D","line":7,"updated":"2014-01-28 22:49:15.000000000","message":"Please tag this with SecurityImpact in the commit message","commit_id":"21cf00d675f548318be1208af5c5cb96fbacaa5b"}],"trove/guestagent/volume.py":[{"author":{"_account_id":5293,"name":"Nikhil","email":"SlickNik@gmail.com","username":"slicknik"},"change_message_id":"ea19206660b83734c3298b0c1be5f099bbb39d06","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        LOG.debug(_(\"Writing new line to fstab:%s\") % fstab_line)"},{"line_number":150,"context_line":"        fstab_temp_file \u003d \"/tmp/fs%s\" % utils.generate_uuid()"},{"line_number":151,"context_line":"        utils.execute(\"sudo\", \"cp\", \"/etc/fstab\", \"/etc/fstab.orig\")"},{"line_number":152,"context_line":"        utils.execute(\"cp\", \"/etc/fstab\", fstab_temp_file)"},{"line_number":153,"context_line":"        with open(fstab_temp_file, \u0027a\u0027) as new_fstab:"},{"line_number":154,"context_line":"            new_fstab.write(\"\\n\" + fstab_line)"},{"line_number":155,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"640\", fstab_temp_file)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAUH%2F%2BL7Q%3D","line":152,"updated":"2014-01-29 10:02:52.000000000","message":"Since the file is copied over as user, it\u0027s possible for a malicious user to access the file and inject a spurious mount  during this window.","commit_id":"21cf00d675f548318be1208af5c5cb96fbacaa5b"},{"author":{"_account_id":6593,"name":"Dirk Mueller","email":"dirk@dmllr.de","username":"dmllr"},"change_message_id":"e746d7b6c39a5c94b9728f590feff60a92a9e9a3","unresolved":false,"context_lines":[{"line_number":149,"context_line":"        LOG.debug(_(\"Writing new line to fstab:%s\") % fstab_line)"},{"line_number":150,"context_line":"        fstab_temp_file \u003d \"/tmp/fs%s\" % utils.generate_uuid()"},{"line_number":151,"context_line":"        utils.execute(\"sudo\", \"cp\", \"/etc/fstab\", \"/etc/fstab.orig\")"},{"line_number":152,"context_line":"        utils.execute(\"cp\", \"/etc/fstab\", fstab_temp_file)"},{"line_number":153,"context_line":"        with open(fstab_temp_file, \u0027a\u0027) as new_fstab:"},{"line_number":154,"context_line":"            new_fstab.write(\"\\n\" + fstab_line)"},{"line_number":155,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"640\", fstab_temp_file)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAUH%2F%2BORY%3D","line":152,"updated":"2014-01-28 22:49:15.000000000","message":"There is no need for running cp here externally then anymore, this could be opening a temp file.NamedTemporaryFile and copying the content over plus the additional line.","commit_id":"21cf00d675f548318be1208af5c5cb96fbacaa5b"},{"author":{"_account_id":6593,"name":"Dirk Mueller","email":"dirk@dmllr.de","username":"dmllr"},"change_message_id":"e746d7b6c39a5c94b9728f590feff60a92a9e9a3","unresolved":false,"context_lines":[{"line_number":153,"context_line":"        with open(fstab_temp_file, \u0027a\u0027) as new_fstab:"},{"line_number":154,"context_line":"            new_fstab.write(\"\\n\" + fstab_line)"},{"line_number":155,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"640\", fstab_temp_file)"},{"line_number":156,"context_line":"        utils.execute(\"sudo\", \"mv\", fstab_temp_file, \"/etc/fstab\")"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAUH%2F%2BOQs%3D","line":156,"updated":"2014-01-28 22:49:15.000000000","message":"This doesn\u0027t reset ownership to root:root, I think.","commit_id":"21cf00d675f548318be1208af5c5cb96fbacaa5b"},{"author":{"_account_id":6593,"name":"Dirk Mueller","email":"dirk@dmllr.de","username":"dmllr"},"change_message_id":"b6c9b00f763f4fa6f5beb7896040152a1215357d","unresolved":false,"context_lines":[{"line_number":146,"context_line":"                      (self.device_path, self.mount_point, self.volume_fstype,"},{"line_number":147,"context_line":"                       self.mount_options))"},{"line_number":148,"context_line":"        LOG.debug(\"Writing new line to fstab:%s\" % fstab_line)"},{"line_number":149,"context_line":"        utils.execute(\"sudo\", \"cp\", \"/etc/fstab\", \"/etc/fstab.orig\")"},{"line_number":150,"context_line":"        utils.execute(\"sudo\", \"cp\", \"/etc/fstab\", \"/tmp/newfstab\")"},{"line_number":151,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"666\", \"/tmp/newfstab\")"},{"line_number":152,"context_line":"        with open(\"/tmp/newfstab\", \u0027a\u0027) as new_fstab:"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUH%2F%2BF7M%3D","side":"PARENT","line":149,"updated":"2014-01-30 07:24:23.000000000","message":"This was lost, is that intentional?","commit_id":"c6de5433d5616328790bb9245925b291e18c226e"},{"author":{"_account_id":7806,"name":"Sushil Kumar","email":"skm.net@gmail.com","username":"sushilkm"},"change_message_id":"672c4ac54429c459288a8ed8db757170ff066175","unresolved":false,"context_lines":[{"line_number":146,"context_line":"                      (self.device_path, self.mount_point, self.volume_fstype,"},{"line_number":147,"context_line":"                       self.mount_options))"},{"line_number":148,"context_line":"        LOG.debug(\"Writing new line to fstab:%s\" % fstab_line)"},{"line_number":149,"context_line":"        utils.execute(\"sudo\", \"cp\", \"/etc/fstab\", \"/etc/fstab.orig\")"},{"line_number":150,"context_line":"        utils.execute(\"sudo\", \"cp\", \"/etc/fstab\", \"/tmp/newfstab\")"},{"line_number":151,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"666\", \"/tmp/newfstab\")"},{"line_number":152,"context_line":"        with open(\"/tmp/newfstab\", \u0027a\u0027) as new_fstab:"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUH%2F%2BF6s%3D","side":"PARENT","line":149,"in_reply_to":"AAAAUH%2F%2BF7M%3D","updated":"2014-01-30 07:26:08.000000000","message":"this is read in fstab_content","commit_id":"c6de5433d5616328790bb9245925b291e18c226e"},{"author":{"_account_id":6593,"name":"Dirk Mueller","email":"dirk@dmllr.de","username":"dmllr"},"change_message_id":"b6c9b00f763f4fa6f5beb7896040152a1215357d","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            tempfstab.write(fstab_content + fstab_line)"},{"line_number":155,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"644\", tempfstab.name)"},{"line_number":156,"context_line":"        utils.execute(\"sudo\", \"chown\", \"root:root\", tempfstab.name)"},{"line_number":157,"context_line":"        utils.execute(\"sudo\", \"mv\", tempfstab.name, \"/etc/fstab\")"},{"line_number":158,"context_line":"        os.remove(tempfstab.name)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUH%2F%2BF7U%3D","line":157,"updated":"2014-01-30 07:24:23.000000000","message":"You could simply use \u0027install\u0027 here I think.","commit_id":"8d244212f2b557eeef7dfa87ce2ec4b6d459646b"},{"author":{"_account_id":7806,"name":"Sushil Kumar","email":"skm.net@gmail.com","username":"sushilkm"},"change_message_id":"672c4ac54429c459288a8ed8db757170ff066175","unresolved":false,"context_lines":[{"line_number":154,"context_line":"            tempfstab.write(fstab_content + fstab_line)"},{"line_number":155,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"644\", tempfstab.name)"},{"line_number":156,"context_line":"        utils.execute(\"sudo\", \"chown\", \"root:root\", tempfstab.name)"},{"line_number":157,"context_line":"        utils.execute(\"sudo\", \"mv\", tempfstab.name, \"/etc/fstab\")"},{"line_number":158,"context_line":"        os.remove(tempfstab.name)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAUH%2F%2BF6o%3D","line":157,"in_reply_to":"AAAAUH%2F%2BF7U%3D","updated":"2014-01-30 07:26:08.000000000","message":"install means ???","commit_id":"8d244212f2b557eeef7dfa87ce2ec4b6d459646b"},{"author":{"_account_id":2340,"name":"Ionut Artarisi","email":"iartarisi@suse.cz","username":"mapleoin"},"change_message_id":"0da41882644aeac5ede042ed0ee8041bcdf38a2e","unresolved":false,"context_lines":[{"line_number":152,"context_line":"            fstab_content \u003d fstab.read()"},{"line_number":153,"context_line":"        with NamedTemporaryFile(delete\u003dFalse) as tempfstab:"},{"line_number":154,"context_line":"            tempfstab.write(fstab_content + fstab_line)"},{"line_number":155,"context_line":"        utils.execute(\"sudo\", \"chmod\", \"644\", tempfstab.name)"},{"line_number":156,"context_line":"        utils.execute(\"sudo\", \"chown\", \"root:root\", tempfstab.name)"},{"line_number":157,"context_line":"        utils.execute(\"sudo\", \"mv\", tempfstab.name, \"/etc/fstab\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAVn%2F%2FvYE%3D","line":155,"updated":"2014-03-04 11:16:07.000000000","message":"Agreed with Dirk, why not use install here instead of these three commands? That would make the change more atomic.\ne.g.\n\nsudo install tempfstab.name /etc/fstab --owner root --group root --mode 644\nsudo rm tempfstab.name\n\nIt would also be good to have some error handling here in case these operations fail.","commit_id":"60c417754f1ed7dd0814649c01c167064245ed84"}]}
