mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:20:45 +00:00
Enforce UUID validation for persistent id (#674)
## Description: - Add more restrictive UUID validation for persistent ids. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
This commit is contained in:
+5
-3
@@ -138,6 +138,8 @@ const SafeString = z
|
||||
)
|
||||
.max(1000);
|
||||
|
||||
const PersistentIdSchema = z.string().uuid();
|
||||
|
||||
const EmojiSchema = z
|
||||
.number()
|
||||
.nonnegative()
|
||||
@@ -388,7 +390,7 @@ export const ClientLogMessageSchema = z.object({
|
||||
type: z.literal("log"),
|
||||
severity: z.nativeEnum(LogSeverity),
|
||||
log: ID,
|
||||
persistentID: SafeString,
|
||||
persistentID: PersistentIdSchema, // WARNING: PII
|
||||
});
|
||||
|
||||
export const ClientPingMessageSchema = z.object({
|
||||
@@ -404,7 +406,7 @@ export const ClientIntentMessageSchema = z.object({
|
||||
export const ClientJoinMessageSchema = z.object({
|
||||
type: z.literal("join"),
|
||||
clientID: ID,
|
||||
persistentID: SafeString, // WARNING: PII
|
||||
persistentID: PersistentIdSchema, // WARNING: PII
|
||||
gameID: ID,
|
||||
lastTurn: z.number(), // The last turn the client saw.
|
||||
username: SafeString,
|
||||
@@ -424,7 +426,7 @@ export const PlayerRecordSchema = z.object({
|
||||
clientID: ID,
|
||||
username: SafeString,
|
||||
ip: SafeString.nullable(), // WARNING: PII
|
||||
persistentID: SafeString, // WARNING: PII
|
||||
persistentID: PersistentIdSchema, // WARNING: PII
|
||||
});
|
||||
|
||||
export const GameRecordSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user