rfc-9865

Cursor-Based Pagination of System of Cross-domain Identity Management (SCIM) Resources

M. Peterson (Editor), D. Zollner, A. Sehgal
date2025-10 streamIETF areasec wgscim statusPROPOSED STANDARD pages14 canonicalhttps://www.rfc-editor.org/rfc/rfc9865 doi10.17487/RFC9865
This document updates RFCs 7643 and 7644 by defining additional System for Cross-Domain Identity Management (SCIM) query parameters and result attributes to allow use of cursor-based pagination in SCIM service providers that are implemented with existing codebases, databases, or APIs where cursor-based pagination is already well established.

updates

Extracted elements (21)

design-rationale §2.3

A service provider MAY require cursor-based pagination to retrieve all results even when the client did not include the cursor parameter, by including a nextCursor in the response to an unpaginated query. This allows service providers to enforce pagination on large result sets regardless of client intent.

security

design-rationale §1

Translating from an underlying cursor-based pagination pattern to the index-based pagination defined in RFC 7644 requires the SCIM service provider to fully iterate the underlying cursor, store results, and serve indexed pages from stored results. This pagination translation increases complexity and memory requirements, impeding SCIM adoption for applications where cursor-based pagination is already established.

security

interoperability-note §2.4

Implementers adding cursor-based pagination to a service provider that previously supported only index-based pagination should use index as the default pagination method to avoid breaking clients that expect index-based behavior when no pagination parameters are specified.

security

interoperability-note §2

Service providers implementing cursor pagination that are unable to estimate totalResults MAY choose to omit the totalResults attribute from paged responses, diverging from the RFC 7644 guidance to return an accurate value.

security

normative-requirement §2 MUST NOT

A negative count value SHALL be interpreted as 0. When count is specified, the service provider MUST NOT return more results than requested, though it MAY return fewer.

security

normative-requirement §4 MUST NOT

Clients MUST NOT interpret the lack of published Service Provider Configuration values to mean that no defaults or limits on page sizes or cursor lifetimes exist, or that there is no default pagination method.

security

normative-requirement §2 MUST NOT

previousCursor MUST NOT be returned with the first page of results. Returning previousCursor is OPTIONAL.

security

normative-requirement §2 MUST

Service providers supporting cursor-based pagination MUST include nextCursor in all paged query responses except when returning the last page. nextCursor MUST be omitted from a response only to indicate that there are no more result pages.

security

normative-requirement §2 MUST

The cursor value MUST be empty or omitted for the first request of a cursor-paginated query. Cursor values may only contain characters from the unreserved character set defined in RFC 3986 Section 2.3.

security

normative-requirement §2 MUST

To retrieve another result page, the client MUST query the same service provider endpoint with all query parameters and values identical to the initial query, with the exception of the cursor value, which SHOULD be set to a nextCursor or previousCursor value returned by the service provider.

security

normative-requirement §2.4 MUST

When a service provider supports both index-based and cursor-based pagination, it MUST choose a default pagination method to use when responding to requests that have not specified a pagination query parameter.

security

protocol-element §4

A `pagination` complex attribute is defined for the /ServiceProviderConfig resource with sub-attributes: `cursor` (Boolean, REQUIRED), `index` (Boolean, REQUIRED), `defaultPaginationMethod` (string, OPTIONAL), `defaultPageSize` (positive integer, OPTIONAL), `maxPageSize` (positive integer, OPTIONAL), and `cursorTimeout` (positive integer in seconds, OPTIONAL).

security

protocol-element §3

Cursor-based pagination parameters (`cursor`, `count`) may be passed in the body of an HTTP POST to a `/.search` endpoint as defined in RFC 7644 Section 3.4.3, in addition to URL query parameters on GET requests.

security, http

protocol-element §2.1

Three scimType error detail values are defined for HTTP 400 responses: `invalidCursor` (cursor value is invalid), `expiredCursor` (cursor has expired, client waited too long between requests), and `invalidCount` (count value is out of range or inconsistent with initial query). These extend the error keyword list in RFC 7644 Table 9.

security

protocol-element §2

Two response attributes are defined: `nextCursor` (opaque URL-safe string cursor for the next page, MUST be included in all paged responses except the last) and `previousCursor` (optional cursor for reverse traversal, MUST NOT be returned with the first page).

security

protocol-element §2

Two URL query parameters are defined for cursor-based pagination: `cursor` (string, the nextCursor value from a previous response, empty or omitted for the first request, restricted to RFC 3986 unreserved characters) and `count` (desired maximum results per page; negative values treated as 0).

security

registry §6

IANA has updated the 'SCIM Schema URIs for Data Resources' registry (established by RFC 7643) to add RFC 9865 Section 2 as a reference for urn:ietf:params:scim:api:messages:2.0:ListResponse and urn:ietf:params:scim:api:messages:2.0:SearchRequest, and the 'SCIM Server-Related Schema URIs' registry to add Section 4 as a reference for urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig.

registry, security

security-consideration §5.2

Cursor values should be obfuscated to prevent clients from interpreting or forging cursors. Service providers should be able to detect forged cursor values and return an invalidCursor error. Error responses for out-of-scope or non-existent pages must use identical messages to avoid leaking information about underlying data or authorization failures.

security, privacy

security-consideration §5.2

Implementers MUST ensure that pagination through result sets is strictly confined to data that the actor's current identity has been authorized to access, even if the actor obtained a cursor generated by a different actor. Authorization checks MUST be continuously applied as an actor navigates through a result set; cursor possession MUST NOT grant supplementary access privileges.

security

security-consideration §5.3

Retaining substantial data or metadata per cursor creates a Denial-of-Service vector: numerous initial queries allocating cursors can exhaust service-provider resources. Mitigations include requiring authentication for large result sets, rate limiting per RFC 6585, administrator-configurable cursor count ceilings, and resource-efficient cursor invalidation mechanisms.

security

security-consideration §5.2

Service providers SHOULD invalidate all cursors corresponding to an actor immediately following a permission change, to prevent post-permission-change queries using old cursors from succeeding. Alternatively, providers may retain cursors but must update result set metadata to reflect new permissions.

security