Skip to content

fix(visualize-only): land on /visualizer/ after one-time sign-in - #18

Merged
SushantGautam merged 1 commit into
mainfrom
fix/visualize-only-redirect
Oct 8, 2026
Merged

SushantGautam merged 1 commit into
mainfrom
fix/visualize-only-redirect

Conversation

@SushantGautam

Copy link
Copy Markdown
Collaborator

Problem

uvx simpleaudit-studio --visualize-only --results_dir ./results opens the one-time sign-in link, but after signing in the browser lands on the dashboard (/) instead of the visualizer (/visualizer/). In visualize-only mode the dashboard is unpopulated, so users hit a dead end and have to navigate to /visualizer/ manually.

Fix

  • auto_login_view (infra/ui.py) now honors a server-side SIMPLEAUDIT_AUTO_LOGIN_NEXT env var as the post-login redirect target, falling back to the dashboard when unset.
  • Guarded against open redirect: only relative paths (/...) are accepted; absolute (http://) and protocol-relative (//evil) values are ignored.
  • _run_visualize_only (simpleaudit_studio/cli.py) sets SIMPLEAUDIT_AUTO_LOGIN_NEXT=/visualizer/, so both the printed one-time sign-in link and the auto-opened browser land on the visualizer.
  • Normal full mode is unchanged (env var not set → dashboard, as before).

Tests

infra/tests/test_minimal_config.py::TestAutoLoginToken:

  • test_redirects_to_visualizer_when_next_set — 302 to /visualizer/ when the env var is set
  • test_next_must_be_a_relative_path — absolute / protocol-relative / empty values are ignored

All 9 auto-login tests pass (7 pre-existing + 2 new); full file: 18 passed. Ruff clean. (Black reports the 3 files as unformatted, but so does pristine origin/main — pre-existing baseline, not introduced here.)

The auto-login view always redirected to the dashboard, so
`uvx simpleaudit-studio --visualize-only` dropped the user on the
unpopulated dashboard instead of the visualizer.

- auto_login_view now honors SIMPLEAUDIT_AUTO_LOGIN_NEXT (server-side
  env var, relative paths only — no open redirect) as the post-login
  target, falling back to the dashboard
- visualize-only mode sets it to /visualizer/, so both the printed
  one-time sign-in link and the auto-opened browser land on the
  visualizer
- tests for the new redirect + relative-path guard
@SushantGautam
SushantGautam merged commit 4d40fc5 into main Oct 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant