T09 · Insecure Skill Coding Practices
- Location
scripts/list_restaurants.py:206- Finding
Unrestricted navigation and DOM inspection through the authenticated browser profile
- Content
View full analysis
``` The script does not validate the URL scheme, hostname, port, or resolved destination before opening it. It then executes the fixed `EVAL_JS` function in the resulting page using the user's `attached` browser profile. According to the project documentation, this profile may contain existing authenticated sessions, open tabs, and stored OpenTable account state. This behavior exceeds the minimum privileges required for an OpenTable-specific discovery skill. Legitimate operation only requires navigation to an HTTPS OpenTable search URL generated by `build_search_url()`. An unrestricted override permits navigation to unrelated websi ...[truncated 2853 chars]- Remediation
View remediation
str: parsed = urlparse(value) hostname = (parsed.hostname or "").lower().rstrip(".") if parsed.scheme != "https": raise ValueError("Only HTTPS URLs are allowed") if hostname != "opentable.com" and not hostname.endswith(".opentable.com"): raise ValueError("Only OpenTable URLs are allowed") if parsed.username or parsed.password: raise ValueError("URL credentials are not allowed") if parsed.port not in (None, 443): raise ValueError("Non-standard ports are not allowed") return value ``` 3. **Reject incomplete invocations.** Do not evaluate the current tab by default: ```python if args.navigate: target_url = validate_opentable_url(args.navigate) elif args.location and args.date_time: target_url = build_search_url( args.location, args.date_time, args.party, args.query ) else: p.error("Provide --location and --date-time") ``` 4. **Verify the final page origin inside `EVAL_JS` before reading the DOM:** ```javascript const hostname = location.hostname.toLowerCase().replace(/\.$/, ""); if ( location.protocol !== "https:" || (hostname !== "opentable.com" && !hostname.endsWith(".opentable.com")) ) { throw new Error("Refusing to inspect a non-OpenTable page"); } ``` 5. **Account for redirects.** Validate the page origin after navigation, not only the initial input URL. 6. **Use a dedicated least-privilege browser profile.** Avoid operating through a general attached profile containing unrelated authenticated sessions and tabs. 7. **Minimize returned ...[truncated 405 chars]
