Skip to content

Commit

Permalink
fix log4j error
Browse files Browse the repository at this point in the history
Change-Id: I991e975d254bb3522070a52d73326c6ea99424ab
  • Loading branch information
zhoney committed Dec 13, 2021
1 parent 94ea15e commit 025e9ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public class HugeSecurityManager extends SecurityManager {
"com.baidu.hugegraph.backend.store.raft.rpc.RpcForwarder"
);

private static final Map<String, Set<String>> NEW_SECURITY_EXCEPTION = ImmutableMap.of(
"com.baidu.hugegraph.security.HugeSecurityManager",
ImmutableSet.of("newSecurityException")
);

@Override
public void checkPermission(Permission permission) {
if (DENIED_PERMISSIONS.contains(permission.getName()) &&
Expand Down Expand Up @@ -306,7 +311,7 @@ public void checkSetFactory() {

@Override
public void checkPropertiesAccess() {
if (callFromGremlin()) {
if (callFromGremlin() && !callFromNewSecurityException()) {
throw newSecurityException(
"Not allowed to access system properties via Gremlin");
}
Expand Down Expand Up @@ -441,6 +446,10 @@ private static boolean callFromRaft() {
return callFromWorkerWithClass(RAFT_CLASSES);
}

private static boolean callFromNewSecurityException() {
return callFromMethods(NEW_SECURITY_EXCEPTION);
}

private static boolean callFromWorkerWithClass(Set<String> classes) {
Thread curThread = Thread.currentThread();
if (curThread.getName().startsWith(GREMLIN_SERVER_WORKER) ||
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<compiler.target>1.8</compiler.target>
<slf4j.version>1.7.5</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<log4j2.version>2.12.1</log4j2.version>
<log4j2.version>2.15.0</log4j2.version>
<junit.version>4.12</junit.version>
<tinkerpop.version>3.4.3</tinkerpop.version>
<commons.io.version>2.4</commons.io.version>
Expand Down

0 comments on commit 025e9ba

Please sign in to comment.