{"action":"created","issue":{"url":"https://api.github.com/repos/uber/buck-http-cache/issues/8","repository_url":"https://api.github.com/repos/uber/buck-http-cache","labels_url":"https://api.github.com/repos/uber/buck-http-cache/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/uber/buck-http-cache/issues/8/comments","events_url":"https://api.github.com/repos/uber/buck-http-cache/issues/8/events","html_url":"https://github.com/uber/buck-http-cache/pull/8","id":189920400,"number":8,"title":"Allow buck http cache verify http header","user":{"login":"zayhero","id":8043955,"avatar_url":"https://avatars.githubusercontent.com/u/8043955?v=3","gravatar_id":"","url":"https://api.github.com/users/zayhero","html_url":"https://github.com/zayhero","followers_url":"https://api.github.com/users/zayhero/followers","following_url":"https://api.github.com/users/zayhero/following{/other_user}","gists_url":"https://api.github.com/users/zayhero/gists{/gist_id}","starred_url":"https://api.github.com/users/zayhero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zayhero/subscriptions","organizations_url":"https://api.github.com/users/zayhero/orgs","repos_url":"https://api.github.com/users/zayhero/repos","events_url":"https://api.github.com/users/zayhero/events{/privacy}","received_events_url":"https://api.github.com/users/zayhero/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-11-17T02:51:27Z","updated_at":"2016-11-17T07:50:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/uber/buck-http-cache/pulls/8","html_url":"https://github.com/uber/buck-http-cache/pull/8","diff_url":"https://github.com/uber/buck-http-cache/pull/8.diff","patch_url":"https://github.com/uber/buck-http-cache/pull/8.patch"},"body":"Right now buck http cache didn't do any auth check against http header. To ensure we are safe from others uploading buggy artifacts, this PR is adding the logic to verify the header.\r\n\r\nThis PR includes:\r\n1. config change to introduce `authorizationConfig`, so that user can send the `authorizedTokens` over\r\n2. introduce `HttpHeaderAuthFilter ` to do http header authentication, what it does is extract the `Authorization` from Http header, and verify if that contains in `authorizedTokens` from config\r\n3. change `BuckCacheApplication` to register the `HttpHeaderAuthFilter` so that it could be used\r\n4. change `BuckCacheResource` to execute the authentication for **PUT** request\r\n5. update existing and new unit test to verify the change\r\n\r\nTo use that, it require:\r\n1. add authorized token into `http_write_headers` in `.buckconfig`, e.g.\r\n```\r\n[cache]\r\n  mode = http\r\n  http_mode = readwrite\r\n  http_url = http://localhost:6457\r\n  http_write_headers = Authorization: ZAYHERO\r\n```\r\n2. add the token (i.e. `ZAYHERO`) into `standalone.yml`, e.g.\r\n```\r\nauthorizationConfig:\r\n  authorizedTokens:\r\n    - ZAYHERO\r\n```\r\n\r\n@dhaval2025 @kageiit Please take a look"},"comment":{"url":"https://api.github.com/repos/uber/buck-http-cache/issues/comments/261178367","html_url":"https://github.com/uber/buck-http-cache/pull/8#issuecomment-261178367","issue_url":"https://api.github.com/repos/uber/buck-http-cache/issues/8","id":261178367,"user":{"login":"kageiit","id":291148,"avatar_url":"https://avatars.githubusercontent.com/u/291148?v=3","gravatar_id":"","url":"https://api.github.com/users/kageiit","html_url":"https://github.com/kageiit","followers_url":"https://api.github.com/users/kageiit/followers","following_url":"https://api.github.com/users/kageiit/following{/other_user}","gists_url":"https://api.github.com/users/kageiit/gists{/gist_id}","starred_url":"https://api.github.com/users/kageiit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kageiit/subscriptions","organizations_url":"https://api.github.com/users/kageiit/orgs","repos_url":"https://api.github.com/users/kageiit/repos","events_url":"https://api.github.com/users/kageiit/events{/privacy}","received_events_url":"https://api.github.com/users/kageiit/received_events","type":"User","site_admin":false},"created_at":"2016-11-17T07:50:31Z","updated_at":"2016-11-17T07:50:31Z","body":"LGTM, but would like @dhaval2025 to make a sanity check"}}
{"actor":{"display_login":"kageiit"}}