Repository navigation
Description
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 includesconfirm_deletion: bool = Truesrc/google/adk/cli/built_in_agents/tools/delete_files.py:75-79- the only check is on that booleansrc/google/adk/cli/built_in_agents/adk_agent_builder_assistant.py:99- registered as a plainFunctionTool(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 resultThere 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 filesFunctionTool.__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_filesdeclaration can be invoked withfile_pathsandconfirm_deletion=Truein 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_backupalso defaults toFalse, 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_deletionfrom 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 returnsTruefor destructive calls, and/or by callingtool_context.request_confirmation(...)before deleting with a default-deny outcome. - Keep the existing root-directory boundary checks.
- Consider making
create_backup=Truethe 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, andfunction_tool.py. - Confirmed
FunctionTool.__init__defaultsrequire_confirmationtoFalseand the registration at line 99 does not override it. - Confirmed no
require_confirmationorrequest_confirmationusage undersrc/google/adk/cli/built_in_agents. - No runtime proof of concept was executed. This report is based on static code review only.
Activity
vijaym2k6 commentedon Oct 22, 2026
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.
sai5880 commentedon Oct 26, 2026
Thanks for the review. The PR already does the following:
confirm_deletionargument fromdelete_files, so the model can no longer supply an approval flag.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.resolve_file_paths, which confines resolved paths to the project root.create_backupremainsFalseby 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.
llalitkumarrr commentedon Oct 26, 2026
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.
GWeale commentedon Nov 24, 2026
this issue no longer applies now that e2a21ac removed
google.adk.cli.built_in_agentsand itsdelete_filestool 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.