Skip to content

feat(dashboard-auth): add read-only guest access - #703

Merged
Komzpa merged 38 commits into
Soju06:mainfrom
geoHeil:feat/dashboard-guest-readonly
Jun 15, 2026
Merged

Komzpa merged 38 commits into
Soju06:mainfrom
geoHeil:feat/dashboard-guest-readonly

Conversation

@geoHeil

@geoHeil geoHeil commented May 18, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer refresh (2026-06-04)

  • Pushed d9f30152ca0a134009331cc3869074f0e03af033 to repair the current-head CI failures after rebasing onto main.
  • Added 20260604_010000_merge_dashboard_guest_and_reauth_status_heads so the guest-access migration chain merges with 20260604_000000_add_reauth_required_account_status.
  • Dashboard account cards now use the backend isEmailDuplicate flag for ID suffixes, matching the Accounts page behavior.
  • Local validation:
    • uv run pytest tests/unit/test_db_migrate.py -q
    • make frontend-test
    • cd frontend && bun run test -- src/features/settings/components/routing-settings.test.tsx src/features/settings/components/import-settings.test.tsx src/features/settings/components/session-settings.test.tsx src/features/settings/components/totp-settings.test.tsx src/features/dashboard/components/account-cards.test.tsx
    • cd frontend && bun run lint && bun run typecheck
    • python .github/scripts/check_all_contributors.py
    • uv run ruff check app/db/alembic/versions/20260604_010000_merge_dashboard_guest_and_reauth_status_heads.py tests/unit/test_db_migrate.py
    • uv run ty check app/db/alembic/versions/20260604_010000_merge_dashboard_guest_and_reauth_status_heads.py tests/unit/test_db_migrate.py
    • make test-unit
    • make test-integration-core
    • git diff --check

Summary

Adds dashboard guest access for issue #673: operators can enable read-only dashboard access with either no guest password or a separate guest password. Internally this introduces role/permission primitives so the authorization model can grow toward multi-user access later.

This rebuilt branch also folds #844, so the shared auth surface covers both dashboard session/guest access and proxy API-key authentication with x-api-key fallback.

Type of change

  • feat: - new user-facing feature or capability
  • fix: - bug fix (no behavior change beyond the bug)
  • refactor: - internal refactor (no behavior change, no API change)
  • docs: - documentation only
  • chore: / ci: / build: - tooling, CI, packaging
  • test: - test-only change
  • Breaking change

Linked issue: Fixes #673

OpenSpec

  • This PR includes / updates an OpenSpec change
  • Not applicable - bug fix that matches the existing spec
  • Not applicable - docs / CI / chore only
  • This PR touches a codex-faithful path (image pipeline, request/response shape, SSE framing, OAuth flow) and preserves upstream-equivalent behavior

Change directory: openspec/changes/add-dashboard-guest-readonly/

Additional auth change directory: openspec/changes/support-x-api-key-auth/

Folded PRs

Changes

  • Adds admin / guest dashboard principals with read / write permissions, stores role/permission metadata in dashboard session cookies, and centralizes write enforcement through require_dashboard_write_access.
  • Adds persisted guest_access_enabled and optional guest_password_hash settings plus guest login, guest password set, and guest password remove endpoints.
  • Allows passwordless read-only guest access when explicitly enabled, while preserving admin sessions and bootstrap behavior.
  • Applies write-access checks to account, OAuth, firewall, settings, sticky-session, quota-planner, auth-export, upstream-proxy, alias, and limit-warmup dashboard mutations so read-only guests cannot change state.
  • Updates the dashboard UI to show guest login/admin login controls, expose guest settings to admins, and disable or hide write controls for read-only guests.
  • Adds backend integration coverage, frontend schema/component coverage, MSW handlers, and Alembic migrations.
  • Accepts x-api-key for proxy API key validation and self-service usage lookup, with Bearer-first precedence and ChatGPT caller-identity flows kept Bearer-only.

Test plan

uv run pytest tests/integration/test_auth_middleware.py tests/integration/test_quota_planner_api.py -q
uv run pytest tests/integration/test_accounts_api.py::test_update_account_limit_warmup_opt_in tests/integration/test_accounts_api.py::test_set_and_clear_account_alias -q
uv run ruff check app/core/auth/dependencies.py app/modules/accounts/api.py app/modules/quota_planner/api.py app/modules/settings/api.py app/modules/settings/repository.py app/modules/settings/schemas.py tests/integration/test_auth_middleware.py
cd frontend && bun run typecheck
cd frontend && bun run lint
git diff --check

Local result: auth/quota planner integration tests passed; focused account API tests passed; ruff, frontend typecheck, frontend lint, and diff check passed for the rebase repair. GitHub CI is running for current head b0e03f36fb224a18ff6d06e16f7e760befef610f.

Screenshots / output (optional)

No screenshots attached.

Checklist

  • Title is in Conventional Commits format (<type>(<scope>)?: <subject>).
  • Linked the related issue / discussion above.
  • Added or updated tests covering the change.
  • Ran uv run ruff check . and uv run ruff format . (or pre-commit) locally for the touched backend paths.
  • Ran uv run pytest and all tests pass.
  • If touching specs: openspec validate --specs passes and /opsx:verify is clean.
  • CHANGELOG is not edited by hand (release-please handles it).

@geoHeil geoHeil mentioned this pull request May 18, 2026
2 tasks done
@geoHeil
geoHeil marked this pull request as ready for review May 18, 2026 19:01
@geoHeil
geoHeil marked this pull request as draft May 18, 2026 19:52
@Komzpa

Komzpa commented May 18, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2118ce37b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/modules/dashboard_auth/api.py Resolved
@geoHeil
geoHeil marked this pull request as ready for review May 18, 2026 21:00
@Komzpa

Komzpa commented May 19, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Komzpa Komzpa added 🤖 codex: ok [@codex review] says no issues found. and removed 🤖 codex: ok [@codex review] says no issues found. labels May 19, 2026
@geoHeil
geoHeil force-pushed the feat/dashboard-guest-readonly branch from 0ba2858 to 8550785 Compare May 20, 2026 10:27
@geoHeil

geoHeil commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@Komzpa thanks for your review/update/small edit. I just updated from the latest main and fixed the conflicts.

Is anything missing which may prevent this from shipping soon?

@Komzpa Komzpa added the db migration PR changes Alembic database migrations; maintainer must coordinate merge order label May 21, 2026
@Komzpa
Komzpa force-pushed the feat/dashboard-guest-readonly branch from 70e6d58 to 04d1089 Compare May 22, 2026 16:12
@Soju06

Soju06 commented May 22, 2026

Copy link
Copy Markdown
Owner

@codex review

1 similar comment
@Komzpa

Komzpa commented May 22, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: abcdb1b434

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/core/auth/dependencies.py Resolved
@Soju06 Soju06 added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels May 22, 2026
@Komzpa

Komzpa commented May 22, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c65408b45c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/core/auth/dependencies.py Resolved
@Soju06 Soju06 added 🤖 codex: needs work [@codex review] raised an issue and removed 🤖 codex: needs work [@codex review] raised an issue labels May 22, 2026
@Soju06

Soju06 commented May 22, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8798921cf3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/modules/dashboard_auth/api.py Resolved
@Komzpa Komzpa added the 🤖 codex: needs work [@codex review] raised an issue label May 22, 2026
@Soju06 Soju06 removed the 🤖 codex: needs work [@codex review] raised an issue label May 22, 2026
@Soju06

Soju06 commented May 22, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9dab6e8f54

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/core/auth/dependencies.py Resolved
@Komzpa

Komzpa commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: bec97d96c4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

🤖 codex: ok [@codex review] says no issues found. db migration PR changes Alembic database migrations; maintainer must coordinate merge order

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: user-management

3 participants