T09 · Insecure Skill Coding Practices
Error
- Location
- references/test-phases.md:145
- Finding
- Unrestricted Automation Can Trigger Destructive Application Actions<![CDATA[ ## Vulnerability Details **File Location**: `references/test-phases.md:145-160`, `references/test-phases.md:214-223`, `references/test-phases.md:278-289`, and `references/test-phases.md:309-320` **Vulnerability Type**: Uncontrolled state-changing browser automation **Risk Level**: High ### Vulnerable Code ```python for i, btn in enumerate(btns): try: text = (btn.inner_text().strip() or btn.get_attribute("value") or btn.get_attribute("aria-label") or f"btn_{i}") print(f" → Clicking: '{text}'") btn.scroll_into_view_if_needed() btn.click(timeout=4000) page.wait_for_timeout(1500) shot(page, f"btn_{text[:20]}") after_url = page.url if after_url != current_url: note("ok", f"button/{text}", f"navigated to: {after_url}") page.go_back() page.wait_for_load_state("networkidle") else: note("ok", f"button/{text}", "action on same page") ``` ```python submit = form.query_selector( "button[type=submit], input[type=submit], button:last-of-type" ) if submit: try: submit.click() page.wait_for_timeout(2000) shot(page, f"form_{fi}_submitted") note("ok", f"form_{fi} on {page_url}", f"submitted → {page.url}") ``` ```python try: page.click("button[type=submit], input[type=submit]", timeout=3000) page.wait_for_timeout(2000) shot(page, "journey_04_register_result") note("ok", "journey/register", f"submitted → {page.url}") except: note("warn", "journey/register", "could not submit register form") ``` ```python try: page.click("button[type=submit], input[type=submit]", timeout=3000) page.wait_for_timeout(2000) shot(page, "journey_07_login_result") note("ok", "journey/login", f"submitted → {page.url}") except: note("warn", "journey/login", "could not submit login form") ``` ### Technical Analysis The test workflow clicks ...[truncated 1373 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Require an explicit staging or disposable test environment by default. - Add a dry-run mode that inventories controls without activating them. - Enforce approved-origin, route, HTTP-method, and action allowlists. - Deny actions whose labels or accessible names indicate destructive behavior, including Delete, Remove, Purchase, Pay, Transfer, Send, Publish, Reset, Disable, and Confirm. - Require explicit operator confirmation before every potentially state-changing action. - Intercept requests and block `POST`, `PUT`, `PATCH`, and `DELETE` operations unless specifically authorized. - Use dedicated low-privilege test accounts and disposable test data. - Do not assume that browser navigation can roll back completed operations. ]]>
