huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.10
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/.agents/plugins/marketplace.json +20 -20
- package/LICENSE +201 -201
- package/README.md +178 -138
- package/README.zh-CN.md +176 -138
- package/bin/setup.cjs +10 -8
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
- package/integrations/opencode/opencode.json +11 -14
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
- package/package.json +60 -44
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +30 -43
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/.mcp.json +13 -15
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +31 -44
- package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
- package/plugins/huaweicloud-core/safety/policy.json +76 -100
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +227 -199
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +103 -101
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +191 -190
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +171 -124
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
- package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +57 -56
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +106 -97
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +36 -29
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +29 -23
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +188 -185
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +144 -133
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +57 -55
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -131
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +60 -58
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +72 -71
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +69 -65
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +148 -122
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +134 -127
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +31 -26
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +101 -100
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
- package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +229 -224
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +173 -134
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +77 -76
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +60 -59
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +56 -47
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +138 -128
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +111 -96
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -20
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +30 -28
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +59 -60
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +54 -1
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +103 -95
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
- package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +283 -265
- package/plugins/huaweicloud-core/src/icon-library.mjs +171 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +130 -129
- package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +68 -0
- package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +94 -0
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +140 -137
- package/plugins/huaweicloud-core/src/safety-policy.mjs +356 -302
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +86 -87
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +150 -153
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +196 -105
- package/plugins/huaweicloud-core/src/search-market.mjs +208 -169
- package/plugins/huaweicloud-core/src/setup-cli.mjs +2622 -1594
- package/plugins/huaweicloud-core/src/tools.mjs +463 -111
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +447 -427
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +128 -132
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +215 -227
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +189 -202
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +164 -158
- package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""PreToolUse hook for Huawei Cloud agent safety.
|
|
3
|
-
|
|
4
|
-
Blocks the highest-risk leakage paths before an agent tool runs:
|
|
5
|
-
- reading local Huawei Cloud credential files
|
|
6
|
-
- dumping cloud credential environment variables
|
|
7
|
-
- directly retrieving cloud secret values
|
|
8
|
-
- running unapproved write operations through hcloud
|
|
9
|
-
|
|
10
|
-
The MCP server carries the same policy in Node for platforms that do not support
|
|
11
|
-
plugin hooks.
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
import json
|
|
15
|
-
import re
|
|
16
|
-
import sys
|
|
17
|
-
from pathlib import Path
|
|
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"
|
|
21
|
-
|
|
22
|
-
CONFIG_FILE_RE = re.compile(r"(\.hcloud|\.huaweicloud|hcloud[/\\](config|credentials)|huaweicloud[/\\](config|credentials))", re.I)
|
|
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)
|
|
24
|
-
SECRET_READ_RE = re.compile(r"(ShowSecretVersion|GetSecretValue|secret_string|secret_binary)", re.I)
|
|
25
|
-
HCLOUD_RE = re.compile(r"(^|\s)hcloud(\.exe)?\s+", re.I)
|
|
26
|
-
WRITE_OPERATION_RE = re.compile(
|
|
27
|
-
r"\b(BatchCreate|BatchDelete|Create|Delete|Update|Modify|Resize|Reboot|Stop|Start|Restart|Authorize|Revoke|Add|Remove|Associate|Disassociate|Attach|Detach|Enable|Disable)\w*",
|
|
28
|
-
re.I,
|
|
29
|
-
)
|
|
30
|
-
READ_OPERATION_RE = re.compile(r"\b(List|Show|Get|Describe|NovaList|NovaShow)\w*", re.I)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def deny(reason):
|
|
34
|
-
json.dump(
|
|
35
|
-
{
|
|
36
|
-
"hookSpecificOutput": {
|
|
37
|
-
"hookEventName": "PreToolUse",
|
|
38
|
-
"permissionDecision": "deny",
|
|
39
|
-
"permissionDecisionReason": DENY_PREFIX + reason,
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
sys.stdout,
|
|
43
|
-
)
|
|
44
|
-
sys.exit(0)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def allow():
|
|
48
|
-
sys.exit(0)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def command_text(tool_input):
|
|
52
|
-
if isinstance(tool_input, str):
|
|
53
|
-
return tool_input
|
|
54
|
-
if isinstance(tool_input, dict):
|
|
55
|
-
values = []
|
|
56
|
-
for key in ("command", "cmd", "script", "args", "arguments"):
|
|
57
|
-
value = tool_input.get(key)
|
|
58
|
-
if isinstance(value, list):
|
|
59
|
-
values.append(" ".join(str(item) for item in value))
|
|
60
|
-
elif value is not None:
|
|
61
|
-
values.append(str(value))
|
|
62
|
-
if values:
|
|
63
|
-
return "\n".join(values)
|
|
64
|
-
return json.dumps(tool_input)
|
|
65
|
-
return json.dumps(tool_input)
|
|
66
|
-
|
|
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
|
-
|
|
111
|
-
def main():
|
|
112
|
-
try:
|
|
113
|
-
data = json.load(sys.stdin)
|
|
114
|
-
except Exception:
|
|
115
|
-
allow()
|
|
116
|
-
|
|
117
|
-
tool_name = data.get("tool_name", "")
|
|
118
|
-
text = command_text(data.get("tool_input", {}))
|
|
119
|
-
|
|
120
|
-
if CONFIG_FILE_RE.search(text):
|
|
121
|
-
deny("reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools.")
|
|
122
|
-
if ENV_DUMP_RE.search(text):
|
|
123
|
-
deny("dumping cloud credential environment variables is not allowed.")
|
|
124
|
-
if SECRET_READ_RE.search(text):
|
|
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')}")
|
|
129
|
-
if tool_name == "Bash" and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
|
|
130
|
-
deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.")
|
|
131
|
-
|
|
132
|
-
allow()
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if __name__ == "__main__":
|
|
136
|
-
main()
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""PreToolUse hook for Huawei Cloud agent safety.
|
|
3
|
+
|
|
4
|
+
Blocks the highest-risk leakage paths before an agent tool runs:
|
|
5
|
+
- reading local Huawei Cloud credential files
|
|
6
|
+
- dumping cloud credential environment variables
|
|
7
|
+
- directly retrieving cloud secret values
|
|
8
|
+
- running unapproved write operations through hcloud
|
|
9
|
+
|
|
10
|
+
The MCP server carries the same policy in Node for platforms that do not support
|
|
11
|
+
plugin hooks.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import re
|
|
16
|
+
import sys
|
|
17
|
+
from pathlib import Path
|
|
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"
|
|
21
|
+
|
|
22
|
+
CONFIG_FILE_RE = re.compile(r"(\.hcloud|\.huaweicloud|hcloud[/\\](config|credentials)|huaweicloud[/\\](config|credentials))", re.I)
|
|
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)
|
|
24
|
+
SECRET_READ_RE = re.compile(r"(ShowSecretVersion|GetSecretValue|secret_string|secret_binary)", re.I)
|
|
25
|
+
HCLOUD_RE = re.compile(r"(^|\s)hcloud(\.exe)?\s+", re.I)
|
|
26
|
+
WRITE_OPERATION_RE = re.compile(
|
|
27
|
+
r"\b(BatchCreate|BatchDelete|Create|Delete|Update|Modify|Resize|Reboot|Stop|Start|Restart|Authorize|Revoke|Add|Remove|Associate|Disassociate|Attach|Detach|Enable|Disable)\w*",
|
|
28
|
+
re.I,
|
|
29
|
+
)
|
|
30
|
+
READ_OPERATION_RE = re.compile(r"\b(List|Show|Get|Describe|NovaList|NovaShow)\w*", re.I)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def deny(reason):
|
|
34
|
+
json.dump(
|
|
35
|
+
{
|
|
36
|
+
"hookSpecificOutput": {
|
|
37
|
+
"hookEventName": "PreToolUse",
|
|
38
|
+
"permissionDecision": "deny",
|
|
39
|
+
"permissionDecisionReason": DENY_PREFIX + reason,
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
sys.stdout,
|
|
43
|
+
)
|
|
44
|
+
sys.exit(0)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def allow():
|
|
48
|
+
sys.exit(0)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def command_text(tool_input):
|
|
52
|
+
if isinstance(tool_input, str):
|
|
53
|
+
return tool_input
|
|
54
|
+
if isinstance(tool_input, dict):
|
|
55
|
+
values = []
|
|
56
|
+
for key in ("command", "cmd", "script", "args", "arguments"):
|
|
57
|
+
value = tool_input.get(key)
|
|
58
|
+
if isinstance(value, list):
|
|
59
|
+
values.append(" ".join(str(item) for item in value))
|
|
60
|
+
elif value is not None:
|
|
61
|
+
values.append(str(value))
|
|
62
|
+
if values:
|
|
63
|
+
return "\n".join(values)
|
|
64
|
+
return json.dumps(tool_input)
|
|
65
|
+
return json.dumps(tool_input)
|
|
66
|
+
|
|
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
|
+
|
|
111
|
+
def main():
|
|
112
|
+
try:
|
|
113
|
+
data = json.load(sys.stdin)
|
|
114
|
+
except Exception:
|
|
115
|
+
allow()
|
|
116
|
+
|
|
117
|
+
tool_name = data.get("tool_name", "")
|
|
118
|
+
text = command_text(data.get("tool_input", {}))
|
|
119
|
+
|
|
120
|
+
if CONFIG_FILE_RE.search(text):
|
|
121
|
+
deny("reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools.")
|
|
122
|
+
if ENV_DUMP_RE.search(text):
|
|
123
|
+
deny("dumping cloud credential environment variables is not allowed.")
|
|
124
|
+
if SECRET_READ_RE.search(text):
|
|
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')}")
|
|
129
|
+
if tool_name == "Bash" and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
|
|
130
|
+
deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.")
|
|
131
|
+
|
|
132
|
+
allow()
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
if __name__ == "__main__":
|
|
136
|
+
main()
|
|
@@ -1,100 +1,76 @@
|
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"safeTextReadCommands": [
|
|
78
|
-
"rg",
|
|
79
|
-
"grep",
|
|
80
|
-
"findstr",
|
|
81
|
-
"git",
|
|
82
|
-
"ls",
|
|
83
|
-
"dir",
|
|
84
|
-
"Get-ChildItem"
|
|
85
|
-
],
|
|
86
|
-
"blockedSandboxCommands": [
|
|
87
|
-
"rm\\s+-rf\\s+/",
|
|
88
|
-
"mkfs",
|
|
89
|
-
"dd\\s+if=",
|
|
90
|
-
":\\(\\)\\{:\\|:&\\};:",
|
|
91
|
-
"shutdown",
|
|
92
|
-
"reboot",
|
|
93
|
-
"init\\s+[06]",
|
|
94
|
-
"fdisk"
|
|
95
|
-
],
|
|
96
|
-
"sandboxWriteTools": [
|
|
97
|
-
"huaweicloud_sandbox_connect",
|
|
98
|
-
"huaweicloud_sandbox_credentials"
|
|
99
|
-
]
|
|
100
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.0",
|
|
3
|
+
"secretKeyNamePatterns": [
|
|
4
|
+
"access[_-]?key",
|
|
5
|
+
"secret[_-]?key",
|
|
6
|
+
"security[_-]?token",
|
|
7
|
+
"x[_-]?auth[_-]?token",
|
|
8
|
+
"authorization",
|
|
9
|
+
"password",
|
|
10
|
+
"passwd",
|
|
11
|
+
"token",
|
|
12
|
+
"credential",
|
|
13
|
+
"private[_-]?key",
|
|
14
|
+
"ak",
|
|
15
|
+
"sk"
|
|
16
|
+
],
|
|
17
|
+
"credentialFilePatterns": [
|
|
18
|
+
"\\.hcloud",
|
|
19
|
+
"\\.huaweicloud",
|
|
20
|
+
"hcloud[/\\\\](config|credentials)",
|
|
21
|
+
"huaweicloud[/\\\\](config|credentials)"
|
|
22
|
+
],
|
|
23
|
+
"blockedConfigureSubcommands": ["show", "get", "list", "export", "init"],
|
|
24
|
+
"blockedSecretOperations": ["ShowSecretVersion", "DownloadSecret", "GetSecretValue"],
|
|
25
|
+
"writeOperationPrefixes": [
|
|
26
|
+
"Create",
|
|
27
|
+
"BatchCreate",
|
|
28
|
+
"Delete",
|
|
29
|
+
"BatchDelete",
|
|
30
|
+
"Update",
|
|
31
|
+
"Modify",
|
|
32
|
+
"Resize",
|
|
33
|
+
"Reboot",
|
|
34
|
+
"Stop",
|
|
35
|
+
"Start",
|
|
36
|
+
"Restart",
|
|
37
|
+
"Authorize",
|
|
38
|
+
"Revoke",
|
|
39
|
+
"Add",
|
|
40
|
+
"Remove",
|
|
41
|
+
"Associate",
|
|
42
|
+
"Disassociate",
|
|
43
|
+
"Attach",
|
|
44
|
+
"Detach",
|
|
45
|
+
"Enable",
|
|
46
|
+
"Disable",
|
|
47
|
+
"Set",
|
|
48
|
+
"Put",
|
|
49
|
+
"Upload",
|
|
50
|
+
"Install",
|
|
51
|
+
"Publish",
|
|
52
|
+
"Bind",
|
|
53
|
+
"Unbind",
|
|
54
|
+
"Invoke",
|
|
55
|
+
"Execute",
|
|
56
|
+
"Trigger",
|
|
57
|
+
"Deploy"
|
|
58
|
+
],
|
|
59
|
+
"readOperationPrefixes": ["List", "Show", "Get", "Describe", "NovaList", "NovaShow"],
|
|
60
|
+
"safeTextReadCommands": ["rg", "grep", "findstr", "git", "ls", "dir", "Get-ChildItem"],
|
|
61
|
+
"blockedSandboxCommands": [
|
|
62
|
+
"rm\\s+-rf\\s+/",
|
|
63
|
+
"mkfs",
|
|
64
|
+
"dd\\s+if=",
|
|
65
|
+
":\\(\\)\\{:\\|:&\\};:",
|
|
66
|
+
"shutdown",
|
|
67
|
+
"reboot",
|
|
68
|
+
"init\\s+[06]",
|
|
69
|
+
"fdisk"
|
|
70
|
+
],
|
|
71
|
+
"sandboxWriteTools": [
|
|
72
|
+
"huaweicloud_sandbox_connect",
|
|
73
|
+
"huaweicloud_sandbox_credentials",
|
|
74
|
+
"huaweicloud_sandbox_upload_file"
|
|
75
|
+
]
|
|
76
|
+
}
|