Skip to content

[BUG] Display Name is not validated before saving, causing SQL error when exceeding VARCHAR(50) #51

Description

@s4l1mz

Environment

  • Issabel: 5.0.0
  • IssabelPBX: 2.12.0-5
  • Asterisk: 18.19.0
  • OS: Rocky Linux 8.10
  • Database: MariaDB

Description

When editing an extension, IssabelPBX allows entering a Display Name longer than the database column can store.

Instead of validating the input and displaying a user-friendly message, the application executes the SQL statement and exposes a database exception.

Steps to reproduce

  1. Open PBX → Extensions.
  2. Edit an existing extension.
  3. Set the Display Name to a value longer than 50 characters.

Example:

ADMINISTRATIVE - IT-SUPPORT-DEPT - Some Name Here For Test
  1. Click Submit and then Apply Config.

Actual behavior

IssabelPBX displays a Fatal Error:

Data too long for column 'name' at row 1

The generated SQL is similar to:

INSERT INTO users
(extension,password,name,...)
VALUES
(
'EXTENSINONUMBER',
'',
'ADMINISTRATIVE - IT-SUPPORT-DEPT - Some Name Here For Test',
...
)

The stack trace shows the exception being raised while executing core_users_add().

Expected behavior

The application should validate the Display Name before attempting the INSERT.

Possible solutions:

  • Prevent values longer than the allowed database limit.
  • Add an HTML maxlength attribute to the input field.
  • Display a validation error such as:
Display Name cannot exceed 50 characters.

instead of exposing the SQL exception.

Additional information

The users table defines the field as:

MariaDB [asterisk]> DESCRIBE users;

+-----------+-------------+
| Field     | Type        |
+-----------+-------------+
| name      | varchar(50) |
+-----------+-------------+

The GUI currently allows values longer than 50 characters and only fails after submitting the form.

This is therefore an input validation issue rather than a database issue.

Suggested improvement

The form should enforce the same limit defined by the database schema before executing the SQL statement, avoiding an uncaught database exception and improving the user experience.

The issue is not that the database rejects oversized values. The problem is that the UI performs no client-side or server-side validation before executing the INSERT. A simple length validation (or HTML maxlength) would prevent the fatal SQL error and provide a much better user experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions