{"action":"created","issue":{"url":"https://api.github.com/repos/kumar303/mohawk/issues/43","repository_url":"https://api.github.com/repos/kumar303/mohawk","labels_url":"https://api.github.com/repos/kumar303/mohawk/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/kumar303/mohawk/issues/43/comments","events_url":"https://api.github.com/repos/kumar303/mohawk/issues/43/events","html_url":"https://github.com/kumar303/mohawk/issues/43","id":213825712,"number":43,"title":"ValueError with accept_untrusted_content=True and hash provided in header.","user":{"login":"torotil","id":182122,"avatar_url":"https://avatars0.githubusercontent.com/u/182122?v=3","gravatar_id":"","url":"https://api.github.com/users/torotil","html_url":"https://github.com/torotil","followers_url":"https://api.github.com/users/torotil/followers","following_url":"https://api.github.com/users/torotil/following{/other_user}","gists_url":"https://api.github.com/users/torotil/gists{/gist_id}","starred_url":"https://api.github.com/users/torotil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torotil/subscriptions","organizations_url":"https://api.github.com/users/torotil/orgs","repos_url":"https://api.github.com/users/torotil/repos","events_url":"https://api.github.com/users/torotil/events{/privacy}","received_events_url":"https://api.github.com/users/torotil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2017-03-13T16:40:20Z","updated_at":"2017-04-06T17:10:21Z","closed_at":null,"body":"With a `Receiver` configured to not validate the content-hash\r\n\r\n```python\r\nReceiver(lookup_hawk_credentials,\r\n         auth_header,\r\n         url,\r\n         env.get('REQUEST_METHOD'),\r\n         content=None\r\n         content_type=None,\r\n         accept_untrusted_content=True)\r\n```\r\n\r\nyou get a `ValueError: payload content and/or content_type cannot be empty without an explicit allowance` whenever a client *does* send a content-hash.\r\n\r\nThe reason is in `HawkAuthority._authorize()`:\r\n\r\n```python\r\n       if 'hash' not in parsed_header and accept_untrusted_content:\r\n            # The request did not hash its content.\r\n            log.debug('NOT calculating/verifiying payload hash '\r\n                      '(no hash in header)')\r\n            check_hash = False\r\n            content_hash = None\r\n        else:\r\n            check_hash = True\r\n            content_hash = resource.gen_content_hash()\r\n```\r\n\r\nHere the check for the hash supersedes `accept_untrusted_content`.\r\n\r\nAs stated in #24 I still think these flags add unneeded complexity."},"comment":{"url":"https://api.github.com/repos/kumar303/mohawk/issues/comments/292241589","html_url":"https://github.com/kumar303/mohawk/issues/43#issuecomment-292241589","issue_url":"https://api.github.com/repos/kumar303/mohawk/issues/43","id":292241589,"user":{"login":"kumar303","id":55398,"avatar_url":"https://avatars2.githubusercontent.com/u/55398?v=3","gravatar_id":"","url":"https://api.github.com/users/kumar303","html_url":"https://github.com/kumar303","followers_url":"https://api.github.com/users/kumar303/followers","following_url":"https://api.github.com/users/kumar303/following{/other_user}","gists_url":"https://api.github.com/users/kumar303/gists{/gist_id}","starred_url":"https://api.github.com/users/kumar303/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kumar303/subscriptions","organizations_url":"https://api.github.com/users/kumar303/orgs","repos_url":"https://api.github.com/users/kumar303/repos","events_url":"https://api.github.com/users/kumar303/events{/privacy}","received_events_url":"https://api.github.com/users/kumar303/received_events","type":"User","site_admin":false},"created_at":"2017-04-06T17:10:21Z","updated_at":"2017-04-06T17:10:21Z","body":"> ...being able to defer the hash check for large/streaming request bodies is still something Mohawk can't do, even once this issue is resolved.\r\n\r\nI don't understand. For that case, why don't you just configure the client to omit the `hash` header?"}}
{"actor":{"display_login":"kumar303"}}