feat(groups): add fail-closed admission management
CI / validate (push) Successful in 5m13s
Release / release (push) Successful in 7m8s

This commit is contained in:
dmg
2026-08-01 18:36:45 -04:00
parent 19a5d04178
commit b88097c15a
32 changed files with 1910 additions and 29 deletions
+1
View File
@@ -30,6 +30,7 @@ This OKF bundle is the product record for implemented and proposed behavior. Sto
* [US-014 — Receive standardized API errors](us-014-problem-details.md) - Application APIs return RFC 9457 Problem Details.
* [US-015 — Deploy and operate securely](us-015-platform-operations.md) - Operators have reproducible builds, migrations, credentials, and security controls.
* [US-016 — Build and publish versioned releases](us-016-automated-releases.md) - Gitea Actions publish the Velocity JAR and web and migration images.
* [US-017 — Control admission with groups](us-017-group-access.md) - Administrators assign users to groups that explicitly grant Minecraft access.
# Tracking
+1
View File
@@ -2,6 +2,7 @@
## 2026-08-01
* **Extend**: Add SoMC Portal branding, live Discord identity details, admin guild configuration visibility, and fail-closed group-based Minecraft admission.
* **Refine**: Group repeated access networks, confirm linked Discord nickname changes before mutation, and add DMG Games sponsorship attribution.
* **Extend**: Add shared Pino logging with credential redaction and actionable web and Discord runtime diagnostics.
* **Fix**: Build magic-link redirects from the configured public portal URL instead of the reverse proxy's internal request origin.
+3 -1
View File
@@ -3,7 +3,7 @@ type: User Story
title: Enter the account portal through Discord
description: Direct visitors are guided to the configured Discord community and its account commands.
tags: [player, portal, discord, onboarding]
timestamp: 2026-08-01T22:04:17Z
timestamp: 2026-08-01T22:34:31Z
story_id: US-001
status: verified
---
@@ -19,12 +19,14 @@ As a prospective player, I want the portal to direct me to the community Discord
- [x] Given a configured guild ID, when the visitor selects the app action, then a `discord://` guild link is opened.
- [x] Given an unauthenticated protected-page request, when authorization fails, then the visitor returns to the portal with prominent Discord instructions.
- [x] Every portal page credits Social Minecraft sponsorship by DMG Games and links to `https://dmg.games`.
- [x] Portal branding uses the SoMC Portal name and a dedicated favicon.
# Implementation
- [`apps/web/src/app/page.tsx`](../apps/web/src/app/page.tsx)
- [`apps/web/src/lib/auth/user-session.ts`](../apps/web/src/lib/auth/user-session.ts)
- [`apps/web/src/components/site-footer.tsx`](../apps/web/src/components/site-footer.tsx)
- [`apps/web/src/app/icon.svg`](../apps/web/src/app/icon.svg)
- Configuration: `DISCORD_GUILD_ID`, `DISCORD_INVITE_URL`
# Validation
+3 -1
View File
@@ -3,7 +3,7 @@ type: User Story
title: Manage linked accounts from the dashboard
description: Authenticated users maintain their profile and active Java Edition accounts.
tags: [player, dashboard, minecraft, profile]
timestamp: 2026-08-01T22:04:17Z
timestamp: 2026-08-01T22:34:31Z
story_id: US-005
status: verified
---
@@ -22,6 +22,8 @@ As a registered player, I want to manage my profile and linked Minecraft account
- [x] Removing a primary account promotes another active account when one exists.
- [x] Name and primary changes preview the expected Discord nickname and require explicit confirmation before either profile mutation occurs.
- [x] The dashboard shows recent portal and game IP observations with classification and available location.
- [x] The dashboard shows the user's Discord display name, username, guild nickname, and immutable Discord ID.
- [x] The dashboard shows effective access groups and whether each group grants Minecraft access.
- [x] The user can revoke the current session by signing out.
# Implementation
+4 -2
View File
@@ -3,7 +3,7 @@ type: User Story
title: Enforce registration at the Velocity proxy
description: Online-mode Java connections are admitted only after a fail-closed account-manager decision.
tags: [minecraft, velocity, whitelist, security]
timestamp: 2026-08-01T18:52:20Z
timestamp: 2026-08-01T22:34:31Z
story_id: US-009
status: verified
---
@@ -22,7 +22,8 @@ As a registered player, I want the Velocity proxy to recognize my approved Java
- [x] Username fallback applies only when the stored account has no UUID.
- [x] Successful fallback backfills UUID and canonical username.
- [x] Changed usernames are persisted and audited.
- [x] Unknown players, API failures, malformed responses, and unauthorized requests fail closed with registration guidance.
- [x] Registered players are allowed only when at least one assigned group has access enabled.
- [x] Unknown players, group-disabled players, API failures, malformed responses, and unauthorized requests fail closed with registration guidance.
- [x] The plugin records the real Velocity connection IP and supports Java Edition online mode only.
# Implementation
@@ -41,3 +42,4 @@ As a registered player, I want the Velocity proxy to recognize my approved Java
- [Validate Minecraft accounts](us-004-minecraft-validation.md)
- [Standardize API errors](us-014-problem-details.md)
- [Control Minecraft admission with groups](us-017-group-access.md)
+2 -2
View File
@@ -3,7 +3,7 @@ type: User Story
title: Operate settings and audit views
description: Authorized administrators control server messaging and investigate recent platform events.
tags: [admin, settings, audit, operations]
timestamp: 2026-08-01T18:43:58Z
timestamp: 2026-08-01T22:34:31Z
story_id: US-012
status: verified
---
@@ -14,7 +14,7 @@ As an administrator, I want operational settings and audit visibility, so that I
# Acceptance Criteria
- [x] The admin console reports whether deployment-managed Discord guild and invite settings are configured.
- [x] The admin console shows the deployment-managed Discord guild ID and linked invite URL.
- [x] An authorized administrator can update the denied-player registration message.
- [x] Settings actions validate message length server-side.
- [x] Administrators can browse the latest 100 events.
+3 -2
View File
@@ -3,7 +3,7 @@ type: User Story
title: Manage users as an administrator
description: Authorized operators search users and maintain their names, linked accounts, primaries, and Discord nicknames.
tags: [admin, users, minecraft, discord]
timestamp: 2026-08-01T18:43:58Z
timestamp: 2026-08-01T22:34:31Z
story_id: US-013
status: verified
---
@@ -16,7 +16,7 @@ As an administrator, I want to manage a user's identity and Minecraft accounts,
- [x] Administrators can search by preferred name, Discord username or ID, Minecraft username, or UUID.
- [x] Search results show onboarding state, primary username, and active account count.
- [x] A user detail view shows Discord identity, active accounts, recent events, and recent IP observations.
- [x] A user detail view shows Discord display name, username, guild nickname, immutable ID, active accounts, groups, recent events, and recent IP observations.
- [x] Administrators can update the preferred name and synchronize Discord.
- [x] Administrators can add Mojang-verified accounts or explicitly override an unverified username.
- [x] Administrators can remove an account only after a visible confirmation step.
@@ -39,3 +39,4 @@ Nickname fallback behavior is tested in [`packages/minecraft/test/minecraft.test
- [Administrator SSO](us-011-admin-sso.md)
- [Synchronize Discord nicknames](us-006-discord-nickname.md)
- [Control Minecraft admission with groups](us-017-group-access.md)
+44
View File
@@ -0,0 +1,44 @@
---
type: User Story
title: Control Minecraft admission with groups
description: Administrators assign users to groups and enable Minecraft access through explicit group policy.
tags: [admin, groups, authorization, velocity, security]
timestamp: 2026-08-01T22:36:20Z
story_id: US-017
status: verified
---
# User Story
As an administrator, I want to organize registered users into access groups, so that server admission can be enabled for selected communities while remaining off by default.
# Acceptance Criteria
- [x] Every registered user implicitly belongs to the protected `everyone` group.
- [x] The `everyone` group is created with Minecraft access disabled.
- [x] Administrators can create groups with access disabled by default.
- [x] Administrators can add and remove users from non-default groups.
- [x] Administrators can enable or disable Minecraft admission for each group.
- [x] A registered player is admitted when any assigned group has access enabled.
- [x] A registered player is denied when none of their groups has access enabled.
- [x] Group creation, membership, and access-policy changes are audited.
- [x] Users and administrators can inspect the user's effective group assignments.
# Implementation
- [`packages/database/src/schema.ts`](../packages/database/src/schema.ts)
- [`packages/database/drizzle/0002_simple_queen_noir.sql`](../packages/database/drizzle/0002_simple_queen_noir.sql)
- [`apps/web/src/app/admin/(console)/groups/page.tsx`](../apps/web/src/app/admin/%28console%29/groups/page.tsx)
- [`apps/web/src/app/admin/(console)/groups/[groupId]/page.tsx`](../apps/web/src/app/admin/%28console%29/groups/%5BgroupId%5D/page.tsx)
- [`apps/web/src/app/api/velocity/access/route.ts`](../apps/web/src/app/api/velocity/access/route.ts)
# Validation
- [`packages/auth/test/group-access.test.ts`](../packages/auth/test/group-access.test.ts)
- Drizzle migration generation, TypeScript validation, tests, lint, and the production build must pass.
# Related Stories
- [Enforce registration at Velocity](us-009-velocity-admission.md)
- [Manage users as an administrator](us-013-admin-user-management.md)
- [Preserve an audit trail](us-010-audit-events.md)