mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-18 12:13:46 +00:00
Run webhooks with the owner's rules again
The owner sets a webhook up and its URL is a secret, and a webhook run already refuses every action that needs approval, so holding it to the API write allowlist only broke the owner's own automations. Webhook runs no longer count as external callers; schedules keep their caller rules. The allowlist copy no longer names webhooks.
This commit is contained in:
1 parent
080b75c81e
commit
51f88144c5
14 files changed
+19
-19
No files matched your search
@@ -90,7 +90,7 @@ def run_agent_headless(
|
||||
``trace_user_id`` owns the trace when the run belongs to someone other
|
||||
than the agent's owner (a schedule a user set on a shared agent), so the
|
||||
trace is visible wherever that user sees the run; it defaults to the owner.
|
||||
``external_caller`` (a webhook, a schedule set through the API) and
|
||||
``external_caller`` (a schedule set through the API) and
|
||||
``public_link_caller`` (a schedule a public-link user set) mark a run for
|
||||
someone who can't approve for the owner: writes on the owner's accounts
|
||||
and credentials then run only when the agent's API write allowlist has
|
||||
|
||||
@@ -1171,7 +1171,7 @@ class ToolExecutor:
|
||||
entry = f"{tool_data.get('id') or tool_id}:{action_name}"
|
||||
if entry in self.api_write_allowlist:
|
||||
return None
|
||||
route = "for API, widget or webhook callers" if self.external_caller else "from its public link"
|
||||
route = "for API or widget callers" if self.external_caller else "from its public link"
|
||||
target = (
|
||||
f"the owner's {resolved.connector_name} account"
|
||||
if resolved is not None and resolved.connector_name
|
||||
|
||||
@@ -162,8 +162,8 @@ def owner_credential_writes(tool: dict) -> list[str]:
|
||||
"""Names of the tool's write actions that run on its owner's credentials.
|
||||
|
||||
These are what someone who can't approve for the owner (an API-key or
|
||||
widget caller, a public-link user, a webhook) may run only when the owner
|
||||
allows them in the agent's API write allowlist.
|
||||
widget caller, a public-link user) may run only when the owner allows
|
||||
them in the agent's API write allowlist.
|
||||
|
||||
Args:
|
||||
tool: A ``user_tools`` row.
|
||||
|
||||
@@ -2189,9 +2189,6 @@ def agent_webhook_worker(self, agent_id, payload):
|
||||
input_data,
|
||||
tool_allowlist=_webhook_tool_allowlist(agent_config),
|
||||
endpoint="webhook",
|
||||
# The payload comes from outside: nobody there can approve for
|
||||
# the owner, so owner-account writes need the API allowlist.
|
||||
external_caller=True,
|
||||
request_id=getattr(getattr(self, "request", None), "id", None),
|
||||
)
|
||||
result = {
|
||||
|
||||
Reference in new issue
Block a user