Varchar limits are probably too low and/or need better enforcement #26

Open
opened 2023-03-17 19:03:37 +01:00 by MoralCode · 2 comments
Owner

github.com/MoralCode/ClassClockAPI@fa35cfe710/common/db_schema.py (L46) as an example of the one that was causing issues (edit: its the 20 character limit on BellScheduleDisplayName thats causing issues)

it seems this is currently being enforced/caught at the sqlalchemy layer by as a DataError. which is probably a dumb way to do it

pending further evaluation and root-causing as the affected column ((mysql.connector.errors.DataError) 1406 (22001): Data too long for column 'bell_schedule_display_name' at row 1) wasnt being given a string that was too long (only 27 ASCII characters). This will also likely require a schema change

https://github.com/MoralCode/ClassClockAPI/blob/fa35cfe710ab55596c1a5742a5ff4015d9c5dc20/common/db_schema.py#L46 as an example of the one that was causing issues (edit: its the 20 character limit on BellScheduleDisplayName thats causing issues) it seems this is currently being enforced/caught at the sqlalchemy layer by as a [DataError](https://docs.sqlalchemy.org/en/13/errors.html#error-9h9h). which is probably a dumb way to do it pending further evaluation and root-causing as the affected column (`(mysql.connector.errors.DataError) 1406 (22001): Data too long for column 'bell_schedule_display_name' at row 1`) wasnt being given a string that was too long (only 27 ASCII characters). This will also likely require a schema change
Author
Owner

Sentry incident refs: CLASSCLOCK-API-7 CLASSCLOCK-API-9

can confirm this crash is replicable when the display name is too long (such as "this is a really long display name for testing purposes")

Sentry incident refs: CLASSCLOCK-API-7 CLASSCLOCK-API-9 can confirm this crash is replicable when the display name is too long (such as "this is a really long display name for testing purposes")
Author
Owner

added client side validation in github.com/MoralCode/ClassClock@47ffde16ce to make this less likely to happen. still needs to be fixed at the schema level though

added client side validation in https://github.com/MoralCode/ClassClock/commit/47ffde16cedce412fa32b96da7cff9835d152ad1 to make this less likely to happen. still needs to be fixed at the schema level though
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ClassClock/API#26
No description provided.