@vizamodo/viza-cli 1.5.12 → 1.5.17
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.
|
@@ -32,9 +32,15 @@ export async function bootstrapAwsRolesAnywhereCommand(options) {
|
|
|
32
32
|
infraKey: "aws",
|
|
33
33
|
targetEnv: env,
|
|
34
34
|
allowedTeams,
|
|
35
|
+
// Canonical CLI contract (explicit, non-magical)
|
|
36
|
+
selfHosted: options.selfHosted === true,
|
|
37
|
+
keepLog: options.removeLog !== true,
|
|
38
|
+
flowGates: {
|
|
39
|
+
secrets: true,
|
|
40
|
+
},
|
|
35
41
|
payload: {}
|
|
36
42
|
}, {
|
|
37
43
|
status: options.status === true,
|
|
38
|
-
log: "
|
|
44
|
+
log: "show",
|
|
39
45
|
});
|
|
40
46
|
}
|
|
@@ -19,6 +19,56 @@ function maybeRenderLog(result, policy) {
|
|
|
19
19
|
renderLog(result.logBuffer, { status: result.status });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
function assertDispatchInputStrict(input) {
|
|
23
|
+
// Required top-level fields
|
|
24
|
+
if (!input.intent || typeof input.intent !== "string") {
|
|
25
|
+
throw new Error("dispatch_input_missing_intent");
|
|
26
|
+
}
|
|
27
|
+
if (!input.commandType || typeof input.commandType !== "string") {
|
|
28
|
+
throw new Error("dispatch_input_missing_commandType");
|
|
29
|
+
}
|
|
30
|
+
if (!input.infraKey || typeof input.infraKey !== "string") {
|
|
31
|
+
throw new Error("dispatch_input_missing_infraKey");
|
|
32
|
+
}
|
|
33
|
+
if (!("payload" in input)) {
|
|
34
|
+
throw new Error("dispatch_input_missing_payload");
|
|
35
|
+
}
|
|
36
|
+
if (typeof input.payload !== "object" ||
|
|
37
|
+
input.payload === null ||
|
|
38
|
+
Array.isArray(input.payload)) {
|
|
39
|
+
throw new Error("dispatch_input_invalid_payload");
|
|
40
|
+
}
|
|
41
|
+
// runnerLabel must be explicit
|
|
42
|
+
if (!input.runnerLabel || (input.runnerLabel !== "native" && input.runnerLabel !== "selfhosted")) {
|
|
43
|
+
throw new Error("dispatch_input_invalid_runnerLabel");
|
|
44
|
+
}
|
|
45
|
+
// keepLog must be boolean if present
|
|
46
|
+
if ("keepLog" in input && typeof input.keepLog !== "boolean") {
|
|
47
|
+
throw new Error("dispatch_input_invalid_keepLog");
|
|
48
|
+
}
|
|
49
|
+
// flowGates validation (no undefined allowed)
|
|
50
|
+
if ("flowGates" in input) {
|
|
51
|
+
if (input.flowGates === undefined || input.flowGates === null) {
|
|
52
|
+
throw new Error("dispatch_input_invalid_flowGates");
|
|
53
|
+
}
|
|
54
|
+
if (typeof input.flowGates !== "object") {
|
|
55
|
+
throw new Error("dispatch_input_invalid_flowGates");
|
|
56
|
+
}
|
|
57
|
+
if ("secrets" in input.flowGates && typeof input.flowGates.secrets !== "boolean") {
|
|
58
|
+
throw new Error("dispatch_input_invalid_flowGates_secrets");
|
|
59
|
+
}
|
|
60
|
+
if ("encVars" in input.flowGates && typeof input.flowGates.encVars !== "boolean") {
|
|
61
|
+
throw new Error("dispatch_input_invalid_flowGates_encVars");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Final hard check: JSON round-trip must still work
|
|
65
|
+
try {
|
|
66
|
+
JSON.parse(JSON.stringify(input));
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw new Error("dispatch_input_not_json_roundtrip_safe");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
22
72
|
async function dispatchIntent(input, mode = "dispatch") {
|
|
23
73
|
const dispatchInput = {
|
|
24
74
|
intent: input.intent,
|
|
@@ -29,6 +79,8 @@ async function dispatchIntent(input, mode = "dispatch") {
|
|
|
29
79
|
keepLog: input.keepLog,
|
|
30
80
|
flowGates: input.flowGates,
|
|
31
81
|
};
|
|
82
|
+
// CLI fail-fast: never dispatch dirty envelope
|
|
83
|
+
assertDispatchInputStrict(dispatchInput);
|
|
32
84
|
const handle = await dispatcherDispatch(dispatchInput, {
|
|
33
85
|
auth: {
|
|
34
86
|
targetEnv: input.targetEnv,
|