Skip to content

fix(admin): limit swagger import response body size#6411

Open
SouthwestAsiaFloat wants to merge 1 commit into
apache:masterfrom
SouthwestAsiaFloat:issue-6401
Open

fix(admin): limit swagger import response body size#6411
SouthwestAsiaFloat wants to merge 1 commit into
apache:masterfrom
SouthwestAsiaFloat:issue-6401

Conversation

@SouthwestAsiaFloat

@SouthwestAsiaFloat SouthwestAsiaFloat commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

#6401

Description

This PR limits the Swagger/OpenAPI import response body size in shenyu-admin.

It adds a configurable shenyu.swagger.max-body-size setting with a default value of 10 MB, rejects oversized Swagger responses both by Content-Length and during streaming, and returns HTTP 400 for
invalid or oversized import requests.

Tests

Added tests in:

  • SwaggerImportControllerTest
  • SwaggerImportServiceImplTest

The tests cover oversized Swagger response rejection, HTTP 400 responses for invalid import requests, successful small-body imports, unknown Content-Length streaming limits, exact-limit bodies, empty
response bodies, and response charset handling.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

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