Skip to content

Commit

Permalink
Remove username/pw access from registry requests
Browse files Browse the repository at this point in the history
This prevents the access token from being sent by the requests library
  • Loading branch information
myw committed Jan 9, 2019
1 parent 3b9c958 commit e76821c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docker_registry_client/_BaseClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,25 @@ def __init__(self, *args, **kwargs):

super(BaseClientV2, self).__init__(*args, **kwargs)

# If we are using token authentication with v2, we use the username
# and pw only for the authorization service and not for the registry
# itself.
#
# We must pop the auth kwarg so it does not get sent to requests,
# because override the authentication token if it sees the username/password
# provided
# See: http://docs.python-requests.org/en/master/user/quickstart/#custom-headers
if auth_service_url:
auth = self.method_kwargs.pop('auth')
else:
auth = self.method_kwargs.get('auth')

self._manifest_digests = {}
self.auth = AuthorizationService(
service_name=auth_service_name,
url=auth_service_url,
verify=self.method_kwargs.get('verify', False),
auth=self.method_kwargs.get('auth', None),
auth=auth,
api_timeout=self.method_kwargs.get('api_timeout')
)

Expand Down

0 comments on commit e76821c

Please sign in to comment.