fully validate game creation parameters sent through the API

This commit is contained in:
AlecM33
2022-12-29 17:05:09 -05:00
parent e0dffe17b6
commit 66698500b9
7 changed files with 67 additions and 12 deletions

View File

@@ -333,7 +333,7 @@ function validateCustomRoleCookie (cookie) {
const cookieJSON = JSON.parse(cookie);
if (Array.isArray(cookieJSON)) {
for (const entry of cookieJSON) {
if (typeof entry === 'object') {
if (entry !== null && typeof entry === 'object') {
if (typeof entry.role !== 'string' || entry.role.length > globals.MAX_CUSTOM_ROLE_NAME_LENGTH
|| typeof entry.team !== 'string' || (entry.team !== globals.ALIGNMENT.GOOD && entry.team !== globals.ALIGNMENT.EVIL)
|| typeof entry.description !== 'string' || entry.description.length > globals.MAX_CUSTOM_ROLE_DESCRIPTION_LENGTH