Skip to content

fix(tools/looker): enforce critical safety annotations for agent tools#2967

Merged
drstrangelooker merged 2 commits intogoogleapis:looker-agentfrom
hiracky16:fix/looker-agent-pr-2830
Apr 7, 2026
Merged

fix(tools/looker): enforce critical safety annotations for agent tools#2967
drstrangelooker merged 2 commits intogoogleapis:looker-agentfrom
hiracky16:fix/looker-agent-pr-2830

Conversation

@hiracky16
Copy link
Copy Markdown
Contributor

@hiracky16 hiracky16 commented Apr 6, 2026

Description

This PR addresses the security and safety concerns raised in #2830 regarding critical annotations in Looker agent tools.

Changes

  • Annotation Protection: Hardcoded readOnlyHint and destructiveHint in the Initialize method for the following tools to ensure they cannot be overridden by user configuration:
    • create_agent (readOnly: false)
    • update_agent (readOnly: false)
    • delete_agent (readOnly: false, destructive: true)
    • get_agent (readOnly: true)
    • list_agents (readOnly: true)
  • Verification Tests: Added TestAnnotations to each tool's test suite to verify that these hints are strictly enforced even when a user attempts to override them in the configuration.
  • Go Environment Consistency: Kept the Go version at 1.25.7 to match the current main branch state while ensuring no unwanted toolchain updates were introduced.

Verification Results

Ran unit tests for all 5 tools and confirmed that all tests, including the new annotation enforcement checks, passed successfully.

…agent tools

Address review feedback from duwenxin99 by:
1. Hardcoding ReadOnlyHint and DestructiveHint in agent tools to prevent user override.
2. Adding unit tests to verify annotation enforcement.
3. Keeping Go version at 1.25.7 to match main while omitting toolchain update.
@hiracky16 hiracky16 requested review from a team as code owners April 6, 2026 21:44
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the initialization logic for tool annotations across several Looker agent tools (create, delete, get, list, and update) to ensure consistent application of ReadOnlyHint and DestructiveHint flags. The review feedback identifies a consistent issue where the input configuration struct is modified directly via a pointer, which could lead to unintended side effects if the caller reuses the configuration. It is recommended to create a new annotations instance and copy values from the configuration instead of modifying the original object.

…nnotations

- Create a new ToolAnnotations instance in Initialize to avoid modifying the cfg.Annotations pointer directly.
- Ensure ReadOnlyHint and DestructiveHint are enforced on the new instance.
@hiracky16
Copy link
Copy Markdown
Contributor Author

@duwenxin99 Updated the code to avoid direct modification of the cfg.Annotations pointer by creating a local copy in Initialize. This ensures no side effects while still enforcing the mandatory safety annotations. PTAL!

@drstrangelooker drstrangelooker merged commit b8f37da into googleapis:looker-agent Apr 7, 2026
9 of 10 checks passed
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.

3 participants