{"action":"created","comment":{"url":"https://api.github.com/repos/buildbot/buildbot/pulls/comments/101550194","pull_request_review_id":22282045,"id":101550194,"diff_hunk":"@@ -32,48 +33,50 @@ class SecretInAFile(SecretProviderBase):\n \n     def checkFileIsReadOnly(self, dirname, secretfile):\n         filepath = os.path.join(dirname, secretfile)\n-        if not os.access(filepath, os.R_OK) or os.access(filepath, os.W_OK):\n-            config.error(\"the file %s is not read-only for user\" %\n+        obs_stat = stat.S_IMODE(os.stat(filepath).st_mode)\n+        if obs_stat not in [stat.S_IRWXU, stat.S_IRUSR]:\n+            config.error(\"the file %s is not user readable only\" %\n                          (secretfile))\n \n-    def checkSecretDirectoryIsAvailableAndReadable(self, dirname, suffix=None):\n+    def checkSecretDirectoryIsAvailableAndReadable(self, dirname, suffixes):\n         if not os.access(dirname, os.F_OK):\n             config.error(\"directory %s does not exists\" % dirname)\n         for secretfile in os.listdir(dirname):\n-            if suffix and secretfile.endswith(suffix):\n-                self.checkFileIsReadOnly(dirname, secretfile)\n-            elif not suffix:\n-                self.checkFileIsReadOnly(dirname, secretfile)\n+            for suffix in suffixes:\n+                if secretfile.endswith(suffix):\n+                    self.checkFileIsReadOnly(dirname, secretfile)\n \n-    def loadSecrets(self, dirname, suffix=None):\n+    def loadSecrets(self, dirname, suffixes):\n         secrets = {}\n         for secretfile in os.listdir(dirname):\n             secretvalue = None\n-            if suffix and secretfile.endswith(suffix):\n-                with open(os.path.join(dirname, secretfile)) as source:\n-                    secretvalue = source.read()\n-            elif not suffix:\n-                with open(os.path.join(dirname, secretfile)) as source:\n-                    secretvalue = source.read()\n-            secrets.update({secretfile: secretvalue})\n+            for suffix in suffixes:\n+                if secretfile.endswith(suffix):\n+                    with open(os.path.join(dirname, secretfile)) as source:\n+                        secretvalue = source.read()\n+                    if suffix:","path":"master/buildbot/secrets/providers/file.py","position":57,"original_position":48,"commit_id":"86171150a5a6ed7b04cdfa58efb1e8adb8c58fbc","original_commit_id":"86171150a5a6ed7b04cdfa58efb1e8adb8c58fbc","user":{"login":"tardyp","id":109859,"avatar_url":"https://avatars.githubusercontent.com/u/109859?v=3","gravatar_id":"","url":"https://api.github.com/users/tardyp","html_url":"https://github.com/tardyp","followers_url":"https://api.github.com/users/tardyp/followers","following_url":"https://api.github.com/users/tardyp/following{/other_user}","gists_url":"https://api.github.com/users/tardyp/gists{/gist_id}","starred_url":"https://api.github.com/users/tardyp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tardyp/subscriptions","organizations_url":"https://api.github.com/users/tardyp/orgs","repos_url":"https://api.github.com/users/tardyp/repos","events_url":"https://api.github.com/users/tardyp/events{/privacy}","received_events_url":"https://api.github.com/users/tardyp/received_events","type":"User","site_admin":false},"body":"rstrip will not work + what is the point of using update with a single entry dictionary (why not just assign?)\r\n```\r\nif suffix:\r\n    secretfile = secretfile[:-len(suffix)]\r\n\r\nsecret[secretfile] = secretvalue\r\n```\r\n","created_at":"2017-02-16T15:47:11Z","updated_at":"2017-02-16T16:01:58Z","html_url":"https://github.com/buildbot/buildbot/pull/2791#discussion_r101550194","pull_request_url":"https://api.github.com/repos/buildbot/buildbot/pulls/2791","_links":{"self":{"href":"https://api.github.com/repos/buildbot/buildbot/pulls/comments/101550194"},"html":{"href":"https://github.com/buildbot/buildbot/pull/2791#discussion_r101550194"},"pull_request":{"href":"https://api.github.com/repos/buildbot/buildbot/pulls/2791"}}},"pull_request":{"url":"https://api.github.com/repos/buildbot/buildbot/pulls/2791","id":106082412,"html_url":"https://github.com/buildbot/buildbot/pull/2791","diff_url":"https://github.com/buildbot/buildbot/pull/2791.diff","patch_url":"https://github.com/buildbot/buildbot/pull/2791.patch","issue_url":"https://api.github.com/repos/buildbot/buildbot/issues/2791","number":2791,"state":"open","locked":false,"title":"Secret returned by files provider. The secret is stored in files.","user":{"login":"protatremy","id":10063334,"avatar_url":"https://avatars.githubusercontent.com/u/10063334?v=3","gravatar_id":"","url":"https://api.github.com/users/protatremy","html_url":"https://github.com/protatremy","followers_url":"https://api.github.com/users/protatremy/followers","following_url":"https://api.github.com/users/protatremy/following{/other_user}","gists_url":"https://api.github.com/users/protatremy/gists{/gist_id}","starred_url":"https://api.github.com/users/protatremy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/protatremy/subscriptions","organizations_url":"https://api.github.com/users/protatremy/orgs","repos_url":"https://api.github.com/users/protatremy/repos","events_url":"https://api.github.com/users/protatremy/events{/privacy}","received_events_url":"https://api.github.com/users/protatremy/received_events","type":"User","site_admin":false},"body":"## Contributor Checklist:\r\n\r\n* [x] I have updated the unit tests\r\n* [ ] I have created a file in the master/buildbot/newsfragment directory (and read the README.txt in that directory)\r\n* [x] I have updated the appropriate documentation\r\n\r\n","created_at":"2017-02-14T11:07:19Z","updated_at":"2017-02-16T16:01:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf2516614ed0a8e7e400b204637b31385121678d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/buildbot/buildbot/pulls/2791/commits","review_comments_url":"https://api.github.com/repos/buildbot/buildbot/pulls/2791/comments","review_comment_url":"https://api.github.com/repos/buildbot/buildbot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/buildbot/buildbot/issues/2791/comments","statuses_url":"https://api.github.com/repos/buildbot/buildbot/statuses/86171150a5a6ed7b04cdfa58efb1e8adb8c58fbc","head":{"label":"protatremy:filesprovider","ref":"filesprovider","sha":"86171150a5a6ed7b04cdfa58efb1e8adb8c58fbc","user":{"login":"protatremy","id":10063334,"avatar_url":"https://avatars.githubusercontent.com/u/10063334?v=3","gravatar_id":"","url":"https://api.github.com/users/protatremy","html_url":"https://github.com/protatremy","followers_url":"https://api.github.com/users/protatremy/followers","following_url":"https://api.github.com/users/protatremy/following{/other_user}","gists_url":"https://api.github.com/users/protatremy/gists{/gist_id}","starred_url":"https://api.github.com/users/protatremy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/protatremy/subscriptions","organizations_url":"https://api.github.com/users/protatremy/orgs","repos_url":"https://api.github.com/users/protatremy/repos","events_url":"https://api.github.com/users/protatremy/events{/privacy}","received_events_url":"https://api.github.com/users/protatremy/received_events","type":"User","site_admin":false},"repo":{"id":62791987,"name":"buildbot","full_name":"protatremy/buildbot","owner":{"login":"protatremy","id":10063334,"avatar_url":"https://avatars.githubusercontent.com/u/10063334?v=3","gravatar_id":"","url":"https://api.github.com/users/protatremy","html_url":"https://github.com/protatremy","followers_url":"https://api.github.com/users/protatremy/followers","following_url":"https://api.github.com/users/protatremy/following{/other_user}","gists_url":"https://api.github.com/users/protatremy/gists{/gist_id}","starred_url":"https://api.github.com/users/protatremy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/protatremy/subscriptions","organizations_url":"https://api.github.com/users/protatremy/orgs","repos_url":"https://api.github.com/users/protatremy/repos","events_url":"https://api.github.com/users/protatremy/events{/privacy}","received_events_url":"https://api.github.com/users/protatremy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/protatremy/buildbot","description":"Python-based continuous integration testing framework; your pull requests are more than welcome!","fork":true,"url":"https://api.github.com/repos/protatremy/buildbot","forks_url":"https://api.github.com/repos/protatremy/buildbot/forks","keys_url":"https://api.github.com/repos/protatremy/buildbot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/protatremy/buildbot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/protatremy/buildbot/teams","hooks_url":"https://api.github.com/repos/protatremy/buildbot/hooks","issue_events_url":"https://api.github.com/repos/protatremy/buildbot/issues/events{/number}","events_url":"https://api.github.com/repos/protatremy/buildbot/events","assignees_url":"https://api.github.com/repos/protatremy/buildbot/assignees{/user}","branches_url":"https://api.github.com/repos/protatremy/buildbot/branches{/branch}","tags_url":"https://api.github.com/repos/protatremy/buildbot/tags","blobs_url":"https://api.github.com/repos/protatremy/buildbot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/protatremy/buildbot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/protatremy/buildbot/git/refs{/sha}","trees_url":"https://api.github.com/repos/protatremy/buildbot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/protatremy/buildbot/statuses/{sha}","languages_url":"https://api.github.com/repos/protatremy/buildbot/languages","stargazers_url":"https://api.github.com/repos/protatremy/buildbot/stargazers","contributors_url":"https://api.github.com/repos/protatremy/buildbot/contributors","subscribers_url":"https://api.github.com/repos/protatremy/buildbot/subscribers","subscription_url":"https://api.github.com/repos/protatremy/buildbot/subscription","commits_url":"https://api.github.com/repos/protatremy/buildbot/commits{/sha}","git_commits_url":"https://api.github.com/repos/protatremy/buildbot/git/commits{/sha}","comments_url":"https://api.github.com/repos/protatremy/buildbot/comments{/number}","issue_comment_url":"https://api.github.com/repos/protatremy/buildbot/issues/comments{/number}","contents_url":"https://api.github.com/repos/protatremy/buildbot/contents/{+path}","compare_url":"https://api.github.com/repos/protatremy/buildbot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/protatremy/buildbot/merges","archive_url":"https://api.github.com/repos/protatremy/buildbot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/protatremy/buildbot/downloads","issues_url":"https://api.github.com/repos/protatremy/buildbot/issues{/number}","pulls_url":"https://api.github.com/repos/protatremy/buildbot/pulls{/number}","milestones_url":"https://api.github.com/repos/protatremy/buildbot/milestones{/number}","notifications_url":"https://api.github.com/repos/protatremy/buildbot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/protatremy/buildbot/labels{/name}","releases_url":"https://api.github.com/repos/protatremy/buildbot/releases{/id}","deployments_url":"https://api.github.com/repos/protatremy/buildbot/deployments","created_at":"2016-07-07T09:04:04Z","updated_at":"2016-07-07T09:04:09Z","pushed_at":"2017-02-16T12:35:09Z","git_url":"git://github.com/protatremy/buildbot.git","ssh_url":"git@github.com:protatremy/buildbot.git","clone_url":"https://github.com/protatremy/buildbot.git","svn_url":"https://github.com/protatremy/buildbot","homepage":"http://buildbot.net","size":43064,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"buildbot:master","ref":"master","sha":"f56dff6b8cef07677564b3fbacda9de41b22c52b","user":{"login":"buildbot","id":324515,"avatar_url":"https://avatars.githubusercontent.com/u/324515?v=3","gravatar_id":"","url":"https://api.github.com/users/buildbot","html_url":"https://github.com/buildbot","followers_url":"https://api.github.com/users/buildbot/followers","following_url":"https://api.github.com/users/buildbot/following{/other_user}","gists_url":"https://api.github.com/users/buildbot/gists{/gist_id}","starred_url":"https://api.github.com/users/buildbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildbot/subscriptions","organizations_url":"https://api.github.com/users/buildbot/orgs","repos_url":"https://api.github.com/users/buildbot/repos","events_url":"https://api.github.com/users/buildbot/events{/privacy}","received_events_url":"https://api.github.com/users/buildbot/received_events","type":"Organization","site_admin":false},"repo":{"id":760165,"name":"buildbot","full_name":"buildbot/buildbot","owner":{"login":"buildbot","id":324515,"avatar_url":"https://avatars.githubusercontent.com/u/324515?v=3","gravatar_id":"","url":"https://api.github.com/users/buildbot","html_url":"https://github.com/buildbot","followers_url":"https://api.github.com/users/buildbot/followers","following_url":"https://api.github.com/users/buildbot/following{/other_user}","gists_url":"https://api.github.com/users/buildbot/gists{/gist_id}","starred_url":"https://api.github.com/users/buildbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buildbot/subscriptions","organizations_url":"https://api.github.com/users/buildbot/orgs","repos_url":"https://api.github.com/users/buildbot/repos","events_url":"https://api.github.com/users/buildbot/events{/privacy}","received_events_url":"https://api.github.com/users/buildbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/buildbot/buildbot","description":"Python-based continuous integration testing framework; your pull requests are more than welcome!","fork":false,"url":"https://api.github.com/repos/buildbot/buildbot","forks_url":"https://api.github.com/repos/buildbot/buildbot/forks","keys_url":"https://api.github.com/repos/buildbot/buildbot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/buildbot/buildbot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/buildbot/buildbot/teams","hooks_url":"https://api.github.com/repos/buildbot/buildbot/hooks","issue_events_url":"https://api.github.com/repos/buildbot/buildbot/issues/events{/number}","events_url":"https://api.github.com/repos/buildbot/buildbot/events","assignees_url":"https://api.github.com/repos/buildbot/buildbot/assignees{/user}","branches_url":"https://api.github.com/repos/buildbot/buildbot/branches{/branch}","tags_url":"https://api.github.com/repos/buildbot/buildbot/tags","blobs_url":"https://api.github.com/repos/buildbot/buildbot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/buildbot/buildbot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/buildbot/buildbot/git/refs{/sha}","trees_url":"https://api.github.com/repos/buildbot/buildbot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/buildbot/buildbot/statuses/{sha}","languages_url":"https://api.github.com/repos/buildbot/buildbot/languages","stargazers_url":"https://api.github.com/repos/buildbot/buildbot/stargazers","contributors_url":"https://api.github.com/repos/buildbot/buildbot/contributors","subscribers_url":"https://api.github.com/repos/buildbot/buildbot/subscribers","subscription_url":"https://api.github.com/repos/buildbot/buildbot/subscription","commits_url":"https://api.github.com/repos/buildbot/buildbot/commits{/sha}","git_commits_url":"https://api.github.com/repos/buildbot/buildbot/git/commits{/sha}","comments_url":"https://api.github.com/repos/buildbot/buildbot/comments{/number}","issue_comment_url":"https://api.github.com/repos/buildbot/buildbot/issues/comments{/number}","contents_url":"https://api.github.com/repos/buildbot/buildbot/contents/{+path}","compare_url":"https://api.github.com/repos/buildbot/buildbot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/buildbot/buildbot/merges","archive_url":"https://api.github.com/repos/buildbot/buildbot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/buildbot/buildbot/downloads","issues_url":"https://api.github.com/repos/buildbot/buildbot/issues{/number}","pulls_url":"https://api.github.com/repos/buildbot/buildbot/pulls{/number}","milestones_url":"https://api.github.com/repos/buildbot/buildbot/milestones{/number}","notifications_url":"https://api.github.com/repos/buildbot/buildbot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/buildbot/buildbot/labels{/name}","releases_url":"https://api.github.com/repos/buildbot/buildbot/releases{/id}","deployments_url":"https://api.github.com/repos/buildbot/buildbot/deployments","created_at":"2010-07-06T17:56:53Z","updated_at":"2017-02-16T15:12:23Z","pushed_at":"2017-02-16T15:38:47Z","git_url":"git://github.com/buildbot/buildbot.git","ssh_url":"git@github.com:buildbot/buildbot.git","clone_url":"https://github.com/buildbot/buildbot.git","svn_url":"https://github.com/buildbot/buildbot","homepage":"http://buildbot.net","size":43142,"stargazers_count":2577,"watchers_count":2577,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1032,"mirror_url":null,"open_issues_count":22,"forks":1032,"open_issues":22,"watchers":2577,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/buildbot/buildbot/pulls/2791"},"html":{"href":"https://github.com/buildbot/buildbot/pull/2791"},"issue":{"href":"https://api.github.com/repos/buildbot/buildbot/issues/2791"},"comments":{"href":"https://api.github.com/repos/buildbot/buildbot/issues/2791/comments"},"review_comments":{"href":"https://api.github.com/repos/buildbot/buildbot/pulls/2791/comments"},"review_comment":{"href":"https://api.github.com/repos/buildbot/buildbot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/buildbot/buildbot/pulls/2791/commits"},"statuses":{"href":"https://api.github.com/repos/buildbot/buildbot/statuses/86171150a5a6ed7b04cdfa58efb1e8adb8c58fbc"}}}}
{"actor":{"display_login":"tardyp"}}