Skip to content

fix: preserve resource names in general rule commands - #3666

Open
hutiefang76 wants to merge 1 commit into
alibaba:1.8from
hutiefang76:frank/sentinel-general-rule-decode-20261022
Open

hutiefang76 wants to merge 1 commit into
alibaba:1.8from
hutiefang76:frank/sentinel-general-rule-decode-20261022

Conversation

@hutiefang76

Copy link
Copy Markdown

Describe what this PR does / why we need it

A once-encoded setRules request can silently change a resource such as api+v1 into api v1, turn a literal %2B into +, or reject a resource containing a lone %. The changed value also reaches writable data sources.

Does this pull request fix one issue?

Fixes #3665.

Describe how you did it

Remove the second URL decode from ModifyRulesCommandHandler; command transports already provide decoded parameters. Keep URL decoding at the transport boundary.

Add regressions for flow and authority rules through the handler, simple HTTP socket requests and the Netty HTTP pipeline. They check loaded rules and writable-data-source values for +, %2B and %, with ASCII, space and Unicode controls. Each test restores rule managers, data sources and the command registration it replaces.

Describe how to verify it

On the unmodified 1.8 base (a3f40ba8), 19 of the 33 regression cases fail. With the fix, all 33 pass on JDK 17.

mvn -B -pl sentinel-transport/sentinel-transport-common,sentinel-transport/sentinel-transport-simple-http,sentinel-transport/sentinel-transport-netty-http -am -Dsurefire.jdk-toolchain-version=17 test

The affected-module reactor and its dependencies passed 285 tests on macOS arm64 / Microsoft JDK 17.0.18, with no failures, errors or skips. verify -DskipTests also passed, including PMD checks and Java 8 compilation compatibility.

After the final test-cleanup changes, the 33 regressions passed again on JDK 17 and on Zulu JDK 8 (1.8.0_492), with no failures, errors or skips. The final verify -DskipTests passed again; it does not count as another test run.

Special notes for reviews

The general handler is separate from the parameter-flow handler in #3628. These tests exercise both supported HTTP transports; a running Spring MVC application was not part of this validation. Implementation and review were AI-assisted. Remote CI has not run for this new PR yet.

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.

[BUG] General setRules command decodes rule data twice

1 participant