huaweicloud-devkit 0.1.24 → 0.1.26-dev.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 +5 -2
- package/integrations/opencode/opencode.json +1 -1
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +2 -0
- package/package.json +1 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +42 -42
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.mcp.json +1 -1
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +48 -0
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +178 -0
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +4 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +21 -6
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -1
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +0 -1
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +2 -11
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +4 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +5 -5
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +14 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +39 -14
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -0
- package/plugins/huaweicloud-core/src/safety-policy.mjs +26 -13
- package/plugins/huaweicloud-core/src/setup-cli.mjs +126 -65
- package/plugins/huaweicloud-core/src/tools.mjs +156 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ npx --yes huaweicloud-devkit uninstall --target codearts # 卸载
|
|
|
76
76
|
```json
|
|
77
77
|
{
|
|
78
78
|
"mcp": {
|
|
79
|
-
"huaweicloud": {
|
|
79
|
+
"huaweicloud-devkit": {
|
|
80
80
|
"type": "local",
|
|
81
81
|
"command": ["node", "<路径>/plugins/huaweicloud-core/src/mcp-server.mjs"],
|
|
82
82
|
"enabled": true
|
|
@@ -123,7 +123,7 @@ Agent 技能是经过整理的指令和参考材料包,帮助 Agent 完成特
|
|
|
123
123
|
|
|
124
124
|
- **安全优先执行** — 所有 `hcloud` 命令执行前自动分类(读/写/密钥),写操作需用户明确批准。
|
|
125
125
|
- **输出脱敏** — 凭证形态的值(AK/SK、Token、密码)自动替换为 `***REDACTED***`。
|
|
126
|
-
- **
|
|
126
|
+
- **16 个结构化工具** — 技能搜索、CLI 检查、只读命令、区域发现、错误解释、Hook 风险检查等。
|
|
127
127
|
- **零运行时依赖** — 纯 Node.js(>= 20),无需 npm install。
|
|
128
128
|
|
|
129
129
|
详见 [MCP 工具表](#mcp-工具)。
|
|
@@ -154,6 +154,9 @@ Agent 技能是经过整理的指令和参考材料包,帮助 Agent 完成特
|
|
|
154
154
|
| CLI | `huaweicloud_run_readonly_command` | 执行只读命令并脱敏输出 |
|
|
155
155
|
| CLI | `huaweicloud_run_approved_command` | 经用户明确批准后执行写命令 |
|
|
156
156
|
| 安全 | `huaweicloud_show_profile_redacted` | 安全查看 KooCLI 配置(凭证脱敏) |
|
|
157
|
+
| 安全 | `huaweicloud_hook_check_command` | 执行前检查 Shell/KooCLI 命令风险 |
|
|
158
|
+
| 安全 | `huaweicloud_hook_check_artifacts` | 检查生成的代码、IaC、IAM/OBS 策略和配置文件风险 |
|
|
159
|
+
| 安全 | `huaweicloud_hook_check_deploy_plan` | 检查沙箱、预览环境和云资源部署计划风险 |
|
|
157
160
|
| 路由 | `huaweicloud_service_catalog` | 返回推荐的能力来源排序 |
|
|
158
161
|
| 排错 | `huaweicloud_explain_error` | 解释错误码并建议诊断步骤 |
|
|
159
162
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://opencode.ai/config.json",
|
|
3
3
|
"_note": "Merge this into ~/.config/opencode/opencode.jsonc. Replace the path with the absolute path to your mcp-server.mjs installation.",
|
|
4
4
|
"mcp": {
|
|
5
|
-
"huaweicloud": {
|
|
5
|
+
"huaweicloud-devkit": {
|
|
6
6
|
"type": "local",
|
|
7
7
|
"command": [
|
|
8
8
|
"node",
|
|
@@ -20,6 +20,8 @@ Use this skill as the OpenCode entry point. Prefer the full skill set under `plu
|
|
|
20
20
|
|
|
21
21
|
Never ask the user to paste credentials. Never read `.hcloud` or `.huaweicloud` files into context. Plan writes first, ask for explicit approval, then verify with read-only checks.
|
|
22
22
|
|
|
23
|
+
For commands that assemble Huawei Cloud parameters through variables, string concatenation, subshells, encoded payloads, or generated scripts, inspect the final expanded command text before execution. If OpenCode cannot determine the final values, ask for explicit review or run the planning/check tool on the expanded command.
|
|
24
|
+
|
|
23
25
|
## KooCLI Basics
|
|
24
26
|
|
|
25
27
|
- Install guide: `https://support.huaweicloud.com/qs-hcli/hcli_02_003.html`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26-dev.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": [
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
2
|
+
"interface": {
|
|
3
|
+
"displayName": "HuaweiCloud Devkit",
|
|
4
|
+
"shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
|
|
5
|
+
"longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
6
|
+
"developerName": "HuaweiCloud Mate",
|
|
7
|
+
"category": "Cloud",
|
|
8
|
+
"capabilities": [
|
|
9
|
+
"Read",
|
|
10
|
+
"Interactive"
|
|
11
|
+
],
|
|
12
|
+
"websiteURL": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
13
|
+
"brandColor": "#C7000B",
|
|
14
|
+
"defaultPrompt": [
|
|
15
|
+
"Help me choose the right Huawei Cloud capability.",
|
|
16
|
+
"Check my Huawei Cloud CLI setup safely.",
|
|
17
|
+
"Plan this Huawei Cloud API or SDK task."
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"mcpServers": "./.mcp.json",
|
|
21
|
+
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
|
+
"skills": "./skills/",
|
|
23
|
+
"version": "0.1.23",
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "HuaweiCloud Mate",
|
|
26
|
+
"url": "https://github.com/huaweicloud-mate"
|
|
27
|
+
},
|
|
28
|
+
"hooks": "./hooks/",
|
|
29
|
+
"name": "huaweicloud-core",
|
|
30
|
+
"homepage": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
31
|
+
"repository": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"huaweicloud",
|
|
35
|
+
"huawei-cloud",
|
|
36
|
+
"koocli",
|
|
37
|
+
"hcloud",
|
|
38
|
+
"agent",
|
|
39
|
+
"mcp",
|
|
40
|
+
"api",
|
|
41
|
+
"sdk",
|
|
42
|
+
"skills"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
2
|
+
"name": "huaweicloud-core",
|
|
3
|
+
"version": "0.1.23",
|
|
4
|
+
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "HuaweiCloud Mate",
|
|
7
|
+
"url": "https://github.com/huaweicloud-mate"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
10
|
+
"repository": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"huaweicloud",
|
|
14
|
+
"huawei-cloud",
|
|
15
|
+
"koocli",
|
|
16
|
+
"hcloud",
|
|
17
|
+
"agent",
|
|
18
|
+
"mcp",
|
|
19
|
+
"api",
|
|
20
|
+
"sdk",
|
|
21
|
+
"skills"
|
|
22
|
+
],
|
|
23
|
+
"skills": "./skills/",
|
|
24
|
+
"mcpServers": "./.mcp.json",
|
|
25
|
+
"interface": {
|
|
26
|
+
"displayName": "HuaweiCloud Devkit",
|
|
27
|
+
"shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
|
|
28
|
+
"longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
29
|
+
"developerName": "HuaweiCloud Mate",
|
|
30
|
+
"category": "Cloud",
|
|
31
|
+
"capabilities": [
|
|
32
|
+
"Read",
|
|
33
|
+
"Interactive"
|
|
34
|
+
],
|
|
35
|
+
"websiteURL": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
36
|
+
"brandColor": "#C7000B",
|
|
37
|
+
"defaultPrompt": [
|
|
38
|
+
"Help me choose the right Huawei Cloud capability.",
|
|
39
|
+
"Check my Huawei Cloud CLI setup safely.",
|
|
40
|
+
"Plan this Huawei Cloud API or SDK task."
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
2
|
+
"interface": {
|
|
3
|
+
"displayName": "HuaweiCloud Devkit",
|
|
4
|
+
"shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
|
|
5
|
+
"longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
6
|
+
"developerName": "HuaweiCloud Mate",
|
|
7
|
+
"category": "Cloud",
|
|
8
|
+
"capabilities": [
|
|
9
|
+
"Read",
|
|
10
|
+
"Interactive"
|
|
11
|
+
],
|
|
12
|
+
"websiteURL": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
13
|
+
"brandColor": "#C7000B",
|
|
14
|
+
"defaultPrompt": [
|
|
15
|
+
"Help me choose the right Huawei Cloud capability.",
|
|
16
|
+
"Check my Huawei Cloud CLI setup safely.",
|
|
17
|
+
"Plan this Huawei Cloud API or SDK task."
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"mcpServers": "./.mcp.json",
|
|
21
|
+
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
|
+
"skills": "./skills/",
|
|
23
|
+
"version": "0.1.23",
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "HuaweiCloud Mate",
|
|
26
|
+
"url": "https://github.com/huaweicloud-mate"
|
|
27
|
+
},
|
|
28
|
+
"hooks": "./hooks/",
|
|
29
|
+
"name": "huaweicloud-core",
|
|
30
|
+
"homepage": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
31
|
+
"repository": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"huaweicloud",
|
|
35
|
+
"huawei-cloud",
|
|
36
|
+
"koocli",
|
|
37
|
+
"hcloud",
|
|
38
|
+
"agent",
|
|
39
|
+
"mcp",
|
|
40
|
+
"api",
|
|
41
|
+
"sdk",
|
|
42
|
+
"skills"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -14,8 +14,10 @@ plugin hooks.
|
|
|
14
14
|
import json
|
|
15
15
|
import re
|
|
16
16
|
import sys
|
|
17
|
+
from pathlib import Path
|
|
17
18
|
|
|
18
19
|
DENY_PREFIX = "Huawei Cloud safety hook blocked this action: "
|
|
20
|
+
RULES_PATH = Path(__file__).resolve().parents[1] / "safety" / "rules" / "cloud-risk-rules.json"
|
|
19
21
|
|
|
20
22
|
CONFIG_FILE_RE = re.compile(r"(\.hcloud|\.huaweicloud|hcloud[/\\](config|credentials)|huaweicloud[/\\](config|credentials))", re.I)
|
|
21
23
|
ENV_DUMP_RE = re.compile(r"(env|printenv|Get-ChildItem\s+Env:|gci\s+Env:|dir\s+Env:).*(HUAWEICLOUD|HWC_|HCLOUD|OS_)", re.I)
|
|
@@ -63,6 +65,49 @@ def command_text(tool_input):
|
|
|
63
65
|
return json.dumps(tool_input)
|
|
64
66
|
|
|
65
67
|
|
|
68
|
+
def load_cloud_risk_rules():
|
|
69
|
+
try:
|
|
70
|
+
with RULES_PATH.open("r", encoding="utf-8") as file_obj:
|
|
71
|
+
catalog = json.load(file_obj)
|
|
72
|
+
return catalog.get("rules", [])
|
|
73
|
+
except Exception:
|
|
74
|
+
return []
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def condition_matches(condition, text):
|
|
78
|
+
return re.search(condition.get("regex", r"a^"), text, re.I | re.M | re.S) is not None
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def rule_matches(rule, text):
|
|
82
|
+
match = rule.get("match") or {}
|
|
83
|
+
all_conditions = match.get("all")
|
|
84
|
+
any_conditions = match.get("any")
|
|
85
|
+
none_conditions = match.get("none")
|
|
86
|
+
|
|
87
|
+
if isinstance(all_conditions, list):
|
|
88
|
+
for condition in all_conditions:
|
|
89
|
+
if not condition_matches(condition, text):
|
|
90
|
+
return False
|
|
91
|
+
if isinstance(any_conditions, list):
|
|
92
|
+
if not any(condition_matches(condition, text) for condition in any_conditions):
|
|
93
|
+
return False
|
|
94
|
+
if isinstance(none_conditions, list):
|
|
95
|
+
if any(condition_matches(condition, text) for condition in none_conditions):
|
|
96
|
+
return False
|
|
97
|
+
return isinstance(all_conditions, list) or isinstance(any_conditions, list)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def first_denied_command_rule(text):
|
|
101
|
+
for rule in load_cloud_risk_rules():
|
|
102
|
+
if "command" not in rule.get("stages", []):
|
|
103
|
+
continue
|
|
104
|
+
if rule.get("severity") != "deny":
|
|
105
|
+
continue
|
|
106
|
+
if rule_matches(rule, text):
|
|
107
|
+
return rule
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
|
|
66
111
|
def main():
|
|
67
112
|
try:
|
|
68
113
|
data = json.load(sys.stdin)
|
|
@@ -78,6 +123,9 @@ def main():
|
|
|
78
123
|
deny("dumping cloud credential environment variables is not allowed.")
|
|
79
124
|
if SECRET_READ_RE.search(text):
|
|
80
125
|
deny("direct secret value retrieval would put plaintext secrets into the agent context.")
|
|
126
|
+
denied_rule = first_denied_command_rule(text)
|
|
127
|
+
if denied_rule:
|
|
128
|
+
deny(f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}")
|
|
81
129
|
if tool_name == "Bash" and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
|
|
82
130
|
deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.")
|
|
83
131
|
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.0",
|
|
3
|
+
"rules": [
|
|
4
|
+
{
|
|
5
|
+
"id": "hwc-command-credential-file",
|
|
6
|
+
"title": "Credential file read",
|
|
7
|
+
"category": "credential",
|
|
8
|
+
"severity": "deny",
|
|
9
|
+
"stages": ["command"],
|
|
10
|
+
"match": {
|
|
11
|
+
"any": [
|
|
12
|
+
{ "field": "text", "regex": "(^|\\s)(cat|type|Get-Content|gc|less|more)\\s+[^\\n]*(\\.hcloud|\\.huaweicloud)" },
|
|
13
|
+
{ "field": "text", "regex": "(hcloud|huaweicloud)[/\\\\](config|credentials)" }
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"message": "The command may read local Huawei Cloud credential or profile files into the agent context.",
|
|
17
|
+
"remediation": "Use huaweicloud_show_profile_redacted or user-side credential configuration instead of reading credential files."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "hwc-command-env-dump",
|
|
21
|
+
"title": "Cloud credential environment dump",
|
|
22
|
+
"category": "credential",
|
|
23
|
+
"severity": "deny",
|
|
24
|
+
"stages": ["command"],
|
|
25
|
+
"match": {
|
|
26
|
+
"all": [
|
|
27
|
+
{ "field": "text", "regex": "(^|\\s)(env|printenv|Get-ChildItem\\s+Env:|gci\\s+Env:|dir\\s+Env:)" },
|
|
28
|
+
{ "field": "text", "regex": "(HUAWEICLOUD|HWC_|HCLOUD|OS_)" }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
"message": "The command may print cloud credential environment variables.",
|
|
32
|
+
"remediation": "Inspect only required non-secret settings and redact secret-like values before returning output."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"id": "hwc-command-secret-value-read",
|
|
36
|
+
"title": "Plaintext secret read",
|
|
37
|
+
"category": "secret",
|
|
38
|
+
"severity": "deny",
|
|
39
|
+
"stages": ["command"],
|
|
40
|
+
"match": {
|
|
41
|
+
"any": [
|
|
42
|
+
{ "field": "text", "regex": "(ShowSecretVersion|DownloadSecret|GetSecretValue)" },
|
|
43
|
+
{ "field": "text", "regex": "(secret_string|secret_binary|secretString|secretBinary)" }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"message": "The command appears to retrieve plaintext secret values.",
|
|
47
|
+
"remediation": "Use runtime secret references, user-side inspection, or redacted metadata checks instead of returning secret values to the agent."
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"id": "hwc-command-encoded-shell-exec",
|
|
51
|
+
"title": "Encoded payload piped to shell",
|
|
52
|
+
"category": "execution",
|
|
53
|
+
"severity": "deny",
|
|
54
|
+
"stages": ["command"],
|
|
55
|
+
"match": {
|
|
56
|
+
"all": [
|
|
57
|
+
{ "field": "text", "regex": "(base64\\s+(-d|--decode)|xxd\\s+-r|certutil\\s+-decode|FromBase64String|hex\\s*decode)" },
|
|
58
|
+
{ "field": "text", "regex": "(\\||;|&&)" },
|
|
59
|
+
{ "field": "text", "regex": "\\b(bash|sh|zsh|powershell|pwsh|cmd|python|node)\\b" }
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"message": "The command decodes an encoded payload and pipes it into an interpreter.",
|
|
63
|
+
"remediation": "Decode payloads into a reviewable file first, inspect the content, then execute only explicit reviewed commands."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "hwc-network-public-admin-port",
|
|
67
|
+
"title": "Public admin port exposure",
|
|
68
|
+
"category": "public_exposure",
|
|
69
|
+
"severity": "deny",
|
|
70
|
+
"stages": ["command", "artifact", "deploy_plan"],
|
|
71
|
+
"match": {
|
|
72
|
+
"all": [
|
|
73
|
+
{ "field": "text", "regex": "(0\\.0\\.0\\.0\\s*/\\s*0|::\\s*/\\s*0|remote_ip_prefix\\s*[=:]\\s*0\\.0\\.0\\.0\\s*/\\s*0|cidr\\s*[=:]\\s*0\\.0\\.0\\.0\\s*/\\s*0)" },
|
|
74
|
+
{ "field": "text", "regex": "(port_range_min|port_range_max|from_port|to_port|port|\\b22\\b|\\b3389\\b|\\b3306\\b|\\b5432\\b|\\b6379\\b|\\b9200\\b)" }
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"message": "The change appears to expose an administrative or database port to the public internet.",
|
|
78
|
+
"remediation": "Restrict the source CIDR to a trusted range, use a bastion or VPN, and keep public preview endpoints behind authenticated HTTP services."
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "hwc-obs-anonymous-write",
|
|
82
|
+
"title": "OBS anonymous write",
|
|
83
|
+
"category": "public_exposure",
|
|
84
|
+
"severity": "deny",
|
|
85
|
+
"stages": ["command", "artifact", "deploy_plan"],
|
|
86
|
+
"match": {
|
|
87
|
+
"all": [
|
|
88
|
+
{ "field": "text", "regex": "(OBS|obs://|bucket|object|Statement|Principal)" }
|
|
89
|
+
],
|
|
90
|
+
"any": [
|
|
91
|
+
{ "field": "text", "regex": "((Anonymous|Everyone|\\\"Principal\\\"\\s*:\\s*\\\"\\*\\\"|AllUsers).*(PutObject|DeleteObject|PutBucketPolicy|FULL_CONTROL|WRITE|obs:object:PutObject|obs:bucket:PutBucketPolicy)|(PutObject|DeleteObject|PutBucketPolicy|FULL_CONTROL|WRITE|obs:object:PutObject|obs:bucket:PutBucketPolicy).*(Anonymous|Everyone|\\\"Principal\\\"\\s*:\\s*\\\"\\*\\\"|AllUsers))" },
|
|
92
|
+
{ "field": "text", "regex": "(-acl\\s*=?\\s*public-read-write|acl\\s*[=:]\\s*[\\\"']?public-read-write|public-write)" }
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"message": "The change may grant anonymous write or full-control access to OBS data.",
|
|
96
|
+
"remediation": "Use private buckets by default. Grant object read only when required, and avoid anonymous write permissions."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "hwc-functiongraph-public-no-auth",
|
|
100
|
+
"title": "Public FunctionGraph trigger without auth",
|
|
101
|
+
"category": "public_exposure",
|
|
102
|
+
"severity": "warn",
|
|
103
|
+
"stages": ["command", "artifact", "deploy_plan"],
|
|
104
|
+
"match": {
|
|
105
|
+
"all": [
|
|
106
|
+
{ "field": "text", "regex": "(FunctionGraph|APIG|CreateTrigger|CreateApi|DEDICATEDGATEWAY|API Gateway)" },
|
|
107
|
+
{ "field": "text", "regex": "(public|PUBLIC|0\\.0\\.0\\.0\\s*/\\s*0|auth[\\\"']?\\s*[=:]\\s*[\\\"']?(NONE|none|false)|security_authentication[\\\"']?\\s*[=:]\\s*[\\\"']?(NONE|none))" }
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"message": "The generated FunctionGraph or API Gateway path may be publicly reachable without authentication.",
|
|
111
|
+
"remediation": "Require IAM, app authentication, JWT, or another explicit auth layer before exposing generated application endpoints."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"id": "hwc-iam-admin-policy",
|
|
115
|
+
"title": "Broad IAM administrator grant",
|
|
116
|
+
"category": "iam",
|
|
117
|
+
"severity": "deny",
|
|
118
|
+
"stages": ["command", "artifact", "deploy_plan"],
|
|
119
|
+
"match": {
|
|
120
|
+
"all": [
|
|
121
|
+
{ "field": "text", "regex": "(IAM|policy|role|agency|Statement|Action)" },
|
|
122
|
+
{ "field": "text", "regex": "(\\\"Action\\\"\\s*:\\s*(\\\"(\\*|\\*:\\*)\\\"|\\[\\s*\\\"(\\*|\\*:\\*)\\\")|Action\\s*[=:]\\s*(\\*|\\*:\\*)|AdministratorAccess|FullAccess)" },
|
|
123
|
+
{ "field": "text", "regex": "(\\\"Effect\\\"\\s*:\\s*\\\"Allow\\\"|Effect\\s*[=:]\\s*Allow)" }
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
"message": "The change appears to grant broad administrator permissions.",
|
|
127
|
+
"remediation": "Use least-privilege service actions, resource constraints, and short-lived credentials for generated application workflows."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"id": "hwc-destructive-delete-force",
|
|
131
|
+
"title": "Forced destructive operation",
|
|
132
|
+
"category": "destructive",
|
|
133
|
+
"severity": "deny",
|
|
134
|
+
"stages": ["command"],
|
|
135
|
+
"match": {
|
|
136
|
+
"all": [
|
|
137
|
+
{ "field": "text", "regex": "(Delete|BatchDelete|Remove|\\brm\\b|delete)" },
|
|
138
|
+
{ "field": "text", "regex": "(--force|-f|--recursive|-r|delete_publicip\\s*[=:]\\s*true)" }
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"message": "The command combines deletion with force, recursive, or cascading deletion behavior.",
|
|
142
|
+
"remediation": "Show the exact resources to be deleted, confirm backups or recovery path, and require explicit user approval for the exact command."
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "hwc-sandbox-missing-ttl",
|
|
146
|
+
"title": "Sandbox deployment missing cleanup metadata",
|
|
147
|
+
"category": "sandbox",
|
|
148
|
+
"severity": "warn",
|
|
149
|
+
"stages": ["artifact", "deploy_plan"],
|
|
150
|
+
"match": {
|
|
151
|
+
"all": [
|
|
152
|
+
{ "field": "text", "regex": "(sandbox|preview|temporary|ephemeral|dev environment|FunctionGraph|ECS|CCE|APIG)" },
|
|
153
|
+
{ "field": "text", "regex": "(Create|Deploy|Provision|resource|stack|environment)" }
|
|
154
|
+
],
|
|
155
|
+
"none": [
|
|
156
|
+
{ "field": "text", "regex": "(ttl|expires_at|expire_at|cleanup|owner|cost_center|auto_delete|auto-delete)" }
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"message": "The preview or sandbox deployment does not show cleanup or ownership metadata.",
|
|
160
|
+
"remediation": "Add owner, purpose, expiration time, and cleanup command before creating preview cloud resources."
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "hwc-cost-unbounded-scale",
|
|
164
|
+
"title": "Unbounded scale or high-cost resource",
|
|
165
|
+
"category": "cost",
|
|
166
|
+
"severity": "warn",
|
|
167
|
+
"stages": ["command", "artifact", "deploy_plan"],
|
|
168
|
+
"match": {
|
|
169
|
+
"any": [
|
|
170
|
+
{ "field": "text", "regex": "(max_instances|max_node_count|max_replica|desired\\s*[=:]\\s*[5-9][0-9]|replicas\\s*[=:]\\s*[5-9][0-9])" },
|
|
171
|
+
{ "field": "text", "regex": "(GPU|gpu|large|xlarge|charging_mode\\s*[=:]\\s*prePaid|period_type|period_num)" }
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
"message": "The generated plan may create high-cost or unbounded capacity.",
|
|
175
|
+
"remediation": "Use small preview defaults, explicit quotas, budget labels, and user approval before creating high-cost resources."
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
@@ -12,7 +12,7 @@ description: |
|
|
|
12
12
|
|
|
13
13
|
# Huawei Cloud Agent Skills Search and Discovery
|
|
14
14
|
|
|
15
|
-
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
15
|
+
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
16
16
|
|
|
17
17
|
## Scenario Description
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ Always run `hcloud DDS <Operation> --help` or `hcloud DCS <Operation> --help` be
|
|
|
12
12
|
|
|
13
13
|
## DDS (Document Database Service — MongoDB Compatible)
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Critical Warnings
|
|
16
16
|
|
|
17
17
|
| Trap | Why |
|
|
18
18
|
|------|-----|
|
|
@@ -35,7 +35,7 @@ Discover exact parameters with `--help` before executing any command.
|
|
|
35
35
|
|
|
36
36
|
## DCS (Distributed Cache Service — Redis/Memcached)
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Critical Warnings
|
|
39
39
|
|
|
40
40
|
| Trap | Why |
|
|
41
41
|
|------|-----|
|
|
@@ -84,6 +84,7 @@ Abort if the result set is larger than `--limit` and ask the user to narrow the
|
|
|
84
84
|
| Insufficient resources | Stock depleted -> Change flavor or AZ |
|
|
85
85
|
| AuthFailure | Expired AK/SK -> hcloud configure init |
|
|
86
86
|
| APIGW.0802 / region permission | IAM user has no access to this region -> IAM console → User → Permissions → add region, or switch to another region |
|
|
87
|
+
| Cannot SSH (port 22 open) | SCP policy may be blocking SSH. Check `SYS.0403` errors in command output -> Use cloud-init/user_data for initial setup instead. See `references/create-instance.md` §Bootstrap |
|
|
87
88
|
|
|
88
89
|
## Security Considerations
|
|
89
90
|
|
|
@@ -98,9 +99,12 @@ Prefer these tools over raw hcloud CLI — they enforce safety policies:
|
|
|
98
99
|
|
|
99
100
|
- huaweicloud_list_operations service=ECS
|
|
100
101
|
- huaweicloud_run_readonly_command for discovery (auto-redacts output)
|
|
102
|
+
- huaweicloud_plan_cli_command for command planning (returns command text + safety classification)
|
|
101
103
|
- huaweicloud_run_approved_command for writes (requires exact command approval)
|
|
102
104
|
- huaweicloud_check_cli to verify hcloud is available
|
|
103
105
|
|
|
106
|
+
> **approvedCommand trap**: `huaweicloud_run_approved_command` validates that `approvedCommand` matches the planned command EXACTLY (including `<redacted>` placeholders). Always use the `command` field value returned by `huaweicloud_plan_cli_command` verbatim — never reconstruct or retype it. Mismatches cause rejection with "approvedCommand must exactly match the planned hcloud command."
|
|
107
|
+
|
|
104
108
|
## Without MCP (Fallback)
|
|
105
109
|
|
|
106
110
|
If MCP tools are NOT available (new install, session not restarted):
|