Skip to content

Add AnalyticsAdminGuard restricting sensitive analytics endpoints - #603

Merged
A6dulmalik merged 1 commit into
MindBlockLabs:mainfrom
web3nova:main
Jul 27, 2026
Merged

Add AnalyticsAdminGuard restricting sensitive analytics endpoints#603
A6dulmalik merged 1 commit into
MindBlockLabs:mainfrom
web3nova:main

Conversation

@web3nova

Copy link
Copy Markdown
Contributor

Description

Adds an AnalyticsAdminGuard that restricts sensitive analytics endpoints (churn-risk, exports, raw event listing) to admin users only, following the pattern of backend/src/roles/roles.guard.ts.

Changes

  • roles.decorator.ts: Added ANALYTICS_ADMIN_KEY and AnalyticsAdmin() decorator
  • analytics-admin.guard.ts: Refactored to use Reflector pattern (matching RolesGuard)
  • analytics.controller.ts: Added @AnalyticsAdmin() decorator to guarded routes
  • analytics-admin.guard.spec.ts: Unit tests with allow (admin) and deny (user/guest/unauthenticated) cases

Acceptance Criteria

  • Non-admin users receive a 403 on guarded routes ✓
  • Admin users pass through normally ✓
  • Guard is unit tested with both allow and deny cases ✓

Closes #551

…nit tests

- Add ANALYTICS_ADMIN_KEY + AnalyticsAdmin() decorator to roles.decorator.ts
- Refactor AnalyticsAdminGuard to use Reflector (matching RolesGuard pattern)
- Add @AnalyticsAdmin() decorator to guarded analytics controller routes
- Add unit test with allow (admin) and deny (user/guest/unauthenticated) cases

Closes MindBlockLabs#551
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
mind-block-app-frontend Skipped Skipped Jul 27, 2026 2:49am

@A6dulmalik
A6dulmalik merged commit f489eab into MindBlockLabs:main Jul 27, 2026
6 of 7 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.

Add AnalyticsAdminGuard restricting sensitive endpoints

2 participants