Skip to content

feat(market): allow verified email identities to administer markets - #3860

Merged
bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:feat/market-admin-emails
Nov 10, 2026
Merged

bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:feat/market-admin-emails

Conversation

@bobleer

@bobleer bobleer commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add MARKET_ADMIN_EMAILS so operators who sign in with a code-verified email identity can administer the MiniApp market without a GitHub account.
  • Today AuthService::is_admin only matches MARKET_ADMIN_GITHUB_IDS and additionally requires github_id > 0, so email-code identities (always github_id = 0) can never reach the review queues even when the deployment wants them to.
  • No change for existing deployments: the new setting is empty by default and GitHub ID admins behave exactly as before.

Type and Areas

Type: Feature

Areas: Rust services (miniapp-market-service), deploy template

Motivation / Impact

Self-hosted market operators often sign in with the email one-time code (email_identities) rather than linking GitHub. The skin market already delegates its admin decision to the MiniApp market's GET /api/v1/me (isAdmin), so one identity check fixes both review queues.

is_admin now delegates to is_admin_identity(config, github_id, email): a verified email match grants admin the same way a configured GitHub ID does.

Only addresses recorded in email_identities are considered, and those rows are created exclusively after a one-time code is verified, so a public GitHub profile email can never grant admin. Comparison is case-insensitive and trimmed. The parser also drops entries without @.

Verification

  • cargo test --release -p openbitfun-miniapp-market-service --lib — passed (60 tests, including new config::tests::admin_emails_* and auth::tests::administrators_are_matched_by_github_id_or_verified_email)
  • cargo fmt --check — no diff in the touched files
  • Manual end-to-end check against a self-hosted deployment running the patched build on top of the same commit: GET /api/v1/me returns isAdmin: true for a configured verified-email identity, and both /miniapp/api/v1/admin/submissions and /skin/api/v1/admin/submissions return 200 for it, while a non-configured email identity still reports isAdmin: false and bobleer's GitHub admin is unchanged. Skin market image was not rebuilt; it picked the flag up through /api/v1/me.

AI-assisted change; testing level: fully tested (unit tests + manual deployment check).

Reviewer Notes

Deployment: set MARKET_ADMIN_EMAILS in the market environment, e.g. MARKET_ADMIN_EMAILS=admin@example.com,second@example.com. Empty/unset keeps the previous GitHub-only behaviour. No migration and no schema change, so rollback is simply unsetting the variable.

Known boundary (unchanged by this PR): the review-approval path checks the submission's submitter_github_id against admin_github_ids (around routes.rs:1647). An email administrator publishing a new release of a listing owned by another account therefore takes the non-admin branch and can hit release_conflict. Review actions themselves are unaffected; extending that check to email identities would be a separate change.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable. (Environment variable documented in market.env.example and the market server README; no UI strings changed.)

Generated with OpenBitFun

MARKET_ADMIN_EMAILS complements MARKET_ADMIN_GITHUB_IDS so an operator can
review MiniApp and skin submissions when signing in with a code-verified
email identity instead of GitHub. Emails come from email_identities, so an
unverified public profile address can never grant admin.
@bobleer
bobleer merged commit 98612bb into openBitFun:main Nov 10, 2026
12 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