Skip to content

Implement RFC-0027: Add configurable route options size limit#4934

Open
rkoster wants to merge 2 commits intocloudfoundry:mainfrom
rkoster:rfc-0027-route-options-size-limit
Open

Implement RFC-0027: Add configurable route options size limit#4934
rkoster wants to merge 2 commits intocloudfoundry:mainfrom
rkoster:rfc-0027-route-options-size-limit

Conversation

@rkoster
Copy link
Contributor

@rkoster rkoster commented Mar 18, 2026

Summary

Implements the route options size limit from RFC-0027 amendment. Adds a configurable max_route_options_size setting (default: 1024 bytes) that rejects route create/update requests with HTTP 422 when the serialized route options JSON exceeds the limit.

Changes

  • Validators (app/messages/validators.rb): Added size check in OptionsValidator to validate raw input size against Config.config.get(:max_route_options_size)
  • Route model (app/models/runtime/route.rb): Added validate_route_options_size as a defense-in-depth database layer validation
  • Actions (app/actions/route_create.rb, app/actions/route_update.rb): Handle the new options_size_exceeded error from the model and return appropriate API error responses
  • Config schemas (api_schema.rb, worker_schema.rb): Added max_route_options_size with default of 1024
  • Tests: Full coverage for validators, model, and actions (create + update)

Error format

Options must be smaller than 1024 bytes (actual size is 1200 bytes)

Related

Adds configurable size limit for route options JSON payload.
Requests exceeding the limit are rejected with HTTP 422.

- Add max_route_options_size config key to api_schema and worker_schema
- Add default value of 1024 bytes to cloud_controller.yml
- Add size validation in OptionsValidator (message layer)
- Add validate_route_options_size in Route model (DB layer)
- Handle options_size_exceeded errors in RouteCreate and RouteUpdate actions
- Add unit tests for all new validation paths
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