weizhouapache commented on code in PR #8603:
URL: https://github.com/apache/cloudstack/pull/8603#discussion_r1479686180
##########
api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java:
##########
@@ -29,6 +33,20 @@ public class ApiServiceConfiguration implements Configurable
{
"true", "Are the source checks on API calls enabled (true) or not
(false)? See api.allowed.source.cidr.list", true, ConfigKey.Scope.Global);
public static final ConfigKey<String> ApiAllowedSourceCidrList = new
ConfigKey<>(String.class, "api.allowed.source.cidr.list", "Advanced",
"0.0.0.0/0,::/0", "Comma separated list of IPv4/IPv6 CIDRs from
which API calls can be performed. Can be set on Global and Account levels.",
true, ConfigKey.Scope.Account, null, null, null, null, null,
ConfigKey.Kind.CSV, null);
+
+
+ public static void validateEndpointUrl() {
+ String csUrl = getApiServletPathValue();
+ if (StringUtils.isBlank(csUrl) || csUrl.contains("localhost") ||
csUrl.contains("127.0.0.1")) {
Review Comment:
can use `StringUtils.containsAny` instead
##########
api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java:
##########
@@ -18,8 +18,12 @@
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
+import com.cloud.exception.InvalidParameterValueException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
Review Comment:
the new imports can be optimized.
--
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]