Skip to content

GET /failures fails (500) for page tokens ending in a line break #420

Closed

Description

@uniqueg

GET /failures answers 500 Internal Server Error instead of 400 Bad Request for a pageToken with a line break at the end, e.g. pageToken=1.000000000000000000000000%0A.

Cause

The schema checks pageToken only against its pattern ^[0-9]{1,15}\.[0-9a-f]{24}$. jsonschema matches patterns with Python's re.search(), where $ also matches before a final line break (see elixir-cloud-aai/foca#797). The token then reaches _after() in cloud_registry/ga4gh/registry/failures.py, and ObjectId("<24 hex digits>\n") raises bson.errors.InvalidId, which FOCA serves as 500.

The other ^...$ patterns of additions.openapi.yaml aren't affected: $ only appears there inside negative lookaheads (serviceId, id of renames, subject, group), where it rejects more values, not fewer, and the values aren't parsed further.

Fix

Check the token again in the controller with re.fullmatch() and answer 400 with the parameter in errors (pattern-mismatch), without quoting the token, as drs-filer does for its page tokens (elixir-cloud-aai/drs-filer#140). Regression test in tests/test_failures.py.

Activity

  1. self-assigned this
    on Nov 19, 2026
  2. added
    priority: medium
    status: in progress
    type: bug
    workload: hours
    on Nov 19, 2026
  3. moved this from Backlog to In progress in ELIXIR On-Cloud: Low Priorityon Nov 19, 2026
  4. moved this from In progress to In review in ELIXIR On-Cloud: Low Priorityon Nov 19, 2026
  5. added a commit that references this issue on Nov 19, 2026
  6. removed
    status: in progress
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority: mediumtype: bugworkload: hours

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions