Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

replace the secret field from obfuscated to full-masked value (#24800)

Charles Liuf7ac1192ae16
diff --git a/api/core/helper/encrypter.py b/api/core/helper/encrypter.py
index 383a2dd57e1..fc54a17f504 100644
--- a/api/core/helper/encrypter.py
+++ b/api/core/helper/encrypter.py
@@ -11,6 +11,10 @@ def obfuscated_token(token: str) -> str:
return token[:6] + "*" * 12 + token[-2:]
+def full_mask_token(token_length=20):
+ return "*" * token_length
+
+
def encrypt_token(tenant_id: str, token: str):
from models.account import Tenant
from models.engine import db
diff --git a/api/fields/workflow_fields.py b/api/fields/workflow_fields.py
index f048d0f3b69..53cb9de3eed 100644
--- a/api/fields/workflow_fields.py
+++ b/api/fields/workflow_fields.py
@@ -17,7 +17,7 @@ class EnvironmentVariableField(fields.Raw):
return {
"id": value.id,
"name": value.name,
- "value": encrypter.obfuscated_token(value.value),
+ "value": encrypter.full_mask_token(),
"value_type": value.value_type.value,
"description": value.description,
}