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


##########
plugins/experimental/access_control/access_control.cc:
##########
@@ -470,6 +513,29 @@ accessTokenStatusToString(const AccessTokenStatus &state)
   return s;
 }
 
+/**
+ * Validates the request path against the token scope using normalized segment 
boundaries.
+ */
+bool
+validateScope(StringView requestPath, StringView scope)
+{
+  if (scope.empty()) {
+    return true;
+  }
+  String normRequestPath = normalizePath(requestPath);
+  String normScope       = normalizePath(scope);
+  if (normScope == "/") {
+    return true;
+  }
+  if (normRequestPath == normScope) {
+    return true;
+  }
+  if (normRequestPath.starts_with(normScope) && 
normRequestPath[normScope.length()] == '/') {

Review Comment:
   `String` is an alias for `std::string`, but `std::string::starts_with()` is 
only available since C++20. This plugin targets the project's pre-C++20 
language standard, so this will fail to compile. Use a C++17-compatible prefix 
check, such as comparing `compare(0, normScope.length(), normScope) == 0`, 
before checking the following segment boundary.



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