T09 · Insecure Skill Coding Practices
- Location
scripts/cue_api.py:1167- Finding
State-Changing API Commands Do Not Enforce User Confirmation
- Content
View full analysis
Vulnerability Details
File Location:
scripts/cue_api.py:1167-1208
Vulnerability Type: Missing executable authorization gate for persistent account mutations
Risk Level: MediumVulnerable Code
python if cmd in ("frequent", "unfrequent"): if len(sys.argv) < 3: print("usage: cue_api.py {frequent|unfrequent} <template_id>") return 2 _bad = validate_template_id(sys.argv[2]) if _bad: print(f"[cue_api] ✗ {_bad}") return 2 res = set_template_frequent( sys.argv[2], is_frequent=(cmd == "frequent"), ) print(json.dumps(res, ensure_ascii=False, indent=2)) return 0 if cmd == "create": if len(sys.argv) < 3: print("usage: cue_api.py create <payload.json>") print( " payload must include: source_conversation_id " "+ the 4 LLM fields" ) return 2 payload_path = sys.argv[2] payload = json.loads( Path(payload_path).read_text(encoding="utf-8") ) if not payload.get("source_conversation_id"): sys.stderr.write( "[create] payload missing source_conversation_id; " "use 'seed:<slug>:v1' for synthetic\n" ) return 2 res = create_template(payload) tid = res.get("template_id") or res.get("id") or "?" print(f"[create] created template_id={tid}") print(json.dumps(res, ensure_ascii=False, indent=2)) return 0 if cmd == "update": if len(sys.argv) < 4: print( "usage: cue_api.py update " "<template_id> <payload.json>" ) print( " payload may include any subset of " "the 4 LLM fields + meta" ) return 2 template_id = sys.argv[2] _bad = validate_template_id(template_id) if _bad: print(f"[cue_api] ✗ {_bad}") return 2 payload_path = sys.argv[3] payload = json.loads( Path(payload_pa ...[truncated 2858 chars]- Remediation
View remediation
Remediation Suggestions
-
Add a default-deny interactive confirmation prompt to every state-changing CLI command:
createupdatefrequentunfrequent
-
Require the user to confirm the exact target and operation. Before approval, display:
- The operation name.
- The target template ID, if applicable.
- A concise payload summary.
- A field-level diff for updates.
-
Support noninteractive automation only through an explicit
--yesflag. The agent should supply this flag only after obtaining the user's approval in the current interaction. -
Create a restorable local backup before direct updates, using the same safe backup mechanism provided by
tune_template.py. -
Consider separating read-only and mutating subcommands so callers can be granted only the capabilities required for a task.
-
Add regression tests verifying that each mutating command:
- Refuses execution by default when no confirmation is available.
- Performs no network mutation after cancellation.
- Executes only after valid interactive confirmation or an explicit
--yesflag.
-
