Skip to content

[Bug] Hardcoded SUPER_ADMIN_EMAIL Blocks Environment-Driven Super Admin Access #224

@Aditya948351

Description

@Aditya948351

Severity

Intermediate

Affected File & Line Number Range

src/components/admin/AdminDashboard.tsx (Line 45)

Detailed Description

The email address for the super administrator is hardcoded to a static string:

const SUPER_ADMIN_EMAIL = "admin@devpath.com";

This directly conflicts with the dynamic environment configuration variable process.env.NEXT_PUBLIC_SUPER_ADMIN_EMAIL used on the ap/page.tsx login page. Under a custom deployment (where the super admin email is changed), the dashboard controls will fail to identify the admin user correctly. This blocks critical features or lets admins demote/delete themselves by accident.

Steps to Reproduce

  1. Deploy the site with NEXT_PUBLIC_SUPER_ADMIN_EMAIL set to a custom address.
  2. Sign in as the super admin.
  3. View the Admin Dashboard.
  4. Try to manage other admins or notice that the application fails to protect your own account because the dashboard checks against admin@devpath.com.

Proposed Solution

Refactor AdminDashboard.tsx to retrieve the super admin email from the global environment variable:

const SUPER_ADMIN_EMAIL = process.env.NEXT_PUBLIC_SUPER_ADMIN_EMAIL;

Ensure fallback variables are set uniformly across all component files.

Metadata

Metadata

Assignees

Labels

gssoc26This is a official GirlScript Summer of Code label.level:intermediateIntermediate level issuestype:bug

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions