diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java index d06ebceb18..d439c96efc 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/auth/HugeGraphAuthProxy.java @@ -679,14 +679,14 @@ public void clearBackend() { @Override public void truncateBackend() { verifyAdminPermission(); - HugeUser admin = this.hugegraph.userManager() - .findUser(HugeAuthenticator.USER_ADMIN); + UserManager userManager = this.hugegraph.userManager(); + HugeUser admin = userManager.findUser(HugeAuthenticator.USER_ADMIN); try { this.hugegraph.truncateBackend(); } finally { - if (admin != null) { + if (admin != null && userManager instanceof StandardUserManager) { // Restore admin user to continue to do any operation - this.hugegraph.userManager().createUser(admin); + userManager.createUser(admin); } } } diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java index 4ccf9e9eb4..38b62455ac 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/security/HugeSecurityManager.java @@ -66,6 +66,7 @@ public class HugeSecurityManager extends SecurityManager { private static final Set WHITE_SYSTEM_PROPERTYS = ImmutableSet.of( "line.separator", "file.separator", + "java.specification.version", // Sofa "socksProxyHost", // MySQL "file.encoding" // PostgreSQL ); @@ -306,6 +307,7 @@ public void checkSetFactory() { @Override public void checkPropertiesAccess() { + System.getProperties(); if (callFromGremlin()) { throw newSecurityException( "Not allowed to access system properties via Gremlin");