From bb9afd86c117d6e7db6a509fd78424b31dc40e66 Mon Sep 17 00:00:00 2001 From: Flightkick Date: Sat, 23 Sep 2023 15:56:34 +0000 Subject: [PATCH] fix: Use reserved example.com as bogus instead of email.com domain. (#2551) `email.com` is not a reserved domain, incorrect configuration could result in unintentional effects. `example.com` is reserved by IANA for bogus purposes, see RFC 6761. --- dev/scripts/all_recipes_stress_test.py | 2 +- .../documentation/community-guide/bulk-url-import.md | 4 ++-- .../getting-started/installation/backend-config.md | 2 +- .../installation/installation-checklist.md | 2 +- docs/docs/overrides/api.html | 2 +- frontend/layouts/blank.vue | 2 +- mealie/core/settings/settings.py | 2 +- mealie/repos/seed/init_users.py | 8 ++++---- mealie/schema/user/user.py | 2 +- template.env | 2 +- .../admin_tests/test_admin_user_actions.py | 2 +- tests/integration_tests/test_validators.py | 2 +- tests/unit_tests/services_tests/test_email_service.py | 2 +- .../validator_tests/test_registration_validators.py | 10 +++++----- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/dev/scripts/all_recipes_stress_test.py b/dev/scripts/all_recipes_stress_test.py index 6b01e46a07fb..510e7b231290 100644 --- a/dev/scripts/all_recipes_stress_test.py +++ b/dev/scripts/all_recipes_stress_test.py @@ -231,7 +231,7 @@ def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dic } -def login(username="changeme@email.com", password="MyPassword"): +def login(username="changeme@example.com", password="MyPassword"): payload = {"username": username, "password": password} r = requests.post("http://localhost:9000/api/auth/token", payload) diff --git a/docs/docs/documentation/community-guide/bulk-url-import.md b/docs/docs/documentation/community-guide/bulk-url-import.md index 4bf2f74db81a..7d597e8f617b 100644 --- a/docs/docs/documentation/community-guide/bulk-url-import.md +++ b/docs/docs/documentation/community-guide/bulk-url-import.md @@ -33,7 +33,7 @@ function import_from_file () { } input="list" -mail="changeme@email.com" +mail="changeme@example.com" password="MyPassword" mealie_url=http://localhost:9000 @@ -85,7 +85,7 @@ def import_from_file(input_file, token, mealie_url): print(response.text) input_file="list" -mail="changeme@email.com" +mail="changeme@example.com" password="MyPassword" mealie_url="http://localhost:9000" diff --git a/docs/docs/documentation/getting-started/installation/backend-config.md b/docs/docs/documentation/getting-started/installation/backend-config.md index 263ba0d87914..db52ee7194d8 100644 --- a/docs/docs/documentation/getting-started/installation/backend-config.md +++ b/docs/docs/documentation/getting-started/installation/backend-config.md @@ -9,7 +9,7 @@ | PUID | 911 | UserID permissions between host OS and container | | PGID | 911 | GroupID permissions between host OS and container | | DEFAULT_GROUP | Home | The default group for users | -| DEFAULT_EMAIL | changeme@email.com | The default username for the superuser | +| DEFAULT_EMAIL | changeme@example.com | The default username for the superuser | | BASE_URL | http://localhost:8080 | Used for Notifications | | TOKEN_TIME | 48 | The time in hours that a login/auth token is valid | | API_PORT | 9000 | The port exposed by backend API. **Do not change this if you're running in Docker** | diff --git a/docs/docs/documentation/getting-started/installation/installation-checklist.md b/docs/docs/documentation/getting-started/installation/installation-checklist.md index f70c859ffec4..1b8d8a6e8639 100644 --- a/docs/docs/documentation/getting-started/installation/installation-checklist.md +++ b/docs/docs/documentation/getting-started/installation/installation-checklist.md @@ -69,7 +69,7 @@ You should see the containers start up without error. You should now be able to !!! tip "Default Credentials" - **Username:** changeme@email.com + **Username:** changeme@example.com **Password:** MyPassword diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html index b0600f327d65..1e2ab3000459 100644 --- a/docs/docs/overrides/api.html +++ b/docs/docs/overrides/api.html @@ -14,7 +14,7 @@
diff --git a/frontend/layouts/blank.vue b/frontend/layouts/blank.vue index c9bccf58291e..2cc3006e06d0 100644 --- a/frontend/layouts/blank.vue +++ b/frontend/layouts/blank.vue @@ -5,7 +5,7 @@
{{ $t("demo.info_message_with_version", { version: version }) }} | - {{ $t("demo.demo_username", { username: "changeme@email.com" }) }} | + {{ $t("demo.demo_username", { username: "changeme@example.com" }) }} | {{ $t("demo.demo_password", { password: "demo" }) }}
diff --git a/mealie/core/settings/settings.py b/mealie/core/settings/settings.py index 130df35ff52d..bb8bd8cd92e9 100644 --- a/mealie/core/settings/settings.py +++ b/mealie/core/settings/settings.py @@ -81,7 +81,7 @@ class AppSettings(BaseSettings): return self.DB_PROVIDER.db_url_public if self.DB_PROVIDER else None DEFAULT_GROUP: str = "Home" - DEFAULT_EMAIL: str = "changeme@email.com" + DEFAULT_EMAIL: str = "changeme@example.com" DEFAULT_PASSWORD: str = "MyPassword" # =============================================== diff --git a/mealie/repos/seed/init_users.py b/mealie/repos/seed/init_users.py index ad347a0d8639..83426236b77c 100644 --- a/mealie/repos/seed/init_users.py +++ b/mealie/repos/seed/init_users.py @@ -12,7 +12,7 @@ def dev_users() -> list[dict]: { "full_name": "Jason", "username": "jason", - "email": "jason@email.com", + "email": "jason@example.com", "password": hash_password(settings.DEFAULT_PASSWORD), "group": settings.DEFAULT_GROUP, "admin": False, @@ -20,7 +20,7 @@ def dev_users() -> list[dict]: { "full_name": "Bob", "username": "bob", - "email": "bob@email.com", + "email": "bob@example.com", "password": hash_password(settings.DEFAULT_PASSWORD), "group": settings.DEFAULT_GROUP, "admin": False, @@ -28,7 +28,7 @@ def dev_users() -> list[dict]: { "full_name": "Sarah", "username": "sarah", - "email": "sarah@email.com", + "email": "sarah@example.com", "password": hash_password(settings.DEFAULT_PASSWORD), "group": settings.DEFAULT_GROUP, "admin": False, @@ -36,7 +36,7 @@ def dev_users() -> list[dict]: { "full_name": "Sammy", "username": "sammy", - "email": "sammy@email.com", + "email": "sammy@example.com", "password": hash_password(settings.DEFAULT_PASSWORD), "group": settings.DEFAULT_GROUP, "admin": False, diff --git a/mealie/schema/user/user.py b/mealie/schema/user/user.py index 7a3ed557a85a..d5cfb5fc7f59 100644 --- a/mealie/schema/user/user.py +++ b/mealie/schema/user/user.py @@ -89,7 +89,7 @@ class UserBase(MealieModel): "example": { "username": "ChangeMe", "fullName": "Change Me", - "email": "changeme@email.com", + "email": "changeme@example.com", "group": settings.DEFAULT_GROUP, "admin": "false", } diff --git a/template.env b/template.env index aad72dba3a1a..e2679f965cdc 100644 --- a/template.env +++ b/template.env @@ -2,7 +2,7 @@ DEFAULT_GROUP=Home # The Default Credentials for the Super User -DEFAULT_EMAIL=changeme@email.com +DEFAULT_EMAIL=changeme@example.com DEFAULT_PASSWORD=MyPassword # Determines Production Mode, This will set the directory path to use for data storage diff --git a/tests/integration_tests/admin_tests/test_admin_user_actions.py b/tests/integration_tests/admin_tests/test_admin_user_actions.py index 257f89870543..850fb62d9c0f 100644 --- a/tests/integration_tests/admin_tests/test_admin_user_actions.py +++ b/tests/integration_tests/admin_tests/test_admin_user_actions.py @@ -124,7 +124,7 @@ def test_self_promote_admin(api_client: TestClient, unique_user: TestUser): update_data = { "id": unique_user.user_id, "fullName": "Updated Name", - "email": "user@email.com", + "email": "user@example.com", "group": "Home", "admin": True, } diff --git a/tests/integration_tests/test_validators.py b/tests/integration_tests/test_validators.py index e1ed565e7f2e..6436a1088651 100644 --- a/tests/integration_tests/test_validators.py +++ b/tests/integration_tests/test_validators.py @@ -31,7 +31,7 @@ def test_validators_username(api_client: TestClient, unique_user: TestUser): def test_validators_email(api_client: TestClient, unique_user: TestUser): emails = [ SimpleCase(value=unique_user.email, is_valid=False), - SimpleCase(value=f"{random_string()}@email.com", is_valid=True), + SimpleCase(value=f"{random_string()}@example.com", is_valid=True), ] for user in emails: diff --git a/tests/unit_tests/services_tests/test_email_service.py b/tests/unit_tests/services_tests/test_email_service.py index 6bef6210a5ce..7c9c3844e366 100644 --- a/tests/unit_tests/services_tests/test_email_service.py +++ b/tests/unit_tests/services_tests/test_email_service.py @@ -4,7 +4,7 @@ from mealie.core.config import get_app_settings from mealie.services.email import EmailService from mealie.services.email.email_senders import ABCEmailSender -FAKE_ADDRESS = "my_secret_email@email.com" +FAKE_ADDRESS = "my_secret_email@example.com" SUBJECTS = {"Mealie Forgot Password", "Invitation to join Mealie", "Test Email"} diff --git a/tests/unit_tests/validator_tests/test_registration_validators.py b/tests/unit_tests/validator_tests/test_registration_validators.py index 0d33233235c8..1c3755ffffbe 100644 --- a/tests/unit_tests/validator_tests/test_registration_validators.py +++ b/tests/unit_tests/validator_tests/test_registration_validators.py @@ -7,7 +7,7 @@ def test_create_user_registration() -> None: CreateUserRegistration( group="Home", group_token=None, - email="SomeValidEmail@email.com", + email="SomeValidEmail@example.com", username="SomeValidUsername", password="SomeValidPassword", password_confirm="SomeValidPassword", @@ -18,7 +18,7 @@ def test_create_user_registration() -> None: CreateUserRegistration( group=None, group_token="asdfadsfasdfasdfasdf", - email="SomeValidEmail@email.com", + email="SomeValidEmail@example.com", username="SomeValidUsername", password="SomeValidPassword", password_confirm="SomeValidPassword", @@ -33,7 +33,7 @@ def test_group_or_token_validator(group, group_token) -> None: CreateUserRegistration( group=group, group_token=group_token, - email="SomeValidEmail@email.com", + email="SomeValidEmail@example.com", username="SomeValidUsername", password="SomeValidPassword", password_confirm="SomeValidPassword", @@ -45,7 +45,7 @@ def test_group_or_token_validator(group, group_token) -> None: def test_group_no_args_passed() -> None: with pytest.raises(ValueError): CreateUserRegistration( - email="SomeValidEmail@email.com", + email="SomeValidEmail@example.com", username="SomeValidUsername", password="SomeValidPassword", password_confirm="SomeValidPassword", @@ -59,7 +59,7 @@ def test_password_validator() -> None: CreateUserRegistration( group=None, group_token="asdfadsfasdfasdfasdf", - email="SomeValidEmail@email.com", + email="SomeValidEmail@example.com", username="SomeValidUsername", password="SomeValidPassword", password_confirm="PasswordDefNotMatch",