T09 · Insecure Skill Coding Practices
- Location
scripts/rds_cli.sh:22- Finding
Destructive RDS Operations Can Bypass the Confirmation Gate
- Content
View full analysis
Vulnerability Details
File Location:
scripts/rds_cli.sh, lines 22–34 and 60–61
Vulnerability Type: Incomplete mutation classification causing confirmation bypass
Risk Level: MediumVulnerable Code
bash # Mutating operations — require explicit user confirmation (ISSUE-013) MUTATING_OPS=" StartInstanceRestartAction StartInstanceEnlargeVolumeAction StartInstanceReduceVolumeAction StartResizeFlavorAction StartFailover SetReadOnlySwitch UpdateInstanceAlias SetAutoEnlargePolicy CreateSqlLimit CreateIntelligentKillSession ValidateInstanceConnection SetBackupPolicy ChangeBackupConfig CreateManualBackup DeleteManualBackup BatchDeleteManualBackup CreateRestoreInstance RestoreToExistingInstance RestoreTables SetSecurityGroup SwitchSsl SetAuditlogPolicy CreateConfiguration UpdateConfiguration ApplyConfigurationAsync UpdateInstanceConfiguration BatchDeleteInstance " if echo "$MUTATING_OPS" | grep -qw "$OPERATION"; then echo "⚠️ 变更操作: $OPERATION" read -r -p " 确认执行? (yes/no): " _ans if [[ "$_ans" != "yes" ]]; then echo "已取消。" exit 0 fi fiThe operation is subsequently passed directly to the authenticated cloud CLI:
bash if command -v hcloud &>/dev/null; then cli_out="$(hcloud RDS "$OPERATION" "$@" 2>&1)"The project documents an omitted destructive operation in
references/api-paths.md, line 55:markdown | Delete Configuration | DELETE | `/v3/{project_id}/configurations/{config_id}` |Technical Analysis
The confirmation mechanism uses a finite list of operation names. It prompts only when the caller-supplied
OPERATIONexactly matches an entry inMUTATING_OPS. Operations absent from that list proceed without confirmation and are passed tohcloud RDSunder the user's authenticated Huawei Cloud identity.DeleteConfigurationis a concrete reachable example: it is documented by the project as a configuration-deletion API operation but is not included inMUTATING_OPS. This contradict ...[truncated 1834 chars]- Remediation
View remediation
Remediation Suggestions
-
Replace the mutation denylist with a fail-closed policy:
- Maintain an explicit allowlist of verified read-only operations.
- Require confirmation for every operation not on that allowlist.
- Reject unknown operations rather than passing them to
hcloud.
-
Add
DeleteConfigurationto the confirmed mutation set as an immediate fix, but do not rely on this alone because future API operations could recreate the bypass. -
Use authoritative operation metadata where available to classify HTTP methods and side effects. Treat
POST,PUT,PATCH, andDELETEoperations as mutating unless explicitly proven otherwise. -
Validate operation names and required parameters before invoking the CLI.
-
Add regression tests covering:
DeleteConfiguration;- every documented create, update, set, switch, start, stop, restore, apply, kill, and delete operation;
- unknown operation names;
- refusal or EOF at the confirmation prompt;
- confirmation behavior across CLI and fallback paths.
-
Keep the implementation synchronized with the confirmation requirements in
SKILL.md,references/api-paths.md, andreferences/acceptance-criteria.md.
-
