Skip to content

delete_files confirmation is a model-controlled tool argument #7655

Not planned

Description

@sai5880

Summary

delete_files in the Agent Builder Assistant exposes confirm_deletion as a normal, model-controlled tool argument. The tool treats that argument as evidence of human approval, but the model supplies its value and the schema defaults it to True. The tool is registered as a plain FunctionTool with no require_confirmation, and it never calls tool_context.request_confirmation. As a result, a model that has been prompt-injected (or that simply decides to clean up) can delete files under the configured project root without any human approval step.

Location

  • src/google/adk/cli/built_in_agents/tools/delete_files.py:30-35 - signature includes confirm_deletion: bool = True
  • src/google/adk/cli/built_in_agents/tools/delete_files.py:75-79 - the only check is on that boolean
  • src/google/adk/cli/built_in_agents/adk_agent_builder_assistant.py:99 - registered as a plain FunctionTool(delete_files)
  • src/google/adk/cli/built_in_agents/utils/resolve_root_directory.py - path resolution and root boundary enforcement

Details

Signature at HEAD (delete_files.py:30-35):

async def delete_files(
    file_paths: List[str],
    tool_context: ToolContext,
    create_backup: bool = False,
    confirm_deletion: bool = True,
) -> Dict[str, Any]:

The confirmation check at delete_files.py:75-79:

    # Safety check - only delete if user confirmed
    if not confirm_deletion:
      result["success"] = False
      result["errors"].append("Deletion not confirmed by user")
      return result

There is no other approval path. The docstring at delete_files.py:46-47 states confirm_deletion: Whether deletion was confirmed by user (default: True for safety), but nothing verifies that a user actually confirmed. Because the parameter is part of the function signature, it is exposed in the generated function declaration and the model chooses the value, including the default True when it omits the argument.

Registration at adk_agent_builder_assistant.py:99:

        FunctionTool(delete_files),  # Delete multiple files

FunctionTool.__init__ defaults require_confirmation to False (src/google/adk/tools/function_tool.py:167-191), and the registration above passes only the function, so framework-level confirmation is not enabled for this tool. A search of src/google/adk/cli/built_in_agents finds no use of require_confirmation or request_confirmation.

Deletion itself uses Path.unlink() at delete_files.py:119, after path resolution through resolve_file_paths (resolve_root_directory.py:89-107). Resolution enforces that each path stays within the configured root directory (resolve_root_directory.py:78-85), so the blast radius is the project root, not the whole filesystem. That boundary does not reduce the need for human approval: an agent can still delete any project file, including configuration and source, and with create_backup=False by default the deletion is not recoverable through this tool.

Impact

  • The delete_files declaration can be invoked with file_paths and confirm_deletion=True in one shot, with no HITL pause.
  • A prompt-injected model, or an attacker controlling file contents or tool output that the model reads, can cause deletion of arbitrary files under the project root.
  • Because create_backup also defaults to False, deleted files are not backed up unless the model chooses to set it.
  • "User confirmation" is asserted by the model in a tool argument, which is not a trustworthy signal.

Suggested fix

  • Remove confirm_deletion from the tool signature so it is not model-controlled.
  • Enable real confirmation on the tool, for example by wrapping it with FunctionTool(delete_files, require_confirmation=True) or a callable that returns True for destructive calls, and/or by calling tool_context.request_confirmation(...) before deleting with a default-deny outcome.
  • Keep the existing root-directory boundary checks.
  • Consider making create_backup=True the default for this tool.

Verification

  • Static review of the repository at HEAD 09ab726 (2026-10-21). Files read: delete_files.py, adk_agent_builder_assistant.py, resolve_root_directory.py, cleanup_unused_files.py, and function_tool.py.
  • Confirmed FunctionTool.__init__ defaults require_confirmation to False and the registration at line 99 does not override it.
  • Confirmed no require_confirmation or request_confirmation usage under src/google/adk/cli/built_in_agents.
  • No runtime proof of concept was executed. This report is based on static code review only.

Activity

  1. vijaym2k6 commented on Oct 22, 2026

    @vijaym2k6

    Good catch. A confirm flag the model fills in is not a control, since a prompt-injected model can simply set it to True. A fix that works without any extra tooling: drop confirm_deletion from the signature and register the tool with require_confirmation so the decision sits outside the model's arguments. Keeping create_backup=True as the default and re-checking the resolved path against the root inside the tool are also cheap wins.

  2. added
    tools
    on Oct 22, 2026
  3. sai5880 commented on Oct 26, 2026

    @sai5880
    Author

    Thanks for the review. The PR already does the following:

    • Removed the model-controlled confirm_deletion argument from delete_files, so the model can no longer supply an approval flag.
    • Registered the tool as FunctionTool(delete_files, require_confirmation=True), so approval is collected by the framework HITL gate before the tool runs. A test confirms that a model-supplied argument cannot bypass it.
    • Path resolution still goes through resolve_file_paths, which confines resolved paths to the project root.

    create_backup remains False by default. Changing that default would alter existing behavior for current callers and is outside the scope of #7655.

    I am open to adding an extra in-tool root check if maintainers want defense in depth. No code was changed for this comment.

  4. llalitkumarrr commented on Oct 26, 2026

    @llalitkumarrr
    Collaborator

    Hello @sai5880,

    Thank you for raising this issue and for your contribution. Your PR is currently under review and will be merged once all checks pass and the reviewers approve the changes. We will reach out if further details are required. In the meantime we appreciate your patience.

  5. self-assigned this
    on Nov 24, 2026
  6. GWeale commented on Nov 24, 2026

    @GWeale
    Collaborator

    this issue no longer applies now that e2a21ac removed google.adk.cli.built_in_agents and its delete_files tool in v2.15.0, so i'm closing it as not planned. thanks for reporting it, @sai5880. if you see a similar confirmation gap elsewhere, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions