google / google/adk-python

More Production Grade Strategy to Access User Identity in Tools

オープン
#1,522 コメント 2 件 リアクション 3 件 担当者 2 名 @klateefa が担当を希望しています GitHub で見る
needs review tools
主要言語
Python
スター
21.5k
フォーク
4k
平均マージ
1日 14時間
マージ済み PR(30日)
37

説明

At present, the safety and security documentation suggests using a tool to run as a user - ie in the tool, make an oauth call to authenticate, then query data with permissions consistent with the user role as opposed to the agent/service account role.

However, I believe this is impractical in most production scenarios. Before I call the tool, I need to securely know who the user is in order to look them up against oauth.

In most production scenarios, the user identity is contained in the http request - ie header, jwt cookie etc. While I can add application wide http middleware to get this information, at present there is no way for me to pass this onto some immutable key in a tool context.

I would like a way for me to take information from a request header and/or cookie and immutably set that into the state for a given agent run.

I could get round this by adding sessions service onto app.state and then in custom middleware putting this information in sessions for relevant routes.

That feels gnarly though and I think this use case is very important... In my opinion, it should be easy to make sure the agent runs only with the permissions of the caller as defined in the incoming http request.

I think the simplest way to solve this would be to pass through request headers and cookies to the invocation context.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。