T09 · Insecure Skill Coding Practices
Warning
- Location
- lib/engagement.py:125
- Finding
- Live Moltbook Actions Bypass Documented Quality Gates and Dry-Run Controls<![CDATA[ ## Vulnerability Details **File Location**: `lib/engagement.py:125-145` **Vulnerability Type**: Missing safety controls for authenticated external actions **Risk Level**: Medium ### Vulnerable Code ```python # Upvote if interesting (simple heuristic: karma > 0 or genuine content) if post.get("upvotes", 0) >= 0 and not is_spam(post): result = api_call(f"/posts/{post['id']}/upvote", method="POST") if "success" in result or "upvote" in str(result): print(" ✓ Upvoted") upvoted += 1 # Comment on interesting posts (limited) if commented < 2 and post.get("upvotes", 0) > 0: comment_body = "Interesting perspective. What inspired you to explore this?" result = api_call(f"/posts/{post['id']}/comments", method="POST", data={"content": comment_body}) # Check if verification required if result.get("verification_required"): print(" 🔐 Verification required...") challenge = result.get("verification", {}).get("challenge", "") vcode = result.get("verification", {}).get("code", "") answer = solve_verification(challenge) verify_result = api_call("/verify", method="POST", data={"verification_code": vcode, "answer": answer}) ``` ### Technical Analysis The implementation performs authenticated, state-changing API requests immediately after scanning the feed. It does not implement the documented four-gate quality assessment or an effective dry-run control. The upvote predicate: ```python post.get("upvotes", 0) >= 0 ``` accepts virtually every non-spam post because absent and nonnegative upvote counts satisfy it. This is not a meaningful test of genuine interest. The comment is also fixed generic content, contrary to the Skill's stated policy of add ...[truncated 1696 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Default all workflows to dry-run and require an explicit `--live` option for state-changing operations. 2. Display each proposed upvote and comment before execution and require user confirmation unless a separately reviewed automation policy explicitly permits unattended operation. 3. Apply all documented quality gates before every upvote, comment, or post—not only before topic posting. 4. Replace the always-true upvote heuristic with a substantive, explainable relevance assessment. 5. Do not generate a fixed generic comment. Require reviewed, post-specific content that adds a concrete perspective. 6. Enforce configurable per-run and per-time-window action limits. 7. Record an audit log containing the action, target post, decision rationale, timestamp, and API result, without recording credentials. 8. Stop immediately on authentication failures, suspension indicators, verification failures, or repeated rate-limit responses. 9. Consolidate `lib/engagement.py` and `lib/engage.py` so there is only one authoritative implementation with consistent dry-run semantics. ]]>
