Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies: Update minimal PyJWT dependency to 2.3.0 #186

Merged
merged 7 commits into from
Dec 28, 2021

Conversation

priitlatt
Copy link
Contributor

With PyJWT version 2.0.1 app-store-connect commands can fail unexpectedly due to

Traceback (most recent call last):
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 200, in invoke_cli
    CliApp._running_app._invoke_action(args)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 156, in _invoke_action
    return cli_action(**action_args)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 412, in wrapper
    return func(*args, **kwargs)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/tools/app_store_connect.py", line 689, in fetch_signing_files
    bundle_ids = self._get_or_create_bundle_ids(
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/tools/app_store_connect.py", line 708, in _get_or_create_bundle_ids
    bundle_ids = self.list_bundle_ids(
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 412, in wrapper
    return func(*args, **kwargs)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/tools/app_store_connect.py", line 380, in list_bundle_ids
    bundle_ids = self._list_resources(
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/tools/_app_store_connect/resource_manager_mixin.py", line 45, in _list_resources
    resources = resource_manager.list(resource_filter=resource_filter)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/provisioning/bundle_ids.py", line 103, in list
    bundle_ids = (BundleId(bundle_id) for bundle_id in self.client.paginate(url, params=params))
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/api_client.py", line 106, in paginate
    return self._paginate(url, params, page_size, limit).data
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/api_client.py", line 92, in _paginate
    response = self.session.get(url, params={'limit': page_size, **params}).json()
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/api_session.py", line 45, in request
    headers.update(self._auth_headers_factory(reset_jwt))
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/api_client.py", line 72, in generate_auth_headers
    return {'Authorization': f'Bearer {self.jwt}'}
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/api_client.py", line 66, in jwt
    jwt = self._jwt_manager.get_jwt()
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/json_web_token_manager.py", line 147, in get_jwt
    self._jwt = self._load_jwt_from_disk()
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/json_web_token_manager.py", line 109, in _load_jwt_from_disk
    payload = self._decode_payload(token)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/codemagic/apple/app_store_connect/json_web_token_manager.py", line 92, in _decode_payload
    return jwt.decode(
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/jwt/api_jwt.py", line 113, in decode
    decoded = self.decode_complete(jwt, key, algorithms, options, **kwargs)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/jwt/api_jwt.py", line 83, in decode_complete
    decoded = api_jws.decode_complete(
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/jwt/api_jws.py", line 149, in decode_complete
    self._verify_signature(signing_input, header, signature, key, algorithms)
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/jwt/api_jws.py", line 235, in _verify_signature
    if not alg_obj.verify(signing_input, key, signature):
  File "/Users/priit/.pyenv/versions/3.8.10/lib/python3.8/site-packages/jwt/algorithms.py", line 428, in verify
    key.verify(der_sig, msg, ec.ECDSA(self.hash_alg()))
AttributeError: '_EllipticCurvePrivateKey' object has no attribute 'verify'

Set minimal PyJWT version requirement to 2.3.0, which resolves the issue.

@priitlatt priitlatt merged commit 6ce7458 into master Dec 28, 2021
@priitlatt priitlatt deleted the dependencies/pyjwt-2-3-0 branch December 28, 2021 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant