Skip to content

Fix/player-name-validation : Add length validation to Player name field to prevent DB truncation errors#2308

Merged
sydseter merged 5 commits intoOWASP:masterfrom
prakhar0x01:fix/player-name-validation
Feb 26, 2026
Merged

Fix/player-name-validation : Add length validation to Player name field to prevent DB truncation errors#2308
sydseter merged 5 commits intoOWASP:masterfrom
prakhar0x01:fix/player-name-validation

Conversation

@prakhar0x01
Copy link
Copy Markdown
Contributor

Issue Related : #2307

Summary

This PR adds length validation to the Player schema to prevent database-level truncation errors when names exceed the defined column size.

Changes Made

  • Added validate_length(:name, min: 1, max: 100) to Player.changeset/2

  • Ensures input is validated at the application layer before database insertion

  • Prevents string_data_right_truncation database error

  • Prevents LiveView crash and HTTP 500 response

Before

Submitting a name longer than 255 characters resulted in:

  • PostgreSQL error 22001

  • LiveView crash

  • 500 response

After

Submitting a name exceeding the allowed limit:

  • Fails validation cleanly

  • Returns a changeset error

  • Does not trigger a database exception

  • No 500 response

@prakhar0x01 prakhar0x01 force-pushed the fix/player-name-validation branch 2 times, most recently from 923870c to 61745c9 Compare February 19, 2026 18:36
@prakhar0x01
Copy link
Copy Markdown
Contributor Author

@sydseter ,

Everything is good from my side,

Please take a look at CI checks.

Thanks,
@prakhar0x01

@prakhar0x01 prakhar0x01 deleted the fix/player-name-validation branch February 20, 2026 05:17
@prakhar0x01 prakhar0x01 restored the fix/player-name-validation branch February 20, 2026 09:20
@prakhar0x01 prakhar0x01 reopened this Feb 20, 2026
@prakhar0x01
Copy link
Copy Markdown
Contributor Author

@sydseter ,

This is done,

Please take a look at : #2307

Thanks,
@prakhar0x01

prakhar0x01 and others added 3 commits February 20, 2026 21:57
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Potential fix for code scanning alert no. 1: Bad HTML filtering regexp
@prakhar0x01 prakhar0x01 force-pushed the fix/player-name-validation branch 3 times, most recently from dabbeae to 4d2b860 Compare February 21, 2026 06:44
@prakhar0x01
Copy link
Copy Markdown
Contributor Author

@sydseter ,

I think I need to update the package.json , it create unneccessary problems in CI checks.

@prakhar0x01 prakhar0x01 force-pushed the fix/player-name-validation branch 2 times, most recently from cab30c9 to cfc5288 Compare February 21, 2026 07:04
@prakhar0x01 prakhar0x01 force-pushed the fix/player-name-validation branch from 47f0e31 to 269339b Compare February 21, 2026 09:44
@prakhar0x01 prakhar0x01 force-pushed the fix/player-name-validation branch from edea7c4 to d2a9f8b Compare February 21, 2026 10:26
@prakhar0x01
Copy link
Copy Markdown
Contributor Author

@sydseter ,

I think we are done, CI checks are quite challenging 😅,

Anyway, all commits are verified, and the changes are applied to the updated code from owasp/master.

Thanks,
@prakhar0x01

sydseter
sydseter previously approved these changes Feb 26, 2026
@prakhar0x01 prakhar0x01 dismissed sydseter’s stale review February 26, 2026 10:57

The merge-base changed after approval.

@sydseter sydseter self-requested a review February 26, 2026 11:00
@sydseter sydseter merged commit 7d75ffb into OWASP:master Feb 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants