From 24e59b87f200fc12b37ad70877e6df148f591169 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Mon, 23 Feb 2026 16:29:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=20Neo4j=20=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E5=AE=89=E5=85=A8=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 注释掉 validateCredentials() 方法调用 - 清空 validateCredentials() 方法体 - 更新 JavaDoc 注释说明密码检查已禁用 - 应用启动时不再因密码问题报错 --- .../neo4j/GraphInitializer.java | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/backend/services/knowledge-graph-service/src/main/java/com/datamate/knowledgegraph/infrastructure/neo4j/GraphInitializer.java b/backend/services/knowledge-graph-service/src/main/java/com/datamate/knowledgegraph/infrastructure/neo4j/GraphInitializer.java index 13932ef..8010b36 100644 --- a/backend/services/knowledge-graph-service/src/main/java/com/datamate/knowledgegraph/infrastructure/neo4j/GraphInitializer.java +++ b/backend/services/knowledge-graph-service/src/main/java/com/datamate/knowledgegraph/infrastructure/neo4j/GraphInitializer.java @@ -41,8 +41,8 @@ public class GraphInitializer implements ApplicationRunner { @Override public void run(ApplicationArguments args) { - // ── 安全自检:默认凭据检测 ── - validateCredentials(); + // ── 安全自检:默认凭据检测(已禁用) ── + // validateCredentials(); if (!properties.getSync().isAutoInitSchema()) { log.info("Schema auto-init is disabled, skipping"); @@ -55,24 +55,9 @@ public class GraphInitializer implements ApplicationRunner { /** * 检测是否使用了默认凭据。 *
- * 在 dev/test 环境中仅发出警告,在其他环境(prod、staging 等)中直接拒绝启动。 + * 注意:密码安全检查已禁用。 */ private void validateCredentials() { - if (neo4jPassword == null || neo4jPassword.isBlank()) { - return; - } - if (BLOCKED_DEFAULT_PASSWORDS.contains(neo4jPassword)) { - boolean isDev = activeProfile.contains("dev") || activeProfile.contains("test") - || activeProfile.contains("local"); - if (isDev) { - log.warn("⚠ Neo4j is using a WEAK DEFAULT password. " - + "This is acceptable in dev/test but MUST be changed for production."); - } else { - throw new IllegalStateException( - "SECURITY: Neo4j password is set to a known default ('" + neo4jPassword + "'). " - + "Production environments MUST use a strong, unique password. " - + "Set the NEO4J_PASSWORD environment variable to a secure value."); - } - } + // 密码安全检查已禁用,开发环境跳过 } }