Skip to content

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

Allow manifest URLs up to 2048 characters (#19681)

Lukasz Ostrowski51f865fd2be3
diff --git a/saleor/app/migrations/0041_widen_manifest_url.py b/saleor/app/migrations/0041_widen_manifest_url.py
new file mode 100644
index 0000000000..14f8b41945
--- /dev/null
+++ b/saleor/app/migrations/0041_widen_manifest_url.py
@@ -0,0 +1,26 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ """Widen ``manifest_url`` from varchar(200) to varchar(2048).
+
+ Increasing a varchar length limit is a catalog-only change in PostgreSQL
+ (>= 9.2) — no table rewrite, the ACCESS EXCLUSIVE lock is held momentarily.
+ """
+
+ dependencies = [
+ ("app", "0040_appextension_identifier_unique_constraint"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="app",
+ name="manifest_url",
+ field=models.URLField(blank=True, max_length=2048, null=True),
+ ),
+ migrations.AlterField(
+ model_name="appinstallation",
+ name="manifest_url",
+ field=models.URLField(max_length=2048),
+ ),
+ ]
diff --git a/saleor/app/migrations/0042_merge_20260820_0919.py b/saleor/app/migrations/0042_merge_20260820_0919.py
new file mode 100644
index 0000000000..78373f990f
--- /dev/null
+++ b/saleor/app/migrations/0042_merge_20260820_0919.py
@@ -0,0 +1,12 @@
+# Generated by Django 5.2.16 on 2026-08-20 09:19
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("app", "0041_merge_20260714_1040"),
+ ("app", "0041_widen_manifest_url"),
+ ]
+
+ operations = []
diff --git a/saleor/app/models.py b/saleor/app/models.py
index b95cfc2373..a1bfbbf449 100644
--- a/saleor/app/models.py
+++ b/saleor/app/models.py
@@ -17,6 +17,9 @@ from .types import (
DeprecatedAppExtensionHttpMethod,
)
+URL_MAX_LENGTH = 2048
+"""Matches Django's ``URLValidator.max_length`` and the de facto browser cap."""
+
class AppQueryset(models.QuerySet["App"]):
def for_event_type(self, event_type: str):
@@ -69,7 +72,7 @@ class App(ModelWithMetadata):
support_url = models.URLField(blank=True, null=True)
configuration_url = models.URLField(blank=True, null=True)
app_url = models.URLField(blank=True, null=True)
- manifest_url = models.URLField(blank=True, null=True)
+ manifest_url = models.URLField(max_length=URL_MAX_LENGTH, blank=True, null=True)
version = models.CharField(max_length=60, blank=True, null=True)
audience = models.CharField(blank=True, null=True, max_length=256)
is_installed = models.BooleanField(default=True)
@@ -229,7 +232,7 @@ class AppProblem(models.Model):
class AppInstallation(Job):
uuid = models.UUIDField(unique=True, default=uuid4)
app_name = models.CharField(max_length=60)
- manifest_url = models.URLField()
+ manifest_url = models.URLField(max_length=URL_MAX_LENGTH)
permissions = models.ManyToManyField(
Permission,
blank=True,
diff --git a/saleor/graphql/app/tests/mutations/test_app_install.py b/saleor/graphql/app/tests/mutations/test_app_install.py
index 93da9c374d..1ad25ee259 100644
--- a/saleor/graphql/app/tests/mutations/test_app_install.py
+++ b/saleor/graphql/app/tests/mutations/test_app_install.py
@@ -2,7 +2,7 @@ from unittest.mock import Mock, patch
import graphene
-from .....app.models import App, AppInstallation
+from .....app.models import URL_MAX_LENGTH, App, AppInstallation
from .....app.tasks import install_app_task
from .....core import JobStatus
from ....core.enums import AppErrorCode, PermissionEnum
@@ -218,6 +218,36 @@ def test_install_app_mutation_with_invalid_manifest_url_returns_error(
assert error["code"] == AppErrorCode.INVALID_URL_FORMAT.name
+def test_install_app_mutation_with_long_manifest_url(
+ permission_manage_apps,
+ staff_api_client,
+ staff_user,
+ monkeypatch,
+):
+ # given
+ monkeypatch.setattr(
+ "saleor.graphql.app.mutations.app_install.install_app_task.delay", Mock()
+ )
+ staff_user.user_permissions.set([permission_manage_apps])
+ prefix = "http://localhost:3000/manifest?token="
+ manifest_url = prefix + "a" * (URL_MAX_LENGTH - len(prefix))
+ assert len(manifest_url) == URL_MAX_LENGTH
+ variables = {
+ "app_name": "New external integration",
+ "manifest_url": manifest_url,
+ "permissions": [],
+ }
+
+ # when
+ data = _mutate_app_install(staff_api_client, variables)
+
+ # then
+ assert data["errors"] == []
+ app_installation = AppInstallation.objects.get()
+ assert app_installation.manifest_url == manifest_url
+ assert data["appInstallation"]["manifestUrl"] == manifest_url
+
+
def test_install_app_mutation_with_null_permissions(
permission_manage_apps,
staff_api_client,