fix: add caching for defaultUA db call and code fixes

This commit is contained in:
mannilakash committed 2026-04-01 17:27:29 -04:00
1 parent babe5ae177
commit 023cf5782d
13 files changed
+89 -19

No files matched your search

+9
View File
@@ -813,6 +813,15 @@ const CreateMonitorPage = () => {
fullWidth
error={!!fieldState.error}
helperText={fieldState.error?.message ?? ""}
onChange={(e) => {
field.onChange(
e.target.value
.replace(/[<>]/g, "")
.replace(/javascript:/gi, "")
.replace(/[^\t\x20-\x7E\x80-\xFF]/g, "") // RFC 7230 header-safe chars only
.slice(0, 500)
);
}}
/>
)}
/>
+9
View File
@@ -442,6 +442,15 @@ export const SettingsPage = () => {
placeholder={t("pages.settings.form.userAgent.option.placeholder")}
error={!!fieldState.error}
helperText={fieldState.error?.message}
onChange={(e) => {
field.onChange(
e.target.value
.replace(/[<>]/g, "")
.replace(/javascript:/gi, "")
.replace(/[^\t\x20-\x7E\x80-\xFF]/g, "") // RFC 7230 header-safe chars only
.slice(0, 500)
);
}}
/>
)}
/>
+8 -1
View File
@@ -38,7 +38,14 @@ const httpSchema = baseSchema.extend({
matchMethod: z.enum(["equal", "include", "regex", ""]).optional(),
expectedValue: z.string().optional(),
jsonPath: z.string().optional(),
customUserAgent: z.string().max(500).optional(),
customUserAgent: z
.string()
.max(500)
.regex(
/^[\t\x20-\x7E\x80-\xFF]*$/,
"Only printable characters, spaces, and tabs are allowed (RFC 7230 §3.2.6)"
)
.optional(),
});
// Ping monitor schema
+4
View File
@@ -15,6 +15,10 @@ export const settingsSchema = z.object({
defaultUserAgent: z
.string()
.max(500)
.regex(
/^[\t\x20-\x7E\x80-\xFF]*$/,
"Only printable characters, spaces, and tabs are allowed (RFC 7230)"
)
.transform((val) => (val.trim() === "" ? null : val.trim()))
.optional(),
checkTTL: z
+1 -1
View File
@@ -1064,7 +1064,7 @@
"description": "Set a default User-Agent header sent with all HTTP uptime monitor requests. Individual monitors can override this. Useful for identifying Checkmate in WAF logs and whitelists.",
"option": {
"label": "Default User-Agent",
"placeholder": "Checkmate/X.X (uptime monitor; your-instance)"
"placeholder": "Checkmate/X.X (uptime monitor)"
}
},
"stats": {