Feat/security commands - #196
Open
cxy01313369 wants to merge 2 commits into
Open
Conversation
- 重构security模块,新增parseSecurityBody函数用于解析双层DataV2信封格式 - 支持legacy平面信封和裸数据直接返回,统一错误抛出处理 - securityGet调用parseSecurityBody解析响应体,保证兼容性和错误提示准确 - securityOverview中检测卡片支持REST接口snake_case及console-gateway camelCase字段 - SCAN_CARDS数据结构更新,支持多个字段键以适配不同来源 - SecurityToggle新增count字段,支持展示对应资产数量 - 完善安全响应体测试用例,涵盖多种信封格式及异常场景 - 优化展示安全检测开关状态时,增加对应数量显示信息 - 移除不再需要的SecurityEnvelope接口定义,精简代码逻辑
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two read-only Agent Security Center (AgentStudio) commands:
bl security overview— protection overview (last 24h): capabilities, protection toggles (+ asset counts), detection cards (content safety / file scan / skill scan).bl security alerts— alert list with risk-level / asset-type / status / vendor / pagination / sorting filters.Why
Brings the Agent security posture to the terminal and AI agents, alongside the existing
knowledge/managed-agentAgentStudio command families.How it fits the repo
agentStudioHost, same shape asragEndpoint). Derived from--workspace-id, or overridden when--base-url/auth login --base-urlpoints at a non-DashScope origin — mirrors themanaged-agentlogin flow. Absolute URL + Client Bearer injection, so the model-domainbase_urlnever leaks in.parseSecurityBodytolerates the shapes the backend serves today — bare payload (REST), legacy{success,data}, and the console-gateway ZeldaDataV2double-envelope; detection cards accept snake_case and camelCase.12000092 → AUTH; unrecognized shapes surface a truncated body for diagnosis.auth:"apiKey"; sharedtext/json/--quiet/--dry-runcontract; enum flags viachoices(fast-fail, exit 2, zero requests); reusesresolveWorkspaceId; bilingualen-US/zh-CNhelp; no single-letter identifiers.Files
client/security.ts,client/endpoints.ts,types/security.tscommands/security/{overview,alerts,shared}.ts+ registration (commands/src/index.ts,cli/src/commands.ts)core/tests/security-envelope.test.ts,commands/tests/e2e/security.e2e.test.ts(+topic-routes.ts)bailian-clireference for the newsecuritygroupTesting
pnpm checkclean. Unitsecurity-envelope.test.ts: 7 passed. E2Esecurity.e2e.test.ts: 10 passed / 2 skipped (live-gated).trial.cn-beijing.pre-maas.aliyuncs.com): overview renders banner / toggles (with counts) / detection cards; alerts returns stats + list.