From 1a210129114a16a6cf067c238ffb9860c57d3dc1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 1 Aug 2020 20:02:43 +0200 Subject: [PATCH] providers/app_gw: fix URL Validation not working for internal and external host --- .../migrations/0003_auto_20200801_1752.py | 32 +++++++++++++++++++ passbook/providers/app_gw/models.py | 8 +++-- 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 passbook/providers/app_gw/migrations/0003_auto_20200801_1752.py diff --git a/passbook/providers/app_gw/migrations/0003_auto_20200801_1752.py b/passbook/providers/app_gw/migrations/0003_auto_20200801_1752.py new file mode 100644 index 000000000..60bf0431f --- /dev/null +++ b/passbook/providers/app_gw/migrations/0003_auto_20200801_1752.py @@ -0,0 +1,32 @@ +# Generated by Django 3.0.8 on 2020-08-01 17:52 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_providers_app_gw", "0002_auto_20200726_1745"), + ] + + operations = [ + migrations.AlterField( + model_name="applicationgatewayprovider", + name="external_host", + field=models.TextField( + validators=[ + django.core.validators.URLValidator(schemes=("http", "https")) + ] + ), + ), + migrations.AlterField( + model_name="applicationgatewayprovider", + name="internal_host", + field=models.TextField( + validators=[ + django.core.validators.URLValidator(schemes=("http", "https")) + ] + ), + ), + ] diff --git a/passbook/providers/app_gw/models.py b/passbook/providers/app_gw/models.py index 3f9cefe00..4c6836bf0 100644 --- a/passbook/providers/app_gw/models.py +++ b/passbook/providers/app_gw/models.py @@ -17,8 +17,12 @@ class ApplicationGatewayProvider(Provider): Protocols by using a Reverse-Proxy.""" name = models.TextField() - internal_host = models.TextField(validators=[URLValidator]) - external_host = models.TextField(validators=[URLValidator]) + internal_host = models.TextField( + validators=[URLValidator(schemes=("http", "https"))] + ) + external_host = models.TextField( + validators=[URLValidator(schemes=("http", "https"))] + ) client = models.ForeignKey(Client, on_delete=models.CASCADE)