T09 · Insecure Skill Coding Practices
- Location
scripts/hh_apply_batch.py:187- Finding
Unrestricted Browser Navigation Allows JavaScript URL Execution in an Authenticated Tab
- Content
View full analysis
BrowserResult: payload = json.dumps(url, ensure_ascii=False) try: return self.evaluate(f"() => {{ window.location.href = {payload}; return {{navigatingTo: {payload}}}; }}", target_id) except BrowserCliError as e: msg = str(e) if "Execution context was destroyed" in msg or "ERR_ABORTED" in msg: return BrowserResult({"ok": True, "result": {"navigatingTo": url}}) raise ``` The target selection also uses the first attached tab without validating its origin: ```python def current_target(self) -> str: tabs = self.tabs().get("tabs") or [] if not tabs: raise BrowserCliError(f"browser profile {self.profile!r} has no attached tabs") return tabs[0]["targetId"] ``` ### Technical Analysis The application workflow states that positional arguments are HH vacancy URLs, but it does not parse or validate their URL scheme or hostname. The regular expression only rewrites values beginning with an HTTP or HTTPS origin: ```python re.sub(r"^https?://[^/]+", origin, url) ``` Consequently, a non-HTTP value such as `javascript:` remains unchanged. The value is then assigned to `window.location.href` inside an attac ...[truncated 2665 chars]- Remediation
View remediation
