`google.api.Service` config seems to require an audience to avoid JWT validation errors
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- api, authentication
調査の方向性
まず endpoints/bookstore-grpc/api_config_auth.yaml と endpoints/bookstore-grpc-transcoding/api_config_auth.yaml から始め、次に認証フローについて jwt_token_gen.py と bookstore_client.py を確認します。Issue に記載された JWT リクエストを再現し、両方のサービス設定が、audience の検証エラーなしで意図したサービスアカウント認証を受け入れることを確認します。
索引モデルが issue の本文から書いたものです。
説明
In which file did you encounter the issue?
Did you change the file? If so, how?
Yes, in the following section of the files:
#
# Request authentication.
#
authentication:
providers:
- id: google_service_account
# Replace SERVICE-ACCOUNT-ID with your service account's email address.
issuer: SERVICE-ACCOUNT-ID
jwks_uri: https://www.googleapis.com/robot/v1/metadata/x509/SERVICE-ACCOUNT-ID
rules:
# This auth rule will apply to all methods.
- selector: "*"
requirements:
- provider_id: google_service_account
I added an audience field to the config:
#
# Request authentication.
#
authentication:
providers:
- id: google_service_account
# Replace SERVICE-ACCOUNT-ID with your service account's email address.
issuer: SERVICE-ACCOUNT-ID
jwks_uri: https://www.googleapis.com/robot/v1/metadata/x509/SERVICE-ACCOUNT-ID
audiences: DEFAULT_HOSTNAME
rules:
# This auth rule will apply to all methods.
- selector: "*"
requirements:
- provider_id: google_service_account
Describe the issue
When using current api_config_auth.yaml for service-account JWT authentication I continued to get "{"message":"Audiences in Jwt are not allowed","code":403}". This error was present regardless of whether the JWT I passed had an audience. I used jwt_token_gen.py to generate the JWTs to pass when reaching out to the api python3 bookstore_client.py --auth_token JWT_TOKEN --host= DEFAULT_HOSTNAME --port 443 --use_tls true.
To generate a JWT without an audience field I commented out the 'aud' portion of the payload in jwt_token_gen.py . I tried without an audience and with the service name as an audience and each test provided the same error message. I inspected each JWT in jwt.io to ensure that each JWT claim was how I expected.
Overall, I suspect the google.api.Service spec has a different behavior for expected audiences than the OpenAPI spec (which doesn't required audience). Adding audience to the config resolved the issue and allowed me to hit the API with service-account JWT authentication enabled. Willing to create a PR to incorporate audiences: DEFAULT_HOSTNAME if approved 👍
- 主要言語
- Jupyter Notebook
- スター
- 8.1k
- フォーク
- 6.7k
- 平均マージ
- 4日 4時間
- マージ済み PR(30日)
- 8
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
GoogleCloudPlatform/python-docs-samples のほかの issue
-
samples
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
GoogleCloudPlatform/python-docs-samples#14609 ·
メンテナーはふだん 1 日以内に返信
-
samples
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
GoogleCloudPlatform/python-docs-samples#14610 ·
メンテナーはふだん 1 日以内に返信
-
samples
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
GoogleCloudPlatform/python-docs-samples#14611 ·
メンテナーはふだん 1 日以内に返信
-
chore(generative_ai) Update model references for generative_ai samples再び着手できるかも @XrossFox が 151 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンsamples
GoogleCloudPlatform/python-docs-samples#14117 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Fix Pipeline dependency issues for geospatial-classification/serving_app再び着手できるかも @XrossFox が 163 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンsamples
GoogleCloudPlatform/python-docs-samples#14091 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
GoogleCloudPlatform/python-docs-samples の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vllm-project/vllm-metal#822 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: chunk_span_bounds and _validated_chunk_spans reject Pydantic models ChunkSpan and AudioFileオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BasedHardware/omi#19047 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ditto-assistant/ditto-subnet#2346 ·
メンテナーはふだん 1 日以内に返信