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

Check user profile field lengths #470

Merged
merged 1 commit into from
Mar 3, 2023

Conversation

HebaruSan
Copy link
Contributor

Problem

The server recently had to be restarted with lots of this in the log:

psycopg2.errors.StringDataRightTruncation: value too long for type character varying(10000)

Cause

The database only allows 10000 characters for user descriptions.

description = Column(Unicode(10000), default='')

But the Python code just passes whatever it receives, and some spammer tried to create a user description that was too long. Somehow this seems to have confused gunicorn into repeating the attempt and taking up lots of CPU. Auto retry somehow?

Changes

Now the profile save code check the lengths of the inputs before using them, and if any exceeds their limits, it aborts. Similar to a side fix in #357 for mod editing.

Fixes #469.

@HebaruSan HebaruSan added Type: Bug Area: Backend Related to the Python code that runs inside gunicorn Priority: High Status: Ready Scope: Trivial Simple changes that should be easy to develop and review labels Mar 3, 2023
@V1TA5 V1TA5 merged commit 6656065 into KSP-SpaceDock:alpha Mar 3, 2023
@HebaruSan HebaruSan deleted the fix/profile-desc-len branch March 3, 2023 18:37
This was referenced Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Backend Related to the Python code that runs inside gunicorn Priority: High Scope: Trivial Simple changes that should be easy to develop and review Status: Ready Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants