Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add colon to valid custom header value. (#15929)

Piotr Zabieglik0c1062eb0da6
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 46a58638a0..4fc3a62004 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -20580,7 +20580,7 @@ input WebhookCreateInput @doc(category: "Webhooks") {
query: String
"""
- Custom headers, which will be added to HTTP request. There is a limitation of 5 headers per webhook and 998 characters per header.Only "X-*" and "Authorization*" keys are allowed.
+ Custom headers, which will be added to HTTP request. There is a limitation of 5 headers per webhook and 998 characters per header.Only `X-*`, `Authorization*`, and `BrokerProperties` keys are allowed.
Added in Saleor 3.12.
diff --git a/saleor/graphql/webhook/mutations/webhook_create.py b/saleor/graphql/webhook/mutations/webhook_create.py
index 356c32e5bb..472e20d339 100644
--- a/saleor/graphql/webhook/mutations/webhook_create.py
+++ b/saleor/graphql/webhook/mutations/webhook_create.py
@@ -72,7 +72,7 @@ class WebhookCreateInput(BaseInputObjectType):
description=f"Custom headers, which will be added to HTTP request. "
f"There is a limitation of {HEADERS_NUMBER_LIMIT} headers per webhook "
f"and {HEADERS_LENGTH_LIMIT} characters per header."
- f'Only "X-*" and "Authorization*" keys are allowed.'
+ f"Only `X-*`, `Authorization*`, and `BrokerProperties` keys are allowed."
+ ADDED_IN_312
+ PREVIEW_FEATURE,
required=False,
diff --git a/saleor/webhook/tests/test_webhook_validators.py b/saleor/webhook/tests/test_webhook_validators.py
index 5fe59cc006..937b571978 100644
--- a/saleor/webhook/tests/test_webhook_validators.py
+++ b/saleor/webhook/tests/test_webhook_validators.py
@@ -39,8 +39,8 @@ from ..validators import (
'Key "ke:y" contains invalid character.',
),
(
- {"Key": "Val:ue"},
- 'Value "Val:ue" contains invalid character.',
+ {"Key": "ż"},
+ 'Value "ż" contains invalid character.',
),
(
{"Key": "X" * HEADERS_LENGTH_LIMIT},
diff --git a/saleor/webhook/validators.py b/saleor/webhook/validators.py
index bf222d8a9b..314bb0bbe3 100644
--- a/saleor/webhook/validators.py
+++ b/saleor/webhook/validators.py
@@ -7,7 +7,7 @@ KEY_CHARS_ALLOWED = (
"[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
)
VALUE_CHARS_ALLOWED = (
- "!\"#$%&'()*+,-./0123456789;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "!\"#$%&'()*+,-./0123456789;:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ \t"
)