feat: mask digital sync client keys
This commit is contained in:
@@ -95,6 +95,14 @@ function compactSummaryText(value: string, maxLength = 96): string {
|
||||
return text.length > maxLength ? `${text.slice(0, maxLength)}...` : text;
|
||||
}
|
||||
|
||||
function maskClientKey(value?: string): string {
|
||||
const key = value?.trim();
|
||||
if (!key) return '--';
|
||||
if (key.length <= 4) return '****';
|
||||
if (key.length <= 10) return `${key.slice(0, 2)}****${key.slice(-2)}`;
|
||||
return `${key.slice(0, 4)}...${key.slice(-4)}`;
|
||||
}
|
||||
|
||||
function entityLabel(entityType: string): string {
|
||||
return (
|
||||
ENTITY_TYPE_OPTIONS[entityType as keyof typeof ENTITY_TYPE_OPTIONS]?.text ||
|
||||
@@ -251,6 +259,7 @@ const DigitalEmployeeSync: React.FC = () => {
|
||||
dataIndex: 'client_key',
|
||||
width: 190,
|
||||
ellipsis: true,
|
||||
renderText: (value) => maskClientKey(value),
|
||||
fieldProps: {
|
||||
placeholder: '输入客户端 Key',
|
||||
allowClear: true,
|
||||
@@ -418,6 +427,10 @@ const DigitalEmployeeSync: React.FC = () => {
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
{renderBusinessSummary(payloadRecord)}
|
||||
</div>
|
||||
<Typography.Paragraph>
|
||||
<Typography.Text strong>客户端 Key:</Typography.Text>
|
||||
{maskClientKey(payloadRecord.client_key)}
|
||||
</Typography.Paragraph>
|
||||
<Typography.Paragraph>
|
||||
<Typography.Text strong>实体:</Typography.Text>
|
||||
{payloadRecord.entity_type} / {payloadRecord.entity_id}
|
||||
|
||||
@@ -487,6 +487,7 @@ GET /api/digital-employee/sync/records
|
||||
- 当前返回通用同步记录和原始 payload,用于管理端页面或联调工具先查看同步结果;后续再拆分为更丰富的 Plan / Task / Run / Event 查询模型。
|
||||
- 管理端已增加“数字员工同步记录”菜单、权限资源和列表页,可按客户端 Key、实体类型、实体 ID、Outbox ID 查询并查看 payload;URL 查询参数会预填筛选条件,并在命中 Outbox ID 时自动打开 payload 抽屉。
|
||||
- 管理端同步记录页会从通用 payload 中提炼标题、状态、Plan/Task/Run 关联、发生时间等业务摘要,列表和详情抽屉不再只能依赖原始 JSON 排障。
|
||||
- 管理端列表和抽屉内的客户端 Key 仅脱敏展示,筛选框仍支持输入完整客户端 Key 精准查询。
|
||||
|
||||
下一步:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user