-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Don't set X-XSRF-TOKEN when the user isn't logged in #1043
Conversation
Cross-reference: opnsense/core#4917 The next version of lighttpd (lighttpd 1.4.60, not yet released) will relax this unintentional restriction which surfaced in the lighttpd HTTP/2 implementation. (It is still poor behavior for a client to send an HTTP request header with an empty value.) |
Oh, nice! I hadn't found anything about that. This bug had me banging my head to the desk for two days 😆 EDIT: I think yes, but maybe I can just wait until the next lighttpd update. Right now I'm proxying the requests to /web/ to a custom built frontend with this patch. |
I agree that it is a good idea to skip sending an HTTP request header with an empty value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does make sense to me.
Generally speaking, this is not a bug on remark42 side, but rather some deficiency of the proxy (Lighttpd). I don't have anything against not sending a no-value header but either way I see no reason why such a header may break anything. Take a look at another project reproxy by the same authors, this one won't do insane things like Lighttpd does ;) |
@gstrauss I don't think it's poor because if it's supported by browsers it should be supported by http servers. But I agree with the PR. If we don't need to send some headers we shouldn't. |
@akellbl4: Actually, with the previous behavior (empty header), if I use Firefox to re-send the request to the server (the one Lighttpd answered 400), Firefox removes the empty header. @umputun: reproxy looks like a nice piece of software. I'll look into it! |
It's problem of Lighttpd :) As you can see Firefox accepts sending empty header. |
Because it's being sent from a JS file. But if it's Firefox making the request, it removes it. $ curl -H "X-XSRF-TOKEN: " https://remark42.example.org/api/v1/config\?site=example Curl doesn't send the header. |
Codecov Report
@@ Coverage Diff @@
## master #1043 +/- ##
==========================================
- Coverage 44.28% 44.18% -0.11%
==========================================
Files 126 126
Lines 2897 2906 +9
Branches 653 653
==========================================
+ Hits 1283 1284 +1
- Misses 1602 1610 +8
Partials 12 12
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove XSRF_HEADER from the import where the linter detected unused variable (frontend/app/common/fetcher.test.ts
)?
An HTTP header cannot be empty, and although some webservers allow this (nginx, Apache), others answer 400 Bad Request (lighttpd), preventing the widget from loading.
@paskal, fixed. Also fixed prettier's complain about the indentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
An HTTP header cannot be empty, and although some webservers allow this (nginx, Apache), others answer 400 Bad Request (lighttpd), preventing the widget from loading.
I'm not sure this is the most elegant way to do it, that's why this is marked as a draft.