huaweicloud-devkit 1.1.0-next.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -2
- package/README.zh-CN.md +45 -2
- package/package.json +3 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +29 -12
- package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +136 -24
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +15 -14
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +5 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/hc-activity.md +27 -0
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +11 -11
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +6 -5
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +291 -53
- package/plugins/huaweicloud-core/skills/huawei-sandbox/references/nginx-templates.md +4 -0
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +19 -12
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +26 -26
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +12 -6
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +7 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +7 -7
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +14 -0
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +30 -1
- package/plugins/huaweicloud-core/src/auth/service.mjs +33 -0
- package/plugins/huaweicloud-core/src/detect-framework.mjs +25 -3
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +67 -5
- package/plugins/huaweicloud-core/src/mcp-server.mjs +23 -0
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +11 -3
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +365 -11
- package/plugins/huaweicloud-core/src/search-market.mjs +1 -0
- package/plugins/huaweicloud-core/src/setup-cli.mjs +491 -64
- package/plugins/huaweicloud-core/src/tools.mjs +184 -14
package/README.md
CHANGED
|
@@ -3,17 +3,26 @@
|
|
|
3
3
|
[](https://github.com/huaweicloud/huaweicloud-devkit/discussions)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://github.com/huaweicloud/huaweicloud-devkit/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/huaweicloud/huaweicloud-devkit)
|
|
6
7
|
|
|
7
8
|
**[中文](README.zh-CN.md) | English**
|
|
8
9
|
|
|
9
10
|
Help AI coding agents use Huawei Cloud safely and accurately — a single integration that gives agents cloud knowledge, CLI tooling, and safety guardrails.
|
|
10
11
|
|
|
11
|
-
Supports OpenCode, CodeArts Agent, WorkBuddy, DeepSeek Harness (DSH), OfficeAce, Hermes, OpenClaw, and AtomCode.
|
|
12
|
+
Supports OpenCode, Codex, CodeArts Agent, WorkBuddy, DeepSeek Harness (DSH), OfficeAce, Hermes, OpenClaw, and AtomCode.
|
|
12
13
|
|
|
13
14
|
## Prerequisites
|
|
14
15
|
|
|
15
16
|
- Node.js >= 22
|
|
16
17
|
|
|
18
|
+
> **China mainland users**: If you experience slow downloads or connection issues with the default npm registry, configure the Huawei Cloud npm mirror:
|
|
19
|
+
>
|
|
20
|
+
> ```bash
|
|
21
|
+
> npm config set registry https://mirrors.huaweicloud.com/repository/npm/
|
|
22
|
+
> ```
|
|
23
|
+
>
|
|
24
|
+
> Restore the default registry: `npm config delete registry`
|
|
25
|
+
|
|
17
26
|
## Quick Start
|
|
18
27
|
|
|
19
28
|
> If `--target` is omitted, the installer auto-detects agents on your machine. When multiple agents are detected, **all of them** will be installed. Specify `--target` to control which agent receives the install.
|
|
@@ -34,6 +43,23 @@ npx --yes huaweicloud-devkit uninstall --target opencode
|
|
|
34
43
|
rm -rf ~/.npm/_npx/ # Linux/macOS only; Windows path TBD
|
|
35
44
|
```
|
|
36
45
|
|
|
46
|
+
### Codex
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx --yes huaweicloud-devkit install --target codex
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Restart the Codex session** after installation.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx --yes huaweicloud-devkit doctor --target codex
|
|
56
|
+
npx --yes huaweicloud-devkit status --target codex
|
|
57
|
+
npx --yes huaweicloud-devkit update --target codex
|
|
58
|
+
npx --yes huaweicloud-devkit uninstall --target codex
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Requires Codex CLI** — the `codex` command must be in PATH. If Codex is installed via WindowsApps (Microsoft Store), use `--target codex-desktop` instead. Run `codex --version` to verify CLI availability.
|
|
62
|
+
|
|
37
63
|
### CodeArts Agent
|
|
38
64
|
|
|
39
65
|
```bash
|
|
@@ -51,6 +77,23 @@ npx --yes huaweicloud-devkit uninstall --target codearts
|
|
|
51
77
|
|
|
52
78
|
> **Sandbox mode**: CodeArts defaults to sandbox mode which blocks KooCLI. `install-hcloud` detects this and shows how to resolve it — install KooCLI outside the sandbox terminal, or disable sandbox mode in CodeArts settings (Settings → Chats → Agents Terminal Command Running Mode → Auto Running).
|
|
53
79
|
|
|
80
|
+
### CodeArts Work
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npx --yes huaweicloud-devkit install --target codearts-work
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Restart the session** after installation.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx --yes huaweicloud-devkit doctor --target codearts-work
|
|
90
|
+
npx --yes huaweicloud-devkit status --target codearts-work
|
|
91
|
+
npx --yes huaweicloud-devkit update --target codearts-work
|
|
92
|
+
npx --yes huaweicloud-devkit uninstall --target codearts-work
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> **CodeArts Work** (CodeArts Space, appId: `com.codearts.work`) uses user-level config at `%USERPROFILE%\.codeartswork\`. No project-level `.codeartswork` directory is created.
|
|
96
|
+
|
|
54
97
|
### WorkBuddy
|
|
55
98
|
|
|
56
99
|
```bash
|
|
@@ -113,9 +156,10 @@ npx --yes huaweicloud-devkit update --target hermes
|
|
|
113
156
|
npx --yes huaweicloud-devkit uninstall --target hermes
|
|
114
157
|
```
|
|
115
158
|
|
|
159
|
+
> **Uninstall notes**: On Linux, run `rm -rf ~/.npm/_npx/* && npm cache clean --force` after uninstall to ensure a clean slate. On Windows, close all Hermes sessions first to release file locks, then after uninstall check `%LOCALAPPDATA%\hermes\config.yaml` for YAML corruption and manually remove `%LOCALAPPDATA%\hermes\huaweicloud-plugins` if any files remain.
|
|
116
160
|
> **Safety hooks**: The installer configures Hermes shell hooks (`config.yaml` → `hooks.pre_tool_call`) to intercept unsafe terminal commands such as credential file reads, environment variable dumps, and unapproved `hcloud` write operations. Hermes shows a consent prompt the first time; approve it or set `hooks_auto_accept: true` in `config.yaml` to auto-accept.
|
|
117
161
|
> **MCP Python SDK**: The installer automatically installs the `mcp` Python package required by Hermes for MCP tool discovery. If you see `[FAIL] Hermes MCP Python SDK` in `doctor`, run `pip3 install mcp` manually.
|
|
118
|
-
> **Windows**:
|
|
162
|
+
> **Windows**: See [docs/hermes-windows.md](docs/hermes-windows.md) for known issues and workarounds.
|
|
119
163
|
|
|
120
164
|
### OpenClaw
|
|
121
165
|
|
package/README.zh-CN.md
CHANGED
|
@@ -8,12 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
帮助 AI 编码助手安全、准确地使用华为云——一站式集成云知识、CLI 工具和安全护栏。
|
|
10
10
|
|
|
11
|
-
支持 OpenCode、码道(CodeArts Agent)、WorkBuddy、DeepSeek Harness(DSH)、OfficeAce、Hermes、OpenClaw、AtomCode。
|
|
11
|
+
支持 OpenCode、Codex、码道(CodeArts Agent)、WorkBuddy、DeepSeek Harness(DSH)、OfficeAce、Hermes、OpenClaw、AtomCode。
|
|
12
12
|
|
|
13
13
|
## 前置条件
|
|
14
14
|
|
|
15
15
|
- Node.js >= 22
|
|
16
16
|
|
|
17
|
+
> **国内用户**:使用默认 npm 镜像时可能遇到下载缓慢或连接失败的问题,建议配置华为云 npm 镜像:
|
|
18
|
+
>
|
|
19
|
+
> ```bash
|
|
20
|
+
> npm config set registry https://mirrors.huaweicloud.com/repository/npm/
|
|
21
|
+
> ```
|
|
22
|
+
>
|
|
23
|
+
> 恢复默认镜像:`npm config delete registry`
|
|
24
|
+
|
|
17
25
|
## 快速开始
|
|
18
26
|
|
|
19
27
|
> 省略 `--target` 时,安装器会自动检测机器上的 agent,检测到多个时**全部安装**。建议始终指定 `--target` 以明确安装目标。
|
|
@@ -34,6 +42,23 @@ npx --yes huaweicloud-devkit uninstall --target opencode
|
|
|
34
42
|
rm -rf ~/.npm/_npx/ # 仅 Linux/macOS;Windows 路径待确认
|
|
35
43
|
```
|
|
36
44
|
|
|
45
|
+
### Codex
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx --yes huaweicloud-devkit install --target codex
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
安装后**重启 Codex 会话**。
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx --yes huaweicloud-devkit doctor --target codex
|
|
55
|
+
npx --yes huaweicloud-devkit status --target codex
|
|
56
|
+
npx --yes huaweicloud-devkit update --target codex
|
|
57
|
+
npx --yes huaweicloud-devkit uninstall --target codex
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
> **需要 Codex CLI** — `codex` 命令必须在 PATH 中。若 Codex 通过 WindowsApps(Microsoft Store)安装,请使用 `--target codex-desktop` 替代。运行 `codex --version` 验证 CLI 可用性。
|
|
61
|
+
|
|
37
62
|
### CodeArts Agent(码道)
|
|
38
63
|
|
|
39
64
|
```bash
|
|
@@ -51,6 +76,23 @@ npx --yes huaweicloud-devkit uninstall --target codearts
|
|
|
51
76
|
|
|
52
77
|
> **沙箱模式**:码道默认沙箱模式会阻止 KooCLI 运行。`install-hcloud` 自动检测并给出指引——请在码道外终端安装使用 KooCLI,或在码道设置中关闭沙箱模式(设置 → 对话流 → 智能体 终端命令运行模式 → 自动运行)。
|
|
53
78
|
|
|
79
|
+
### CodeArts Work(码道工作空间)
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx --yes huaweicloud-devkit install --target codearts-work
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
安装后**重启会话**。
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx --yes huaweicloud-devkit doctor --target codearts-work
|
|
89
|
+
npx --yes huaweicloud-devkit status --target codearts-work
|
|
90
|
+
npx --yes huaweicloud-devkit update --target codearts-work
|
|
91
|
+
npx --yes huaweicloud-devkit uninstall --target codearts-work
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
> **CodeArts Work**(工作空间,appId: `com.codearts.work`)使用用户级配置 `%USERPROFILE%\.codeartswork\`,不创建项目级目录。
|
|
95
|
+
|
|
54
96
|
### WorkBuddy
|
|
55
97
|
|
|
56
98
|
```bash
|
|
@@ -113,9 +155,10 @@ npx --yes huaweicloud-devkit update --target hermes
|
|
|
113
155
|
npx --yes huaweicloud-devkit uninstall --target hermes
|
|
114
156
|
```
|
|
115
157
|
|
|
158
|
+
> **卸载说明**:Linux 上卸载后执行 `rm -rf ~/.npm/_npx/* && npm cache clean --force` 确保下次全新安装。Windows 上先关闭所有 Hermes 会话(释放文件锁),卸载后检查 `%LOCALAPPDATA%\hermes\config.yaml` 是否有 YAML 损坏,如有残留文件手动删除 `%LOCALAPPDATA%\hermes\huaweicloud-plugins`。
|
|
116
159
|
> **安全钩子(Safety hooks)**:安装器会在 `config.yaml` 中写入 shell hooks 配置(`hooks.pre_tool_call`),拦截不安全的终端命令,如读取凭据文件、导出环境变量、未审批的 `hcloud` 写操作。Hermes 首次使用时会弹出同意提示,可批准或设置 `hooks_auto_accept: true` 自动批准。
|
|
117
160
|
> **MCP Python SDK**:安装器会自动安装 Hermes 所需的 `mcp` Python 包。如果 doctor 显示 `[FAIL] Hermes MCP Python SDK`,手动执行 `pip3 install mcp`。
|
|
118
|
-
> **Windows
|
|
161
|
+
> **Windows**:参见 [docs/hermes-windows.md](docs/hermes-windows.md) 了解已知问题和解决方法。
|
|
119
162
|
|
|
120
163
|
### OpenClaw
|
|
121
164
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"agent",
|
|
50
50
|
"codex",
|
|
51
51
|
"opencode",
|
|
52
|
+
"codearts",
|
|
53
|
+
"codearts-work",
|
|
52
54
|
"officeace",
|
|
53
55
|
"office-claw",
|
|
54
56
|
"workbuddy",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"mcpServers": "./.mcp.json",
|
|
18
18
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
19
19
|
"skills": "./skills/",
|
|
20
|
-
"version": "1.1.0
|
|
20
|
+
"version": "1.1.0",
|
|
21
21
|
"author": {
|
|
22
22
|
"name": "HuaweiCloud Mate",
|
|
23
23
|
"url": "https://github.com/huaweicloud"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "1.1.0
|
|
23
|
+
"version": "1.1.0",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"mcpServers": "./.mcp.json",
|
|
18
18
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
19
19
|
"skills": "./skills/",
|
|
20
|
-
"version": "1.1.0
|
|
20
|
+
"version": "1.1.0",
|
|
21
21
|
"author": {
|
|
22
22
|
"name": "HuaweiCloud Mate",
|
|
23
23
|
"url": "https://github.com/huaweicloud"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -138,6 +138,31 @@ def first_denied_command_rule(text):
|
|
|
138
138
|
return None
|
|
139
139
|
|
|
140
140
|
|
|
141
|
+
def evaluate(tool_name, tool_input):
|
|
142
|
+
"""Run the full safety check and return a raw block reason, or None to allow.
|
|
143
|
+
|
|
144
|
+
Shared by the CLI shell (``main``) and the Hermes Python-plugin hook, which
|
|
145
|
+
reuses this module via ``importlib`` so a single implementation enforces the
|
|
146
|
+
policy everywhere. The returned reason does NOT include ``DENY_PREFIX`` —
|
|
147
|
+
callers decide the exact output shape.
|
|
148
|
+
"""
|
|
149
|
+
text = command_text(tool_input)
|
|
150
|
+
|
|
151
|
+
if CONFIG_FILE_RE and CONFIG_FILE_RE.search(text):
|
|
152
|
+
return "reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools."
|
|
153
|
+
if ENV_DUMP_RE.search(text):
|
|
154
|
+
return "dumping cloud credential environment variables is not allowed."
|
|
155
|
+
if SECRET_READ_RE and SECRET_READ_RE.search(text):
|
|
156
|
+
return "direct secret value retrieval would put plaintext secrets into the agent context."
|
|
157
|
+
denied_rule = first_denied_command_rule(text)
|
|
158
|
+
if denied_rule:
|
|
159
|
+
return f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}"
|
|
160
|
+
if tool_name in ("Bash", "terminal") and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
|
|
161
|
+
return "unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user."
|
|
162
|
+
|
|
163
|
+
return None
|
|
164
|
+
|
|
165
|
+
|
|
141
166
|
def main():
|
|
142
167
|
try:
|
|
143
168
|
data = json.load(sys.stdin)
|
|
@@ -145,20 +170,12 @@ def main():
|
|
|
145
170
|
allow()
|
|
146
171
|
|
|
147
172
|
tool_name = data.get("tool_name", "")
|
|
148
|
-
|
|
173
|
+
tool_input = data.get("tool_input", {})
|
|
149
174
|
hermes = "hook_event_name" in data
|
|
150
175
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
deny("dumping cloud credential environment variables is not allowed.", hermes)
|
|
155
|
-
if SECRET_READ_RE and SECRET_READ_RE.search(text):
|
|
156
|
-
deny("direct secret value retrieval would put plaintext secrets into the agent context.", hermes)
|
|
157
|
-
denied_rule = first_denied_command_rule(text)
|
|
158
|
-
if denied_rule:
|
|
159
|
-
deny(f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}", hermes)
|
|
160
|
-
if tool_name in ("Bash", "terminal") and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
|
|
161
|
-
deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.", hermes)
|
|
176
|
+
reason = evaluate(tool_name, tool_input)
|
|
177
|
+
if reason:
|
|
178
|
+
deny(reason, hermes)
|
|
162
179
|
|
|
163
180
|
allow()
|
|
164
181
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
3
|
"id": "huaweicloud-devkit",
|
|
4
4
|
"displayName": "HuaweiCloud DevKit",
|
|
5
|
-
"version": "1.1.0
|
|
5
|
+
"version": "1.1.0",
|
|
6
6
|
"family": "bundle-plugin",
|
|
7
7
|
"bundleFormat": "codex",
|
|
8
8
|
"description": "Guide coding agents to use Huawei Cloud safely — KooCLI, APIs, SDKs, 28 MCP tools, skills, and safety guardrails.",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"field": "text",
|
|
14
14
|
"regex": "(^|\\s)(cat|type|Get-Content|gc|less|more)\\s+[^\\n]*(\\.hcloud|\\.huaweicloud)"
|
|
15
15
|
},
|
|
16
|
-
{
|
|
16
|
+
{
|
|
17
|
+
"field": "text",
|
|
18
|
+
"regex": "(hcloud|huaweicloud)[/\\\\](config|credentials)"
|
|
19
|
+
}
|
|
17
20
|
]
|
|
18
21
|
},
|
|
19
22
|
"message": "The command may read local Huawei Cloud credential or profile files into the agent context.",
|
|
@@ -27,8 +30,14 @@
|
|
|
27
30
|
"stages": ["command"],
|
|
28
31
|
"match": {
|
|
29
32
|
"all": [
|
|
30
|
-
{
|
|
31
|
-
|
|
33
|
+
{
|
|
34
|
+
"field": "text",
|
|
35
|
+
"regex": "(^|\\s)(env|printenv|Get-ChildItem\\s+Env:|gci\\s+Env:|dir\\s+Env:)"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"field": "text",
|
|
39
|
+
"regex": "(HUAWEICLOUD|HWC_|HCLOUD|OS_)"
|
|
40
|
+
}
|
|
32
41
|
]
|
|
33
42
|
},
|
|
34
43
|
"message": "The command may print cloud credential environment variables.",
|
|
@@ -42,13 +51,36 @@
|
|
|
42
51
|
"stages": ["command"],
|
|
43
52
|
"match": {
|
|
44
53
|
"any": [
|
|
45
|
-
{
|
|
46
|
-
|
|
54
|
+
{
|
|
55
|
+
"field": "text",
|
|
56
|
+
"regex": "(ShowSecretVersion|DownloadSecret|GetSecretValue)"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"field": "text",
|
|
60
|
+
"regex": "(secret_string|secret_binary|secretString|secretBinary)"
|
|
61
|
+
}
|
|
47
62
|
]
|
|
48
63
|
},
|
|
49
64
|
"message": "The command appears to retrieve plaintext secret values.",
|
|
50
65
|
"remediation": "Use runtime secret references, user-side inspection, or redacted metadata checks instead of returning secret values to the agent."
|
|
51
66
|
},
|
|
67
|
+
{
|
|
68
|
+
"id": "hwc-command-sts-credential",
|
|
69
|
+
"title": "Temporary credential exposure",
|
|
70
|
+
"category": "credential",
|
|
71
|
+
"severity": "warn",
|
|
72
|
+
"stages": ["command"],
|
|
73
|
+
"match": {
|
|
74
|
+
"any": [
|
|
75
|
+
{
|
|
76
|
+
"field": "text",
|
|
77
|
+
"regex": "hcloud\\s+STS\\s+(AssumeAgency|GetCallerIdentity|GetTemporaryCredential)\\b"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"message": "此操作将返回临时 AK/SK 和 SecurityToken。注意敏感数据保密,不要将凭证输出到日志或分享给第三方。",
|
|
82
|
+
"remediation": "临时凭证仅用于当前会话,使用完毕后及时销毁,不要持久化存储。"
|
|
83
|
+
},
|
|
52
84
|
{
|
|
53
85
|
"id": "hwc-command-encoded-shell-exec",
|
|
54
86
|
"title": "Encoded payload piped to shell",
|
|
@@ -61,8 +93,14 @@
|
|
|
61
93
|
"field": "text",
|
|
62
94
|
"regex": "(base64\\s+(-d|--decode)|xxd\\s+-r|certutil\\s+-decode|FromBase64String|hex\\s*decode)"
|
|
63
95
|
},
|
|
64
|
-
{
|
|
65
|
-
|
|
96
|
+
{
|
|
97
|
+
"field": "text",
|
|
98
|
+
"regex": "(\\||;|&&)"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"field": "text",
|
|
102
|
+
"regex": "\\b(bash|sh|zsh|powershell|pwsh|cmd|python|node)\\b"
|
|
103
|
+
}
|
|
66
104
|
]
|
|
67
105
|
},
|
|
68
106
|
"message": "The command decodes an encoded payload and pipes it into an interpreter.",
|
|
@@ -96,7 +134,12 @@
|
|
|
96
134
|
"severity": "deny",
|
|
97
135
|
"stages": ["command", "artifact", "deploy_plan"],
|
|
98
136
|
"match": {
|
|
99
|
-
"all": [
|
|
137
|
+
"all": [
|
|
138
|
+
{
|
|
139
|
+
"field": "text",
|
|
140
|
+
"regex": "(OBS|obs://|bucket|object|Statement|Principal)"
|
|
141
|
+
}
|
|
142
|
+
],
|
|
100
143
|
"any": [
|
|
101
144
|
{
|
|
102
145
|
"field": "text",
|
|
@@ -119,7 +162,10 @@
|
|
|
119
162
|
"stages": ["command", "artifact", "deploy_plan"],
|
|
120
163
|
"match": {
|
|
121
164
|
"all": [
|
|
122
|
-
{
|
|
165
|
+
{
|
|
166
|
+
"field": "text",
|
|
167
|
+
"regex": "(FunctionGraph|APIG|CreateTrigger|CreateApi|DEDICATEDGATEWAY|API Gateway)"
|
|
168
|
+
},
|
|
123
169
|
{
|
|
124
170
|
"field": "text",
|
|
125
171
|
"regex": "(public|PUBLIC|0\\.0\\.0\\.0\\s*/\\s*0|auth[\\\"']?\\s*[=:]\\s*[\\\"']?(NONE|none|false)|security_authentication[\\\"']?\\s*[=:]\\s*[\\\"']?(NONE|none))"
|
|
@@ -137,12 +183,18 @@
|
|
|
137
183
|
"stages": ["command", "artifact", "deploy_plan"],
|
|
138
184
|
"match": {
|
|
139
185
|
"all": [
|
|
140
|
-
{
|
|
186
|
+
{
|
|
187
|
+
"field": "text",
|
|
188
|
+
"regex": "(IAM|policy|role|agency|Statement|Action)"
|
|
189
|
+
},
|
|
141
190
|
{
|
|
142
191
|
"field": "text",
|
|
143
192
|
"regex": "(\\\"Action\\\"\\s*:\\s*(\\\"(\\*|\\*:\\*)\\\"|\\[\\s*\\\"(\\*|\\*:\\*)\\\")|Action\\s*[=:]\\s*(\\*|\\*:\\*)|AdministratorAccess|FullAccess)"
|
|
144
193
|
},
|
|
145
|
-
{
|
|
194
|
+
{
|
|
195
|
+
"field": "text",
|
|
196
|
+
"regex": "(\\\"Effect\\\"\\s*:\\s*\\\"Allow\\\"|Effect\\s*[=:]\\s*Allow)"
|
|
197
|
+
}
|
|
146
198
|
]
|
|
147
199
|
},
|
|
148
200
|
"message": "The change appears to grant broad administrator permissions.",
|
|
@@ -156,13 +208,40 @@
|
|
|
156
208
|
"stages": ["command"],
|
|
157
209
|
"match": {
|
|
158
210
|
"all": [
|
|
159
|
-
{
|
|
160
|
-
|
|
211
|
+
{
|
|
212
|
+
"field": "text",
|
|
213
|
+
"regex": "(Delete|BatchDelete|Remove|\\brm\\b|delete)"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"field": "text",
|
|
217
|
+
"regex": "(\\s--force|\\s-f\\s|\\s--recursive|\\s-r\\s|delete_publicip\\s*[=:]\\s*true)"
|
|
218
|
+
}
|
|
161
219
|
]
|
|
162
220
|
},
|
|
163
221
|
"message": "The command combines deletion with force, recursive, or cascading deletion behavior.",
|
|
164
222
|
"remediation": "Show the exact resources to be deleted, confirm backups or recovery path, and require explicit user approval for the exact command."
|
|
165
223
|
},
|
|
224
|
+
{
|
|
225
|
+
"id": "hwc-destructive-delete-operation",
|
|
226
|
+
"title": "Destructive cloud resource operation",
|
|
227
|
+
"category": "destructive",
|
|
228
|
+
"severity": "warn",
|
|
229
|
+
"stages": ["command"],
|
|
230
|
+
"match": {
|
|
231
|
+
"any": [
|
|
232
|
+
{
|
|
233
|
+
"field": "text",
|
|
234
|
+
"regex": "hcloud\\s+\\w+\\s+(Delete\\w*|Detach\\w*|Remove\\w*|Dissociate\\w*|Unassign\\w*|Revoke\\w*)\\b"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"field": "text",
|
|
238
|
+
"regex": "hcloud\\s+\\w+\\s+(BatchDelete\\w*|BatchRemove\\w*)\\b"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
"message": "This hcloud command will delete, detach, or remove cloud resources. The operation may be irreversible.",
|
|
243
|
+
"remediation": "List the resources to be affected first, confirm with the user, and require explicit approval before executing any destructive operation."
|
|
244
|
+
},
|
|
166
245
|
{
|
|
167
246
|
"id": "hwc-sandbox-missing-ttl",
|
|
168
247
|
"title": "Sandbox deployment missing cleanup metadata",
|
|
@@ -175,10 +254,16 @@
|
|
|
175
254
|
"field": "text",
|
|
176
255
|
"regex": "(sandbox|preview|temporary|ephemeral|dev environment|FunctionGraph|ECS|CCE|APIG)"
|
|
177
256
|
},
|
|
178
|
-
{
|
|
257
|
+
{
|
|
258
|
+
"field": "text",
|
|
259
|
+
"regex": "(Create|Deploy|Provision|resource|stack|environment)"
|
|
260
|
+
}
|
|
179
261
|
],
|
|
180
262
|
"none": [
|
|
181
|
-
{
|
|
263
|
+
{
|
|
264
|
+
"field": "text",
|
|
265
|
+
"regex": "(ttl|expires_at|expire_at|cleanup|owner|cost_center|auto_delete|auto-delete)"
|
|
266
|
+
}
|
|
182
267
|
]
|
|
183
268
|
},
|
|
184
269
|
"message": "The preview or sandbox deployment does not show cleanup or ownership metadata.",
|
|
@@ -196,7 +281,10 @@
|
|
|
196
281
|
"field": "text",
|
|
197
282
|
"regex": "(max_instances|max_node_count|max_replica|desired\\s*[=:]\\s*[5-9][0-9]|replicas\\s*[=:]\\s*[5-9][0-9])"
|
|
198
283
|
},
|
|
199
|
-
{
|
|
284
|
+
{
|
|
285
|
+
"field": "text",
|
|
286
|
+
"regex": "(GPU|gpu|large|xlarge|charging_mode\\s*[=:]\\s*prePaid|period_type|period_num)"
|
|
287
|
+
}
|
|
200
288
|
]
|
|
201
289
|
},
|
|
202
290
|
"message": "The generated plan may create high-cost or unbounded capacity.",
|
|
@@ -210,14 +298,38 @@
|
|
|
210
298
|
"stages": ["command"],
|
|
211
299
|
"match": {
|
|
212
300
|
"any": [
|
|
213
|
-
{
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
301
|
+
{
|
|
302
|
+
"field": "text",
|
|
303
|
+
"regex": "rm\\s+-rf\\s+/"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"field": "text",
|
|
307
|
+
"regex": "mkfs"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"field": "text",
|
|
311
|
+
"regex": "dd\\s+if="
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"field": "text",
|
|
315
|
+
"regex": ":\\\\(\\\\)\\\\{[^}]*\\\\|[^}]*&[^}]*\\\\}[^;]*;:"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"field": "text",
|
|
319
|
+
"regex": "\\bshutdown\\b"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"field": "text",
|
|
323
|
+
"regex": "\\breboot\\b"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"field": "text",
|
|
327
|
+
"regex": "\\binit\\s+[06]\\b"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"field": "text",
|
|
331
|
+
"regex": "\\bfdisk\\b"
|
|
332
|
+
}
|
|
221
333
|
]
|
|
222
334
|
},
|
|
223
335
|
"message": "The sandbox terminal command is destructively dangerous and could destroy the workspace.",
|
|
@@ -8,7 +8,7 @@ version: 1
|
|
|
8
8
|
|
|
9
9
|
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
10
|
|
|
11
|
-
Always run `hcloud BSS <Operation> --help` before constructing commands to discover exact parameter names and requirements.
|
|
11
|
+
Always run `hcloud BSS <Operation> --help --cli-region=cn-north-1` before constructing commands to discover exact parameter names and requirements.
|
|
12
12
|
|
|
13
13
|
## Overview
|
|
14
14
|
|
|
@@ -16,22 +16,23 @@ Domain expertise for billing queries (BSS). Covers cost tracking, bill details,
|
|
|
16
16
|
|
|
17
17
|
## Critical Warnings
|
|
18
18
|
|
|
19
|
-
| Trap | Why
|
|
20
|
-
| -------------------------- |
|
|
21
|
-
| Bills delayed ~24h | Yesterday's costs may not appear until the next day
|
|
22
|
-
| BSS Admin role needed | IAM user must have BSS Administrator or Finance role
|
|
23
|
-
| Currency conversion varies | Cross-region costs use daily exchange rates
|
|
19
|
+
| Trap | Why |
|
|
20
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| Bills delayed ~24h | Yesterday's costs may not appear until the next day |
|
|
22
|
+
| BSS Admin role needed | IAM user must have BSS Administrator or Finance role |
|
|
23
|
+
| Currency conversion varies | Cross-region costs use daily exchange rates |
|
|
24
|
+
| Region fixed to cn-north-1 | BSS operations only support `--cli-region=cn-north-1` in KooCLI. This is a KooCLI metadata limitation — the billing data itself covers all regions. |
|
|
24
25
|
|
|
25
26
|
## Common Workflows
|
|
26
27
|
|
|
27
|
-
| Task | Operation
|
|
28
|
-
| -------------------- |
|
|
29
|
-
| List costs | `ListCosts --cli-region
|
|
30
|
-
| List customer bills | `
|
|
31
|
-
| List resource usage | `ListResourceUsage --cli-region
|
|
32
|
-
| List sub-customers | `ListConsumeSubCustomers --cli-region
|
|
33
|
-
| Show account balance | `ShowCustomerAccountBalances --cli-region
|
|
34
|
-
| List conversions | `ListConversions --cli-region
|
|
28
|
+
| Task | Operation |
|
|
29
|
+
| -------------------- | ---------------------------------------------------------------------- |
|
|
30
|
+
| List costs | `ListCosts --cli-region=cn-north-1 --project_id=<p>` |
|
|
31
|
+
| List customer bills | `ListCustomerBillsFeeRecords --cli-region=cn-north-1 --project_id=<p>` |
|
|
32
|
+
| List resource usage | `ListResourceUsage --cli-region=cn-north-1 --project_id=<p>` |
|
|
33
|
+
| List sub-customers | `ListConsumeSubCustomers --cli-region=cn-north-1 --project_id=<p>` |
|
|
34
|
+
| Show account balance | `ShowCustomerAccountBalances --cli-region=cn-north-1 --project_id=<p>` |
|
|
35
|
+
| List conversions | `ListConversions --cli-region=cn-north-1 --project_id=<p>` |
|
|
35
36
|
|
|
36
37
|
Discover exact parameters with `--help` before executing any command. All BSS operations are read-only.
|
|
37
38
|
|
|
@@ -69,7 +69,7 @@ secret_value = client.get_secret(secret_id="my-secret")
|
|
|
69
69
|
|
|
70
70
|
# hcloud (for approved automation only)
|
|
71
71
|
|
|
72
|
-
hcloud CSMS
|
|
72
|
+
hcloud CSMS DownloadSecretBlob --secret_name=<name>
|
|
73
73
|
|
|
74
74
|
# WARNING: Output goes to stdout. Pipe directly, never capture in agent.
|
|
75
75
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: huawei-ecs
|
|
3
|
-
description: 'Use when creating, configuring, managing, or troubleshooting ECS instances on Huawei Cloud. Covers instance creation (hcloud ECS CreateServers), flavor selection, image management, security groups, EIP binding, disk attachment, auto-scaling (AS), and troubleshooting. Triggers on: ECS, instance, flavor, image, security group, EIP, EVS, auto-scaling. NOT for: CCE container workloads (use huawei-cce), BMS bare metal servers.
|
|
3
|
+
description: 'Use when creating, configuring, managing, or troubleshooting ECS instances on Huawei Cloud. Covers instance creation (hcloud ECS CreateServers), flavor selection, image management, security groups, EIP binding, disk attachment, auto-scaling (AS), and troubleshooting. Triggers on: ECS, instance, flavor, image, security group, EIP, EVS, auto-scaling. NOT for: CCE container workloads (use huawei-cce), BMS bare metal servers.
|
|
4
|
+
|
|
5
|
+
HC活动场景(ECS+Nginx部署后端服务)触发词: HC活动, 华为HC, HC大会, 活动部署, HC ECS, 活动流程, 部署后端, Nginx部署, Nodejs部署, 上线后端服务, 部署个人网站, /hc-activity/.'
|
|
4
6
|
version: 1
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -59,6 +61,7 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
|
|
|
59
61
|
| Attach disk | hcloud EVS AttachVolume --volume_id=<id> --server_id=<id> | references/evs.md |
|
|
60
62
|
| Delete instance | hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true | references/create-instance.md |
|
|
61
63
|
| Reboot instance | hcloud ECS BatchRebootServers --reboot.servers.1.id=<id> --reboot.type=SOFT | NOT `RebootServer` — that operation does not exist |
|
|
64
|
+
| HC活动部署 | 按量付费购买ECS+Nginx部署后端服务 | references/hc-activity.md |
|
|
62
65
|
|
|
63
66
|
## How to Search for Instances
|
|
64
67
|
|
|
@@ -186,3 +189,4 @@ For Flexus X, use standard ECS CreateServers flow with `x1.*` flavors. For Flexu
|
|
|
186
189
|
- ECS Docs: https://support.huaweicloud.com/ecs/
|
|
187
190
|
- Flavor specs: references/flavors.md
|
|
188
191
|
- Create instance: references/create-instance.md
|
|
192
|
+
- HC活动 ECS+Nginx部署: references/hc-activity.md
|