Skip to content

Commit

Permalink
fix: security bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxxoo committed Jan 19, 2024
1 parent 57cd0e8 commit 2a31997
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions hugegraph-server/hugegraph-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@
<artifactId>arthas-packaging</artifactId>
<version>${arthas.version}</version>
</dependency>
<dependency>
<groupId>org.gridkit.jvmtool</groupId>
<artifactId>sjk-core</artifactId>
<version>0.14</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.tinkerpop.gremlin.server.auth.AuthenticationException;
import org.glassfish.grizzly.http.server.Request;
import org.glassfish.grizzly.utils.Charsets;
import org.gridkit.jvmtool.cmd.AntPathMatcher;
import org.slf4j.Logger;

import com.alipay.remoting.util.StringUtils;
Expand Down Expand Up @@ -71,10 +72,11 @@ public class AuthenticationFilter implements ContainerRequestFilter {
private static final Logger LOG = Log.logger(AuthenticationFilter.class);

private static final List<String> WHITE_API_LIST = ImmutableList.of(
"auth/login",
"versions",
"openapi.json"
"/**/auth/login",
"/**/versions",
"/**/openapi.json"
);
private static final AntPathMatcher MATCHER = new AntPathMatcher();

private static String whiteIpStatus;

Expand Down Expand Up @@ -314,9 +316,8 @@ public boolean equals(Object obj) {

public static boolean isWhiteAPI(ContainerRequestContext context) {
String path = context.getUriInfo().getPath();

for (String whiteApi : WHITE_API_LIST) {
if (path.endsWith(whiteApi)) {
if (MATCHER.match(path, whiteApi)) {
return true;
}
}
Expand Down

0 comments on commit 2a31997

Please sign in to comment.