Conversation
src/httpserver.cpp
Outdated
There was a problem hiding this comment.
Should redact authorization header?
|
Output example when using Output example when running the test framework: |
|
Concept ACK Perhaps some sanitization or escaping is needed on the adversary controlled input before printing/logging to make sure we’re not opening up to log injection, etc? |
af855e2 to
8d416e4
Compare
|
@practicalswift Added a commit that only dumps headers if the request is valid (authorized and method is known). |
src/httpserver.cpp
Outdated
There was a problem hiding this comment.
it should avoid doing this if !LogAcceptCategory(BCLog::HTTP), no need for the overhead to copy the headers when the result is ignored
|
agree that string sanitizing is very important to prevent manipulation with escape codes etc. EDIT dumping the |
f0e8c1d to
1a4af64
Compare
|
@laanwj right, I asked it above #13992 (comment). |
|
Thinking of it, I'm not sure this is worth the added code and complexity. |
1a4af64 to
88f1c9d
Compare
|
Updated to redact authorization header (added Agree with @laanwj and I'm going to close this unless there is a strong reason to keep it. |
|
|
||
| bool EqualHeaders(const std::string& h1, const std::string& h2) | ||
| { | ||
| return evutil_ascii_strcasecmp(h1.c_str(), h2.c_str()) == 0; |
There was a problem hiding this comment.
Is there a reason for relying on libevent in this function? If not I suggest doing this without relying on third-party code by introducing the required locale independent string helper functions in-tree. That would perhaps also allow us to reduce the number of know locale dependence problems listed here: https://github.com/bitcoin/bitcoin/blob/master/test/lint/lint-locale-dependence.sh#L4
Note to reviewers: This pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Hey @promag I was looking at this PR when you closed it. I agree with @laanwj and you that a web debugging proxy is the right tool for inspecting HTTP requests. If the PR was still open and you where leaning towards implementing it, I would have suggested to extract the dump headers implementation and make it a freestanding utility function. But more importantly, IMO the changes where non-const member functions have been changed to |
|
Yeah I was going to cherry pick that. Thanks for reviewing. |
No description provided.