{"action":"created","comment":{"url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/comments/94216610","pull_request_review_id":14747095,"id":94216610,"diff_hunk":"@@ -40,7 +40,12 @@ Add this to your `.pre-commit-config.yaml`\n - `check-xml` - Attempts to load all xml files to verify syntax.\n - `check-yaml` - Attempts to load all yaml files to verify syntax.\n - `debug-statements` - Check for pdb / ipdb / pudb statements in code.\n-- `detect-aws-credentials` - Checks for the existence of AWS secrets that you have set up with the AWS CLI.\n+- `detect-aws-credentials` - Checks for the existence of AWS secrets that you\n+  have set up with the AWS CLI.\n+  The following arguments are available:\n+  - `--credential-file` - additional AWS CLI style configuration file in a","path":"README.md","position":8,"original_position":8,"commit_id":"0fd09bf67aef299764b8bc9777779ced6a5bfc69","original_commit_id":"0fd09bf67aef299764b8bc9777779ced6a5bfc69","user":{"login":"arahayrabedian","id":5959895,"avatar_url":"https://avatars.githubusercontent.com/u/5959895?v=3","gravatar_id":"","url":"https://api.github.com/users/arahayrabedian","html_url":"https://github.com/arahayrabedian","followers_url":"https://api.github.com/users/arahayrabedian/followers","following_url":"https://api.github.com/users/arahayrabedian/following{/other_user}","gists_url":"https://api.github.com/users/arahayrabedian/gists{/gist_id}","starred_url":"https://api.github.com/users/arahayrabedian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arahayrabedian/subscriptions","organizations_url":"https://api.github.com/users/arahayrabedian/orgs","repos_url":"https://api.github.com/users/arahayrabedian/repos","events_url":"https://api.github.com/users/arahayrabedian/events{/privacy}","received_events_url":"https://api.github.com/users/arahayrabedian/received_events","type":"User","site_admin":false},"body":"typo --> should be `--credentials-file`, not usually a stickler but this is a readme.","created_at":"2016-12-30T10:17:11Z","updated_at":"2016-12-30T10:17:11Z","html_url":"https://github.com/pre-commit/pre-commit-hooks/pull/162#discussion_r94216610","pull_request_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162","_links":{"self":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/comments/94216610"},"html":{"href":"https://github.com/pre-commit/pre-commit-hooks/pull/162#discussion_r94216610"},"pull_request":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162"}}},"pull_request":{"url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162","id":99729275,"html_url":"https://github.com/pre-commit/pre-commit-hooks/pull/162","diff_url":"https://github.com/pre-commit/pre-commit-hooks/pull/162.diff","patch_url":"https://github.com/pre-commit/pre-commit-hooks/pull/162.patch","issue_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues/162","number":162,"state":"open","locked":false,"title":"Improve searching for configured AWS credentials","user":{"login":"Dunedan","id":1735355,"avatar_url":"https://avatars.githubusercontent.com/u/1735355?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunedan","html_url":"https://github.com/Dunedan","followers_url":"https://api.github.com/users/Dunedan/followers","following_url":"https://api.github.com/users/Dunedan/following{/other_user}","gists_url":"https://api.github.com/users/Dunedan/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunedan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunedan/subscriptions","organizations_url":"https://api.github.com/users/Dunedan/orgs","repos_url":"https://api.github.com/users/Dunedan/repos","events_url":"https://api.github.com/users/Dunedan/events{/privacy}","received_events_url":"https://api.github.com/users/Dunedan/received_events","type":"User","site_admin":false},"body":"The previous approach for finding AWS credentials was pretty naive and\r\nonly covered contents of a single file (`~/.aws/credentials` by default).\r\n\r\nThe AWS CLI documentation states various other ways to configure\r\ncredentials which weren't covered:\r\nhttps://docs.aws.amazon.com/cli/latest/topic/config-vars.html#credentials\r\nEven that aren't all ways, a look into the code shows:\r\nhttps://github.com/boto/botocore/blob/develop/botocore/credentials.py\r\n\r\nThis commit changes the behavior so the hook will behave in a way\r\nthat if the AWS CLI is able to obtain credentials from local files,\r\nthe hook will find them as well.\r\n\r\nThe changes in detail are:\r\n- detect AWS session tokens and handle them like secret keys.\r\n- always search credentials in the default AWS CLI file locations\r\n  (`~/.aws/config`, `~/.aws/credentials`, `/etc/boto.cfg` and `~/.boto`)\r\n- detect AWS credentials configured via environment variables in\r\n  `AWS_SECRET_ACCESS_KEY`, `AWS_SECURITY_TOKEN` and `AWS_SESSION_TOKEN`\r\n- check additional configuration files configured via environment\r\n  variables (`AWS_CREDENTIAL_FILE`, `AWS_SHARED_CREDENTIALS_FILE` and\r\n  `BOTO_CONFIG`)\r\n- print out the first four characters of each secret found in files to\r\n  be checked in, to make it easier to figure out, what the secrets\r\n  were, which were going to be checked in\r\n- improve error handling for parsing ini-files\r\n- improve tests\r\n\r\nThere is a major functional change introduced by this commit:\r\nLocations the AWS CLI gets credentials from are always searched and\r\nthere is no way to disable them. `--credentials-file` is still there to\r\nspecify one or more additional files to search credentials in. It's\r\nthe purpose of this hook to find and check files for found\r\ncredentials, so it should work in any case. As this commit also\r\nimproves error handling for not-existing or malformed configuration\r\nfiles, it should be no big deal.\r\n\r\nReceiving credentials via the EC2 and ECS meta data services is not\r\ncovered intentionally, to not further increase the amount of changes\r\nin this commit and as it's probably an edge case anyway to have this\r\nhook running in such an environment.","created_at":"2016-12-30T07:45:52Z","updated_at":"2016-12-30T10:17:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dccd2fdf4c8a44e9854253cd230a7e72e128cf42","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162/commits","review_comments_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162/comments","review_comment_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues/162/comments","statuses_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/statuses/0fd09bf67aef299764b8bc9777779ced6a5bfc69","head":{"label":"Dunedan:improve-aws-credential-searching","ref":"improve-aws-credential-searching","sha":"0fd09bf67aef299764b8bc9777779ced6a5bfc69","user":{"login":"Dunedan","id":1735355,"avatar_url":"https://avatars.githubusercontent.com/u/1735355?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunedan","html_url":"https://github.com/Dunedan","followers_url":"https://api.github.com/users/Dunedan/followers","following_url":"https://api.github.com/users/Dunedan/following{/other_user}","gists_url":"https://api.github.com/users/Dunedan/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunedan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunedan/subscriptions","organizations_url":"https://api.github.com/users/Dunedan/orgs","repos_url":"https://api.github.com/users/Dunedan/repos","events_url":"https://api.github.com/users/Dunedan/events{/privacy}","received_events_url":"https://api.github.com/users/Dunedan/received_events","type":"User","site_admin":false},"repo":{"id":77399575,"name":"pre-commit-hooks","full_name":"Dunedan/pre-commit-hooks","owner":{"login":"Dunedan","id":1735355,"avatar_url":"https://avatars.githubusercontent.com/u/1735355?v=3","gravatar_id":"","url":"https://api.github.com/users/Dunedan","html_url":"https://github.com/Dunedan","followers_url":"https://api.github.com/users/Dunedan/followers","following_url":"https://api.github.com/users/Dunedan/following{/other_user}","gists_url":"https://api.github.com/users/Dunedan/gists{/gist_id}","starred_url":"https://api.github.com/users/Dunedan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dunedan/subscriptions","organizations_url":"https://api.github.com/users/Dunedan/orgs","repos_url":"https://api.github.com/users/Dunedan/repos","events_url":"https://api.github.com/users/Dunedan/events{/privacy}","received_events_url":"https://api.github.com/users/Dunedan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Dunedan/pre-commit-hooks","description":"Some out-of-the-box hooks for pre-commit","fork":true,"url":"https://api.github.com/repos/Dunedan/pre-commit-hooks","forks_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/forks","keys_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/teams","hooks_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/hooks","issue_events_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/issues/events{/number}","events_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/events","assignees_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/assignees{/user}","branches_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/branches{/branch}","tags_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/tags","blobs_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/statuses/{sha}","languages_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/languages","stargazers_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/stargazers","contributors_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/contributors","subscribers_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/subscribers","subscription_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/subscription","commits_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/contents/{+path}","compare_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/merges","archive_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/downloads","issues_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/issues{/number}","pulls_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/pulls{/number}","milestones_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/milestones{/number}","notifications_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/labels{/name}","releases_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/releases{/id}","deployments_url":"https://api.github.com/repos/Dunedan/pre-commit-hooks/deployments","created_at":"2016-12-26T18:10:11Z","updated_at":"2016-12-26T18:10:14Z","pushed_at":"2016-12-30T09:41:08Z","git_url":"git://github.com/Dunedan/pre-commit-hooks.git","ssh_url":"git@github.com:Dunedan/pre-commit-hooks.git","clone_url":"https://github.com/Dunedan/pre-commit-hooks.git","svn_url":"https://github.com/Dunedan/pre-commit-hooks","homepage":null,"size":227,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pre-commit:master","ref":"master","sha":"9573c13884bdfd563c989311e432dcb11e6a1830","user":{"login":"pre-commit","id":6943086,"avatar_url":"https://avatars.githubusercontent.com/u/6943086?v=3","gravatar_id":"","url":"https://api.github.com/users/pre-commit","html_url":"https://github.com/pre-commit","followers_url":"https://api.github.com/users/pre-commit/followers","following_url":"https://api.github.com/users/pre-commit/following{/other_user}","gists_url":"https://api.github.com/users/pre-commit/gists{/gist_id}","starred_url":"https://api.github.com/users/pre-commit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pre-commit/subscriptions","organizations_url":"https://api.github.com/users/pre-commit/orgs","repos_url":"https://api.github.com/users/pre-commit/repos","events_url":"https://api.github.com/users/pre-commit/events{/privacy}","received_events_url":"https://api.github.com/users/pre-commit/received_events","type":"Organization","site_admin":false},"repo":{"id":17714713,"name":"pre-commit-hooks","full_name":"pre-commit/pre-commit-hooks","owner":{"login":"pre-commit","id":6943086,"avatar_url":"https://avatars.githubusercontent.com/u/6943086?v=3","gravatar_id":"","url":"https://api.github.com/users/pre-commit","html_url":"https://github.com/pre-commit","followers_url":"https://api.github.com/users/pre-commit/followers","following_url":"https://api.github.com/users/pre-commit/following{/other_user}","gists_url":"https://api.github.com/users/pre-commit/gists{/gist_id}","starred_url":"https://api.github.com/users/pre-commit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pre-commit/subscriptions","organizations_url":"https://api.github.com/users/pre-commit/orgs","repos_url":"https://api.github.com/users/pre-commit/repos","events_url":"https://api.github.com/users/pre-commit/events{/privacy}","received_events_url":"https://api.github.com/users/pre-commit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pre-commit/pre-commit-hooks","description":"Some out-of-the-box hooks for pre-commit","fork":false,"url":"https://api.github.com/repos/pre-commit/pre-commit-hooks","forks_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/forks","keys_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/teams","hooks_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/hooks","issue_events_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues/events{/number}","events_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/events","assignees_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/assignees{/user}","branches_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/branches{/branch}","tags_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/tags","blobs_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/git/refs{/sha}","trees_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/statuses/{sha}","languages_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/languages","stargazers_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/stargazers","contributors_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/contributors","subscribers_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/subscribers","subscription_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/subscription","commits_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/commits{/sha}","git_commits_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/git/commits{/sha}","comments_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/comments{/number}","issue_comment_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues/comments{/number}","contents_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/contents/{+path}","compare_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/merges","archive_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/downloads","issues_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues{/number}","pulls_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls{/number}","milestones_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/milestones{/number}","notifications_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/labels{/name}","releases_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/releases{/id}","deployments_url":"https://api.github.com/repos/pre-commit/pre-commit-hooks/deployments","created_at":"2014-03-13T15:21:46Z","updated_at":"2016-12-23T04:56:51Z","pushed_at":"2016-12-30T09:41:10Z","git_url":"git://github.com/pre-commit/pre-commit-hooks.git","ssh_url":"git@github.com:pre-commit/pre-commit-hooks.git","clone_url":"https://github.com/pre-commit/pre-commit-hooks.git","svn_url":"https://github.com/pre-commit/pre-commit-hooks","homepage":null,"size":219,"stargazers_count":223,"watchers_count":223,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":20,"forks":71,"open_issues":20,"watchers":223,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162"},"html":{"href":"https://github.com/pre-commit/pre-commit-hooks/pull/162"},"issue":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues/162"},"comments":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/issues/162/comments"},"review_comments":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162/comments"},"review_comment":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/pulls/162/commits"},"statuses":{"href":"https://api.github.com/repos/pre-commit/pre-commit-hooks/statuses/0fd09bf67aef299764b8bc9777779ced6a5bfc69"}}}}
{"actor":{"display_login":"arahayrabedian"}}