-
Notifications
You must be signed in to change notification settings - Fork 381
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
8.0 Compliance improvements #3246
Comments
Registering the idea here: we should try to improve RFC coverage in the code as we make progress in this area. By that I mean comments like: varnish-cache/bin/varnishd/cache/cache_req_fsm.c Lines 414 to 420 in e896529
|
I'm wondering whether VIP24 also falls under the compliance umbrella. |
I had a look at the Edge Architecture Specification, and noticed something that is not properly implemented in our
Surrogate-Control: no-storeIn https://github.com/varnishcache/varnish-cache/blob/master/bin/varnishd/builtin.vcl#L154, we unconditionally allow According to the spec If we want to improve compliance, we could change the Surrogate check as follows:
Surrogate-Control: max-ageThe This would be a change in the core. But the same check on Setting a Surrogate-Capability header in builtin.vclIf we really want to support surrogates, it would also make sense to already set a
That would allow the origin to know that we support both the surrogate caching syntax and ESI. Processing ESI based on the Surrogate-Control headerIf we send a proper We could add the following to
If this would undermine any other proxy or CDN that has ESI capabilities, we can use device targeting to make it more specific. The corresponding VCL code would then look like this:
Next steps
|
I added a list of parsing mistakes in the issue description, two items I'm aware of so far. |
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs varnishcache#3246 Refs varnishcache#3379
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs varnishcache#3246 Refs varnishcache#3379
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs varnishcache#3246 Refs varnishcache#3379
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs varnishcache#3246 Refs varnishcache#3379
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs varnishcache#3246 Refs varnishcache#3379
They are meant to convey and abstract the comparison of components of the HTTP grammar. They are also used as anchors to reference what the RFCs have to say about case sensitivity for comparisons. Refs varnishcache#3246
This should hopefully signal that we aren't merely comparing strings, but specific kinds of strings, and prevent regressions in that area. Refs varnishcache#3246
We should avoid loose parsing of HTTP/1 header line delimiters. This could potentially create a smuggling vector if Varnish was stacked with a different server that would interpret the delimiters differently. Refs varnishcache#3246
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs varnishcache#3246 Refs varnishcache#3379
Because we funnel HTTP header names through the symbol table they have to be valid VCL identifiers. It means that we can't support all valid header names, which are tokens in the HTTP grammar. To finally close this loophole without the help of a VMOD we allow header names to be quoted: req.http.regular-header req.http."quoted.header" However we don't want to allow any component of a symbol to be quoted: req."http".we-dont-want-this So we teach the symbol table that wildcard symbols may be quoted. There used to be several use cases for wildcards but it is now limited to HTTP headers. Refs #3246 Refs #3379
That is, only when http_range_support is on, which is the default. Refs varnishcache#3246
That is, only when http_range_support is on, which is the default. Refs varnishcache#3246
That is, only when http_range_support is on, which is the default. Refs #3246
I'm super late to this, but I would certainly make use of at least two of these improved use of the Surrogate-Control headers. In particular, we use ESI, and have custom handling in our vcl to process ESI based on that header. It's only a few lines, but it would be simpler for everyone using ESI if those few lines were unnecessary. Also, I sometimes run into an issue when I want to set Cache-control no-cache for the browse, but cache on Varnish. Being able to override the no-cache in Surrogate-Control with a max-age would simplify things, again removing the need for custom VCL. |
Since 4ab1100 (see also varnishcache#3246), we fail backend responses with an unexpected Content-Range. Yet RFC9110 states: The Content-Range header field has no meaning for status codes that do not explicitly describe its semantic. https://www.rfc-editor.org/rfc/rfc9110.html#section-14.4 The semantic is described for status codes 206 and 416, so the obvious implementation change would be for core code to only consider Content-Range for these status codes. But there might be scenarios where a stricter-than-RFC check is intended, so we keep that in core code and change builtin.vcl to remove the header where it has no semantic.
Since 4ab1100 (see also varnishcache#3246), we fail backend responses with an unexpected Content-Range. Yet RFC9110 states: The Content-Range header field has no meaning for status codes that do not explicitly describe its semantic. https://www.rfc-editor.org/rfc/rfc9110.html#section-14.4 The semantic is described for status codes 206 and 416, so the obvious implementation change would be for core code to only consider Content-Range for these status codes. But there might be scenarios where a stricter-than-RFC check is intended, so we keep that in core code and change builtin.vcl to remove the header where it has no semantic.
Since 4ab1100 (see also varnishcache#3246), we fail backend responses with an unexpected Content-Range. Yet RFC9110 states: The Content-Range header field has no meaning for status codes that do not explicitly describe its semantic. https://www.rfc-editor.org/rfc/rfc9110.html#section-14.4 The semantic is described for status codes 206 and 416, so the obvious implementation change would be for core code to only consider Content-Range for these status codes. But there might be scenarios where a stricter-than-RFC check is intended, so we keep that in core code and change builtin.vcl to remove the header where it has no semantic.
We have agreed to improve RFC compliance in the next "big" release (7.0/vcl x.y)
This ticket is meant to be the coordination point for this, in particular for the necessary documentation updates.
Each of the subtasks will have their own tickets, listed here:
Completed Subtasks for 7.0:
Discarded Subtasks:
Todo list:
The text was updated successfully, but these errors were encountered: