Skip to content

fix(node)!: gate agent-task reads behind visibility rules - #553

Merged
beardthelion merged 60 commits into
mainfrom
fix/task-read-visibility-gate
Nov 9, 2026
Merged

beardthelion merged 60 commits into
mainfrom
fix/task-read-visibility-gate

Conversation

@beardthelion

@beardthelion beardthelion commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Re-homes #464 (fix(node)!: gate agent-task reads behind visibility rules) onto an upstream branch so the upstream-only Code Quality check can run. Task reads now return null/404 for callers who cannot see the backing repo or task, closing an existence-and-content leak across REST, GraphQL, and WebSocket task surfaces.

Motivation & context

Before this, any caller could enumerate and read every agent task on a node regardless of repo visibility: private and quarantined repos' tasks, their assignees, payloads, and UCAN tokens were readable by anyone, and a failed claim revealed that a task existed and was reserved. Contributor PR #464 was approved at an earlier head; this branch carries the same commits on current main so the required check can run.

Kind of change

  • Bug fix
  • Feature
  • Security fix
  • Docs
  • Tests / CI
  • Refactor (no behavior change)
  • Breaking or protocol change (issue required first)

What changed

  • gitlawb-node: every task read surface (REST list/get, GraphQL task/tasks/taskById, WS task query) gates through get_visible_task; claim/complete/fail gate through get_claimable_task. Ineligible callers get the same 404/not-found as a missing task, so denials never leak existence or reservations.
  • gitlawb-node: sealed opaque task cursors for keyset pagination, bound to position, filter, and caller; anonymous cursors cannot resume an authenticated scan.
  • gitlawb-node: per-request task scan budget and an IP rate limiter on task read routes, shared by REST and GraphQL.
  • gitlawb-node: UCAN tokens never appear in read responses or GraphQL errors.
  • gl: task client and MCP surface updates matching the gated contract.
  • Mirror-repo rows (slash-form ids, whose own visibility pair is vacuous) fail closed on every gate.

Merge detail: 52 contributor commits preserved author-identical from 1514f3d8; one maintainer merge commit brings main at a4026e84. Conflicts resolved by union: both error helpers kept in api/tasks.rs, the PR's GraphQL complete_task/fail_task mutations (which ort had dropped) restored against finish_task's new actor_did signature, stored-assignee by_did (#550 contract) on all task event broadcasts, and two stale test oracles updated for the merged contract (ineligible claim is 404, list_tasks_keyset normalizes the assignee filter).

How a reviewer can verify

On main, a permissionless caller gets task rows back:

curl -s localhost:8080/api/v1/tasks | jq '.count'   # >0 for tasks on private repos

On this branch the same call returns count: 0 and a per-id GET returns 404. Locally: cargo test -p gitlawb-node --bin gitlawb-node task exercises the gate on list, get, claim, complete, fail, GraphQL, WS, cursors, deny windows, and the mirror-row case.

Before you request review

  • Scope is one logical change; no unrelated churn
  • cargo test --workspace passes locally
  • New behavior is covered by tests (required for fixes)
  • cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings are clean
  • Commit titles use Conventional Commits (feat(...), fix(...), docs(...))
  • Docs / .env.example updated if behavior or config changed (or N/A)
  • Checked existing PRs so this isn't a duplicate

Protocol & signing impact

  • Touches DID / did:key, Ed25519 / RFC 9421 signatures, UCAN, ref certs, or P2P wire formats
  • Discussed in an issue before implementation
  • Backward-compatible with existing nodes and previously signed history

DID-matching and UCAN handling change (assignee normalization, UCAN redaction); signed artifacts and wire formats are untouched. The breaking item is the read contract, called out in the title: callers that could previously read gated tasks now get 404/not-found.

Notes for reviewers

  • Original fork PR: fix(node)!: Gate agent-task reads behind visibility rules #464 (closed, pointer left there). Approvals predated its rebase and this merge to current main, so fresh review is requested.
  • Mirror-row handling: a task on a slash-form mirror id cannot establish read access (its is_public/visibility_rules pair is hardcoded empty/true), so every gate fails closed on it; mirror_only_repo_task_is_hidden_from_anonymous_reads covers the no-canonical-twin case.

Summary by CodeRabbit

  • New Features
    • Task lists now support cursor-based pagination across REST, GraphQL, and CLI, with completeness information and warnings when results are incomplete.
    • Task reads respect repository and task visibility, and omit authorization tokens from returned task data.
    • Anonymous task reads are limited to 1,200 requests per client IP per hour by default; this limit can be disabled in configuration.
  • Bug Fixes
    • Task claim and completion conflicts now return clearer conflict errors, while inaccessible tasks are not disclosed as available.
  • Documentation
    • Updated security and configuration guidance for task visibility, pagination, and read limits.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants