Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Backend Allows Inviting Users with Invalid Email Formats in Local Part of the Email Addresses #7134

Open
arindam-sahoo opened this issue Jan 29, 2025 · 0 comments
Labels
A-errors Area: error messages, structure & logging

Comments

@arindam-sahoo
Copy link
Contributor

arindam-sahoo commented Jan 29, 2025

The backend currently allows invitations to be sent to users with improperly formatted email addresses. When querying user details with an invalid email, the API correctly returns a Json deserialize error, indicating inconsistent validation across endpoints.

Steps to Reproduce:

  1. Send an invite:

    curl '{{baseUrl}}/api/user/user/invite_multiple?auth_id=' \
      -H 'authorization: auth_token' \
      -H 'content-type: application/json' \
      -H 'cookie: some_cookie' \
      --data-raw '[{"email":"#[email protected]","name":"#$gdyhasd","role_id":"merchant_view_only"}]'
    
  2. Response:

    [{"email":"#[email protected]","is_email_sent":true}]
    • The API accepts the invalid email format.
  3. Attempt to retrieve user details using an invalid email:

    curl '{{baseUrl}}/api/user/user' \
      -H 'authorization: auth_token' \
      -H 'content-type: application/json' \
      -H 'cookie: some_token' \
      --data-raw '{"email":""}'
    
  4. Response:

    {
        "error": {
            "error_type": "invalid_request",
            "message": "Json deserialize error: Failed to parse email at line 1 column 12",
            "code": "IR_06"
        }
    }

Invalid Characters in the Local Part (#$gdyhasd):

  • The local part of an email address (before @) can include letters, digits, and certain special characters like . (dot), _ (underscore), and - (hyphen).
  • Special characters like # and $ are not allowed unless they are part of a quoted string (e.g., "#$gdyhasd").

Domain Part:

  • This part seems fine as it allows emails addresses that follows the format of a valid domain name: letters, digits, and hyphens followed by a valid top-level domain (e.g., '.in', '.com').
@arindam-sahoo arindam-sahoo added the A-errors Area: error messages, structure & logging label Jan 29, 2025
@juspay juspay deleted a comment from 726laoho Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-errors Area: error messages, structure & logging
Projects
None yet
Development

No branches or pull requests

1 participant