Copilot commented on code in PR #13160:
URL: https://github.com/apache/trafficserver/pull/13160#discussion_r3289887808


##########
plugins/experimental/maxmind_acl/mmdb.cc:
##########
@@ -429,6 +434,42 @@ Acl::parseregex(const YAML::Node &regex, bool allow)
   }
 }
 
+void
+Acl::loadbypass(const YAML::Node &bypassNode)
+{
+  if (!bypassNode) {
+    Dbg(dbg_ctl, "No bypass set");
+    return;
+  }
+  if (bypassNode.IsNull()) {
+    Dbg(dbg_ctl, "bypass node is NULL");
+    return;
+  }

Review Comment:
   `loadbypass()` starts with `if (!bypassNode)`, but in `Acl::init()` the 
argument is `maxmind["bypass"]` where `maxmind` is a non-const `YAML::Node`. In 
yaml-cpp the non-const `operator[]` inserts a defined (Null) node for missing 
keys, so this branch is effectively unreachable and the config tree is mutated 
just by reading. Consider dropping the `!bypassNode` check (rely on 
`IsNull()`), or make the root `maxmind` node `const` so missing keys remain 
undefined and `!node` works as intended.
   



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