zmuxuny opened a new pull request, #5493:
URL: https://github.com/apache/rocketmq-dashboard/pull/5493

   ### Which Issue(s) This PR Fixes
   
   Fixes #5492
   
   ### Brief Description
   
   Pass the already-encoded webhook URL to RestTemplate.postForEntity(URI, 
...). The String overload encodes it again: DingTalk signature padding changes 
from %3D to %253D, so the query-decoded signature differs from the HMAC. Test 
notifications and queued alerts use this path. Existing escaped values in 
unsigned DingTalk/SMS URLs are affected too.
   
   This changes request construction only. URL-host validation, HMAC 
generation, response validation, and the delivery/retry state machine remain 
unchanged. No logging or configuration is added. The target follows 
CONTRIBUTING.md: rocketmq-studio. AI assistance was used for investigation, 
implementation and review.
   
   ### How Did You Test This Change?
   
   NotificationWebhookEncodingTest uses a real RestTemplate with 
MockRestServiceServer, a synthetic secret and a TEST-NET address. It inspects 
the final request URI rather than mocking postForEntity. Coverage includes 
signed test notifications with no query, plain query and escaped query; signed 
queued delivery and audit; unsigned DingTalk/SMS with no query, plain query and 
escaped +, /, = and space. HMAC is independently recomputed from the 
transmitted timestamp; SHA-256 Base64 padding makes the regression 
deterministic.
   
   - Before the production change: 10 new tests, 6 failures, 4 passes.
   - After the change: all 10 new tests and 30 existing notification tests pass.
   - Broader local backend run: 3,301 tests pass, zero failures/errors/skips. 
This includes all non-@SpringBootTest tests; the 13 full application/database 
classes still need upstream CI.
   - Checkstyle: zero violations. git diff --check passes.
   - Independent review found no must-fix issues. No live DingTalk request was 
made.
   
   Focused command:
   ```sh
   cd server
   mvn -B -ntp test 
-Dtest=NotificationWebhookEncodingTest,NotificationOutboxServiceTest 
-DargLine="$TEST_JVM_ARGS"
   ```
   
   Broader command:
   ```sh
   EXCLUDES=$(grep -R -l '@SpringBootTest' src/test/java | sed -E 
's@.*/([^/]+)\.java@!\1@' | paste -sd,)
   mvn -B -ntp test -Dtest="*,$EXCLUDES" -DargLine="$TEST_JVM_ARGS"
   ```
   
   The local test JVM uses the cached Mockito JAR as an explicit -javaagent 
because self-attachment is unavailable. A test-only jdk.net.hosts.file retains 
the container hostname and supplies TEST-NET answers for existing mocked 
example.com and LLM endpoint requests. New regression tests do not need DNS. 
These options make no live webhook calls and do not change the repository, 
dependencies, assertions or production networking policy.
   
   The first broader run also encountered the existing H2 concurrency flake 
#5302; that unchanged test passed in subsequent runs.
   
   ### Checklist
   
   - [x] One coherent change
   - [x] Conventional Commit subject
   - [x] Regression tests with names ending in Test
   - [x] ASF header on new source file
   - [x] No UI strings or public configuration changes
   - [ ] Full backend CI, including database integration tests, still needs to 
run
   - [x] Encoding rationale documented in code and issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to