Page MenuHomePhabricator

CDN doesn't validate request-target
Closed, ResolvedPublic

Description

Per RFC 9112 Section 3.2 request-target should match:

request-target = origin-form
                 / absolute-form
                 / authority-form
                 / asterisk-form

origin-form is defined like this:

origin-form    = absolute-path [ "?" query ] # https://www.rfc-editor.org/rfc/rfc9112.html#name-origin-form
absolute-path  = 1*( "/" segment ) # https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-references

and the RFC explicitly mentions When making a request directly to an origin server, other than a CONNECT or server-wide OPTIONS request (as detailed below), a client MUST send only the absolute path and query components of the target URI as the request-target.

The other kind of request targets are defined like this:

absolute-form   = absolute-URI # https://www.rfc-editor.org/rfc/rfc9112.html#name-absolute-form
absolute-URI    = scheme ":" hier-part [ "?" query ] # https://www.rfc-editor.org/rfc/rfc3986.html#section-4.3
authority-form  = uri-host ":" port # https://www.rfc-editor.org/rfc/rfc9112.html#name-authority-form
asterisk-form   = "*" # https://www.rfc-editor.org/rfc/rfc9112.html#name-asterisk-form

authority-form is only used for CONNECT requests, absolute-form can be used for CONNECT and site-wide OPTIONS while the asterisk-form is only used for OPTIONS requests.

Majority of the requests (GET/HEAD/POST) should use the origin-form, hence request-target should always be of the form ^/. The CDN currently fails to ensure this and this has triggered T317660 (public report available in https://github.com/apache/trafficserver/issues/9094)

Similar to the fix proposed in https://github.com/apache/trafficserver/issues/9094 and backported to ATS 9.1.3-1wm2 in https://gerrit.wikimedia.org/r/c/operations/debs/trafficserver/+/834045 Varnish should enforce RFC 9112 Section 3.2 and return a 400 for requests that don't provide a valid request-target

Related Objects

StatusSubtypeAssignedTask
ResolvedVgutierrez

Event Timeline

Vgutierrez triaged this task as Medium priority.Sep 27 2022, 9:50 AM
Vgutierrez added a subtask: Restricted Task.
Vgutierrez added a project: SRE.

Apparently varnish supports the absolute-URI form for non CONNECT requests. This has been introduced a long time ago in https://gerrit.wikimedia.org/r/c/operations/puppet/+/275474. @BBlack do you have any context for this?

Change 837633 had a related patch set uploaded (by Vgutierrez; author: Vgutierrez):

[operations/puppet@production] varnish: Enforce RFC 9112 request-target definition

https://gerrit.wikimedia.org/r/837633

Change 837633 merged by Vgutierrez:

[operations/puppet@production] varnish: Enforce RFC 9112 request-target definition

https://gerrit.wikimedia.org/r/837633

Mentioned in SAL (#wikimedia-operations) [2022-10-03T13:18:00Z] <vgutierrez> enforcing origin-form|asterisk-form for request-target on varnish (could trigger spikes of HTTP 400 errors) - T318676

Vgutierrez closed subtask Restricted Task as Resolved.Oct 3 2022, 2:53 PM