Use aiplatform.user role for agent identity permissions#727
Conversation
Update agent identity setup to grant roles/aiplatform.user instead of roles/aiplatform.expressUser. The user role provides broader access to Vertex AI services including model prediction capabilities, while expressUser is limited to simplified Express Mode features with API keys.
Summary of ChangesHello @eliasecchig, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the operational scope of AI agents by upgrading their assigned Identity and Access Management (IAM) role. The previous role, Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the IAM role for the agent identity from the restrictive roles/aiplatform.expressUser to the more permissive roles/aiplatform.user. This change is intended to provide agents with broader access to Vertex AI services for more complex workflows. While the change is functionally correct, I have raised a concern regarding the principle of least privilege, suggesting the use of a custom IAM role to grant only the necessary permissions instead of the broad aiplatform.user role.
|
|
||
| roles = [ | ||
| "roles/aiplatform.expressUser", | ||
| "roles/aiplatform.user", |
There was a problem hiding this comment.
The change from roles/aiplatform.expressUser to roles/aiplatform.user significantly broadens the permissions granted to the agent identity. The roles/aiplatform.user role is quite powerful, granting permissions to create, delete, and manage various Vertex AI resources. This goes against the principle of least privilege. For better security, consider creating a custom IAM role that includes only the specific additional permissions required for the agent's complex workflows, rather than using the broad aiplatform.user predefined role. This would limit the potential attack surface if the agent's identity were compromised.
…gleCloudPlatform#727) Update agent identity setup to grant roles/aiplatform.user instead of roles/aiplatform.expressUser. The user role provides broader access to Vertex AI services including model prediction capabilities, while expressUser is limited to simplified Express Mode features with API keys.
Summary
roles/aiplatform.expressUsertoroles/aiplatform.userProblem
The current implementation grants
roles/aiplatform.expressUserwhich is designed for simplified Express Mode usage with API keys. This role has limited capabilities compared to the full Vertex AI user role.Solution
Changed the IAM role assignment in
deploy.py:151to useroles/aiplatform.userinstead. This role provides:The change affects the
setup_agent_identity()function which automatically configures IAM permissions when deploying agents with the--agent-identityflag.