|
3 | 3 | Litestar 2 Changelog |
4 | 4 | ==================== |
5 | 5 |
|
| 6 | +.. changelog:: 2.20.0 |
| 7 | + :date: 2026-02-08 |
| 8 | + |
| 9 | + .. change:: Fix ``AllowedHosts`` validation bypass via improperly escaped host names in ``AllowedHostsConfig`` |
| 10 | + :type: bugfix |
| 11 | + |
| 12 | + Fix a bug in :class:`~litestar.config.allowed_hosts.AllowedHostsConfig`, that |
| 13 | + could allow to bypass the allowed hosts validation, caused by an improperly |
| 14 | + escaped regex value in the ``allowed_hosts`` property. |
| 15 | + |
| 16 | + ``allowed_hosts=["*.example.com"]`` would not only allow ``foo.example.com``, |
| 17 | + but also ``example.x.com``. |
| 18 | + |
| 19 | + .. change:: Fix CORS vulnerability in ``CORSConfig`` via improperly escaped ``allow_origins`` |
| 20 | + :type: bugfix |
| 21 | + |
| 22 | + Fix a bug in :class:`~litestar.config.cors.CORSConfig`, that could allow to |
| 23 | + bypass CORS validation, caused by an improperly escaped regex value in the |
| 24 | + ``allow_origins`` property; A value like ``example.com`` would not only allow |
| 25 | + the host ``example.com``, but also ``exampleXcom``. |
| 26 | + |
| 27 | + .. change:: Fix key collision due to improper key normalization in ``FileStore`` |
| 28 | + :type: bugfix |
| 29 | + |
| 30 | + Fix a bug in :class:`~litestar.stores.file.FileStore`, that could lead to a key |
| 31 | + collision due to improper normalization. |
| 32 | + |
| 33 | + ``FileStore`` use a key normalization method to ensure every key passed was able |
| 34 | + to be used as a valid file name on any platform. However, due to the nature of |
| 35 | + unicode normalization, the approach taken resulted in the possibility of |
| 36 | + uninentional key collisions, e.g. ``K`` (The Kelvin sign) would normalize to a |
| 37 | + regular ASCII ``K``, so a key like ``K1234`` (with the Kelvin sign) and |
| 38 | + ``K1234`` (with a regular ``K``) would result in the same key. |
| 39 | + |
| 40 | + This has been fixed by performing normalization on the keys via a hashing |
| 41 | + function. |
| 42 | + |
| 43 | + .. change:: Added ``exclude_spans`` option for ``OpenTelemetryMiddleware`` |
| 44 | + :type: feature |
| 45 | + :pr: 4534 |
| 46 | + :issue: 4533 |
| 47 | + |
| 48 | + Add a config option to ``exclude_spans`` for ``OpenTelemetryMiddleware`` |
| 49 | + |
| 50 | + .. change:: DTO: add ``__schema_name__`` to dto base |
| 51 | + :type: feature |
| 52 | + :pr: 4131 |
| 53 | + :issue: 3427 |
| 54 | + |
| 55 | + Add a new ``__schema_name__`` attribute to the DTO base, to allow to customising |
| 56 | + the name the DTO model will be given in the OpenAPI schema |
| 57 | + |
| 58 | + .. change:: Fix header name when raising ``MethodNotAllowedException`` |
| 59 | + :type: bugfix |
| 60 | + :pr: 4539 |
| 61 | + :issue: 4277 |
| 62 | + |
| 63 | + Fix a typo that snuck in when fixing https://github.com/litestar-org/litestar/issues/4277, |
| 64 | + where instead of an ``Allow`` header, an ``Allowed`` header would be sent |
| 65 | + |
| 66 | + .. change:: JWT: Store raw token in cookies without ``Bearer`` prefix |
| 67 | + :type: bugfix |
| 68 | + :pr: 4552 |
| 69 | + |
| 70 | + Fix a bug wherer the JWT Cookie backend would store the token with a ``Bearer`` |
| 71 | + prefix in the cookie, because it was using the same functions to generate the |
| 72 | + payload as the header-based JWT backend |
| 73 | + |
| 74 | + .. change:: JWT: Relax typing to allow ``Sequence`` for ``Token.aud`` |
| 75 | + :type: bugfix |
| 76 | + :pr: 4241 |
| 77 | + |
| 78 | + Fix typing to allow :class:`typing.Sequence` in |
| 79 | + :attr:`~litestar.security.jwt.Token.aud`. |
| 80 | + |
| 81 | + |
| 82 | + .. change:: DI: Properly handle (async) generators returned by ``__call__`` |
| 83 | + :type: bugfix |
| 84 | + :pr: 4459 |
| 85 | + :issue: 4457 |
| 86 | + |
| 87 | + Fix a bug that would treat a generator returned from a provider by invoking its |
| 88 | + ``__call__`` method, as a regular return value, and would ignore the cleanup |
| 89 | + step. |
| 90 | + |
| 91 | + .. change:: Testing: Improve stdout handling of subprocess test client |
| 92 | + :type: bugfix |
| 93 | + :pr: 4574 |
| 94 | + |
| 95 | + Adds handling to the subprocess (sync and async) test clients to: |
| 96 | + |
| 97 | + - Discard output to :obj:`subprocess.DEVNULL` by default, rather than to an |
| 98 | + unconsumed :obj:`subprocess.PIPE` (which could result in an overflow) |
| 99 | + - Enable subprocess output capture in the main stdout/stderr via the |
| 100 | + ``capture_output`` flag (defaults to ``True`` to keep existing behaviour) |
| 101 | + |
6 | 102 | .. changelog:: 2.19.0 |
7 | 103 | :date: 2025-12-14 |
8 | 104 |
|
|
0 commit comments