)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"bf255e0f0e01e64768cb11cf9a9c0335beb3fe07","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Jaewoo Park \u003cjp655p@att.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-06-02 13:13:16 -0700"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Brush up X-Subject-Token to prevent keystone curl from failing using awk commands"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Regex to brush up the X-Subject-Token so that \"\\r\" is removed from its tail"},{"line_number":10,"context_line":"so that 400, 401s do not occur when extracting the token using awk commands."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"df140735_22cecbb3","line":7,"range":{"start_line":7,"start_character":0,"end_line":7,"end_character":81},"updated":"2017-06-02 20:19:52.000000000","message":"Need to shorten this title as well. I think it\u0027s 50 characters.","commit_id":"7decbd429a67a892e09e5e9ddd25a4cd22336114"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"2c5c5341e356fa25cf58bcb7c07f7ddb1182d9af","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Jaewoo Park \u003cjp655p@att.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-06-02 20:23:53 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Brush up X-Subject-Token to prevent keystone curl from failing with awk"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Regex to brush up the X-Subject-Token so that \"\\r\" is removed from its "},{"line_number":10,"context_line":"tail so that 400, 401s do not occur when extracting the token using "}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"df140735_622043ad","line":7,"updated":"2017-06-02 20:50:54.000000000","message":"need to shorten the title to 50 characters. See https://wiki.openstack.org/wiki/GitCommitMessages#Summary_of_Git_commit_message_structure\n\nMaybe just \"Trim whitespace from X-Subject-Token\"","commit_id":"0cdd3702b4da7188f79e6e89c8069de4f768a70a"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"2c5c5341e356fa25cf58bcb7c07f7ddb1182d9af","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Brush up X-Subject-Token to prevent keystone curl from failing with awk"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Regex to brush up the X-Subject-Token so that \"\\r\" is removed from its "},{"line_number":10,"context_line":"tail so that 400, 401s do not occur when extracting the token using "},{"line_number":11,"context_line":"awk commands."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"df140735_1d0b2a24","line":9,"updated":"2017-06-02 20:50:54.000000000","message":"both this line and the next have trailing spaces. You\u0027ll need to rephrase this anyway if you use strip() instead of re as I suggested in another comment.","commit_id":"0cdd3702b4da7188f79e6e89c8069de4f768a70a"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"d010edc13473d919afa4c47115243e9d8320f4dc","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Kelly Hall \u003ckh928q@att.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-06-30 17:36:35 +0000"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Trim Whitespace from X-Subject-Token"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"This unit test proves that .strip() removes"},{"line_number":10,"context_line":"whitespace from a token, preventing a 401 error"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":9,"id":"3f1d235d_3c908e4e","line":7,"range":{"start_line":7,"start_character":21,"end_line":7,"end_character":36},"updated":"2017-07-01 17:25:55.000000000","message":"Can we also update the commitmsg to say it is removing whitespace from X-Auth-Token also?","commit_id":"ba576887e18a25945a18950910080bd6fef50b4b"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"63f0e238e490db75353097296d9bb5de04f4faf1","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Kelly Hall \u003ckh928q@att.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2017-07-06 09:38:07 -0700"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Trims whitespace from request headers"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The unit tests proves that .strip() removes"},{"line_number":10,"context_line":"whitespace such as \\r, \\n, \\t, and \u0027 \u0027 from"},{"line_number":11,"context_line":"X-Auth-Token and X-Subject-Token, preventing a"},{"line_number":12,"context_line":"401 error from occuring and allowing it to be"},{"line_number":13,"context_line":"authorized."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Cleaned up middleware/core.py to check if the"},{"line_number":16,"context_line":"strings that need to be stripped are not empty."},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Change-Id: I0073980b3f399b02bee86180fa91b741a6fd4d05"},{"line_number":19,"context_line":"Closes-Bug: 1689468"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":13,"id":"3f1d235d_ede4063e","line":16,"range":{"start_line":7,"start_character":0,"end_line":16,"end_character":47},"updated":"2017-07-06 22:17:29.000000000","message":"Actually we could cleanup this commit message to better describe the changes being made. Maybe something like:\n\n\nTrim whitespace from request header tokens\n\nThis change removes any leading and trailing whitespaces\nfrom the X-Auth-Token and X-Subject-Token headers.\n\nThis removes invalid characters such as carriage\nreturns from either X-Auth or X-Subject tokens that would\ncause keystone to see the token as invalid and return\na 401 unauthorized response when the actual token value\nwas valid.","commit_id":"3450167dfa50e870120cd2befb04b33b81b87765"}],"keystone/middleware/core.py":[{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"2c5c5341e356fa25cf58bcb7c07f7ddb1182d9af","unresolved":false,"context_lines":[{"line_number":46,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":47,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":48,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":49,"context_line":"            subject_token \u003d request.headers[SUBJECT_TOKEN_HEADER]"},{"line_number":50,"context_line":"            subject_token \u003d re.sub(r\"\\r$\", \"\", subject_token)"},{"line_number":51,"context_line":"            context[\u0027subject_token_id\u0027] \u003d subject_token"},{"line_number":52,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"df140735_226febfc","line":51,"range":{"start_line":49,"start_character":0,"end_line":51,"end_character":55},"updated":"2017-06-02 20:50:54.000000000","message":"using strip() instead of re would be simpler. E.g.:\n\ncontext[\u0027subject_token_id\u0027] \u003d request.headers[SUBJECT_TOKEN_HEADER].strip()","commit_id":"0cdd3702b4da7188f79e6e89c8069de4f768a70a"},{"author":{"_account_id":17860,"name":"Samuel de Medeiros Queiroz","email":"samueldmq@gmail.com","username":"samueldmq"},"change_message_id":"ec4b1d50678e09efaa497ef8bde5dd8bd8a99220","unresolved":false,"context_lines":[{"line_number":46,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":47,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":48,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":49,"context_line":"            subject_token \u003d request.headers[SUBJECT_TOKEN_HEADER]"},{"line_number":50,"context_line":"            subject_token \u003d re.sub(r\"\\r$\", \"\", subject_token)"},{"line_number":51,"context_line":"            context[\u0027subject_token_id\u0027] \u003d subject_token"},{"line_number":52,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"df140735_bf7ae8ed","line":51,"range":{"start_line":49,"start_character":0,"end_line":51,"end_character":55},"in_reply_to":"df140735_226febfc","updated":"2017-06-03 22:19:17.000000000","message":"++ just add .strip(\u0027\\r\u0027) at the end\n\nBTW why does this contain \\r at the end?","commit_id":"0cdd3702b4da7188f79e6e89c8069de4f768a70a"},{"author":{"_account_id":8482,"name":"Colleen Murphy","email":"colleen@gazlene.net","username":"krinkle"},"change_message_id":"f2477543decc27dc9e90460c66cfea576653b542","unresolved":false,"context_lines":[{"line_number":46,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":47,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":48,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":49,"context_line":"            subject_token \u003d request.headers[SUBJECT_TOKEN_HEADER]"},{"line_number":50,"context_line":"            subject_token \u003d re.sub(r\"\\r$\", \"\", subject_token)"},{"line_number":51,"context_line":"            context[\u0027subject_token_id\u0027] \u003d subject_token"},{"line_number":52,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"df140735_b4dd66e1","line":51,"range":{"start_line":49,"start_character":0,"end_line":51,"end_character":55},"in_reply_to":"df140735_b46fa629","updated":"2017-06-04 20:46:53.000000000","message":"Please include the reason in the commit message even though it\u0027s explained in the bug.","commit_id":"0cdd3702b4da7188f79e6e89c8069de4f768a70a"},{"author":{"_account_id":10608,"name":"Matthew Edmonds","email":"edmondsw@us.ibm.com","username":"edmondsw"},"change_message_id":"744e0c9982ce02657f9bd0adc4f92b5059133891","unresolved":false,"context_lines":[{"line_number":46,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":47,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":48,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":49,"context_line":"            subject_token \u003d request.headers[SUBJECT_TOKEN_HEADER]"},{"line_number":50,"context_line":"            subject_token \u003d re.sub(r\"\\r$\", \"\", subject_token)"},{"line_number":51,"context_line":"            context[\u0027subject_token_id\u0027] \u003d subject_token"},{"line_number":52,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":53,"context_line":""},{"line_number":54,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"df140735_b46fa629","line":51,"range":{"start_line":49,"start_character":0,"end_line":51,"end_character":55},"in_reply_to":"df140735_bf7ae8ed","updated":"2017-06-04 20:34:11.000000000","message":"I don\u0027t think the \u0027\\r\u0027 is really necessary... might as well strip any whitespace, not just \u0027\\r\u0027.\n\nAs to why it\u0027s happening... see the LP bug.","commit_id":"0cdd3702b4da7188f79e6e89c8069de4f768a70a"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"4353375dfee9806404a27d19fa408e3d91b84619","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":46,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":47,"context_line":"            context[\u0027subject_token_id\u0027] \u003d request.headers["},{"line_number":48,"context_line":"                SUBJECT_TOKEN_HEADER].strip()"},{"line_number":49,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"5f201791_0260efa4","line":48,"updated":"2017-06-21 14:15:13.000000000","message":"This might be out of scope for this specific issue, but shouldn\u0027t we strip() both x-auth-token and x-subject-token?\n\nA user can pass an x-subject-token and an x-auth-token to validate the token in the x-subject-token header, shouldn\u0027t we take the same steps to sanitize that data?\n\nI\u0027m not sure if that\u0027s actually an issue, but we could try and recreate it. I\u0027d be fine documenting that and fixing in a separate patch though, too.","commit_id":"307c23f6beca32a97a109d7d89d7bfc9e9742ee8"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"b9ce8d76cfa7a7839c5db5c999e0ba0eae201b66","unresolved":false,"context_lines":[{"line_number":41,"context_line":""},{"line_number":42,"context_line":"class TokenAuthMiddleware(wsgi.Middleware):"},{"line_number":43,"context_line":"    def process_request(self, request):"},{"line_number":44,"context_line":"        token \u003d request.headers.get(AUTH_TOKEN_HEADER).strip()"},{"line_number":45,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":46,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":47,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_865e61e4","line":44,"range":{"start_line":44,"start_character":54,"end_line":44,"end_character":62},"updated":"2017-06-29 19:12:25.000000000","message":"move this to context[\u0027token_id\u0027] \u003d token","commit_id":"a566ce5c2637840683babae644c06703e492df87"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"3a8c46f6f4fd1aeb3a796b001f54eae7f8fde0dd","unresolved":false,"context_lines":[{"line_number":41,"context_line":""},{"line_number":42,"context_line":"class TokenAuthMiddleware(wsgi.Middleware):"},{"line_number":43,"context_line":"    def process_request(self, request):"},{"line_number":44,"context_line":"        token \u003d request.headers.get(AUTH_TOKEN_HEADER).strip()"},{"line_number":45,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":46,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":47,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_e1d17f59","line":44,"range":{"start_line":44,"start_character":54,"end_line":44,"end_character":62},"in_reply_to":"3f1d235d_865e61e4","updated":"2017-06-29 19:42:50.000000000","message":"Disregard the above comment.\nHowever you do need to check if the request.header.get(AUTH) is actually not empty. I suggest something like if token: or something to fix this.","commit_id":"a566ce5c2637840683babae644c06703e492df87"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"3a8c46f6f4fd1aeb3a796b001f54eae7f8fde0dd","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":46,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":47,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":48,"context_line":"            context[\u0027subject_token_id\u0027] \u003d request.headers[SUBJECT_TOKEN_HEADER].strip()"},{"line_number":49,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":50,"context_line":""},{"line_number":51,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"3f1d235d_61c56f8e","line":48,"range":{"start_line":48,"start_character":12,"end_line":48,"end_character":79},"updated":"2017-06-29 19:42:50.000000000","message":"Ditto here","commit_id":"a566ce5c2637840683babae644c06703e492df87"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"5b9b5b4dca1cc4b0dc4b10bf6b09b62173eb09b3","unresolved":false,"context_lines":[{"line_number":43,"context_line":"    def process_request(self, request):"},{"line_number":44,"context_line":"        token \u003d request.headers.get(AUTH_TOKEN_HEADER)"},{"line_number":45,"context_line":"        if token:"},{"line_number":46,"context_line":"            token.strip()"},{"line_number":47,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":48,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":49,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f1d235d_2dc76115","line":46,"range":{"start_line":46,"start_character":12,"end_line":46,"end_character":25},"updated":"2017-06-30 04:32:58.000000000","message":".strip() doesn\u0027t change the ``token`` string, it returns a stripped string.  You will need to be reassigned back to ``token``.","commit_id":"abdcf241b78d93331e342b2d665a51127c2d0066"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"d9d818c3116d91246296470916bf515cb3736dfc","unresolved":false,"context_lines":[{"line_number":43,"context_line":"    def process_request(self, request):"},{"line_number":44,"context_line":"        token \u003d request.headers.get(AUTH_TOKEN_HEADER)"},{"line_number":45,"context_line":"        if token:"},{"line_number":46,"context_line":"            token.strip()"},{"line_number":47,"context_line":"        context \u003d request.environ.get(CONTEXT_ENV, {})"},{"line_number":48,"context_line":"        context[\u0027token_id\u0027] \u003d token"},{"line_number":49,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f1d235d_8a4f66bc","line":46,"range":{"start_line":46,"start_character":12,"end_line":46,"end_character":25},"in_reply_to":"3f1d235d_2dc76115","updated":"2017-06-30 15:37:15.000000000","message":"yup something like token \u003d token.strip()","commit_id":"abdcf241b78d93331e342b2d665a51127c2d0066"},{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"5b9b5b4dca1cc4b0dc4b10bf6b09b62173eb09b3","unresolved":false,"context_lines":[{"line_number":49,"context_line":"        if SUBJECT_TOKEN_HEADER in request.headers:"},{"line_number":50,"context_line":"            subject_token \u003d request.headers[SUBJECT_TOKEN_HEADER]"},{"line_number":51,"context_line":"            if subject_token:"},{"line_number":52,"context_line":"                subject_token.strip()"},{"line_number":53,"context_line":"            context[\u0027subject_token_id\u0027] \u003d subject_token"},{"line_number":54,"context_line":"        request.environ[CONTEXT_ENV] \u003d context"},{"line_number":55,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"3f1d235d_8d69d526","line":52,"range":{"start_line":52,"start_character":16,"end_line":52,"end_character":37},"updated":"2017-06-30 04:32:58.000000000","message":"ditto","commit_id":"abdcf241b78d93331e342b2d665a51127c2d0066"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"e784c0e4f65488c388d889f7aaedc585bfc06b39","unresolved":false,"context_lines":[{"line_number":15,"context_line":"from oslo_log import log"},{"line_number":16,"context_line":"from oslo_log import versionutils"},{"line_number":17,"context_line":"from oslo_serialization import jsonutils"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"from keystone.common import wsgi"},{"line_number":20,"context_line":"from keystone import exception"},{"line_number":21,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_a02121b7","side":"PARENT","line":18,"updated":"2017-06-30 17:03:42.000000000","message":"Add this line break back in, typically we separate the imports based on library/third party/local [0].\n\nHere\u0027s another example from keystone [1]\n\n\n[0] https://www.python.org/dev/peps/pep-0008/#imports\n[1] https://github.com/openstack/keystone/blob/master/keystone/token/provider.py","commit_id":"7e715f641ac61bb4d23d66949be510a88bb0ce30"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"e784c0e4f65488c388d889f7aaedc585bfc06b39","unresolved":false,"context_lines":[{"line_number":12,"context_line":"# License for the specific language governing permissions and limitations"},{"line_number":13,"context_line":"# under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"from oslo_log import log"},{"line_number":17,"context_line":"from oslo_log import versionutils"},{"line_number":18,"context_line":"from oslo_serialization import jsonutils"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f1d235d_20519137","line":15,"updated":"2017-06-30 17:03:42.000000000","message":"remove this extra line break","commit_id":"a79902045c26a8982d7621abbe1ea3ca2ee8aa7b"}],"keystone/tests/unit/test_middleware.py":[{"author":{"_account_id":20466,"name":"Tin Lam","email":"tin@lam.wtf","username":"tinlam"},"change_message_id":"5b9b5b4dca1cc4b0dc4b10bf6b09b62173eb09b3","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":116,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":117,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"},{"line_number":118,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027token_id\u0027].strip())"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"class JsonBodyMiddlewareTest(MiddlewareRequestTestBase):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f1d235d_8dd795c0","line":118,"range":{"start_line":118,"start_character":53,"end_line":118,"end_character":61},"updated":"2017-06-30 04:32:58.000000000","message":"The stripping would have happened in the code, so you don\u0027t want to .strip() here.  If you .strip() here, it will always work and won\u0027t test the code.","commit_id":"abdcf241b78d93331e342b2d665a51127c2d0066"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"d9d818c3116d91246296470916bf515cb3736dfc","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":116,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":117,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"},{"line_number":118,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027token_id\u0027].strip())"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"class JsonBodyMiddlewareTest(MiddlewareRequestTestBase):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f1d235d_eaeeda86","line":118,"range":{"start_line":118,"start_character":53,"end_line":118,"end_character":61},"in_reply_to":"3f1d235d_8dd795c0","updated":"2017-06-30 15:37:15.000000000","message":"^+1\ncompare the context id with \u0027     TOKEN      \u0027.strip() or \u0027TOKEN\u0027. This test would pass regardless of any changes because of the strip","commit_id":"abdcf241b78d93331e342b2d665a51127c2d0066"},{"author":{"_account_id":17860,"name":"Samuel de Medeiros Queiroz","email":"samueldmq@gmail.com","username":"samueldmq"},"change_message_id":"88bd81d43458cbddeccf5885b8af0a401b79c3f7","unresolved":false,"context_lines":[{"line_number":115,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":116,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":117,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"},{"line_number":118,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027token_id\u0027])"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"class JsonBodyMiddlewareTest(MiddlewareRequestTestBase):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f1d235d_5c035574","line":118,"updated":"2017-06-30 18:45:31.000000000","message":"make a test with subject token too","commit_id":"ba576887e18a25945a18950910080bd6fef50b4b"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"fa79bf31d5bc71aa6a0b72a813a6cbfe5ae8d2e1","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        self.assertEqual(\u0027MAGIC\u0027, context[\u0027token_id\u0027])"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def test_stripped_auth_token(self):"},{"line_number":114,"context_line":"        \"\"\"verify that context[\u0027token_id\u0027] equals TOKEN.\"\"\""},{"line_number":115,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":116,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":117,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f1d235d_55728dae","line":114,"updated":"2017-07-05 21:51:07.000000000","message":"Add docs explaining the test is important, but this doesn\u0027t give us more context outside of just reading the test anyway. We could replace this with a simple comment that describe *why* we need to do this, instead of *what* we\u0027re doing.","commit_id":"9f7d1d3424df338d29ff8d84fcb649dd53d877a0"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"5ad1e7e1d7ac0ff7659028caaacd111c15cb604d","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        self.assertEqual(\u0027MAGIC\u0027, context[\u0027token_id\u0027])"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def test_stripped_auth_token(self):"},{"line_number":114,"context_line":"        \"\"\"verify that context[\u0027token_id\u0027] equals TOKEN.\"\"\""},{"line_number":115,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":116,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":117,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f1d235d_f5bcf906","line":114,"in_reply_to":"3f1d235d_55728dae","updated":"2017-07-05 21:52:08.000000000","message":"Adding*\n\ndescribes*","commit_id":"9f7d1d3424df338d29ff8d84fcb649dd53d877a0"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"fa79bf31d5bc71aa6a0b72a813a6cbfe5ae8d2e1","unresolved":false,"context_lines":[{"line_number":118,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027token_id\u0027])"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":"    def test_stripped_subj_token(self):"},{"line_number":121,"context_line":"        \"\"\"verify that context[\u0027subject_token_id\u0027] equals TOKEN.\"\"\""},{"line_number":122,"context_line":"        headers \u003d {middleware.SUBJECT_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":123,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":124,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"}],"source_content_type":"text/x-python","patch_set":10,"id":"3f1d235d_156895b6","line":121,"updated":"2017-07-05 21:51:07.000000000","message":"Same comment here.","commit_id":"9f7d1d3424df338d29ff8d84fcb649dd53d877a0"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"8e996306a2236e405f95c538873fd4b6aba74c31","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        # testing the case when whitepsace and carriage returns"},{"line_number":115,"context_line":"        # are included in X-Auth-Token in order to prevent an"},{"line_number":116,"context_line":"        # unauthoried 401 error code"},{"line_number":117,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":118,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":119,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"},{"line_number":120,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027token_id\u0027])"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_e6ffb1a8","line":117,"range":{"start_line":117,"start_character":49,"end_line":117,"end_character":66},"updated":"2017-07-06 01:08:40.000000000","message":"We need to add \u0027\\r\u0027 and \u0027\\n\u0027 here to test carriage return/newline removal, could add \u0027\\t\u0027 too for tabs.","commit_id":"ebd9a9ba082dfe35b284fccf8e6c28a9aa8b13b5"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"8e996306a2236e405f95c538873fd4b6aba74c31","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        # testing the case when whitepsace and carriage returns"},{"line_number":124,"context_line":"        # are included in X-Subject-Token in order to prevent an"},{"line_number":125,"context_line":"        # unauthoried 401 error code"},{"line_number":126,"context_line":"        headers \u003d {middleware.SUBJECT_TOKEN_HEADER: \u0027     TOKEN     \u0027}"},{"line_number":127,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":128,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"},{"line_number":129,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027subject_token_id\u0027])"}],"source_content_type":"text/x-python","patch_set":12,"id":"3f1d235d_86347d94","line":126,"range":{"start_line":126,"start_character":52,"end_line":126,"end_character":69},"updated":"2017-07-06 01:08:40.000000000","message":"ditto","commit_id":"ebd9a9ba082dfe35b284fccf8e6c28a9aa8b13b5"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"0da378b60866d2b8f09468b41d7f391e2e7f01a2","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        self.assertEqual(\u0027MAGIC\u0027, context[\u0027token_id\u0027])"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def test_stripped_auth_token(self):"},{"line_number":114,"context_line":"        # testing the case when whitepsace and carriage returns"},{"line_number":115,"context_line":"        # are included in X-Auth-Token in order to prevent an"},{"line_number":116,"context_line":"        # unauthoried 401 error code"},{"line_number":117,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027\\r\\n\\t  TOKEN  \\r\\n\\t\u0027}"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f1d235d_26ac5beb","line":114,"updated":"2017-07-07 00:25:50.000000000","message":"whitespace*","commit_id":"968b23457229a478206f79386aeddf5d8257207e"},{"author":{"_account_id":21420,"name":"Gage Hugo","email":"gagehugo@gmail.com","username":"ghugo"},"change_message_id":"b5d61b3e6e0a4e70347b39f569d7f41c3eff7731","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        self.assertEqual(\u0027MAGIC\u0027, context[\u0027token_id\u0027])"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def test_stripped_auth_token(self):"},{"line_number":114,"context_line":"        # testing the case when whitepsace and carriage returns"},{"line_number":115,"context_line":"        # are included in X-Auth-Token in order to prevent an"},{"line_number":116,"context_line":"        # unauthoried 401 error code"},{"line_number":117,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027\\r\\n\\t  TOKEN  \\r\\n\\t\u0027}"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f1d235d_c500fa04","line":114,"in_reply_to":"3f1d235d_26ac5beb","updated":"2017-07-07 03:12:56.000000000","message":"++","commit_id":"968b23457229a478206f79386aeddf5d8257207e"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"0da378b60866d2b8f09468b41d7f391e2e7f01a2","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        self.assertEqual(\u0027TOKEN\u0027, context[\u0027token_id\u0027])"},{"line_number":121,"context_line":""},{"line_number":122,"context_line":"    def test_stripped_subj_token(self):"},{"line_number":123,"context_line":"        # testing the case when whitepsace and carriage returns"},{"line_number":124,"context_line":"        # are included in X-Subject-Token in order to prevent an"},{"line_number":125,"context_line":"        # unauthoried 401 error code"},{"line_number":126,"context_line":"        headers \u003d {middleware.SUBJECT_TOKEN_HEADER: \u0027\\r\\n\\t  TOKEN  \\r\\n\\t\u0027}"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f1d235d_06b71f3c","line":123,"updated":"2017-07-07 00:25:50.000000000","message":"whitespace*","commit_id":"968b23457229a478206f79386aeddf5d8257207e"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"f9267523961f8949ef4bd58dee637d613a684e38","unresolved":false,"context_lines":[{"line_number":113,"context_line":"    def test_stripped_auth_token(self):"},{"line_number":114,"context_line":"        # testing the case when whitespace and carriage returns"},{"line_number":115,"context_line":"        # are included in X-Auth-Token in order to prevent an"},{"line_number":116,"context_line":"        # unauthoried 401 error code"},{"line_number":117,"context_line":"        headers \u003d {middleware.AUTH_TOKEN_HEADER: \u0027\\r\\n\\t  TOKEN  \\r\\n\\t\u0027}"},{"line_number":118,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":119,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"}],"source_content_type":"text/x-python","patch_set":15,"id":"3f1d235d_ef75fa33","line":116,"range":{"start_line":116,"start_character":10,"end_line":116,"end_character":21},"updated":"2017-07-07 18:26:13.000000000","message":"unauthorized*","commit_id":"c99069fedbab120af87a929f36b68221ed238c41"},{"author":{"_account_id":23659,"name":"Jaewoo Park","email":"jaewoopark91@gmail.com","username":"aselius"},"change_message_id":"f9267523961f8949ef4bd58dee637d613a684e38","unresolved":false,"context_lines":[{"line_number":122,"context_line":"    def test_stripped_subj_token(self):"},{"line_number":123,"context_line":"        # testing the case when whitespace and carriage returns"},{"line_number":124,"context_line":"        # are included in X-Subject-Token in order to prevent an"},{"line_number":125,"context_line":"        # unauthoried 401 error code"},{"line_number":126,"context_line":"        headers \u003d {middleware.SUBJECT_TOKEN_HEADER: \u0027\\r\\n\\t  TOKEN  \\r\\n\\t\u0027}"},{"line_number":127,"context_line":"        req \u003d self._do_middleware_request(headers\u003dheaders)"},{"line_number":128,"context_line":"        context \u003d req.environ[middleware.CONTEXT_ENV]"}],"source_content_type":"text/x-python","patch_set":15,"id":"3f1d235d_af8dc22b","line":125,"range":{"start_line":125,"start_character":10,"end_line":125,"end_character":21},"updated":"2017-07-07 18:26:13.000000000","message":"unauthorized*","commit_id":"c99069fedbab120af87a929f36b68221ed238c41"}]}
