summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-02-02 22:15:03 +1100
committerGitHub <noreply@github.com>2023-02-02 22:15:03 +1100
commita03f7c894809d4db48cf5c417c07f3fb0d0fde30 (patch)
tree27f18299686d00765df85b9d206fee64ef12563e /src
parentUse erlpack instead of @yukikaze-bot/erlpack (#968) (diff)
downloadserver-a03f7c894809d4db48cf5c417c07f3fb0d0fde30.tar.xz
Merge pull request from GHSA-r7h4-76f7-6264
* Actually use maxUsername config value.

* Change maxUsername default to discord.com default
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/users/@me/index.ts10
-rw-r--r--src/util/config/types/subconfigurations/limits/UserLimits.ts2
2 files changed, 11 insertions, 1 deletions
diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts

index 0d3c3135..30091344 100644 --- a/src/api/routes/users/@me/index.ts +++ b/src/api/routes/users/@me/index.ts
@@ -129,6 +129,16 @@ router.patch( }, }); } + + const { maxUsername } = Config.get().limits.user; + if (check_username.length > maxUsername) { + throw FieldErrors({ + username: { + code: "USERNAME_INVALID", + message: `Username must be less than ${maxUsername} in length`, + }, + }); + } } if (body.discriminator) { diff --git a/src/util/config/types/subconfigurations/limits/UserLimits.ts b/src/util/config/types/subconfigurations/limits/UserLimits.ts
index 06f7a059..836f7143 100644 --- a/src/util/config/types/subconfigurations/limits/UserLimits.ts +++ b/src/util/config/types/subconfigurations/limits/UserLimits.ts
@@ -18,6 +18,6 @@ export class UserLimits { maxGuilds: number = 1048576; - maxUsername: number = 127; + maxUsername: number = 32; maxFriends: number = 5000; }