π Release v2.475.27
βββ Complex Integrity & Security β’ 16 commits β’ 92 filesThis release prioritizes platform security and integrity with critical permission guard fixes, admin route access control hardening, and a significant security fix preventing unauthorized token escalation. Additional improvements include refined theme contrast for accessibility and UI polish.
Whatβs New
- Permission Guard Restoration: Fixed 17 dead permission checks across admin analytics endpoints (user, achievement, challenge, reward, organization stats) that prevented unauthorized data access
- Admin Proxy Security Hardening: Blocked direct admin route access through the user app proxy and prevented unauthorized token lending to member sessions
- Challenge Stats Route Access Control: Added comprehensive authentication and authorization enforcement for challenge statistics endpoints with tenant-scoped action lookups
- Theme Contrast Improvements: Enhanced challenge option visibility by ensuring primary colors have sufficient contrast against backgrounds, with automatic accent color substitution when needed
- Game Tutorial Theme Alignment: Tutorial screens now respect the communityβs game appearance colors and gracefully skip unresolvable icons
- UI Polish: Hidden disabled state separators in info modals for cleaner appearance
Apps Updated
User App
β Updated - Theme contrast, proxy security, tutorial styling
API
β Updated - Permission guard restoration, analytics RBAC
Admin
β Updated - Challenge stats route access control, UI polish
MCP Server
β No changes
Website
β No changes
Games
β Updated - Tutorial appearance theming
Detailed Changes
User App
User App
- Theme Contrast System β Added
ensurePrimaryContrastInVars()function that automatically substitutes primary color with accent when contrast against background is insufficient (< 15 lightness difference) - Color Control Variables β Generate control-scoped theme variables (
--control-surface,--control-foreground,--control-border, etc.) ensuring form controls adapt to community colors - Ring Color Resolution β Auto-generate
--ringcolor from primary when not explicitly set, using both primary and accent for better visual feedback - Foreground & Popover Fallbacks β Ensure primary/secondary foreground colors and popover surfaces have sensible defaults when not explicitly themed
- Proxy Security Hardening β Removed automatic forwarding of user access tokens to the API; upload routes now exclusively use org-level API tokens
- Admin Route Blocking β Blocked all direct admin API routes through the user app proxy, returning HTTP 404 to prevent unauthorized access
- Community Banner UI β Hidden separator divider when info modal is disabled for cleaner visual hierarchy
- Tutorial Appearance Binding β Tutorial layout now reads and applies game appearance colors (background, primary, secondary) from the community theme
- Icon Fallback Handling β Skip unresolvable icon references in tutorial screens instead of breaking the layout
- Comprehensive Test Coverage β Added 600+ lines of test coverage for theme utilities, color contrast validation, and control variable generation
API
API
- Permission Guard Restoration β Restored 17 dead
!ctx.can.read()permission checks across admin analytics endpoints - User Analytics Access Control β Added org-level and community-scoped RBAC checks to user analytics endpoints (
get-user-activity-timeseries) - Organization Analytics Access Control β Added permission validation to org-level stats endpoints (
get-org-communities,get-org-stats-overview) - Challenge Analytics Access Control β Enforced Challenge read permission on
get-challenge-stats-overview - Achievement Analytics Access Control β Added permission checks to achievement completion batch and participant list endpoints
- Community Analytics Access Control β Enforced Community read permission on community stats endpoints
- Reward Analytics Access Control β Added permission validation to reward allocation and timeline endpoints
- Community-Scoped User Access β Added community-level RBAC validation to prevent users from reading data across unauthorized communities
- User Create/Get/Sync Authorization β Implemented community-scoped permission checks on user admin endpoints with detailed error logging
- Comprehensive Auth Tests β Added 300+ lines of test coverage for permission scenarios and org/community-scoped access validation
Admin
Admin
- Challenge Stats Route Access Control β Created
require-challenge-route-access.tshelper providing centralized auth and authorization for challenge statistics routes - Session Authentication β Required valid admin session for all challenge stats endpoints with detailed 401/403 error responses
- Organization ID Validation β Enforced organisation ID parameter presence and ObjectId format validation
- Challenge ID Validation β Added challenge ID presence and format validation with detailed error messages
- RBAC Permission Enforcement β Super-admin bypass plus role-based Challenge and Action read permission checks
- Tenant-Scoped Challenge Lookup β Retrieve challengeβs organization location and verify tenant membership to prevent cross-org data access
- Community-Scoped Action Lookups β Validate action belongs to challengeβs community before exposing allocation data
- Comprehensive Audit Logging β Detailed
log.warn()calls for every auth failure with userId, org, reason, and error context - Refactored Stats Routes β Simplified
multiple-choice-stats,results,receipt-detections, andimage-uploadsroutes using centralized access helper - Consistent Error Handling β Standardized 401/403/404 responses across all challenge stats endpoints
Games
Games
- Tutorial Theme Integration β Tutorial layout reads and applies community game appearance colors to the interface
- Color Application β Primary, secondary, and background colors from community theme now style the tutorial container
- Icon Resolution β Skip unresolvable icon references gracefully instead of failing the entire tutorial
- Appearance Utility β Created
tutorial-appearance.tshelper to extract and normalize game appearance colors from theme - Test Coverage β Added 300+ lines of test coverage for tutorial layout color application and icon handling
Technical Details
Permission Guard Restoration
The API shipped 17 permission checks across admin analytics endpoints that were never executed due to unreachable code paths. This release restores all of them:- Scope:
get-achievement-completion-batch,get-achievement-participants-list,get-challenge-completion-batch,get-challenge-stats-overview,get-community-stats-overview,get-dashboard-callouts,get-new-members-timeseries,get-wau-timeseries,get-org-communities,get-org-stats-overview,get-allocations-overview,get-reward-recipients,get-reward-timeline,get-user-activity-timeseries, plus user admin endpoints (create-user,get-user-by-id,sync-user-to-external-account) - Impact: Prevents unauthorized users from accessing organization and community analytics, user directory, and reward distribution data
- Enforcement: All checks are RBAC-aware and include community-scoped access validation for endpoints serving multiple-community data
Proxy Security Model
The user app proxy (/api/proxy/[...path]) previously allowed:
- Direct forwarding of admin routes to the API (security boundary violation)
- Automatic token escalation β member sessions would send their access tokens to any proxied route
- Blocks all
/api/v2/adminroutes β returns HTTP 404 to prevent accidental exposure - Removes automatic token forwarding β only upload routes use the org-level API token; integration routes must supply their own credentials
- Maintains backward compatibility β upload functionality unchanged, integration routes unchanged
Theme Contrast Algorithm
The new contrast system measures HSL lightness difference between primary and background colors:- Formula:
|primary_lightness - background_lightness| - Threshold: 15% difference minimum
- Fallback: When contrast is insufficient, the system automatically substitutes primary with accent color
- Atomic: Both
--primaryand--primary-foregroundswap simultaneously to maintain the theme relationship - Safe Mode: Falls back to default accent if the incoming theme lacks either color
Challenge Stats Route Access
The new centralizedrequire-challenge-route-access() helper:
- Validates session β requires authenticated admin user
- Validates parameters β organisation ID and challenge ID must be present and valid ObjectIds
- Enforces RBAC β checks Challenge and Action read permissions, allows SuperAdmin bypass
- Scopes to tenant β retrieves challengeβs organisation location and prevents cross-org leakage
- Scopes to community β validates action allocations belong to the challengeβs community
- Logs all failures β detailed audit trail for security investigation
Contributors
@erek_d7 commits β’ +27,825/-0 lines
@dch4 commits β’ +833/-729 lines
@jamescockayne2 commits β’ +738/-182 lines
@zuhayrk001 commit β’ +835/-1,006 lines
@solicshop1 commit β’ +384/-16 linesRelease Stats
v2.475.27 deployed on August 12, 2026

