Skip to content

feat(dashboard): mask peer address and account in bridge connection cards - #2168

Merged
jubaoliang merged 2 commits into
TencentCloud:developfrom
ideshun:feat/bridge-peer-info-mask
Oct 23, 2026
Merged

jubaoliang merged 2 commits into
TencentCloud:developfrom
ideshun:feat/bridge-peer-info-mask

Conversation

@ideshun

@ideshun ideshun commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

云端协同的连接卡片和表格会直接显示对端地址与对端账号。开会截图、共享屏幕或投屏时,这两项会连带暴露内网拓扑(host/IP)和账号名。

这个 PR 把两者在展示层打码,并且只改展示层:

  • 对端地址:保留 scheme 和端口,host 保留前二后二;IPv4 打码中间两段,保留首尾段
  • 对端账号:保留前二后二;不足六位的账号只保留第一位(保留前二后二会暴露过半字符)
  • 填充符定长,不通过长度泄露原始值长度

交互上分两级:

  • 主开关「隐藏对端信息」放在面板工具栏,默认开启,状态存 localStorage(octop:bridge:hide-peer-info),跨会话保持;关闭后整页明文,单条揭示按钮自动隐藏
  • 单条临时揭示:每张卡片 / 表格每一行一个眼睛按钮,只影响该条;纯内存状态,刷新或拨动主开关即恢复打码

编辑抽屉保持明文 —— 那里是真正要改地址账号的地方。tooltip(title)和接口返回都没有改动。

Target branch

  • Base is develop (feature / fix — default)
  • Base is main (release/* or hotfix/* only)

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Refactor / chore
  • Release / hotfix

Changes

File Change
dashboard/src/pages/Settings/AdvancedSettings/bridgePeerLabel.ts 新增 maskPeerAddress / maskPeerAccount,与已有 peerHostLabel 放在同一模块
dashboard/src/pages/Settings/AdvancedSettings/bridgePeerLabel.test.ts 打码规则单测(域名、带端口、IPv4、短值、CJK 字符、空值)
dashboard/src/pages/Settings/AdvancedSettings/BridgeSettings.tsx 主开关 + 单条揭示 + 卡片 / 表格 / 被动接入连接的接入;InboundPeerFacts 增加 privacy 参数,编辑抽屉传明文
dashboard/src/pages/Settings/AdvancedSettings/BridgeSettings.module.less 开关的 toolbar 样式
dashboard/src/pages/Settings/AdvancedSettings/BridgeSettings.test.tsx 新增组件测试:默认打码、单条揭示不影响其他条、主开关整体切换、偏好持久化
dashboard/src/locales/{zh,en}.json 4 条文案
CHANGELOG.md [Unreleased] → 变更

被动接入(对端主动拨入)的连接原本就展示观测到的 IP,属于同一类泄露,因此并入同一套开关。

Test plan

在 dashboard/ 下执行:

  • npx tsc --noEmit -p tsconfig.app.json → 通过

  • npx eslint src/pages/Settings/AdvancedSettings/ → 通过

  • npx prettier --check → 通过

  • npx vitest run src/pages/Settings/AdvancedSettings/ → 12 个打码单测 + 4 个组件测试全部通过

  • npm run build → 通过(产物写入 src/octop/dashboard/,已 gitignore)

  • make all passes locally(前端部分已按上面的命令跑过;make all 全量未在容器内跑,见下)

  • Added/updated tests

npm test 全量结果:266 个文件、1398 个用例,7 个文件失败(knowledgeBases / publishedExperts / AuthGuard / DocumentPreviewCore.docxSanitize / SkillDrawer / skillMarkdown / ChatInput.prefill)。这 7 个在干净的 develop 上以同样方式失败,与本次改动无关(本地 stash 后复现确认)。

Checklist

  • Updated CHANGELOG.md (if user-facing)
  • README / docs updated (if needed) — 不需要

说明

image

打码输出与开关行为由上面的单测和组件测试覆盖,实际渲染字符串例如:

原始值 打码后
https://cloud.corp.example.com https://cl••••••om
http://sandbox-a156c721:8088 http://sa••••••21:8088
203.0.113.8 203.•••.•••.8
administrator ad••••••or
alice(5 位) a••

Cloud bridge connection cards are the usual screen-share surface, so the
peer address and account now render masked by default:

- address: keep the scheme/port plus the first and last two characters of
  the host; IPv4 keeps the first and last octet (middle two masked)
- account: keep the first and last two characters; accounts shorter than
  six characters keep only the first character
- fixed-width dots, so the masked length does not leak the real length

A master switch in the panel toolbar (on by default, persisted in
localStorage) controls the whole page, and each card/table row can be
revealed temporarily. Reveals are session-only and reset on reload or
when the master switch flips. The edit drawer keeps plaintext values,
since that is where connection data is edited.

Display only: no API, storage or tooltip changes.
@jubaoliang
jubaoliang merged commit 086d687 into TencentCloud:develop Oct 23, 2026
3 checks passed
@ideshun
ideshun deleted the feat/bridge-peer-info-mask branch October 23, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants