Skip to content

cron.runs with scope=all leaks job names across sessions #49175

Closed

Description

@antonio-mello-ai

Summary

Follow-up from #35447 (per-session isolation for cron operations). While implementing session-scoped filtering for cron.list, cron.remove, cron.update, and cron.run, we identified that cron.runs with scope === "all" still leaks job names from other agents/sessions.

Current Behavior

In src/gateway/server-methods/cron.ts, the cron.runs handler (around line 320) builds a jobNameById map by calling context.cron.list({ includeDisabled: true }) — the non-paginated list() method which does not apply caller-based filtering. This means:

  • The jobNameById map contains names of all jobs from all agents/sessions
  • These names are injected into the run log entries returned to the caller
  • A user can see the names of cron jobs belonging to other users

Expected Behavior

When cron.runs is called with scope === "all", the jobNameById map should only contain jobs visible to the calling session (consistent with the filtering applied by cron.list after #35447).

Suggested Fix

Apply the same caller-based filtering from listPage() (introduced in PR #49174) to the list() call inside the cron.runs handler. The resolveCronCallerOptions() helper already exists and can be reused.

Context

Activity

  1. Hollychou924 commented on Mar 17, 2026

    @Hollychou924
  2. added a commit that references this issue on Mar 18, 2026
    2c22e14
  3. clawsweeper commented on Apr 28, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Current main fixes the reported disclosure: agent-scoped callers now carry trusted Gateway caller identity and cron.runs rejects all-scope history before the unfiltered job-name map can run. The fix is merged on main through #96883 but is not in the latest release tag yet.

    I found the merged PR that appears to have closed this: #96883: Scope agent cron operations to the calling agent.

    Root-cause cluster
    Relationship: canonical
    Canonical: #49175
    Summary: This issue is the canonical report for the cron.runs all-scope job-name leak; current main fixes it, and the older open PR is superseded.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the current-main trusted caller-scope implementation and retire the older conflicting linked fix PR separately if maintainer cleanup is authorized.

    Do we have a high-confidence way to reproduce the issue?

    No current-main reproduction remains. Source inspection shows caller-scoped all-scope history is rejected and the regression test verifies the old unfiltered list path is not called.

    Is this the best way to solve the issue?

    Yes. The current-main fix is the safer solution because it derives scope from trusted Gateway agent runtime identity and rejects caller-scoped all-scope history instead of trusting a caller-supplied agent id.

    Security review:

    Security review cleared: Current main blocks the reported cross-session cron job-name disclosure for agent-scoped callers; no remaining issue-wide security concern was found in the reviewed path.

    AGENTS.md: found and applied where relevant.

    What I checked:

    • Current source blocks caller-scoped all-scope history: cron.runs reads the Gateway client's agent runtime identity, rejects scope: "all" when a caller scope exists, and returns before calling the unfiltered context.cron.list({ includeDisabled: true }) name-enrichment path. (src/gateway/server-methods/cron.ts:964, c5d34c8376f8)
    • Regression coverage prevents the old leak path: The validation test asserts caller-scoped cron.runs all-scope history returns scope all is not allowed by caller scope and that context.cron.list is not called. (src/gateway/server-methods/cron.validation.test.ts:1456, c5d34c8376f8)
    • Blame ties the guard to the fixing commit: git blame attributes the caller-scope read and all-scope rejection in the current handler to cee2aca4091265288ce1351b2c97e1f02a2e6dad. (src/gateway/server-methods/cron.ts:973, cee2aca40912)
    • Merged PR provenance: Scope agent cron operations to the calling agent #96883 merged with commit cee2aca4091265288ce1351b2c97e1f02a2e6dad and its body documents agent-tool cron calls being limited to the calling agent, with cross-agent history and mutation attempts rejected. (cee2aca40912)
    • Fix timestamp: The fix commit is cee2aca4091265288ce1351b2c97e1f02a2e6dad, committed at 2026-06-26T21:41:14-05:00, with subject Scope agent cron operations to the calling agent (#96883). (cee2aca40912)
    • Release provenance: No tag contains the fix commit, and git merge-base --is-ancestor returned 1 for v2026.6.10; this is fixed on current main only, not in latest release v2026.6.10. (cee2aca40912)

    Likely related people:

    • joshavant: Authored and merged the current main caller-scoping fix in Scope agent cron operations to the calling agent #96883, including the cron.runs all-scope rejection and regression tests. (role: recent area contributor; confidence: high; commits: cee2aca40912; files: src/gateway/server-methods/cron.ts, src/gateway/server-methods/cron.validation.test.ts)
    • Takhoffman: Merged all-jobs cron run-history work that introduced much of the surrounding Gateway and run-log surface. (role: historical run-history contributor; confidence: medium; commits: 77c3b142a966; files: src/gateway/server-methods/cron.ts, src/cron/run-log.ts)
    • kip-claw: Merged adjacent single-job cron.runs job-name enrichment through the same Gateway and run-log reader path. (role: recent adjacent contributor; confidence: medium; commits: c213827aa50b; files: src/gateway/server-methods/cron.ts, src/cron/run-log.test.ts, src/gateway/server.cron.test.ts)

    Codex review notes: model internal, reasoning high; reviewed against c5d34c8376f8; fix evidence: merged PR #96883, commit cee2aca40912, main fix timestamp 2026-06-26T21:41:14-05:00.

  4. added
    P1
    impact:security
    impact:session-state
    clawsweeper:source-repro
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-security-review
    issue-rating: 🦞 diamond lobster
    clawsweeper:fix-shape-clear
    clawsweeper:needs-maintainer-review
    and removed
    clawsweeper:fix-shape-clear
    clawsweeper:needs-maintainer-review
    on May 17, 2026
  5. openclaw-barnacle commented on Jun 8, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  6. added
    stale
    on Jun 8, 2026
  7. locked as resolved and limited conversation to collaborators on Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1clawsweeper:linked-pr-openclawsweeper:needs-security-reviewclawsweeper:no-new-fix-prclawsweeper:source-reproimpact:securityimpact:session-stateissue-rating: 🦞 diamond lobsterstale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions