T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/smn_dms_skill.py:235
- Finding
- State-Changing and Destructive Operations Bypass Documented Confirmation Gates<![CDATA[ ## Vulnerability Details **File Location**: `scripts/smn_dms_skill.py:31-35`, `scripts/smn_dms_skill.py:153-240`, and `scripts/smn_dms_skill.py:294-297` **Vulnerability Type**: Confirmation-control bypass **Risk Level**: High ### Vulnerable Code ```python def run_hcloud(args_list, region, preview=False): cmd = ["hcloud"] + args_list if region: cmd.append("--cli-region=%s" % region) if preview: print("[PREVIEW] " + " ".join(cmd)) return "" ``` Destructive handlers pass the optional flag directly to the execution function: ```python def delete_smn_topic(a): require(a.topic_urn, "topic_urn", sys.argv) print_json(run_hcloud(["SMN", "DeleteTopic", "--topic_urn=%s" % a.topic_urn], a.region, preview=a.preview)) def confirm_smn_subscription(a): require(a.token, "token", sys.argv) args = ["SMN", "ConfirmSubscription", "--token=%s" % a.token] if a.topic_urn: args.append("--topic_urn=%s" % a.topic_urn) if a.endpoint: args.append("--endpoint=%s" % a.endpoint) print_json(run_hcloud(args, a.region, preview=a.preview)) def delete_dms_instance(a): engine = (a.engine or "").lower() require(engine, "engine (kafka|rabbitmq|rocketmq)", sys.argv) validate_engine(engine, sys.argv) service = ENGINE_SERVICE[engine] require(a.instance_id, "instance_id", sys.argv) print_json(run_hcloud([service, "DeleteInstance", "--instance_id=%s" % a.instance_id], a.region, preview=a.preview)) ``` The preview flag is disabled by default: ```python p.add_argument("--preview", action="store_true", help="print the hcloud command without executing it (R2/R1 confirmation)") ``` ### Technical Analysis The documentation states that R2 management operations require command preview and user confirmation, while R1 destructive operations require explicit end-to-end confirmation. The implementation does not enforce either c ...[truncated 1937 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make preview mode the default for every R1 and R2 operation. - Require an explicit execution option such as `--execute` in addition to a one-time approval value. - Bind approval to a cryptographic digest of the exact command, action, region, engine, and target resource so approval cannot be reused for altered parameters. - For R1 operations, display the resource identifier and irreversible impact, then require a second-stage confirmation. - Reject noninteractive destructive execution unless an independently issued approval token is supplied. - Separate read-only and write-capable entry points or execution roles. - Add automated tests verifying that every R1/R2 action fails closed when confirmation is absent. - Use a lower-privilege cloud identity for query actions and grant create or delete permissions only for workflows that require them. ]]>
