Skip to content

Commit 16cb2fc

Browse files
authored
workflow: gate the FunctionNode confirmation resume on the caller principal
@node(require_confirmation=True) (988fd1a, after this PR's last push) reads the resumed answer from ctx.resume_inputs the same way the tool node does, and had no principal check: in strict mode an approval arriving on an invocation with an unauthenticated principal ran the function. It now goes through resumed_tool_confirmation, so the answer is stored as a rejection for a caller the serving layer could not authenticate. Tests in the next commit fail on main without this.
1 parent 4ab3a72 commit 16cb2fc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/google/adk/workflow/_function_node.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
from .utils._workflow_hitl_utils import confirmation_interrupt_id
5353
from .utils._workflow_hitl_utils import create_auth_request_event
5454
from .utils._workflow_hitl_utils import has_auth_credential
55-
from .utils._workflow_hitl_utils import parse_tool_confirmation
5655
from .utils._workflow_hitl_utils import process_auth_resume
56+
from .utils._workflow_hitl_utils import resumed_tool_confirmation
5757

5858
logger = logging.getLogger("google_adk." + __name__)
5959
_ANY_TYPE_ADAPTER: TypeAdapter[Any] = TypeAdapter(Any)
@@ -794,9 +794,9 @@ async def _run_impl(
794794
resumed_confirmation = False
795795
if self.require_confirmation:
796796
interrupt_id = confirmation_interrupt_id(ctx.node_path)
797-
if (conf_response := ctx.resume_inputs.get(interrupt_id)) is not None:
797+
if (confirmation := resumed_tool_confirmation(ctx)) is not None:
798798
resumed_confirmation = True
799-
ctx.tool_confirmation = parse_tool_confirmation(conf_response)
799+
ctx.tool_confirmation = confirmation
800800
if ctx.tool_confirmation is not None:
801801
if not ctx.tool_confirmation.confirmed:
802802
yield Event(output={"error": "This tool call is rejected."})

0 commit comments

Comments
 (0)