Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] - autoclosed #78

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Sep 25, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
laminas/laminas-diactoros (source) ~2.8.0 -> ~2.18.1 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2022-31109

Impact

Applications that use Diactoros, and are either not behind a proxy, or can be accessed via untrusted proxies, can potentially have the host, protocol, and/or port of a Laminas\Diactoros\Uri instance associated with the incoming server request modified to reflect values from X-Forwarded-* headers. Such changes can potentially lead to XSS attacks (if a fully-qualified URL is used in links) and/or URL poisoning.

Patches

Any version after 2.11.0.

Starting in laminas/laminas-diactoros 2.11.1, we have added Laminas\Diactoros\ServerRequestFilter\FilterServerRequestInterface, which defines the single method __invoke(Psr\Http\Message\ServerRequestInterface $request): Psr\Http\Message\ServerRequestInterface. Filters implementing this interface allow modifying and returning a generated ServerRequest.

The primary use case of the interface is to allow modifying the generated URI based on the presence of headers such as X-Forwarded-Host. When operating behind a reverse proxy, the Host header is often rewritten to the name of the node to which the request is being forwarded, and an X-Forwarded-Host header is generated with the original Host value to allow the server to determine the original host the request was intended for. (We have always examined the X-Forwarded-Proto header; as of Diactoros 2.11.1, we also examine the X-Forwarded-Port header.) To accommodate this use case, we created Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders.

Due to potential security issues, it is generally best to only accept these headers if you trust the reverse proxy that has initiated the request.
(This value is found in $_SERVER['REMOTE_ADDR'], which is present as $request->getServerParams()['REMOTE_ADDR'] within PSR-7 implementations.) FilterUsingXForwardedHeaders provides named constructors to allow you to trust these headers from any source (which has been the default behavior of Diactoros since the beginning), or to specify specific IP addresses or CIDR subnets to trust, along with which headers are trusted.

Laminas\Diactoros\ServerRequestFactory::fromGlobals() was updated to accept a FilterServerRequestInterface as an additional, optional argument. Since the X-Forwarded-* headers do have valid use cases, particularly in clustered environments using a load balancer, to prevent backwards compatibility breaks, if no filter is provided, we generate an instance via FilterUsingXForwardedHeaders::trustReservedSubnets(), which generates an instance marked to trust only proxies on private subnets.

Workarounds

Infrastructure or DevOps can configure web servers to reject X-Forwarded-* headers at the web server level.

Users of laminas/laminas-diactoros can make use of the Laminas\Diactoros\RequestFilter\RequestFilterInterface functionality in order to either (a) disable usage of the X-Forwarded-* headers entirely, (b) opt-in to it, or (c) opt-in to the usage for configured proxy servers.

References

For more information

If you have any questions or comments about this advisory:

CVE-2023-29530

Impact

Affected versions of Laminas Diactoros accepted a single line feed (LF / \n ) character at the end of a header name. When serializing such a header name containing a line-feed into the on-the-wire representation of a HTTP/1.x message, the resulting message would be syntactically invalid, due to the header line being terminated too early. An attacker that is able to control the header names that are passed to Laminas Diactoros would be able to intentionally craft invalid messages, possibly causing application errors or invalid HTTP requests being sent out with an PSR-18 HTTP client. The latter might present a denial of service vector if a remote service’s web application firewall bans the application due to the receipt of malformed requests.

Patches

The problem has been patched in the following versions:

  • 2.18.1
  • 2.19.1
  • 2.20.1
  • 2.21.1
  • 2.22.1
  • 2.23.1
  • 2.24.2
  • 2.25.2

Workarounds

Validate HTTP header keys and/or values, and if using user-supplied values, filter them to strip off leading or trailing newline characters before calling withHeader().

References


Release Notes

laminas/laminas-diactoros (laminas/laminas-diactoros)

v2.18.1

Compare Source

v2.18.0

Compare Source

Release Notes for 2.18.0

Feature release (minor)

2.18.0
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Enhancement

v2.17.0

Compare Source

Release Notes for 2.17.0

Feature release (minor)

2.17.0
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Enhancement

v2.16.0

Compare Source

Release Notes for 2.16.0

Feature release (minor)

2.16.0
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Enhancement

v2.15.0

Compare Source

Release Notes for 2.15.0

Feature release (minor)

2.15.0
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
renovate

v2.14.0

Compare Source

Release Notes for 2.14.0

Feature release (minor)

2.14.0
  • Total issues resolved: 0
  • Total pull requests resolved: 3
  • Total contributors: 2
Documentation,Enhancement
Enhancement

v2.13.0

Compare Source

Release Notes for 2.13.0

Feature release (minor)

2.13.0
  • Total issues resolved: 0
  • Total pull requests resolved: 4
  • Total contributors: 3
Enhancement
renovate

v2.12.0

Compare Source

Release Notes for 2.12.0

Feature release (minor)

2.12.0
  • Total issues resolved: 0
  • Total pull requests resolved: 5
  • Total contributors: 4
Bug
Enhancement
Documentation,Enhancement

v2.11.3

Compare Source

Release Notes for 2.11.3

2.11.x bugfix release (patch)

2.11.3
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Bug,Enhancement

v2.11.2

Compare Source

Release Notes for 2.11.2

2.11.x bugfix release (patch)

2.11.2
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Bug

v2.11.1

Compare Source

Release Notes for 2.11.1

This is a SECURITY release. All users are encouraged to upgrade immediately.

Added

This release adds features to allow filtering a ServerRequest as generated by Laminas\Diactoros\ServerRequestFactory::fromGlobals() for the purposes of initialization. Examples include:

  • Adding a request identifier.
  • Using X-Forwarded-* headers to modify the URL to represent the original client request.

The features are based on a new interface, Laminas\Diactorors\ServerRequestFilter\FilterServerRequestInterface, which defines a single method:

public function __invoke(
    \Psr\Http\Message\ServerRequestInterface $request
): \Psr\Http\Message\ServerRequestInterface

We provide two implementations, as follows:

  • Laminas\Diactoros\ServerRequestFilter\DoNotFilter will return the provided request verbatim.
  • Laminas\Diactoros\ServerRequestFilter\FilterUsingXForwardedHeaders has named constructors that allow you to define how and when X-Forwarded-* headers are used to modify the URI instance associated with the request. These methods are:
    • trustAny(): this method generates a filter instance that will trust all X-Forwarded-* headers from any source.
    • trustReservedSubnets(array $trustedHeaders = ?): this method generates a filter instance that only modifies the URL if the IP address of the requesting server is from a reserved, private subnet (localhost; classes A, B, and C subnets; and IPv6 private and local-link subnets). By default, it will trust all X-Forwarded-* headers from these sources, but you may specify a list to allow via the $trustedHeaders argument.
    • trustProxies(array $proxyCIDRList, array $trustedHeaders = ?): this method will generate a filter instance that only modifies the URL if the requesting server matches an entry in the $proxyCIDRList. These entries may be IP addresses, or any IPv4 or IPv6 CIDR subnets. By default, it will trust all X-Forwarded-* headers from these sources, but you may specify a list to allow via the $trustedHeaders argument.

ServerRequestFactory::fromGlobals() now accepts a FilterServerRequestInterface instance as the optional argument $requestFilter. If none is provided, it uses one as produced by FilterUsingXForwardedHeaders::trustReservedSubnets().

Deprecated
  • The function Laminas\Diactoros\marshalUriFromSapi() is deprecated, and no longer used internally.
Changed

Laminas\Diactoros\ServerRequestFactory::fromGlobals() no longer consumes marshalUriFromSapi(), and instead inlines an alternate implementation. The new implementation does not consider X-Forwarded-* headers by default when generating the associated URI instance. Internally, if no FilterServerRequestInterface implementation is provided, it defaults to using an instance returned by FilterUsingXForwardeHeaders::trustReservedSubnets(). If you previously relied on X-Forwarded-* headers, you MAY need to update your code to use either the FilterUsingXForwardedHeaders::trustAny() or FilterUsingXForwardedHeaders::trustProxies() methods to generate a filter to use with ServerRequestFactory::fromGlobals().

Fixed
2.11.1
  • Total issues resolved: 0
  • Total pull requests resolved: 0
  • Total contributors: 0

v2.11.0

Compare Source

Release Notes for 2.11.0

Feature release (minor)

2.11.0
  • Total issues resolved: 0
  • Total pull requests resolved: 2
  • Total contributors: 1
Enhancement

v2.10.0

Compare Source

Release Notes for 2.10.0
Changed

This release adds minor normalization of header values with line continuations; the line continuations are now normalized to a single space. This is done to conform to RFC 7230#3.2.4, which is an important security guideline.

2.10.0
  • Total issues resolved: 0
  • Total pull requests resolved: 5
  • Total contributors: 2
Enhancement
Bug,Enhancement
Bug

v2.9.2

Compare Source

Release Notes for 2.9.2

2.9.x bugfix release (patch)

2.9.2
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Bug

v2.9.1

Compare Source

Release Notes for 2.9.1

2.9.x bugfix release (patch)

2.9.1
  • Total issues resolved: 0
  • Total pull requests resolved: 1
  • Total contributors: 1
Bug

v2.9.0

Compare Source

Release Notes for 2.9.0
2.9.0
  • Total issues resolved: 1
  • Total pull requests resolved: 4
  • Total contributors: 4
Enhancement
Documentation,Enhancement,hacktoberfest-accepted

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 038bb2d to c0f9ce0 Compare September 26, 2022 01:47
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Sep 26, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Sep 27, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from 79e9db3 to c762224 Compare September 28, 2022 08:24
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Sep 28, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Oct 2, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from 0dbe7bf to d9be578 Compare October 2, 2022 14:05
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Oct 2, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Oct 5, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from d5ecb01 to e05d390 Compare October 5, 2022 09:15
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Oct 5, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Oct 5, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from 557a06b to 059abb8 Compare October 5, 2022 20:39
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Oct 5, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Oct 6, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from 786a904 to cc06eec Compare October 6, 2022 13:59
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Oct 6, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Oct 6, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from 6c1d59e to 3be6bb4 Compare October 6, 2022 19:30
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Oct 6, 2022
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Oct 10, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch 2 times, most recently from 5b0832f to 96a8142 Compare October 10, 2022 17:52
@renovate renovate bot changed the title Pin dependency laminas/laminas-diactoros to v2.8.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.11.1 [SECURITY] Oct 10, 2022
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 99e3e4c to eb456ca Compare May 1, 2024 13:34
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] May 1, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from eb456ca to 0d1773e Compare May 9, 2024 11:44
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] May 9, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 0d1773e to 8be93b6 Compare May 9, 2024 12:18
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] May 9, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 8be93b6 to ebdeb27 Compare May 15, 2024 19:35
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] May 15, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from ebdeb27 to 380a6d1 Compare May 16, 2024 01:50
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] May 16, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 380a6d1 to e8cdb1d Compare June 1, 2024 02:09
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Jun 1, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from e8cdb1d to 5843de8 Compare June 1, 2024 04:56
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Jun 1, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 5843de8 to d61d0b3 Compare June 27, 2024 08:27
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Jun 27, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from d61d0b3 to e2d7376 Compare June 27, 2024 10:56
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Jun 27, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from e2d7376 to 9fef6b3 Compare July 14, 2024 11:08
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Jul 14, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 9fef6b3 to d9c8d0a Compare July 14, 2024 12:54
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Jul 14, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from d9c8d0a to 0044269 Compare July 28, 2024 16:32
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Jul 28, 2024
@renovate renovate bot force-pushed the renovate/packagist-laminas/laminas-diactoros-vulnerability branch from 0044269 to 2657f40 Compare July 28, 2024 18:26
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.26.0 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Jul 28, 2024
@renovate renovate bot changed the title Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] Update dependency laminas/laminas-diactoros to ~2.18.1 [SECURITY] - autoclosed Aug 6, 2024
@renovate renovate bot closed this Aug 6, 2024
@renovate renovate bot deleted the renovate/packagist-laminas/laminas-diactoros-vulnerability branch August 6, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants