Skip to content

test(backend): cover pagination cursor tampering, overflows, and mixed sort directions - #2226

Open
DeepDev69x3 wants to merge 2 commits into
LabsCrypt:mainfrom
DeepDev69x3:test/pagination-cursor-tampering-2086
Open

DeepDev69x3 wants to merge 2 commits into
LabsCrypt:mainfrom
DeepDev69x3:test/pagination-cursor-tampering-2086

Conversation

@DeepDev69x3

Copy link
Copy Markdown

Summary

Adds comprehensive deterministic unit tests covering pagination cursor tampering defenses, 64-bit integer overflows, boundary sequences, and mixed sort direction query parsing:

  • Cursor tampering rejection: asserts HTTP 400 and ErrorCode.VALIDATION_ERROR for non-base64 input, non-JSON decoded payloads, missing or non-string createdAt, invalid ISO date strings, missing or non-string seq, and unparseable BigInt sequence values.
  • 64-bit integer overflow support: asserts round-trip encoding and decoding for max signed 64-bit integer (9223372036854775807n), max unsigned 64-bit integer (18446744073709551615n), and zero sequence (0n).
  • Keyset WHERE clause generation with boundary sequences (0n, 18446744073709551615n) and Unix epoch timestamps (1970-01-01T00:00:00.000Z).
  • Mixed sort direction parsing: handles standard directions (asc, desc), compound column-direction specifiers (created_at:desc, amount:asc), and whitespace/empty input fallback in parseQueryParams and parseCursorQueryParams.

Test Coverage

  • npm test -- src/utils/__tests__/pagination.test.ts: 29/29 tests passing 100% green.
  • npm run build: 0 errors.
  • npm run lint: 0 errors.

Closes #2086

@github-actions github-actions Bot added the security:malware-suspected Automated malware indicator found in a pull request label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Malware detection scan flagged this pull request

The scan found 2 indicator(s) in the PR diff. This PR is blocked until a maintainer reviews the flagged files.

  • backend/src/utils/__tests__/pagination.test.ts — encoded-payload-execution (high)
  • backend/src/utils/__tests__/pagination.test.ts — hidden-appended-config-payload (high)

This is an automated triage signal; maintainers must verify whether the finding is malicious or intentional.

This branch has not been deployed

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

Labels

security:malware-suspected Automated malware indicator found in a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[test] Cover pagination cursor tampering

2 participants