Remove Hardcoded Default Admin Username in Node.js Environment Config

Đang mở
#170 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, node.js, typescript

Hướng nghiên cứu

Start with apps/node/src/env.ts and trace how environment variables are validated and consumed at startup. Check .env.test.example, .dev.vars.example, and the Node/Docker self-hosting documentation for the required variable. Done means a missing or blank value produces the stated actionable error and the examples and documentation explain how to set it; run the listed typecheck, tests, and lint commands.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug good first issue

Summary

When running Codra in Node.js / Docker mode without explicitly setting DASHBOARD_ALLOWED_USERS, the application defaults to granting dashboard admin access to a hardcoded GitHub username (devarshishimpi). Self-hosting operators who do not set this variable are locked out of their own dashboard while an unintended user may have access.

Affected File

apps/node/src/env.ts lines 59-60:

DASHBOARD_ALLOWED_USERS:
  process.env.DASHBOARD_ALLOWED_USERS || "devarshishimpi",

Impact

  • A self-hoster who follows the quickstart (docker run -p 3000:3000 devarshishimpi/codra) without reading .env.example configures an instance that only allows devarshishimpi to log in.
  • The self-hoster cannot access their own dashboard.
  • If someone follows the Docker quickstart exactly as documented, they get a broken, inaccessible dashboard with no error message explaining why.

Proposed Fix

Replace the silent default with an explicit startup error:

const allowedUsers = process.env.DASHBOARD_ALLOWED_USERS;
if (!allowedUsers || allowedUsers.trim() === "") {
  throw new Error(
    "Missing required environment variable: DASHBOARD_ALLOWED_USERS\n" +
    "Set it to a comma-separated list of GitHub usernames that are allowed to access the dashboard.\n" +
    "Example: DASHBOARD_ALLOWED_USERS=your-github-username"
  );
}
DASHBOARD_ALLOWED_USERS: allowedUsers,

Additionally:

  • Update .env.test.example and .dev.vars.example to include a clear placeholder for DASHBOARD_ALLOWED_USERS
  • Update the Node/Docker setup documentation to call out this variable as required

Done When

  • Starting the Node server without DASHBOARD_ALLOWED_USERS set throws a clear, actionable startup error
  • .env.test.example and .dev.vars.example include a documented placeholder for this variable
  • The self-hosting documentation explains this variable is required
  • npm run typecheck, npm test, and npm run lint all pass
Ngôn ngữ chính
TypeScript
Star
125
Fork
23
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
12

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của devarshishimpi/codra

Tất cả issue của devarshishimpi/codra

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.