|
3 | 3 | Litestar 2 Changelog |
4 | 4 | ==================== |
5 | 5 |
|
| 6 | +.. changelog:: 2.18.0 |
| 7 | + :date: 2025-10-05 |
| 8 | + |
| 9 | + .. change:: Fix header spoofing vulnerability in ``RateLimitMiddleware`` that allowed bypassing client-specific rate limits |
| 10 | + :type: bugfix |
| 11 | + |
| 12 | + Fix a vulnerability in |
| 13 | + :class:`~litestar.middleware.rate_limit.RateLimitMiddleware` that allowed |
| 14 | + clients to bypass the limit by spoofing the ``X-FORWARDED-FOR`` header. |
| 15 | + |
| 16 | + **Who is affected?** |
| 17 | + |
| 18 | + All usages of the ``RateLimitMiddleware`` that did not customize |
| 19 | + ``RateLimitMiddleware.cache_key_from_request``. |
| 20 | + |
| 21 | + **What needs to be done?** |
| 22 | + |
| 23 | + The middleware has been fixed to remove this particular vulnerability, by |
| 24 | + ignoring the ``X-FORWARDED-FOR`` header when determining a client's identity. |
| 25 | + If you are using ``litestar>=2.18.0``, nothing needs to be done. |
| 26 | + |
| 27 | + .. note:: |
| 28 | + |
| 29 | + Applications operating behind a proxy should consult |
| 30 | + :ref:`usage/middleware/builtin-middleware:Using behind a proxy` on how to |
| 31 | + obtain reliable client identification in such cases. |
| 32 | + |
| 33 | + .. change:: OpenAPI: Fix broken Typescript export for ``NotRequired`` |
| 34 | + :type: bugfix |
| 35 | + :pr: 4318 |
| 36 | + :issue: 4198 |
| 37 | + |
| 38 | + Fix a bug that would result in broken Typescript type definition for a model |
| 39 | + using ``NotRequired`` |
| 40 | + |
| 41 | + .. change:: CLI: Fix command registration |
| 42 | + :type: bugfix |
| 43 | + :pr: 4298 |
| 44 | + |
| 45 | + Fix an issue where CLI plugins no longer appear in the command help text |
| 46 | + after recent updates to ``rich-click`` and ``click``. |
| 47 | + |
| 48 | + Ensure plugins load before rendering the help text so they appear in the |
| 49 | + formatted help output. |
| 50 | + |
| 51 | + .. change:: Remove fix polyfactory deprecation warning |
| 52 | + :type: bugfix |
| 53 | + :pr: 4292 |
| 54 | + |
| 55 | + Fix a deprecation warning from polyfactory caused by a changed default value. |
| 56 | + |
| 57 | + .. change:: Ensure ``MethodNotAllowedException`` properly sets ``Allow`` header during routing |
| 58 | + :type: bugfix |
| 59 | + :pr: 4289 |
| 60 | + :issue: 4277 |
| 61 | + |
| 62 | + Ensure :exc:`MethodNotAllowedException` exceptions raised during routing |
| 63 | + always includes an ``Allow`` header. |
| 64 | + |
| 65 | + .. change:: Preserve empty strings in ``multipart/form-data`` requests |
| 66 | + :type: bugfix |
| 67 | + :pr: 4271 |
| 68 | + :issue: 4204 |
| 69 | + |
| 70 | + Preserve empty strings in multipart forms instead of converting them to |
| 71 | + :obj:`None`. |
| 72 | + |
| 73 | + .. change:: OpenAPI: Regression - Fix missing constraints for ``msgspec.Struct`` |
| 74 | + :type: bugfix |
| 75 | + :pr: 4282 |
| 76 | + :issue: 3999 |
| 77 | + |
| 78 | + Ensure constraints on set on an ``msgspec.Struct`` are always reflected in |
| 79 | + the OpenAPI schema, for simple (non-union, non-optional, non-nested) fields. |
| 80 | + |
| 81 | + .. change:: Fix ``KeyError`` when using ``data`` keyword argument in dependency function |
| 82 | + :type: bugfix |
| 83 | + :pr: 4270 |
| 84 | + :issue: 4230 |
| 85 | + |
| 86 | + Fix a ``KeyError`` that occured when a dependency function used the ``data`` |
| 87 | + keyword argument, if no ``data`` keyword argument was used in the handler |
| 88 | + requesting this dependency. |
| 89 | + |
| 90 | + .. change:: OpenAPI - Regression: Allow ``Parameter`` to set an Enum's schema fields |
| 91 | + :type: bugfix |
| 92 | + :pr: 4251 |
| 93 | + :issue: 4250 |
| 94 | + |
| 95 | + Fix a bug introduced in ``2.14.0`` that would prevent an Enum field's OpenAPI |
| 96 | + schema to be modified via :func:`~litestar.params.Parameter`. |
| 97 | + |
| 98 | + .. change:: CLI: Fix ``TypeError`` when passing ``--help`` and `--app-dir`` simultaneously |
| 99 | + :type: bugfix |
| 100 | + :pr: 4341 |
| 101 | + :issue: 4331 |
| 102 | + |
| 103 | + Fix a bug that would raise a :exc:`TypeError` when the CLI's ``--help`` option |
| 104 | + was invoked, if the ``--app-dir`` option was also set. |
| 105 | + |
| 106 | + |
| 107 | + .. change:: CLI: Fix ``--app-dir`` being ignore on subsequent reloads when used together with ``--reload`` option |
| 108 | + :type: bugfix |
| 109 | + :pr: 4352 |
| 110 | + :issue: 4329 |
| 111 | + |
| 112 | + Fix a bug that would cause the ``--app-dir`` option to be ignored after the first |
| 113 | + reload, because it was not passed properly to uvicorn. |
| 114 | + |
| 115 | + .. change:: OpenAPI: Use ``NotRequired`` instead of ``Optional`` for values with a ``default_factory`` |
| 116 | + :type: bugfix |
| 117 | + :pr: 4347 |
| 118 | + :issue: 4294 |
| 119 | + |
| 120 | + Fix a bug that would consider fields with a ``default_factory`` set to be |
| 121 | + ``Optional`` instead of ``NotRequired``. |
| 122 | + |
| 123 | + .. change:: Fix ``Stream`` response being treated as ``File`` response in OpenAPI schema |
| 124 | + :type: bugfix |
| 125 | + :pr: 4371 |
| 126 | + |
| 127 | + Prevent handlers returning a ``Stream`` from falsely indicating a file |
| 128 | + response in the OpenAPI schema with file-specific headers such as |
| 129 | + ``content-length``, ``last-modified``, and ``etag``. |
| 130 | + |
| 131 | + .. change:: Deprecate ``litestar.plugins.sqlalchemy`` module |
| 132 | + :type: feature |
| 133 | + :pr: 4343 |
| 134 | + |
| 135 | + Deprecate the ``litestar.plugins.sqlalchemy`` module, which is scheduled for |
| 136 | + removal in v3.0. |
| 137 | + |
| 138 | + This deprecation follows the migration to advanced-alchemy. Users should update their imports: |
| 139 | + |
| 140 | + .. code-block:: python |
| 141 | +
|
| 142 | + # Old (deprecated) |
| 143 | + from litestar.plugins.sqlalchemy import SQLAlchemyPlugin |
| 144 | +
|
| 145 | + # New |
| 146 | + from advanced_alchemy.extensions.litestar import SQLAlchemyPlugin |
| 147 | +
|
| 148 | + .. change:: Add ``round_trip`` parameter to ``PydanticPlugin`` |
| 149 | + :type: feature |
| 150 | + :pr: 4350 |
| 151 | + :issue: 4349 |
| 152 | + |
| 153 | + Add new ``round_trip`` parameter to |
| 154 | + :class:`~litestar.contrib.pydantic.PydanticPlugin`, allowing correct |
| 155 | + serialization of types like ``pydanctic.Json``. |
| 156 | + |
| 157 | + |
6 | 158 | .. changelog:: 2.17.0 |
7 | 159 | :date: 2025-08-09 |
8 | 160 |
|
|
0 commit comments