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

Variable names should be case sensitive per RFC 3986 #1041

Closed
fzipi opened this issue Apr 15, 2024 · 3 comments
Closed

Variable names should be case sensitive per RFC 3986 #1041

fzipi opened this issue Apr 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@fzipi
Copy link
Member

fzipi commented Apr 15, 2024

Description

Related to #1028, and in general, on HTTP request argument keys: The specification for URIs (Uniform Resource Identifiers), defined in RFC 3986: https://tools.ietf.org/html/rfc3986, states that all components of a URI after the domain name are case-sensitive. This includes the query string and its parameters (variables and values).

We are using the variable name as key in several collection. The key is specifically lowercased, for example here:

KeyStr: strings.ToLower(key),
and in the same method it is lowewcased in other places. This change came from 998cc14, and we also have tests that check that things are case insensitive (see
func TestVariableKeysAreCaseInsensitive(t *testing.T) {
).

Looks like this was done somehow to be compatible with CRS tests. Now, it this is true, then we should do the right implementation ™️ , and file a bug report with CRS so they can fix whatever is broken there.

Steps to reproduce

See related issue #1028.

Expected result

ARGS should be case sensitive.

Actual result

They are not.

CC @jptosso @jcchavezs

@fzipi fzipi added the bug Something isn't working label Apr 15, 2024
@fzipi
Copy link
Member Author

fzipi commented Apr 15, 2024

To add more information, modsec2 uses an apr_table to store headers for example, and when using apr_table_get to obtain variables back again, the key to search for says "(case does not matter)".

@fzipi
Copy link
Member Author

fzipi commented Apr 15, 2024

For args, modsec2 uses apr_table_addn, and it will Add data to a table, regardless of whether there is another element with the same key (see https://apr.apache.org/docs/apr/1.5/group__apr__tables.html#gaff9fdbd8f499f0dfb07123230e19ea54).

@M4tteoP
Copy link
Member

M4tteoP commented May 28, 2024

Implemented in #1059, and tracked in #945 to make it the default behavior in the next major version

@M4tteoP M4tteoP closed this as completed May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants