t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: list_scheduled_tasks ignores scheduledTaskId and returns every task's webhook bearer URL

Open 1kuna opened this issue 1 month ago • 1 comments

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/server (orchestrator MCP: list_scheduled_tasks)

Version

T3 Code 0.1.3 (macOS arm64)

Steps to reproduce

  1. In a project, create several scheduled tasks, including at least one {type: "webhook"} task.
  2. From an agent in a thread of that project, call list_scheduled_tasks with a scheduledTaskId filter naming one task.

Expected

  • Only the named task is returned.
  • Webhook bearer URLs (the tokenized webhookUrl) are redacted in list output, or returned only by the call that creates or rotates them.

Actual

  • The filter is ignored. The call returns every scheduled task in the project.
  • Each webhook task's full webhookUrl, token included, is returned to the agent.

Impact

The bearer URL is the only credential for an unsigned webhook task. Once it's in an agent's tool output, it is stored in thread history and sent to the model provider as context. So any agent that lists scheduled tasks exposes every webhook credential in its project, including tasks created by other threads. The only fix today is to recreate each affected task, which rotates the URL, and then update every sender.

Suggested fix

  • Honour scheduledTaskId (and other filters) in list_scheduled_tasks.
  • Omit or mask webhookUrl and token fields in list and read output by default. Expose them only from schedule_task create or rotate, or behind an explicit opt-in.
  • Optionally add a "rotate webhook URL" action, so rotating no longer means recreating the task.

1kuna avatar Oct 30 '26 16:10 1kuna

We hit this too: four leaks of the same unsigned webhook URL in one week on one machine. Each time, an agent thread unrelated to the task called list_scheduled_tasks and the raw result (every task's webhookUrl) ended up in its transcript. We had to rotate each time.

Still reproducible on main (337c5858c3). scheduledTaskSummary includes webhookUrl for any caller whose modes cover the task's, so in practice every full-access thread in a project receives every task's URL. OrchestratorMcpListScheduledTasksInput also has no scheduledTaskId, so the filter in the report is dropped silently.

We have a small, tested patch for the redaction half, and we're running it locally. It's offered here in case the direction is acceptable:

  • Listings only: list_scheduled_tasks includes webhookUrl only for tasks bound to the calling thread (task.threadId === caller thread). Other tasks get webhookUrlWithheld: true instead, so an agent can still tell that a URL exists.

  • Linked environments: calls forwarded from a linked environment never get URLs, since no task here can be bound to a thread there.

  • Unchanged: schedule_task create and update results, the user's own MCP client (no thread, not linked), and the existing mode, read-only, live-turn and policy checks, which still run first.

  • Contract: additive. One optional webhookUrlWithheld: Literal(true). The webhookUrl description now also covers the withheld case, so agents don't tell users to enable T3 Connect when it's already on.

  • Tests:

    • a bound thread sees its own URL; other and unbound tasks are withheld
    • a thread-less client is unchanged; a linked client is withheld
    • create still returns the URL
    • ended-turn and read-only cases show neither the URL nor the marker

    src/mcp passes 335/335, and server and contracts type-check cleanly.

It's narrower than the report's "mask by default everywhere": the bound thread can still list its own URL. We chose that so orchestrator threads that own their webhook tasks keep working. Masking in every listing would be a one-line change if you'd prefer it.

Happy to open a PR (4 files, about 100 lines) if a maintainer agrees with this direction. Honouring scheduledTaskId and adding a rotate action could follow separately.

kellersefi avatar Nov 05 '26 15:11 kellersefi