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


##########
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:
   This test changes a global gflag value via the /flags service, but the 
manual restore at the end will be skipped if any ASSERT_* in the test returns 
early, potentially leaking modified flag state into later tests. Prefer the 
repo’s established pattern of using GFLAGS_NAMESPACE::FlagSaver to guarantee 
restoration on all exits (e.g., 
test/brpc_http_rpc_protocol_unittest.cpp:351-353).



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