T09 · Insecure Skill Coding Practices
- Location
scripts/x_post.py:65- Finding
Mandatory Human Approval Is Not Enforced by the Publishing Code
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:8-11,scripts/run.py:22-24,scripts/x_post.py:65-94
Vulnerability Type: Missing authorization and approval enforcement
Risk Level: HighThe Skill documentation requires the user to respond with the exact uppercase word
PUBLICARorPUBLISHbefore content is posted. This safety requirement exists only as a natural-language instruction and is not enforced by the executable publishing path.markdown ## Safety / approval rule (mandatory) - Never publish unless the user explicitly replies with **PUBLICAR** or **PUBLISH** (uppercase). - Before publishing, always show the final text + the image you will use.scripts/run.pyforwards all supplied arguments directly to the publishing script without validating approval:python target = base_dir / "scripts" / "x_post.py" cmd = [str(venv_py), str(target), *sys.argv[1:]] print("+", " ".join(cmd)) return subprocess.call(cmd)scripts/x_post.pyacceptspublishas an ordinary command and performs the network operations immediately:python def main(): ap = argparse.ArgumentParser() ap.add_argument("command", choices=["dry-run", "publish"]) ap.add_argument("--text", required=True) ap.add_argument("--image", required=False) args = ap.parse_args() text = args.text.strip() image_path = Path(args.image).expanduser() if args.image else None if image_path and not image_path.exists(): raise SystemExit(f"ERROR: image not found: {image_path}") if args.command == "dry-run": out = { "ok": True, "mode": "dry-run", "text": text, "image": str(image_path) if image_path else None, "note": "Not published. Use 'publish' to post.", } print(json.dumps(out, ensure_ascii=False, indent=2)) return 0 # publish oauth = build_oauth1() ...[truncated 1883 chars]- Remediation
View remediation
Remediation Suggestions
- Enforce approval inside
x_post.pyimmediately before media upload and post creation. - Generate a short-lived, single-use approval artifact only after displaying the final text and image to the user.
- Bind the artifact cryptographically to:
- The exact post text.
- A cryptographic hash of the image.
- The destination account.
- An expiration time and unique nonce.
- Reject missing, expired, reused, or content-mismatched approval artifacts.
- Keep
dry-runas the default operation and require a distinct protected authorization path for publication. - If an interactive confirmation is used, display the final content again and require exact confirmation. Do not rely on a command-line flag alone as proof of user approval.
- Add automated tests demonstrating that direct
publishinvocation fails without valid, content-bound approval.
- Enforce approval inside
