{"action":"created","comment":{"url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/comments/175812447","pull_request_review_id":105403912,"id":175812447,"diff_hunk":"@@ -2499,4 +2338,36 @@ protected function _filter_data($table, $data)\n \t}\n \n \t/**\n+\n+\t/** Generate a random token\n+\t * Inspired from http://php.net/manual/en/function.random-bytes.php#118932\n+\t *\n+\t * @param int $result_length\n+\t * @return string\n+\t */\n+\tprotected function _random_token($result_length = 32)\n+\t{\n+\t\tif(!isset($result_length) || intval($result_length) <= 8 ){\n+\t\t\t$result_length = 32;\n+\t\t}\n+\n+\t\t// Try random_bytes: PHP 7\n+\t\tif (function_exists('random_bytes')) {\n+\t\t\treturn bin2hex(random_bytes($result_length / 2));\n+\t\t}\n+\n+\t\t// Try mcrypt\n+\t\tif (function_exists('mcrypt_create_iv')) {\n+\t\t\treturn bin2hex(mcrypt_create_iv($result_length / 2, MCRYPT_DEV_URANDOM));\n+\t\t}\n+\n+\t\t// Try openssl\n+\t\tif (function_exists('openssl_random_pseudo_bytes')) {\n+\t\t\treturn bin2hex(openssl_random_pseudo_bytes($result_length / 2));\n+\t\t}\n+\n+\t\t// No luck!\n+\t\tshow_error(\"Cannot generate a token random enough. \" .","path":"models/Ion_auth_model.php","position":null,"original_position":356,"commit_id":"22072025604f5ff352818254bd39d37d08ad6829","original_commit_id":"a51923b4715fc3c50e19b9a0316eaa98217bac40","user":{"login":"Indigo744","id":7137528,"avatar_url":"https://avatars3.githubusercontent.com/u/7137528?v=4","gravatar_id":"","url":"https://api.github.com/users/Indigo744","html_url":"https://github.com/Indigo744","followers_url":"https://api.github.com/users/Indigo744/followers","following_url":"https://api.github.com/users/Indigo744/following{/other_user}","gists_url":"https://api.github.com/users/Indigo744/gists{/gist_id}","starred_url":"https://api.github.com/users/Indigo744/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Indigo744/subscriptions","organizations_url":"https://api.github.com/users/Indigo744/orgs","repos_url":"https://api.github.com/users/Indigo744/repos","events_url":"https://api.github.com/users/Indigo744/events{/privacy}","received_events_url":"https://api.github.com/users/Indigo744/received_events","type":"User","site_admin":false},"body":"Got it.","created_at":"2018-03-20T15:32:34Z","updated_at":"2018-03-20T15:32:34Z","html_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth/pull/1200#discussion_r175812447","pull_request_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/comments/175812447"},"html":{"href":"https://github.com/benedmunds/CodeIgniter-Ion-Auth/pull/1200#discussion_r175812447"},"pull_request":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200"}},"in_reply_to_id":175808591},"pull_request":{"url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200","id":176225196,"html_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth/pull/1200","diff_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth/pull/1200.diff","patch_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth/pull/1200.patch","issue_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues/1200","number":1200,"state":"open","locked":false,"title":"Ion Auth 3: remove salt and better token generator","user":{"login":"Indigo744","id":7137528,"avatar_url":"https://avatars3.githubusercontent.com/u/7137528?v=4","gravatar_id":"","url":"https://api.github.com/users/Indigo744","html_url":"https://github.com/Indigo744","followers_url":"https://api.github.com/users/Indigo744/followers","following_url":"https://api.github.com/users/Indigo744/following{/other_user}","gists_url":"https://api.github.com/users/Indigo744/gists{/gist_id}","starred_url":"https://api.github.com/users/Indigo744/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Indigo744/subscriptions","organizations_url":"https://api.github.com/users/Indigo744/orgs","repos_url":"https://api.github.com/users/Indigo744/repos","events_url":"https://api.github.com/users/Indigo744/events{/privacy}","received_events_url":"https://api.github.com/users/Indigo744/received_events","type":"User","site_admin":false},"body":"Related to #1195 \r\n\r\nSince bcrypt handles the salt internally, there is no need to store it separately.\r\n\r\nThis PR removes any salt-related code.\r\n\r\nAlso, the salt generator was used to generate the remember and forgotten token.\r\nWe greatly simplify it by using a simple `random_token()` generator based on function known to be random enough. In case a user misses the proper function (I would guess less than 1%), then the [random_compat](https://github.com/paragonie/random_compat) library is proposed.\r\n","created_at":"2018-03-20T15:17:25Z","updated_at":"2018-03-20T15:32:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24e6991d0e790a96dcb765204fac2262aa7a3a9e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200/commits","review_comments_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200/comments","review_comment_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues/1200/comments","statuses_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/statuses/22072025604f5ff352818254bd39d37d08ad6829","head":{"label":"Indigo744:cleanup_salt_token","ref":"cleanup_salt_token","sha":"22072025604f5ff352818254bd39d37d08ad6829","user":{"login":"Indigo744","id":7137528,"avatar_url":"https://avatars3.githubusercontent.com/u/7137528?v=4","gravatar_id":"","url":"https://api.github.com/users/Indigo744","html_url":"https://github.com/Indigo744","followers_url":"https://api.github.com/users/Indigo744/followers","following_url":"https://api.github.com/users/Indigo744/following{/other_user}","gists_url":"https://api.github.com/users/Indigo744/gists{/gist_id}","starred_url":"https://api.github.com/users/Indigo744/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Indigo744/subscriptions","organizations_url":"https://api.github.com/users/Indigo744/orgs","repos_url":"https://api.github.com/users/Indigo744/repos","events_url":"https://api.github.com/users/Indigo744/events{/privacy}","received_events_url":"https://api.github.com/users/Indigo744/received_events","type":"User","site_admin":false},"repo":{"id":71487388,"name":"CodeIgniter-Ion-Auth","full_name":"Indigo744/CodeIgniter-Ion-Auth","owner":{"login":"Indigo744","id":7137528,"avatar_url":"https://avatars3.githubusercontent.com/u/7137528?v=4","gravatar_id":"","url":"https://api.github.com/users/Indigo744","html_url":"https://github.com/Indigo744","followers_url":"https://api.github.com/users/Indigo744/followers","following_url":"https://api.github.com/users/Indigo744/following{/other_user}","gists_url":"https://api.github.com/users/Indigo744/gists{/gist_id}","starred_url":"https://api.github.com/users/Indigo744/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Indigo744/subscriptions","organizations_url":"https://api.github.com/users/Indigo744/orgs","repos_url":"https://api.github.com/users/Indigo744/repos","events_url":"https://api.github.com/users/Indigo744/events{/privacy}","received_events_url":"https://api.github.com/users/Indigo744/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Indigo744/CodeIgniter-Ion-Auth","description":"Simple and Lightweight Auth System for CodeIgniter","fork":true,"url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth","forks_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/forks","keys_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/teams","hooks_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/hooks","issue_events_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/issues/events{/number}","events_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/events","assignees_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/assignees{/user}","branches_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/branches{/branch}","tags_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/tags","blobs_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/statuses/{sha}","languages_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/languages","stargazers_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/stargazers","contributors_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/contributors","subscribers_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/subscribers","subscription_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/subscription","commits_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/contents/{+path}","compare_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/merges","archive_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/downloads","issues_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/issues{/number}","pulls_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/pulls{/number}","milestones_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/milestones{/number}","notifications_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/labels{/name}","releases_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/releases{/id}","deployments_url":"https://api.github.com/repos/Indigo744/CodeIgniter-Ion-Auth/deployments","created_at":"2016-10-20T17:29:06Z","updated_at":"2018-03-19T18:27:55Z","pushed_at":"2018-03-20T15:31:45Z","git_url":"git://github.com/Indigo744/CodeIgniter-Ion-Auth.git","ssh_url":"git@github.com:Indigo744/CodeIgniter-Ion-Auth.git","clone_url":"https://github.com/Indigo744/CodeIgniter-Ion-Auth.git","svn_url":"https://github.com/Indigo744/CodeIgniter-Ion-Auth","homepage":"http://benedmunds.com/ion_auth/","size":1848,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"2"}},"base":{"label":"benedmunds:3","ref":"3","sha":"3bb0af5fcefcaac9cb2ab5feeba9a26344dacbe6","user":{"login":"benedmunds","id":156823,"avatar_url":"https://avatars1.githubusercontent.com/u/156823?v=4","gravatar_id":"","url":"https://api.github.com/users/benedmunds","html_url":"https://github.com/benedmunds","followers_url":"https://api.github.com/users/benedmunds/followers","following_url":"https://api.github.com/users/benedmunds/following{/other_user}","gists_url":"https://api.github.com/users/benedmunds/gists{/gist_id}","starred_url":"https://api.github.com/users/benedmunds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benedmunds/subscriptions","organizations_url":"https://api.github.com/users/benedmunds/orgs","repos_url":"https://api.github.com/users/benedmunds/repos","events_url":"https://api.github.com/users/benedmunds/events{/privacy}","received_events_url":"https://api.github.com/users/benedmunds/received_events","type":"User","site_admin":false},"repo":{"id":481040,"name":"CodeIgniter-Ion-Auth","full_name":"benedmunds/CodeIgniter-Ion-Auth","owner":{"login":"benedmunds","id":156823,"avatar_url":"https://avatars1.githubusercontent.com/u/156823?v=4","gravatar_id":"","url":"https://api.github.com/users/benedmunds","html_url":"https://github.com/benedmunds","followers_url":"https://api.github.com/users/benedmunds/followers","following_url":"https://api.github.com/users/benedmunds/following{/other_user}","gists_url":"https://api.github.com/users/benedmunds/gists{/gist_id}","starred_url":"https://api.github.com/users/benedmunds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benedmunds/subscriptions","organizations_url":"https://api.github.com/users/benedmunds/orgs","repos_url":"https://api.github.com/users/benedmunds/repos","events_url":"https://api.github.com/users/benedmunds/events{/privacy}","received_events_url":"https://api.github.com/users/benedmunds/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth","description":"Simple and Lightweight Auth System for CodeIgniter","fork":false,"url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth","forks_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/forks","keys_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/teams","hooks_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/hooks","issue_events_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues/events{/number}","events_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/events","assignees_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/assignees{/user}","branches_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/branches{/branch}","tags_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/tags","blobs_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/statuses/{sha}","languages_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/languages","stargazers_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/stargazers","contributors_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/contributors","subscribers_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/subscribers","subscription_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/subscription","commits_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/contents/{+path}","compare_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/merges","archive_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/downloads","issues_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues{/number}","pulls_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls{/number}","milestones_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/milestones{/number}","notifications_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/labels{/name}","releases_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/releases{/id}","deployments_url":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/deployments","created_at":"2010-01-20T19:19:39Z","updated_at":"2018-03-20T15:07:21Z","pushed_at":"2018-03-20T15:31:46Z","git_url":"git://github.com/benedmunds/CodeIgniter-Ion-Auth.git","ssh_url":"git@github.com:benedmunds/CodeIgniter-Ion-Auth.git","clone_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth.git","svn_url":"https://github.com/benedmunds/CodeIgniter-Ion-Auth","homepage":"http://benedmunds.com/ion_auth/","size":1991,"stargazers_count":1924,"watchers_count":1924,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":950,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":950,"open_issues":8,"watchers":1924,"default_branch":"2"}},"_links":{"self":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200"},"html":{"href":"https://github.com/benedmunds/CodeIgniter-Ion-Auth/pull/1200"},"issue":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues/1200"},"comments":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/issues/1200/comments"},"review_comments":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200/comments"},"review_comment":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/pulls/1200/commits"},"statuses":{"href":"https://api.github.com/repos/benedmunds/CodeIgniter-Ion-Auth/statuses/22072025604f5ff352818254bd39d37d08ad6829"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Indigo744"}}