{"action":"created","issue":{"url":"https://api.github.com/repos/apache/libcloud/issues/844","repository_url":"https://api.github.com/repos/apache/libcloud","labels_url":"https://api.github.com/repos/apache/libcloud/issues/844/labels{/name}","comments_url":"https://api.github.com/repos/apache/libcloud/issues/844/comments","events_url":"https://api.github.com/repos/apache/libcloud/issues/844/events","html_url":"https://github.com/apache/libcloud/pull/844","id":167421411,"number":844,"title":"[LIBCLOUD-835] Fix caching of Google auth tokens","user":{"login":"paultiplady","id":18148490,"avatar_url":"https://avatars.githubusercontent.com/u/18148490?v=3","gravatar_id":"","url":"https://api.github.com/users/paultiplady","html_url":"https://github.com/paultiplady","followers_url":"https://api.github.com/users/paultiplady/followers","following_url":"https://api.github.com/users/paultiplady/following{/other_user}","gists_url":"https://api.github.com/users/paultiplady/gists{/gist_id}","starred_url":"https://api.github.com/users/paultiplady/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paultiplady/subscriptions","organizations_url":"https://api.github.com/users/paultiplady/orgs","repos_url":"https://api.github.com/users/paultiplady/repos","events_url":"https://api.github.com/users/paultiplady/events{/privacy}","received_events_url":"https://api.github.com/users/paultiplady/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-25T17:29:49Z","updated_at":"2016-07-25T17:42:00Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/libcloud/pulls/844","html_url":"https://github.com/apache/libcloud/pull/844","diff_url":"https://github.com/apache/libcloud/pull/844.diff","patch_url":"https://github.com/apache/libcloud/pull/844.patch"},"body":"## Fix corruption bug in Google auth token caching\r\n\r\n### Description\r\n\r\nThe `GoogleOAuth2Credential. _write_token_to_file()` method writes a copy of the latest OAuth token to disk. Prior to this fix, the token was being written to disk without truncating the file first, which is fine in the case where the new token has the same number of characters (or more) as the old one. However, in some situations Google OAuth returns a shorter token string, which was causing the library to crash when loading the corrupted token.\r\n\r\n### Status\r\n\r\nFixed, needs tests.\r\n\r\n### Checklist (tick everything that applies)\r\n\r\n- [x] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks)\r\n- [ ] Documentation\r\n- [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)\r\n- [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes)\r\n\r\n_write_token_to_file was not zeroing the file before writing\r\na new token, causing corruption.\r\n\r\nFIXES: LIBCLOUD-835"},"comment":{"url":"https://api.github.com/repos/apache/libcloud/issues/comments/235026841","html_url":"https://github.com/apache/libcloud/pull/844#issuecomment-235026841","issue_url":"https://api.github.com/repos/apache/libcloud/issues/844","id":235026841,"user":{"login":"erjohnso","id":2154049,"avatar_url":"https://avatars.githubusercontent.com/u/2154049?v=3","gravatar_id":"","url":"https://api.github.com/users/erjohnso","html_url":"https://github.com/erjohnso","followers_url":"https://api.github.com/users/erjohnso/followers","following_url":"https://api.github.com/users/erjohnso/following{/other_user}","gists_url":"https://api.github.com/users/erjohnso/gists{/gist_id}","starred_url":"https://api.github.com/users/erjohnso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erjohnso/subscriptions","organizations_url":"https://api.github.com/users/erjohnso/orgs","repos_url":"https://api.github.com/users/erjohnso/repos","events_url":"https://api.github.com/users/erjohnso/events{/privacy}","received_events_url":"https://api.github.com/users/erjohnso/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T17:42:00Z","updated_at":"2016-07-25T17:42:00Z","body":"/cc @supertom - thanks for this @paultiplady!"}}
{"actor":{"display_login":"erjohnso"}}