Forráskód Böngészése

增加配置查看时oss配置内容隐藏

luoshi 2 éve
szülő
commit
c28b632e7f

+ 8 - 0
src/main/java/com/qmth/ops/api/controller/admin/PropertyController.java

@@ -92,12 +92,20 @@ public class PropertyController {
         //非环境可编辑用户,需要隐藏机密信息
         if (!adminSession.getUser().hasRole(env.getType().getRole())) {
             for (PropertyItem item : list) {
+                //包含密钥/密码类信息
                 if (item.getKey().contains("secret") || item.getKey().contains("password")) {
                     //直接引用其他变量时不隐藏
                     if (!(item.getValue().startsWith("${") && item.getValue().endsWith("}"))) {
                         item.setValue("***");
                     }
                 }
+                //core-fss在oss模式下隐藏AK信息
+                else if (item.getKey().startsWith("com.qmth.fss") && item.getKey().endsWith("config")) {
+                    if (item.getValue().startsWith("oss")) {
+                        String value = item.getValue();
+                        item.setValue("oss://***" + value.substring(value.indexOf("@")));
+                    }
+                }
             }
         }
         return list;