Skip to content

Keep the cursor token and the filter values out of the exception messages. - #13

Merged
gustavofreze merged 2 commits into
mainfrom
fix/no-token-in-cursor-messages
Oct 14, 2026
Merged

gustavofreze merged 2 commits into
mainfrom
fix/no-token-in-cursor-messages

Conversation

@gustavofreze

Copy link
Copy Markdown
Member

Summary

The message of CursorIsInvalid carried the whole cursor token, and the messages of FilterValueNotAllowed,
FilterExpressionIsInvalid and FilterShapeNotSupported carried the value or the expression the client typed. The
services that consume the library answer these exceptions with a 422, and the message reaches the response body and the
log. A cursor token is the base64 of the ordering keys, so a listing sorted by name carries the name of a person inside
it, and a filter on a name, an e-mail or a phone carried that value, so personal data reached the response and the
log. The 2.5.0 release already stated that the message of kindMismatch carries no decoded value.

The messages now keep the field and the kind, and drop the token and the typed value:

  • Cursor token is invalid and could not be decoded.
  • Cursor token does not match the uuid kind for cursor key <id>.
  • Value does not match the <kind> kind for filter field <field>.
  • Value is not permitted for filter field <field>.
  • Filter expression is invalid and could not be parsed.
  • Filter shape is not supported.

The exceptions that echo only a field name, an operator or a documented number stay as they were
(FilterFieldNotAllowed, SortFieldNotAllowed, FilterOperatorNotAllowed, FilterColumnNotMapped,
PageNumberOutOfRange, PageSizeOutOfRange, OffsetOutOfRange, TotalIsNegative). No signature changed: the token and
the values stay in the factories as parameters, and only the message stopped using them.

Public API: backward compatible, since only the text of the messages changes, so the release is 2.6.1. A consumer
whose tests compare the exact message of an invalid cursor must drop the token from the expected text.

Related issue

None.

Checklist

  • Tests added or updated. Four tests with an anchored pattern prove that nothing beyond the fixed text appears in a
    message: a cursor sorted by name, a value that breaks its kind, a malformed value, and a disjunction of personal
    values.
  • Documentation updated when applicable. README: the filter messages never carry a value or an expression, and the
    cursor message never carries the token.
  • make review passes.
  • make tests passes. 403 tests, lines 100% (973/973), MSI 100% (767 of 767 killed).

@gustavofreze
gustavofreze merged commit ce6f1e0 into main Oct 14, 2026
5 checks passed
@gustavofreze
gustavofreze deleted the fix/no-token-in-cursor-messages branch October 14, 2026 21:24
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.

1 participant