{"action":"created","comment":{"url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/comments/35419750","id":35419750,"diff_hunk":"@@ -0,0 +1,24 @@\n+# -*- coding: utf-8 -*-\n+import binascii\n+import os\n+\n+from Crypto.Hash import SHA256, SHA512\n+\n+class DefaultTokenGenerator(object):\n+\n+    def generate_key(self):\n+        return binascii.hexlify(os.urandom(20)).decode()\n+\n+\n+class SHA256TokenGenerator(object):\n+\n+    def generate_key(self):\n+        return SHA256.new(os.urandom(20)).hexdigest().decode()\n+\n+class SHA512TokenGenerator(object):\n+\n+    def generate_key(self):\n+        return SHA512.new(os.urandom(20)).hexdigest().decode()[-40:]\n+","path":"postcodeinfo/apps/postcode_api/custom_token_generators.py","position":22,"original_position":22,"commit_id":"0d4f929c73881291aba98366b9614f538c883883","original_commit_id":"0d4f929c73881291aba98366b9614f538c883883","user":{"login":"andyhd","id":35194,"avatar_url":"https://avatars.githubusercontent.com/u/35194?v=3","gravatar_id":"","url":"https://api.github.com/users/andyhd","html_url":"https://github.com/andyhd","followers_url":"https://api.github.com/users/andyhd/followers","following_url":"https://api.github.com/users/andyhd/following{/other_user}","gists_url":"https://api.github.com/users/andyhd/gists{/gist_id}","starred_url":"https://api.github.com/users/andyhd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyhd/subscriptions","organizations_url":"https://api.github.com/users/andyhd/orgs","repos_url":"https://api.github.com/users/andyhd/repos","events_url":"https://api.github.com/users/andyhd/events{/privacy}","received_events_url":"https://api.github.com/users/andyhd/received_events","type":"User","site_admin":false},"body":"Missing blank line","created_at":"2015-07-24T13:05:15Z","updated_at":"2015-07-24T13:05:15Z","html_url":"https://github.com/ministryofjustice/postcodeinfo/pull/84#discussion_r35419750","pull_request_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84","_links":{"self":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/comments/35419750"},"html":{"href":"https://github.com/ministryofjustice/postcodeinfo/pull/84#discussion_r35419750"},"pull_request":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84"}}},"pull_request":{"url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84","id":40680875,"html_url":"https://github.com/ministryofjustice/postcodeinfo/pull/84","diff_url":"https://github.com/ministryofjustice/postcodeinfo/pull/84.diff","patch_url":"https://github.com/ministryofjustice/postcodeinfo/pull/84.patch","issue_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/84","number":84,"state":"open","locked":false,"title":"Overriden Token.generate_key to use last 40 chars of SHA512 hash, on advice of pentesting","user":{"login":"aldavidson","id":134501,"avatar_url":"https://avatars.githubusercontent.com/u/134501?v=3","gravatar_id":"","url":"https://api.github.com/users/aldavidson","html_url":"https://github.com/aldavidson","followers_url":"https://api.github.com/users/aldavidson/followers","following_url":"https://api.github.com/users/aldavidson/following{/other_user}","gists_url":"https://api.github.com/users/aldavidson/gists{/gist_id}","starred_url":"https://api.github.com/users/aldavidson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldavidson/subscriptions","organizations_url":"https://api.github.com/users/aldavidson/orgs","repos_url":"https://api.github.com/users/aldavidson/repos","events_url":"https://api.github.com/users/aldavidson/events{/privacy}","received_events_url":"https://api.github.com/users/aldavidson/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-23T14:55:47Z","updated_at":"2015-07-24T13:05:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41ce9ad49e2664938d619496d9a8ad2dd092ee5d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84/commits","review_comments_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84/comments","review_comment_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/84/comments","statuses_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/statuses/0d4f929c73881291aba98366b9614f538c883883","head":{"label":"ministryofjustice:generate-token-with-secure-hash","ref":"generate-token-with-secure-hash","sha":"0d4f929c73881291aba98366b9614f538c883883","user":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"repo":{"id":34381577,"name":"postcodeinfo","full_name":"ministryofjustice/postcodeinfo","owner":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ministryofjustice/postcodeinfo","description":"REST API for looking up a given UK Postcode and getting addresses, lat/long, and local authority info","fork":false,"url":"https://api.github.com/repos/ministryofjustice/postcodeinfo","forks_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/forks","keys_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/teams","hooks_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/hooks","issue_events_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/events{/number}","events_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/events","assignees_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/assignees{/user}","branches_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/branches{/branch}","tags_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/tags","blobs_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/refs{/sha}","trees_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/statuses/{sha}","languages_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/languages","stargazers_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/stargazers","contributors_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/contributors","subscribers_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/subscribers","subscription_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/subscription","commits_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/commits{/sha}","git_commits_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/commits{/sha}","comments_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/comments{/number}","issue_comment_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/comments{/number}","contents_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/contents/{+path}","compare_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/merges","archive_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/downloads","issues_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues{/number}","pulls_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls{/number}","milestones_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/milestones{/number}","notifications_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/labels{/name}","releases_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/releases{/id}","created_at":"2015-04-22T09:32:13Z","updated_at":"2015-07-09T15:39:18Z","pushed_at":"2015-07-24T09:58:19Z","git_url":"git://github.com/ministryofjustice/postcodeinfo.git","ssh_url":"git@github.com:ministryofjustice/postcodeinfo.git","clone_url":"https://github.com/ministryofjustice/postcodeinfo.git","svn_url":"https://github.com/ministryofjustice/postcodeinfo","homepage":"","size":1536,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"ministryofjustice:master","ref":"master","sha":"396009be7d3e7f9869d5039460465a6da998862f","user":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"repo":{"id":34381577,"name":"postcodeinfo","full_name":"ministryofjustice/postcodeinfo","owner":{"login":"ministryofjustice","id":2203574,"avatar_url":"https://avatars.githubusercontent.com/u/2203574?v=3","gravatar_id":"","url":"https://api.github.com/users/ministryofjustice","html_url":"https://github.com/ministryofjustice","followers_url":"https://api.github.com/users/ministryofjustice/followers","following_url":"https://api.github.com/users/ministryofjustice/following{/other_user}","gists_url":"https://api.github.com/users/ministryofjustice/gists{/gist_id}","starred_url":"https://api.github.com/users/ministryofjustice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ministryofjustice/subscriptions","organizations_url":"https://api.github.com/users/ministryofjustice/orgs","repos_url":"https://api.github.com/users/ministryofjustice/repos","events_url":"https://api.github.com/users/ministryofjustice/events{/privacy}","received_events_url":"https://api.github.com/users/ministryofjustice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ministryofjustice/postcodeinfo","description":"REST API for looking up a given UK Postcode and getting addresses, lat/long, and local authority info","fork":false,"url":"https://api.github.com/repos/ministryofjustice/postcodeinfo","forks_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/forks","keys_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/teams","hooks_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/hooks","issue_events_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/events{/number}","events_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/events","assignees_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/assignees{/user}","branches_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/branches{/branch}","tags_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/tags","blobs_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/refs{/sha}","trees_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/statuses/{sha}","languages_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/languages","stargazers_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/stargazers","contributors_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/contributors","subscribers_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/subscribers","subscription_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/subscription","commits_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/commits{/sha}","git_commits_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/git/commits{/sha}","comments_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/comments{/number}","issue_comment_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/comments{/number}","contents_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/contents/{+path}","compare_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/merges","archive_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/downloads","issues_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues{/number}","pulls_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls{/number}","milestones_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/milestones{/number}","notifications_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/labels{/name}","releases_url":"https://api.github.com/repos/ministryofjustice/postcodeinfo/releases{/id}","created_at":"2015-04-22T09:32:13Z","updated_at":"2015-07-09T15:39:18Z","pushed_at":"2015-07-24T09:58:19Z","git_url":"git://github.com/ministryofjustice/postcodeinfo.git","ssh_url":"git@github.com:ministryofjustice/postcodeinfo.git","clone_url":"https://github.com/ministryofjustice/postcodeinfo.git","svn_url":"https://github.com/ministryofjustice/postcodeinfo","homepage":"","size":1536,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84"},"html":{"href":"https://github.com/ministryofjustice/postcodeinfo/pull/84"},"issue":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/84"},"comments":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/issues/84/comments"},"review_comments":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84/comments"},"review_comment":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/pulls/84/commits"},"statuses":{"href":"https://api.github.com/repos/ministryofjustice/postcodeinfo/statuses/0d4f929c73881291aba98366b9614f538c883883"}}}}