Skip to content

feat(configure): mask secretId/secretKey in list and get output#123

Open
Mxiansen wants to merge 1 commit into
TencentCloud:masterfrom
Mxiansen:feat/configure-mask-secret
Open

feat(configure): mask secretId/secretKey in list and get output#123
Mxiansen wants to merge 1 commit into
TencentCloud:masterfrom
Mxiansen:feat/configure-mask-secret

Conversation

@Mxiansen

@Mxiansen Mxiansen commented Jul 1, 2026

Copy link
Copy Markdown

Related TAPD: https://tapd.woa.com/tapd_fe/10161711/story/detail/1010161711135046182

优化内容

  • 在 BasicConfigure 中新增 sensitive_keys 集合与 _mask_value 静态方法,沿用项目已有 '*' + value[-4:] 的脱敏样式。
  • 优化 ConfigureListCommand._run_main,输出敏感字段前套用 _mask_value;token / role-arn 等非密钥字段保持明文。
  • 优化 ConfigureGetCommand._run_main,增加 from_cred 标志,仅当命中 credential 文件且字段属于 sensitive_keys 时脱敏,conf 分支与 kv 解析分支行为不变。
  • 同步更新 ConfigureListCommand.EXAMPLES 与 ConfigureGetCommand.EXAMPLES,演示脱敏后的输出形态。
  • 保持磁盘上的 credential 文件内容原样,不影响后续鉴权调用。

在 tccli configure list 与 tccli configure get 命令输出中对 secretId 和
secretKey 做脱敏,避免在 AI Agent 等场景直接打印凭证原文导致泄漏。

- 在 BasicConfigure 中新增 sensitive_keys 集合与 _mask_value 静态方法,
  沿用项目已有 '*' + value[-4:] 的脱敏样式。
- ConfigureListCommand._run_main 输出敏感字段前套用 _mask_value,
  token / role-arn 等非密钥字段保持明文。
- ConfigureGetCommand._run_main 增加 from_cred 标志,仅当命中
  credential 文件且字段属于 sensitive_keys 时脱敏,
  conf 分支与 kv 解析分支行为不变。
- 同步更新 ConfigureListCommand.EXAMPLES 与 ConfigureGetCommand.EXAMPLES,
  演示脱敏后的输出形态。
- 磁盘上的 credential 文件内容保持原样,不影响后续鉴权调用。

Related TAPD: https://tapd.woa.com/tapd_fe/10161711/story/detail/1010161711135046182
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.

1 participant