Repository navigation
feat(admin): sign in locally as a test user; retire ADMIN_DEV_BYPASS - #1666
Merged
Merged
Conversation
Local sign-in without Slack is the devtools panel, gated on the local deploy context. Both sign-in pages point at pnpm db:seed when Slack is not configured. Refs #1665.
getSession() is the cached Better Auth lookup. The seeded admin is a real, devtools-registered user (dev-seed-admin). requireVolunteer tests move to a db test with real sessions. Refs #1665.
A database seeded as dev-bypass kept that row, and its email blocked the insert of dev-seed-admin. Refs #1665
✅ Deploy Preview for virtual-coffee-io ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
devtoolsEnabled() now repeats the library's NODE_ENV check, so a local production build doesn't point at a panel that never renders. Refs #1665
The local test-user hint and the deploy warning are one component, so the pages no longer branch on devtoolsEnabled(). The /invites copy also named only two of the three Slack variables slackAuthConfigured requires. Refs #1665
The previous preview build got no database URL from Netlify, so the migrate step failed before touching anything.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Linked Issue
Closes #1665
Description
TestUserPanel(src/app/admin/testUserPanel.tsx) renders the better-auth-devtools panel on/admin/sign-in,/invites/sign-inand the protected/adminlayout, so a signed-out browser can pick a seeded admin, CoC reviewer or Volunteer.devtoolsEnabled()insrc/lib/access/devtools.ts(deployContext() === 'local') is both the plugin'senabledand the panel's render check, on top of the library's ownNODE_ENVrefusal. That keeps the defence in depth the bypass had.pnpm db:seedand pick a test user. Deploys keep the misconfiguration warning.devBypassSession()and the cookie-vs-bypass precedence ingetSession()are deleted.ADMIN_DEV_BYPASS*vars are gone fromnetlify/env.d.ts, and.env.examplegets a short pointer instead.dev-seed-admin/U_DEV_ADMIN.reset()also clears seeded users by email, so a database seeded under the old id reseeds cleanly.requireVolunteermoved tovolunteerAccess.db.test.tson real sessions viasignInAs(). It now covers the no-Slack-id redirect.docs/agents/membership.md, ADR 0010, ADR 0018 anddocs/testing.mdnow describe the panel, not the bypass.Methodology
The panel's login endpoint needs no existing session, and
pnpm db:seedalready registers a test user per role. The bypass therefore bought nothing a contributor couldn't get from the panel, because/adminneeds the local database either way. It did cost a second, in-memory identity with nouserrow, plus precedence logic so the two could coexist.Verified in the browser on a fresh
netlify dev:/admin/sign-inlands on/admin./invites/sign-inlands on/inviteswith their allowance.The "Slack not configured" hint wasn't exercised in the browser, because the local
.envhas Slack credentials.pnpm codegen && pnpm typecheck && pnpm lint && pnpm test && pnpm knippass: 94 files, 1075 tests.Code of Conduct