jacob-ai-bot / jacob

Just Another Coding Bot
https://jacb.ai
Apache License 2.0
131 stars 20 forks source link

Improper Trimming of Usernames in `DASHBOARD_USERS` Environment Variable Leads to Authentication Bugs #308

Closed kleneway closed 2 weeks ago

kleneway commented 2 weeks ago

Description

There is a bug in the handling of the DASHBOARD_USERS environment variable where usernames are split by commas but are not trimmed of leading or trailing whitespace. This causes issues when the list includes spaces after commas, such as "user1, user2, user3". The resulting usernames contain unintended spaces (e.g., " user2" instead of "user2"), leading to authentication failures and user validation errors within the dashboard.

Impact

Expected Behavior

When parsing the DASHBOARD_USERS environment variable:

Steps to Reproduce

  1. Set the DASHBOARD_USERS environment variable in .env or .env.example to include spaces after commas:
    DASHBOARD_USERS=user1, user2, user3
  2. Start the application.
  3. Attempt to authenticate as user2.
  4. Observe that authentication fails due to the username being parsed as " user2" with a leading space.

Possible Solution

Adjust the parsing logic for DASHBOARD_USERS to: