django-ninja-aio-crud 2.18.1__py3-none-any.whl → 2.18.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of django-ninja-aio-crud might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-ninja-aio-crud
3
- Version: 2.18.1
3
+ Version: 2.18.2
4
4
  Summary: Django Ninja AIO CRUD - Rest Framework
5
5
  Author: Giuseppe Casillo
6
6
  Requires-Python: >=3.10, <3.15
@@ -1,4 +1,4 @@
1
- ninja_aio/__init__.py,sha256=0d83rifGl3AtqjPqmhu8uQRV_EBq6JoUIWpkaU_OSaQ,120
1
+ ninja_aio/__init__.py,sha256=GG9VIprfl_xsxe8mkdQQOZKg-SjYn-uPExDck4VTOSg,120
2
2
  ninja_aio/api.py,sha256=tuC7vdvn7s1GkCnSFy9Kn1zv0glZfYptRQVvo8ZRtGQ,2429
3
3
  ninja_aio/auth.py,sha256=f4yk45fLi36Qctu0A0zgHTFedb9yk3ewq5rOMpoPYIE,9035
4
4
  ninja_aio/exceptions.py,sha256=w8QWmVlg88iJvBrNODSDBHSsy8nNpwngaCGWRnkXoPo,3899
@@ -15,7 +15,7 @@ ninja_aio/helpers/api.py,sha256=va_HvZVBFm1KxwQhH4u09U4F1JS5JrQuRpRmPTHJt7w,2132
15
15
  ninja_aio/helpers/query.py,sha256=Lqv4nrWYr543tC5K-SEcBottLID8cb83aDc26i2Wxj4,5053
16
16
  ninja_aio/models/__init__.py,sha256=L3UQnQAlKoI3F7jinadL-Nn55hkPvnSRPYW0JtnbWFo,114
17
17
  ninja_aio/models/serializers.py,sha256=pRRa0ci8ObhmJoQkzreDxV0JA6elG0Tyj8mJutRDqpo,64021
18
- ninja_aio/models/utils.py,sha256=iZ2pmtREtTC9G1isJbHTME-PzgI_BW7r6RBxvnlQJBw,39940
18
+ ninja_aio/models/utils.py,sha256=uIjQz6-89H7Myires79_v9xSMU5A6JVBBmMzlDLZwp4,37261
19
19
  ninja_aio/schemas/__init__.py,sha256=dHILiYBKMb51lDcyQdiXRw_0nzqM7Lu81UX2hv7kEfo,837
20
20
  ninja_aio/schemas/api.py,sha256=dGUpJXR1iAf93QNR4kYj1uqIkTjiMfXultCotY6GtaQ,361
21
21
  ninja_aio/schemas/filters.py,sha256=VxzH2xSWok8cUSkyfeqtrGhRewtFVmNHQfHNvY8Aynw,2662
@@ -24,7 +24,7 @@ ninja_aio/schemas/helpers.py,sha256=CpubwNXsZHtu8jddliyQybF1epwZ-GO60vHIuF5AR1Y,
24
24
  ninja_aio/views/__init__.py,sha256=DEzjWA6y3WF0V10nNF8eEurLNEodgxKzyFd09AqVp3s,148
25
25
  ninja_aio/views/api.py,sha256=Sj4yIVLVQEVKxwFzVbT6YhiSCxXtcvdlTtWhJfccOus,26191
26
26
  ninja_aio/views/mixins.py,sha256=rE4otyuenx6bfOLmnvMiSn10Kh7p0newU0-HarWDWS4,17779
27
- django_ninja_aio_crud-2.18.1.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
28
- django_ninja_aio_crud-2.18.1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
- django_ninja_aio_crud-2.18.1.dist-info/METADATA,sha256=vMfBlBuF8vq6dNp2ciGcjLSjMM5Gx0I7pqNM2dtGs7I,13404
30
- django_ninja_aio_crud-2.18.1.dist-info/RECORD,,
27
+ django_ninja_aio_crud-2.18.2.dist-info/licenses/LICENSE,sha256=yrDAYcm0gRp_Qyzo3GQa4BjYjWRkAhGC8QRva__RYq0,1073
28
+ django_ninja_aio_crud-2.18.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
29
+ django_ninja_aio_crud-2.18.2.dist-info/METADATA,sha256=uRj6qJ8HaV6vM5nhqSTs6FYwd1Bex_gfCosWXtlJDbw,13404
30
+ django_ninja_aio_crud-2.18.2.dist-info/RECORD,,
ninja_aio/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Django Ninja AIO CRUD - Rest Framework"""
2
2
 
3
- __version__ = "2.18.1"
3
+ __version__ = "2.18.2"
4
4
 
5
5
  from .api import NinjaAIO
6
6
 
ninja_aio/models/utils.py CHANGED
@@ -195,46 +195,6 @@ class ModelUtil:
195
195
  """
196
196
  return [field.name for field in self.model._meta.get_fields()]
197
197
 
198
- def get_valid_input_fields(
199
- self, is_serializer: bool, serializer: "ModelSerializer | None" = None
200
- ) -> set[str]:
201
- """
202
- Get allowlist of valid field names for input validation.
203
-
204
- Security: Prevents field injection by returning only fields that should
205
- be accepted from user input.
206
-
207
- Parameters
208
- ----------
209
- is_serializer : bool
210
- Whether using a ModelSerializer
211
- serializer : ModelSerializer, optional
212
- Serializer instance if applicable
213
-
214
- Returns
215
- -------
216
- set[str]
217
- Set of valid field names that can be accepted in input payloads
218
- """
219
- valid_fields = set(self.model_fields)
220
-
221
- # If using a serializer, also include custom fields
222
- if is_serializer and serializer:
223
- # Get all custom fields defined in the serializer
224
- try:
225
- # Custom fields are those that are not model fields but are defined
226
- # in the serializer configuration
227
- for schema_type in ['create', 'update', 'read', 'detail']:
228
- try:
229
- schema_fields = serializer.get_fields(schema_type)
230
- if schema_fields:
231
- valid_fields.update(schema_fields)
232
- except (AttributeError, TypeError):
233
- continue
234
- except (AttributeError, TypeError):
235
- pass
236
-
237
- return valid_fields
238
198
 
239
199
  @property
240
200
  def model_name(self) -> str:
@@ -743,43 +703,6 @@ class ModelUtil:
743
703
  obj = await self.get_object(request, query_data=query_data, is_for=is_for)
744
704
  return await self._bump_object_from_schema(obj, obj_schema)
745
705
 
746
- def _validate_input_fields(
747
- self, payload: dict, is_serializer: bool, serializer
748
- ) -> None:
749
- """
750
- Validate non-custom payload keys against model fields.
751
-
752
- Parameters
753
- ----------
754
- payload : dict
755
- Input payload to validate.
756
- is_serializer : bool
757
- Whether using a ModelSerializer.
758
- serializer : ModelSerializer | Serializer
759
- Serializer instance if applicable.
760
-
761
- Raises
762
- ------
763
- SerializeError
764
- If invalid field names are found in payload.
765
- """
766
- invalid_fields = []
767
- for key in payload.keys():
768
- # Skip custom fields - they're validated by Pydantic schema
769
- if is_serializer and serializer.is_custom(key):
770
- continue
771
- # Validate non-custom fields exist on the model
772
- if key not in self.model_fields:
773
- invalid_fields.append(key)
774
-
775
- if invalid_fields:
776
- raise SerializeError(
777
- {
778
- "detail": f"Invalid field names in payload: {', '.join(sorted(invalid_fields))}",
779
- "invalid_fields": sorted(invalid_fields),
780
- },
781
- 400,
782
- )
783
706
 
784
707
  def _collect_custom_and_optional_fields(
785
708
  self, payload: dict, is_serializer: bool, serializer
@@ -888,7 +811,7 @@ class ModelUtil:
888
811
 
889
812
  Steps
890
813
  -----
891
- - Validate fields against allowlist (security).
814
+ - Validate fields against schema (including aliases and custom fields).
892
815
  - Strip custom fields (retain separately).
893
816
  - Drop optional fields with None (ModelSerializer only).
894
817
  - Decode BinaryField base64 values.
@@ -917,8 +840,8 @@ class ModelUtil:
917
840
  )
918
841
  serializer = self.serializer if self.with_serializer else self.model
919
842
 
920
- # Security: Validate non-custom payload keys against model fields
921
- self._validate_input_fields(payload, is_serializer, serializer)
843
+ # Note: Field validation is handled by Pydantic during schema deserialization
844
+ # No additional validation needed here since data is already a validated Schema instance
922
845
 
923
846
  # Collect custom and optional fields
924
847
  customs, optionals = self._collect_custom_and_optional_fields(