You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "kenballus (via GitHub)" <gi...@apache.org> on 2025/03/04 20:35:11 UTC

[I] `@` is incorrectly accepted within header names [trafficserver]

kenballus opened a new issue, #12082:
URL: https://github.com/apache/trafficserver/issues/12082

   RFC 9110 states that header names must consist only of `tchar`s, which are defined as follows:
   ```
     tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
                    / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
                    / DIGIT / ALPHA
                    ; any VCHAR, except delimiters
   ```
   
   `@` is not in this list, but ATS accepts it within header names, as long as it is not the first character.
   
   To test this, send ATS a request with `@` in a header name, and observe that it forwards the invalid header without modification.
   
   For example, sending the following request
   ```
   GET / HTTP/1.1\r\n
   Host: whatever\r\n
   To@st: test\r\n
   \r\n
   ```
   elicits the following response:
   ```
   GET / HTTP/1.1\r\n
   Host: echo\r\n
   To@st: test\r\n
   Client-ip: 172.18.0.1\r\n
   X-Forwarded-For: 172.18.0.1\r\n
   Via: http/1.1 traffic_server[503cce9c-f4c1-4ee9-bd19-63c6ae774944] (ApacheTrafficServer/10.1.0)\r\n
   \r\n
   ```
   
   The correct behavior is to respond 400, since `@` is not a valid character in this context.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `@` is incorrectly accepted within header names [trafficserver]

Posted by "dweepvira (via GitHub)" <gi...@apache.org>.
dweepvira commented on issue #12082:
URL: https://github.com/apache/trafficserver/issues/12082#issuecomment-3892073308

   
   
   I have opened a PR to address this issue: [https://github.com/apache/trafficserver/pull/12881](https://github.com/apache/trafficserver/pull/12881)
   
   The change disallows the `@` character in HTTP/1 header field-names to align with RFC 9110.
   
   Kindly review and let me know if any modifications are required.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `@` is incorrectly accepted within header names [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall closed issue #12082: `@` is incorrectly accepted within header names
URL: https://github.com/apache/trafficserver/issues/12082


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] `@` is incorrectly accepted within header names [trafficserver]

Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on issue #12082:
URL: https://github.com/apache/trafficserver/issues/12082#issuecomment-4828271010

   Thanks for the detailed report. After looking into this, the behavior is intentional and not something we can change. Apache Traffic Server uses header field-names that begin with `@` (for example `@Ats-Internal`) as a marker for internal headers, so the HTTP/1 field-name parser deliberately accepts `@`. This is documented right in the code: the parser unit test keeps `delimiter_@: 0` as a valid case with the note "Not allowed by the spec, but we use it as internal header indicator" (src/proxy/hdrs/unit_tests/test_Hdrs.cc), and the `@Ats-Internal` token is defined in src/proxy/hdrs/HdrToken.cc and wired up in src/proxy/hdrs/MIME.cc.
   
   Two pull requests that attempted exactly this change, [PR #12838](https://github.com/apache/trafficserver/pull/12838) and your [PR #12881](https://github.com/apache/trafficserver/pull/12881), were both closed for this reason: making the parser reject `@` would leave it unable to parse our own internal headers. Since this is by design and not a defect we plan to change, I am closing this issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org