feat: warn about unsafe CORS (#12773)

* feat: warn about unsafe CORS

* extend docs

* fix defaults

* bump api version

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
Matthias Mair
2026-09-03 13:09:17 +10:00
committed by GitHub
co-authored by Oliver
parent 9f8dfda18b
commit fa52affe98
6 changed files with 28 additions and 2 deletions
+3
View File
@@ -267,6 +267,8 @@ class InfoApiSerializer(serializers.Serializer):
target = serializers.CharField(read_only=True, allow_null=True)
django_admin = serializers.CharField(read_only=True)
settings = SettingsSerializer(read_only=True, many=False)
"""System state details that are mainly for warning purposes and do not require a hard API contract."""
system_state = serializers.JSONField(read_only=True)
class InfoView(APIView):
@@ -337,6 +339,7 @@ class InfoView(APIView):
'LOGIN_ENABLE_PWD_FORGOT'
),
},
'system_state': {'cors_allow_all': settings.CORS_ALLOW_ALL_ORIGINS},
}
return JsonResponse(data)
@@ -1,11 +1,14 @@
"""InvenTree API version information."""
# InvenTree API version
INVENTREE_API_VERSION = 539
INVENTREE_API_VERSION = 540
"""Increment this API version number whenever there is a significant change to the API that any clients need to know about."""
INVENTREE_API_TEXT = """
v540 -> 2026-09-04 : https://github.com/inventree/InvenTree/pull/12773
- Adds a "system_state" field to the info endpoint for non-critical general system state information
v539 -> 2026-09-02 : https://github.com/inventree/InvenTree/pull/12723
- Adds search fields to AddressList, ContactList, UserList, GroupList, RuleSetList, and TokenListView API endpoints