From e25dea27e71581c2318431516ebf5aea205dc574 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 23 Mar 2020 19:09:20 +0900 Subject: [PATCH] Better theme validation --- src/client/theme.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/client/theme.ts b/src/client/theme.ts index e90c1f3a3..cc69ee406 100644 --- a/src/client/theme.ts +++ b/src/client/theme.ts @@ -104,8 +104,9 @@ function genValue(c: tinycolor.Instance): string { } export function validateTheme(theme: Record): boolean { - if (theme.id == null) return false; - if (theme.name == null) return false; + if (theme.id == null || typeof theme.id !== 'string') return false; + if (theme.name == null || typeof theme.name !== 'string') return false; if (theme.base == null || !['light', 'dark'].includes(theme.base)) return false; + if (theme.props == null || typeof theme.props !== 'object') return false; return true; }