mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
API security hardening (#571)
* Enhance security and safety around user update API - Prevent a regular user from promoting themself to admin - Prevent an admin from demoting themself - Refactor token fixture to admin + regular user tokens * Restrict user CRUD API to admins * Secure admin API routes * Refactor APIrouter into Admin/UserAPIRouter * Secure theme routes * Make 'all recipes' routes public * Secure favorite routes * Remove redundant checks * Fix public routes mistakenly flagged user routes * Make webhooks changeable only by admin * Allow users to create categories and tags * Address lint issues
This commit is contained in:
parent
f5faff66d3
commit
6320ba7ec5
43 changed files with 456 additions and 347 deletions
|
@ -19,11 +19,11 @@ def test_default_settings(api_client: TestClient, api_routes: AppRoutes, default
|
|||
assert json.loads(response.content) == default_settings
|
||||
|
||||
|
||||
def test_update_settings(api_client: TestClient, api_routes: AppRoutes, default_settings, token):
|
||||
def test_update_settings(api_client: TestClient, api_routes: AppRoutes, default_settings, admin_token):
|
||||
default_settings["language"] = "fr"
|
||||
default_settings["showRecent"] = False
|
||||
|
||||
response = api_client.put(api_routes.site_settings, json=default_settings, headers=token)
|
||||
response = api_client.put(api_routes.site_settings, json=default_settings, headers=admin_token)
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue