Repository navigation
Conversation
…out request-path overhead
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8219.
Problem
The bootstrap exposes the gateway's raw configuration caches through plain Spring controllers mapped under a hard-coded
/actuatorprefix (ShenyuControllerEndpointinshenyu-web). BecauseHealthFilterdispatches every/actuator/*request straight to theDispatcherHandler, these mappings sit outside the request-plugin chain: anyone who can reach the gateway listener can anonymously read full plugin/selector/rule/metadata DTOs, andPluginData.config, selector and rule handles, and RPC metadata extensions routinely carry real credentials. The shippedmanagement.endpoints.web.exposure.include=health,infosetting does not help because these are not Actuator endpoints, and changing the Actuator base path or port does not move them.Change
This PR makes raw cache inspection default-denied and opt-in with a bounded safe representation.
ShenyuControllerEndpointis now annotated with@ConditionalOnProperty(name = "shenyu.endpoint.raw-data.enabled", havingValue = "true", matchIfMissing = false), following the existingshenyu.diagnostics.enabledprecedent: with shipped settings the controller bean is not registered at all, so anonymous requests are rejected before any cache traversal or JSON generation, and health/readiness/info mappings are untouched.PluginData.config, selector and rule handles, metadata path and RPC extension) plus non-secret structural counters, reusing the sharedDiagnosticRedactor.digest()policy from the diagnostics subsystem instead of serializing-then-redacting per request.Tests
ShenyuActuatorDispatchIntegrationTestdrives the real reactive HTTP mapping (WebFluxDispatcherHandlerbehindHealthFilter, with a denyWebFilterstanding in for the request-plugin chain): with shipped settingsGET /actuator/pluginDatareturns 404 before any cache traversal; health-style mappings keep working; business paths still traverse the plugin chain and are denied 401 while the actuator dispatch bypasses it; and with the property enabled the endpoints return only the digest representation.ShenyuControllerEndpointTestseeds the caches with clearly marked fake secrets and asserts all eight endpoints answer with the bounded digest structure and never emit the raw config, handle or metadata material.Verification
Removing the
@ConditionalOnPropertyannotation turns the default-denied integration test red (404 becomes 200), confirming it guards the shipped behavior.The denial path is bean-absence — the dispatcher answers 404 with no cache iteration, no DTO serialization and no JSON generation — and ordinary gateway forwarding is unmodified, so there is no regression on the request path.
shenyu-bootstrapcompiles against the change.