apache / apache/beam

Service Account Based Authentication Broken

Open
#18,071 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
205

Description

`sdks/python/apache_beam/internal/auth.py` calls into the `oauth2client.service_account.ServiceAccountCredentials.from_p12_keyfile` method with invalid and incorrectly-ordered parameters. Compare the [function signature of ServiceAccountCredentials.from_p12_keyfile](https://github.com/google/oauth2client/blob/ae73312942d3cf0e98f097dfbb40f136c2a7c463/oauth2client/service_account.py#L300-L303) with [how it is invoked](https://github.com/apache/incubator-beam/blob/9ded359daefc6040d61a1f33c77563474fcb09b6/sdks/python/apache_beam/internal/auth.py#L150-L154). This causes a runtime error when one attempts to use a service account to authenticate with the Google Dataflow APIs.

The specific problems are:
- the `client_scopes` variable (a list) is passed as a positional parameter where the function signature expects the `private_key_password` parameter (a string).
- a keyed parameter, `user_agent`, is passed but no such parameter is defined in the function signature.
- no value is provided for `private_key_password`. All p12 key files for service accounts issued by Google Cloud have the password `notasecret` as documented [here](https://support.google.com/cloud/answer/6158849?hl=en#serviceaccounts), so it's currently not possible to use a Google-issued p12 key file with this implementation.

Imported from Jira [BEAM-1070](https://issues.apache.org/jira/browse/BEAM-1070). Original Jira may contain additional context.
Reported by: smrquizlet.

Contributor guide

Open the contributing guide

Research direction

Start in sdks/python/apache_beam/internal/auth.py around the service-account credential call and compare it with the linked ServiceAccountCredentials.from_p12_keyfile signature. Verify the corrected authentication path using a Google-issued p12 key file and the Dataflow APIs; done means service-account authentication no longer raises the reported runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, python
Domain
api, authentication, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.