Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Issue 86123002: Adds SSO auth to gsutil (Closed)

Created:
7 years ago by hinoka
Modified:
6 years, 5 months ago
CC:
chromium-reviews, Dirk Pranke, cmp-cc_chromium.org, M-A Ruel, iannucci+depot_tools_chromium.org, ilevy-cc_chromium.org
Visibility:
Public.

Description

Adds SSO auth to gsutil Code path: 1. plugins.sso_auth is imported, which adds the AuthHandler class to the global state. 2. HasConfiguredCredentials() in gslib/utils.py is called by gsutil, and will return true if "prodaccess" exists on the system, which tells the system that we don't want a no-op auth handler. 3. When a command is called, all the auth handlers are cycled through and sso_auth.SSOAuth is called, which calls a stubby command to emit a gaiamint'ed oauth2 access token, which is then used as the Authorization Header if --bypass_prodaccess is passed in, then: 1. HasConfiguredCredentials() will bypass the check for prodaccess, as if it didn't exist. 2. plugins.sso_auth does not get imported. Which will essentially cause gsutil to behave as if this patch never existed. So the expected behavior is: =.boto file does not exist, prodaccess exists, but unauthenticated= Failure: No handler was ready to authenticate. 3 handlers were checked. ['OAuth2Auth', 'HmacAuthV1Handler', 'SSOAuth'] Check your credentials. =.boto file exists, prodaccess exists, but unauthenticated= sso_auth will raise NotReadyToAuthenticate, and the .boto file will be used instead =.boto file exists, prodaccess exists, authenticated= sso_auth will be run _after_ the default gsutil authenticator, which causes the sso_auth to be used over whatever the default authentication is. bypass_prodaccess is passed in by default to upload_to_google_storage because we expect people who use upload_to_google_storage to not need prodaccess and have their own boto file already. Also the sso_auth plugin will only request a readonlyi token, which will not work for uploading. BUG=258152 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=240266

Patch Set 1 #

Patch Set 2 : Added bypass support #

Total comments: 1

Patch Set 3 : Don't import sso_auth if bypass_prodaccess is passed in #

Patch Set 4 : Bypass for upload and if token does not exist #

Total comments: 28

Patch Set 5 : Review fixes, added caching #

Total comments: 10

Patch Set 6 : Modified readme, review fixes #

Patch Set 7 : 80 char #

Total comments: 1

Patch Set 8 : Remove unneeded line #

Total comments: 10

Patch Set 9 : Addressed comments #

Total comments: 3

Patch Set 10 : review fix #

Patch Set 11 : Bug fix or -> and #

Unified diffs Side-by-side diffs Delta from patch set Stats (+163 lines, -35 lines) Patch
M download_from_google_storage.py View 1 2 3 4 5 6 7 8 3 chunks +18 lines, -14 lines 0 comments Download
M tests/download_from_google_storage_unittests.py View 1 2 1 chunk +0 lines, -9 lines 0 comments Download
M third_party/gsutil/README.chromium View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -1 line 0 comments Download
M third_party/gsutil/gslib/command.py View 1 2 3 4 5 chunks +7 lines, -4 lines 0 comments Download
M third_party/gsutil/gslib/util.py View 1 2 3 4 5 6 7 8 9 10 4 chunks +14 lines, -2 lines 0 comments Download
M third_party/gsutil/gsutil View 1 2 6 chunks +14 lines, -5 lines 0 comments Download
A + third_party/gsutil/plugins/__init__.py View 0 chunks +-1 lines, --1 lines 0 comments Download
A third_party/gsutil/plugins/sso_auth.py View 1 2 3 4 5 6 7 8 1 chunk +105 lines, -0 lines 0 comments Download
M upload_to_google_storage.py View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 12 (0 generated)
Ryan Tseng
We got an OK from security to land this publicly. Can you take a look? ...
7 years ago (2013-12-02 22:50:29 UTC) #1
Vadim Sh.
Don't forget to update README.chromium. I'm not sure about this myself, but what about abusing ...
7 years ago (2013-12-03 01:33:41 UTC) #2
Ryan Tseng
Addressed comments https://codereview.chromium.org/86123002/diff/60001/download_from_google_storage.py File download_from_google_storage.py (right): https://codereview.chromium.org/86123002/diff/60001/download_from_google_storage.py#newcode45 download_from_google_storage.py:45: self.bypass_prodaccess = False On 2013/12/03 01:33:41, Vadim ...
7 years ago (2013-12-03 22:57:10 UTC) #3
Vadim Sh.
Mostly nits. And I still don't see a change to README.chromium mentioning this modification. https://codereview.chromium.org/86123002/diff/80001/third_party/gsutil/plugins/sso_auth.py ...
7 years ago (2013-12-03 23:32:41 UTC) #4
Ryan Tseng
Oops, added README change. Also responded to earlier comment about abusing os.environ, I'm a bit ...
7 years ago (2013-12-03 23:55:24 UTC) #5
Vadim Sh.
lgtm But you still need LGTM from OWNERS :P Also, how are you going to ...
7 years ago (2013-12-04 00:08:03 UTC) #6
Ryan Tseng
+maruel for owners Tested it and seemed okay on goobuntu, fired off a few builds ...
7 years ago (2013-12-04 00:15:26 UTC) #7
M-A Ruel
https://codereview.chromium.org/86123002/diff/140001/download_from_google_storage.py File download_from_google_storage.py (right): https://codereview.chromium.org/86123002/diff/140001/download_from_google_storage.py#newcode66 download_from_google_storage.py:66: cmd += ['--bypass_prodaccess'] Use append() https://codereview.chromium.org/86123002/diff/140001/download_from_google_storage.py#newcode67 download_from_google_storage.py:67: cmd += ...
7 years ago (2013-12-04 00:38:16 UTC) #8
Ryan Tseng
https://codereview.chromium.org/86123002/diff/140001/download_from_google_storage.py File download_from_google_storage.py (right): https://codereview.chromium.org/86123002/diff/140001/download_from_google_storage.py#newcode66 download_from_google_storage.py:66: cmd += ['--bypass_prodaccess'] On 2013/12/04 00:38:17, M-A Ruel wrote: ...
7 years ago (2013-12-04 01:22:22 UTC) #9
M-A Ruel
lgtm with nits. https://codereview.chromium.org/86123002/diff/160001/third_party/gsutil/README.chromium File third_party/gsutil/README.chromium (right): https://codereview.chromium.org/86123002/diff/160001/third_party/gsutil/README.chromium#newcode19 third_party/gsutil/README.chromium:19: * Added and imports sso_auth.py to ...
7 years ago (2013-12-04 01:33:32 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/hinoka@chromium.org/86123002/180001
7 years ago (2013-12-12 08:24:09 UTC) #11
commit-bot: I haz the power
7 years ago (2013-12-12 08:26:19 UTC) #12
Message was sent while issue was closed.
Change committed as 240266

Powered by Google App Engine
This is Rietveld 408576698