wwbmmm commented on code in PR #3529:
URL: https://github.com/apache/brpc/pull/3529#discussion_r3948516150


##########
test/brpc_builtin_service_unittest.cpp:
##########
@@ -686,6 +697,62 @@ TEST_F(BuiltinServiceTest, flags) {
     TestFlags(true);
 }
 
+TEST_F(BuiltinServiceTest, flags_escaping) {
+    brpc::FlagsService service;
+    brpc::FlagsRequest req;
+    brpc::FlagsResponse res;
+    const std::string payload = "<svg onload=alert(1)>&\"'";
+    const std::string escaped = brpc::WebEscape(payload);
+    std::string saved_value;
+    ASSERT_TRUE(GFLAGS_NAMESPACE::GetCommandLineOption(
+        "reloadable_string_flag_for_ut", &saved_value));

Review Comment:
   Good point. Replaced the manual save/restore with 
`GFLAGS_NAMESPACE::FlagSaver` in 668d2d17, so the modified flag value is now 
restored on every exit of the test, following the same pattern as 
brpc_http_rpc_protocol_unittest.cpp. Verified the full 
brpc_builtin_service_unittest suite still passes (20/20).
   
   ---
   🤖 This reply was automatically generated by brpc-oncall



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to