Skip to content

[Security] restoreState navigates to saved URLs without validation #674

Closed

Description

@wernerkasselman-au

Summary

browse/src/browser-manager.ts:633-635 — restoreState() calls page.goto(saved.url) without running validateNavigationUrl(). State files loaded from disk via the state load command could contain file://, chrome://, or cloud metadata URLs that would bypass the scheme/host blocklist enforced by newTab() and goto.

Reproduction

# Save state normally
$B state save mystate

# Tamper with the state file — inject a blocked URL
# Edit ~/.gstack/browse-states/mystate.json:
# Change a page URL to "file:///etc/passwd"

# Load the tampered state
$B state load mystate
# → Browser navigates to file:///etc/passwd without validation

Severity

Medium — requires local file tampering, but bypasses all URL validation.

Fix

PR #664 adds validateNavigationUrl(saved.url) before page.goto in restoreState(). Blocked URLs are skipped. 5 tests added to url-validation.test.ts.

Found via sqry AST-based semantic code graph analysis.

Activity

  1. added a commit that references this issue on Apr 1, 2026
    95337a3
  2. garrytan commented on Apr 13, 2026

    @garrytan
    Owner

    Fixed in commit c151fabf (PR #664, v0.15.13.0). restoreState now calls validateNavigationUrl(saved.url) before page.goto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions