mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-23 18:29:19 -05:00
feat(webhook): add validation for Authorization header conflict
Signed-off-by: 0xsysr3ll <0xsysr3ll@pm.me>
This commit is contained in:
@@ -93,6 +93,8 @@ const messages = defineMessages(
|
||||
customHeadersKey: 'Header Name',
|
||||
customHeadersValue: 'Header Value',
|
||||
customHeadersIncomplete: 'All headers must have both name and value',
|
||||
customHeadersAuthConflict:
|
||||
'Cannot use both Authorization Header and custom Authorization header. Please remove one.',
|
||||
validationJsonPayloadRequired: 'You must provide a valid JSON payload',
|
||||
webhooksettingssaved: 'Webhook notification settings saved successfully!',
|
||||
webhooksettingsfailed: 'Webhook notification settings failed to save.',
|
||||
@@ -156,6 +158,23 @@ const NotificationsWebhook = () => {
|
||||
(!header.value || !header.value.trim())
|
||||
);
|
||||
}
|
||||
)
|
||||
.test(
|
||||
'auth-conflict',
|
||||
intl.formatMessage(messages.customHeadersAuthConflict),
|
||||
function (headers) {
|
||||
const { authHeader } = this.parent;
|
||||
if (!authHeader || !headers || headers.length === 0) return true;
|
||||
|
||||
const hasCustomAuthHeader = headers.some(
|
||||
(header) =>
|
||||
header.key &&
|
||||
header.value &&
|
||||
header.key.toLowerCase() === 'authorization'
|
||||
);
|
||||
|
||||
return !hasCustomAuthHeader;
|
||||
}
|
||||
),
|
||||
|
||||
jsonPayload: Yup.string()
|
||||
|
||||
@@ -683,6 +683,7 @@
|
||||
"components.Settings.Notifications.NotificationsWebhook.authheader": "Authorization Header",
|
||||
"components.Settings.Notifications.NotificationsWebhook.customHeaders": "Custom Headers",
|
||||
"components.Settings.Notifications.NotificationsWebhook.customHeadersAdd": "Add Header",
|
||||
"components.Settings.Notifications.NotificationsWebhook.customHeadersAuthConflict": "Cannot use both Authorization Header and custom Authorization header. Please remove one.",
|
||||
"components.Settings.Notifications.NotificationsWebhook.customHeadersIncomplete": "All headers must have both name and value",
|
||||
"components.Settings.Notifications.NotificationsWebhook.customHeadersKey": "Header Name",
|
||||
"components.Settings.Notifications.NotificationsWebhook.customHeadersRemove": "Remove",
|
||||
|
||||
Reference in New Issue
Block a user