Skip to content

fix(task-store): preserve authorized task pagination - #1258

Merged
kabir merged 3 commits into
a2aproject:mainfrom
kabir:task-list-read-access
Nov 2, 2026
Merged

kabir merged 3 commits into
a2aproject:mainfrom
kabir:task-list-read-access

Conversation

@kabir

@kabir kabir commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Task listings need to apply the request handler's authorization provider before pagination so page contents, continuation tokens, and totals describe the same set of readable tasks.

This change passes that provider to TaskStore.listAuthorized, preserves the list-level access check, and validates returned tasks. In-memory and JPA stores filter authorized candidates before selecting a page. Custom stores inherit a bounded fallback with authorized totals and page-token loop detection.

The JPA fallback uses configurable scan batches and limits. The documentation explains scan costs and consistency guarantees, with regression coverage for builder-wired handlers, pagination, totals, and scan limits.

Validation: mvn -B -pl server-common,extras/task-store-database-jpa -am package -DskipDockerTests=false passed (1,868 tests, zero failures or errors, six skipped).

Apply per-task read checks after the list-scope gate so builder-wired stores cannot return tasks the caller may not read. Keep the fail-closed path from querying a store when authorization is required but no provider is available.

Add coverage for the list-scope check and for filtering individual returned tasks.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Route authorized listings through the request handler provider so stores apply a consistent per-task read check before pagination. Add a bounded fallback for custom stores that do not implement the optimized path, including an exact authorized total and page-token loop detection.

Update the JPA store to scan authorized candidates in configurable batches, return a safe partial page when its scan budget is exhausted, and avoid exposing inaccessible task counts.

Document the default fallback scan cost and limits, and qualify exact counts when concurrent changes occur.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Signed-off-by: Kabir Khan <kkhan@redhat.com>
throw new TaskStoreException("a2a.max-scanned-tasks must be greater than zero");
}
if (provider != null && authorizationScanBatchSize <= 0) {
throw new TaskStoreException("a2a.authorization-scan-batch-size must be greater than zero");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this validation (& a2a.max-scanned-tasks) be done in the initConfig method instead.

Reject nonpositive scan limits and authorization batch sizes in initConfig
instead of waiting for an authorized listing. Cover zero, negative, and
positive values without requiring an authorization provider, and document
the initialization failure.
@kabir
kabir merged commit acacbb8 into a2aproject:main Nov 2, 2026
15 checks passed
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.

3 participants