huaweicloud-devkit 2.0.1-next.0 → 2.0.1-next.2
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/package.json +1 -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/dist/hcloud-plan.js +5 -0
- package/plugins/huaweicloud-core/dist/hcloud-run-once.js +5 -1
- package/plugins/huaweicloud-core/dist/mcp-server.js +20 -1
- package/plugins/huaweicloud-core/dist/mcp-server.js.map +2 -2
- package/plugins/huaweicloud-core/dist/safety/classify-hcloud.js +55 -0
- package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +2 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +3 -0
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +4 -0
- package/plugins/huaweicloud-core/src/hcloud-plan.ts +6 -0
- package/plugins/huaweicloud-core/src/hcloud-run-once.ts +5 -1
- package/plugins/huaweicloud-core/src/safety/classify-hcloud.ts +64 -0
|
@@ -7,6 +7,17 @@ import { findHcloudCommandSegments } from "./segments.js";
|
|
|
7
7
|
import { OBSUTIL_WRITES } from "./tokens.js";
|
|
8
8
|
import { stripExecutable } from "./unwrap.js";
|
|
9
9
|
import { SECRET_ARGS_RE } from "./vocabulary.js";
|
|
10
|
+
// The dry-run preflight vocabulary (see the carve-out comment in
|
|
11
|
+
// classifyHcloudArgs). The global `--dryrun` flag is KooCLI's own
|
|
12
|
+
// "print the request, do not execute" (hcloud --help, service-agnostic);
|
|
13
|
+
// the body param `--dry_run=true` is the service-side preflight, pinned to
|
|
14
|
+
// the `${service} ${operation}` pairs (lowercased) whose operation-level
|
|
15
|
+
// --help documents it. Verified against `hcloud <op> --help` on
|
|
16
|
+
// 2026-11-27 for both entries; a future operation joins the set only with
|
|
17
|
+
// the same --help evidence.
|
|
18
|
+
const DRYRUN_GLOBAL_TOKEN = '--dryrun';
|
|
19
|
+
const DRY_RUN_PREFLIGHT_OPERATIONS = new Set(['ecs createservers', 'ecs createpostpaidservers']);
|
|
20
|
+
const DRY_RUN_EXACT_TOKEN = '--dry_run=true';
|
|
10
21
|
export function classifyHcloudArgs(args, options = {}) {
|
|
11
22
|
const policy = options.policy || DEFAULT_POLICY;
|
|
12
23
|
const unwrappedTokens = stripExecutable(Array.isArray(args) ? args.map((arg) => String(arg)) : []);
|
|
@@ -96,6 +107,50 @@ export function classifyHcloudArgs(args, options = {}) {
|
|
|
96
107
|
reason: 'The command appears to retrieve a secret value. Use a runtime secret reference pattern instead.',
|
|
97
108
|
};
|
|
98
109
|
}
|
|
110
|
+
// The dry-run preflight carve-out (the argv tool faces only — never the
|
|
111
|
+
// text/hook faces, see the rawCommand guard): a command whose child
|
|
112
|
+
// provably creates nothing is not a write, so plans/runs need no
|
|
113
|
+
// confirmation. Two documented zero-side-effect channels:
|
|
114
|
+
// (a) the KooCLI GLOBAL flag `--dryrun` — "Print the request message
|
|
115
|
+
// after verification, without execution" (hcloud --help): no
|
|
116
|
+
// request ever leaves the CLI, for ANY service/operation.
|
|
117
|
+
// (b) the ECS body param `--dry_run=true` — the service-side preflight
|
|
118
|
+
// ("true: indicates that only the request is sent, but the ECS
|
|
119
|
+
// will not be created. Check items include mandatory parameters
|
|
120
|
+
// and request format", per `hcloud ECS CreateServers --help`),
|
|
121
|
+
// allowlisted to the operations whose --help documents it
|
|
122
|
+
// (ECS CreateServers / CreatePostPaidServers, verified 2026-11-27).
|
|
123
|
+
// Fences keep the carve-out narrower than the facts it rests on:
|
|
124
|
+
// - EXACT TOKENS — only `--dryrun` and `--dry_run=true`. Case
|
|
125
|
+
// variants, `=True`, `=1`, `--dry-run`, or a bare `--dry_run` keep
|
|
126
|
+
// the write verdict, so a misspelled preflight still asks the user
|
|
127
|
+
// (fail-closed).
|
|
128
|
+
// - The body-param arm refuses `--cli-jsonInput`: a JSON body could
|
|
129
|
+
// carry a conflicting dry_run value under a precedence the CLI owns
|
|
130
|
+
// and the classifier cannot see.
|
|
131
|
+
// - The rawCommand === undefined guard is the face boundary: every
|
|
132
|
+
// hook entry point (the .mjs PreToolUse twin, the opencode
|
|
133
|
+
// in-process gate, and every nested walk inside classifyTextCommand)
|
|
134
|
+
// classifies TEXT with rawCommand set, so raw Bash keeps its deny
|
|
135
|
+
// and the py twin's verdicts stay parity-true. The argv faces —
|
|
136
|
+
// plan/run tool calls — carry no rawCommand and take the carve-out.
|
|
137
|
+
// A compound argv (a value containing `;`/`&&`/…) fragments in the
|
|
138
|
+
// segment pass and lands here WITHOUT its preflight token in the
|
|
139
|
+
// fragment, so the severity merge denies fail-closed.
|
|
140
|
+
if (options.rawCommand === undefined &&
|
|
141
|
+
(normalizedArgs.includes(DRYRUN_GLOBAL_TOKEN) ||
|
|
142
|
+
(DRY_RUN_PREFLIGHT_OPERATIONS.has(`${service.toLowerCase()} ${operation.toLowerCase()}`) &&
|
|
143
|
+
normalizedArgs.includes(DRY_RUN_EXACT_TOKEN) &&
|
|
144
|
+
!normalizedArgs.some((arg) => arg.startsWith('--cli-jsonInput'))))) {
|
|
145
|
+
return applyCommandRiskRules({
|
|
146
|
+
decision: 'allow',
|
|
147
|
+
risk: 'preflight',
|
|
148
|
+
reason: 'Documented dry-run preflight: the CLI prints the request without executing, or the service validates it and creates nothing, so no confirmation is required.',
|
|
149
|
+
service,
|
|
150
|
+
operation,
|
|
151
|
+
args: normalizedArgs,
|
|
152
|
+
}, normalizedArgs, options);
|
|
153
|
+
}
|
|
99
154
|
const readOnly = hasReadPrefix(operation, policy);
|
|
100
155
|
const executionOps = /(^|\.)(Invoke|SyncInvoke|AsyncInvoke|Send|Trigger|Execute|Start|Reboot|Restart|Stop|Publish|Deploy)/i;
|
|
101
156
|
const isExecution = executionOps.test(operation) && !readOnly;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
3
|
"id": "huaweicloud-devkit",
|
|
4
4
|
"displayName": "HuaweiCloud DevKit",
|
|
5
|
-
"version": "2.0.1-next.
|
|
5
|
+
"version": "2.0.1-next.2",
|
|
6
6
|
"family": "bundle-plugin",
|
|
7
7
|
"bundleFormat": "codex",
|
|
8
8
|
"description": "Guide coding agents to use Huawei Cloud safely �?KooCLI, APIs, SDKs, 40 MCP tools, skills, and safety guardrails.",
|
|
@@ -159,6 +159,8 @@ hcloud ECS CreateServers --cli-region=<region> --cli-jsonInput=./<file>.json --d
|
|
|
159
159
|
|
|
160
160
|
`--cli-jsonInput` / `--skeleton` / `--dryrun` are **global flags — they are NOT listed in operation-level `--help` output** (only in `hcloud --help`), so agents routinely miss them.
|
|
161
161
|
|
|
162
|
+
**Through the MCP tools, pre-flight is confirmation-free**: plan with `--dryrun` appended (or `--dry_run=true` — the service-side check, documented on both create operations) and the plan returns `classification.risk: "preflight"` with `userConfirmation.needed: false`; run it with `huaweicloud_run_readonly_command` and fix parameter errors without any user confirmation round-trip. Iterate freely, then plan the real create WITHOUT the dry-run flag and follow the plan → confirm → run contract. Note: a `--cli-jsonInput` body keeps the confirmation requirement even with `--dry_run=true` — for the JSON-file path, prepend `--dryrun` instead.
|
|
163
|
+
|
|
162
164
|
> **Anti-pattern (observed in the wild, #964)**: when the base64 blob exceeded the tool parameter limit, the agent dropped the MCP tools entirely and ran `hcloud` directly in a shell — which also silently bypassed the plan → approve → run approval layer. The JSON-file path above keeps oversized parameters on the approved channel. Never abandon the MCP wrapper just because one parameter is too long.
|
|
163
165
|
>
|
|
164
166
|
> **Skeleton side effect**: `--skeleton` writes its JSON file to the current working directory and prints the path to stdout (the skeleton content itself goes to the file). Clean it up or keep it as the record of what was created.
|
|
@@ -24,6 +24,7 @@ Use this skill before any Huawei Cloud action that may expose secrets, change re
|
|
|
24
24
|
- cost/payment
|
|
25
25
|
- public exposure
|
|
26
26
|
5. For any non-read-only operation, follow the plan, confirm, run contract: plan with `huaweicloud_plan_cli_command`, show the user the command, then run with `huaweicloud_run_approved_command`. The confirm step follows the plan's `userConfirmation`: by default (`userConfirmation.mode` is `ask`) call the run tool and let the SERVER ask the user — a capable client raises a form during the call, and any other client answers with `ASK_CONFIRMATION_REQUIRED` so you can show the command in chat and retry with `approvedByUser: true`; in token mode (opt-in, `DEVKIT_APPROVAL_MODE=token`) show the terminal confirmation line and wait for the user to run it in their own terminal. See `references/approvals.md`. The same gate covers the registered non-CLI mutators (`huaweicloud_obs_set_website_config`, `huaweicloud_obs_set_cors`, `huaweicloud_upgrade`, `huaweicloud_secret_delete`, `huaweicloud_packs_configure`): call the tool and let the gate confirm — obs `action=get` runs unconfirmed as a signed read; the shell CLI twins (`update`/`upgrade`, `secret rm`, `packs enable/disable`) are hook-denied on the Bash face.
|
|
27
|
+
Preflight exception: a plan whose `classification.risk` is `preflight` (the KooCLI global `--dryrun` flag, or `--dry_run=true` on the ECS create operations that document it) validates without creating anything, so `userConfirmation.needed` is false — run it directly with `huaweicloud_run_readonly_command`, iterate parameters freely, and reserve the plan → confirm → run contract for the real create. Raw Bash never gets this: hooks still deny it.
|
|
27
28
|
6. Redact secrets from command output, errors, JSON, logs, and generated reports.
|
|
28
29
|
7. If a command contains `adminPass`, `password`, token, or any secret-like field, warn that plaintext can remain in shell history. Prefer local-only input, runtime injection, or user-side execution.
|
|
29
30
|
|
|
@@ -35,6 +36,8 @@ Use this skill before any Huawei Cloud action that may expose secrets, change re
|
|
|
35
36
|
|
|
36
37
|
## Write Execution Boundary
|
|
37
38
|
|
|
39
|
+
0. Preflight first (no confirmation): when a create call has a documented zero-side-effect form, validate it BEFORE asking the user to approve the real one. Plan with the KooCLI global `--dryrun` flag (any operation — the CLI prints the request without executing) or `--dry_run=true` (ECS CreateServers / CreatePostPaidServers — the service checks mandatory parameters and request format but creates nothing). The plan returns `classification.risk: "preflight"` and `userConfirmation.needed: false`; run it with `huaweicloud_run_readonly_command` and fix parameter errors freely — each retry is free. Then plan the REAL command (no dry-run flag) and continue below.
|
|
40
|
+
|
|
38
41
|
1. Plan: call `huaweicloud_plan_cli_command`. The result echoes the exact command and carries `userConfirmation: { needed, mode: "ask", note }` by default, or `userConfirmation: { needed, command }` when the plan ran under `DEVKIT_APPROVAL_MODE=token` (opt-in).
|
|
39
42
|
2. Confirm (ask mode, the default): when `userConfirmation.mode` is `ask`, there is no terminal line and no token. The FIRST unattested call to `huaweicloud_run_approved_command` (same args, no `approvedByUser`; the `command` display field is recommended but optional) makes the server ask: an elicitation-capable client renders a form, and any other client returns `ASK_CONFIRMATION_REQUIRED`, whose envelope carries the command — show it to the user in chat, then retry that same call with `approvedByUser: true`. That retry is model-relayed posture trust, labeled as such, and its envelope stays live for the session's TTL, so further identical retries of the SAME command execute without re-asking. Different args get their own envelope first.
|
|
40
43
|
3. Confirm (token mode, opt-in): when `needed` is true, show the user the plan echo and the `userConfirmation.command` line (`npx huaweicloud-devkit approve <approvalToken>`), then wait. The USER runs that line in their own terminal, where a TTY check and a PIN gate the confirmation. First use: the user runs `npx huaweicloud-devkit pin` once in their own terminal to enroll the PIN.
|
|
@@ -46,6 +46,10 @@ The same gate covers every tool on the approval roster, not only the hcloud plan
|
|
|
46
46
|
|
|
47
47
|
The account-switch pair is registered (PR-3b): `huaweicloud_auth_init` and `huaweicloud_auth_switch` confirm on every call, and their confirmation views name the target account fingerprint and the credential source, because the account switch is the step that can redirect every later approved write to a different account. The confirmation binds the resolved snapshot — the account, region, and session token of the switch — so the account the user confirmed is the account that switches; a changed file or a changed region re-asks instead of executing. The devkit CLI verbs (`npx huaweicloud-devkit auth init`, `auth sync`) are the operator's own terminal surface: the hook denies them on the agent Bash face, so an agent cannot use the CLI to bypass the gate the MCP tools carry. `auth_confirm` (the persist-conflict reconciliation) and the read faces (`auth_status`, `check_account_type`, `auth_sync` on the MCP surface) stay ungated by this chain.
|
|
48
48
|
|
|
49
|
+
## The dry-run preflight (no confirmation)
|
|
50
|
+
|
|
51
|
+
A command that provably creates nothing is not a write, so it skips the confirmation contract entirely. The classifier recognizes two zero-side-effect channels on the plan/run tool faces: the KooCLI global flag `--dryrun` ("Print the request message after verification, without execution" — no request ever leaves the CLI, any operation) and the ECS body param `--dry_run=true` (the service checks mandatory parameters and request format but creates nothing — documented on `ECS CreateServers` / `ECS CreatePostPaidServers`; a `--cli-jsonInput` body keeps the write verdict because its dry_run value could conflict). Only the exact tokens match: case variants, bare `--dry_run`, `--dry-run`, or `=1` keep the write verdict, so a misspelled preflight still asks the user. The plan returns `classification.risk: "preflight"` with `userConfirmation.needed: false` — run it with `huaweicloud_run_readonly_command` and iterate parameters freely, then plan the real command (no dry-run flag) and follow the plan → confirm → run contract below. Raw Bash never gets this carve-out: the hook faces still deny a dry-run write, so preflights go through the MCP tools.
|
|
52
|
+
|
|
49
53
|
## Ask mode (the default): the server-run confirmation
|
|
50
54
|
|
|
51
55
|
The confirmation happens on the server, in one of two tiers.
|
|
@@ -133,6 +133,10 @@ function planningWarnings(args: string[]): string[] {
|
|
|
133
133
|
|
|
134
134
|
const REQUIRED_PARAMS: Record<string, string[]> = {
|
|
135
135
|
'ECS CreateServers': ['server.flavorRef', 'server.imageRef', 'server.nics.1.subnet_id'],
|
|
136
|
+
// KooCLI rejects a CreatePostPaidServers call that omits server.vpcid
|
|
137
|
+
// with "The following parameters are required: server.vpcid" (live
|
|
138
|
+
// evidence 2026-11-27), so the plan warns before the child ever runs.
|
|
139
|
+
'ECS CreatePostPaidServers': ['server.flavorRef', 'server.imageRef', 'server.nics.1.subnet_id', 'server.vpcid'],
|
|
136
140
|
'VPC CreateVpc': ['vpc.cidr'],
|
|
137
141
|
'VPC CreateSubnet': ['subnet.vpc_id', 'subnet.cidr'],
|
|
138
142
|
'VPC CreateSecurityGroupRule': [
|
|
@@ -152,6 +156,8 @@ const PARAM_VALUE_HINTS: Record<string, string> = {
|
|
|
152
156
|
'server.flavorRef': 'Run `hcloud ECS ListFlavors --cli-region=<r>` to find valid flavors',
|
|
153
157
|
'server.imageRef': 'Run `hcloud IMS ListImages --cli-region=<r> --__imagetype=gold` to find image IDs',
|
|
154
158
|
'server.nics.1.subnet_id': 'Run `hcloud VPC ListSubnets --cli-region=<r>` to find subnet IDs',
|
|
159
|
+
'server.vpcid':
|
|
160
|
+
'Run `hcloud VPC ListVpcs --cli-region=<r>` to find VPC IDs (KooCLI rejects CreatePostPaidServers without it)',
|
|
155
161
|
'subnet.vpc_id': 'Run `hcloud VPC ListVpcs --cli-region=<r>` to find VPC IDs',
|
|
156
162
|
func_name: 'Function name must be unique within project',
|
|
157
163
|
runtime: 'Run `hcloud FunctionGraph ListRuntimes` to see available runtimes',
|
|
@@ -214,8 +214,12 @@ export function runHcloudOnce(plan: HcloudPlanWithArgs, options: HcloudRunOption
|
|
|
214
214
|
// marker, the worse direction. Comment promised fixed; anchor kept.
|
|
215
215
|
const useErrorSource = stripKooCliUpdateBanner(stdout).trim() || stderr.trim();
|
|
216
216
|
const useErrorFormatError = useErrorSource.match(/^\[?USE_ERROR\]?\s*参数\S*的格式错误[^\n]*$/i);
|
|
217
|
+
// #921 (live 2026-11-26, KooCLI 7.3.12): the VALUE-validation family —
|
|
218
|
+
// `[USE_ERROR]The value of os-start must match [].` from NovaStartServer
|
|
219
|
+
// (empty-body params have no inline spelling) — also exits 0 with the
|
|
220
|
+
// command never executed, so it joins the marked families here.
|
|
217
221
|
const useErrorMarked = useErrorSource.match(
|
|
218
|
-
/^\[?(?:ERROR|USE_ERROR)\]?[: ]*(?:unknown parameter|unknown option|incorrect (?:option|switch|parameter)|invalid (?:parameter|argument)|参数不存在|参数错误|无效的参数|缺少必填参数|不正确的参数|不支持的服务名称|Unsupported service|The following parameters are required|[^\n]{0,40}?parameter format must be|format must be)[^\n]*/i,
|
|
222
|
+
/^\[?(?:ERROR|USE_ERROR)\]?[: ]*(?:unknown parameter|unknown option|incorrect (?:option|switch|parameter)|invalid (?:parameter|argument)|参数不存在|参数错误|无效的参数|缺少必填参数|不正确的参数|不支持的服务名称|Unsupported service|The following parameters are required|The value of \S{1,60} must match|[^\n]{0,40}?parameter format must be|format must be)[^\n]*/i,
|
|
219
223
|
);
|
|
220
224
|
const paramError = useErrorMarked ?? useErrorFormatError;
|
|
221
225
|
if (paramError) {
|
|
@@ -9,6 +9,18 @@ import { stripExecutable } from './unwrap.ts';
|
|
|
9
9
|
import { SECRET_ARGS_RE } from './vocabulary.ts';
|
|
10
10
|
import type { RiskDecision } from '../risk-rule-engine.ts';
|
|
11
11
|
|
|
12
|
+
// The dry-run preflight vocabulary (see the carve-out comment in
|
|
13
|
+
// classifyHcloudArgs). The global `--dryrun` flag is KooCLI's own
|
|
14
|
+
// "print the request, do not execute" (hcloud --help, service-agnostic);
|
|
15
|
+
// the body param `--dry_run=true` is the service-side preflight, pinned to
|
|
16
|
+
// the `${service} ${operation}` pairs (lowercased) whose operation-level
|
|
17
|
+
// --help documents it. Verified against `hcloud <op> --help` on
|
|
18
|
+
// 2026-11-27 for both entries; a future operation joins the set only with
|
|
19
|
+
// the same --help evidence.
|
|
20
|
+
const DRYRUN_GLOBAL_TOKEN = '--dryrun';
|
|
21
|
+
const DRY_RUN_PREFLIGHT_OPERATIONS = new Set(['ecs createservers', 'ecs createpostpaidservers']);
|
|
22
|
+
const DRY_RUN_EXACT_TOKEN = '--dry_run=true';
|
|
23
|
+
|
|
12
24
|
export function classifyHcloudArgs(args: unknown, options: ClassifyOptions = {}): RiskDecision {
|
|
13
25
|
const policy = options.policy || DEFAULT_POLICY;
|
|
14
26
|
const unwrappedTokens = stripExecutable(Array.isArray(args) ? args.map((arg) => String(arg)) : []);
|
|
@@ -122,6 +134,58 @@ export function classifyHcloudArgs(args: unknown, options: ClassifyOptions = {})
|
|
|
122
134
|
};
|
|
123
135
|
}
|
|
124
136
|
|
|
137
|
+
// The dry-run preflight carve-out (the argv tool faces only — never the
|
|
138
|
+
// text/hook faces, see the rawCommand guard): a command whose child
|
|
139
|
+
// provably creates nothing is not a write, so plans/runs need no
|
|
140
|
+
// confirmation. Two documented zero-side-effect channels:
|
|
141
|
+
// (a) the KooCLI GLOBAL flag `--dryrun` — "Print the request message
|
|
142
|
+
// after verification, without execution" (hcloud --help): no
|
|
143
|
+
// request ever leaves the CLI, for ANY service/operation.
|
|
144
|
+
// (b) the ECS body param `--dry_run=true` — the service-side preflight
|
|
145
|
+
// ("true: indicates that only the request is sent, but the ECS
|
|
146
|
+
// will not be created. Check items include mandatory parameters
|
|
147
|
+
// and request format", per `hcloud ECS CreateServers --help`),
|
|
148
|
+
// allowlisted to the operations whose --help documents it
|
|
149
|
+
// (ECS CreateServers / CreatePostPaidServers, verified 2026-11-27).
|
|
150
|
+
// Fences keep the carve-out narrower than the facts it rests on:
|
|
151
|
+
// - EXACT TOKENS — only `--dryrun` and `--dry_run=true`. Case
|
|
152
|
+
// variants, `=True`, `=1`, `--dry-run`, or a bare `--dry_run` keep
|
|
153
|
+
// the write verdict, so a misspelled preflight still asks the user
|
|
154
|
+
// (fail-closed).
|
|
155
|
+
// - The body-param arm refuses `--cli-jsonInput`: a JSON body could
|
|
156
|
+
// carry a conflicting dry_run value under a precedence the CLI owns
|
|
157
|
+
// and the classifier cannot see.
|
|
158
|
+
// - The rawCommand === undefined guard is the face boundary: every
|
|
159
|
+
// hook entry point (the .mjs PreToolUse twin, the opencode
|
|
160
|
+
// in-process gate, and every nested walk inside classifyTextCommand)
|
|
161
|
+
// classifies TEXT with rawCommand set, so raw Bash keeps its deny
|
|
162
|
+
// and the py twin's verdicts stay parity-true. The argv faces —
|
|
163
|
+
// plan/run tool calls — carry no rawCommand and take the carve-out.
|
|
164
|
+
// A compound argv (a value containing `;`/`&&`/…) fragments in the
|
|
165
|
+
// segment pass and lands here WITHOUT its preflight token in the
|
|
166
|
+
// fragment, so the severity merge denies fail-closed.
|
|
167
|
+
if (
|
|
168
|
+
options.rawCommand === undefined &&
|
|
169
|
+
(normalizedArgs.includes(DRYRUN_GLOBAL_TOKEN) ||
|
|
170
|
+
(DRY_RUN_PREFLIGHT_OPERATIONS.has(`${service.toLowerCase()} ${operation.toLowerCase()}`) &&
|
|
171
|
+
normalizedArgs.includes(DRY_RUN_EXACT_TOKEN) &&
|
|
172
|
+
!normalizedArgs.some((arg) => arg.startsWith('--cli-jsonInput'))))
|
|
173
|
+
) {
|
|
174
|
+
return applyCommandRiskRules(
|
|
175
|
+
{
|
|
176
|
+
decision: 'allow',
|
|
177
|
+
risk: 'preflight',
|
|
178
|
+
reason:
|
|
179
|
+
'Documented dry-run preflight: the CLI prints the request without executing, or the service validates it and creates nothing, so no confirmation is required.',
|
|
180
|
+
service,
|
|
181
|
+
operation,
|
|
182
|
+
args: normalizedArgs,
|
|
183
|
+
},
|
|
184
|
+
normalizedArgs,
|
|
185
|
+
options,
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
125
189
|
const readOnly = hasReadPrefix(operation, policy);
|
|
126
190
|
const executionOps =
|
|
127
191
|
/(^|\.)(Invoke|SyncInvoke|AsyncInvoke|Send|Trigger|Execute|Start|Reboot|Restart|Stop|Publish|Deploy)/i;
|