Skip to content

header_map/fuzz: improve robustness to embedded NULL in headers.#6170

Merged
htuch merged 2 commits intoenvoyproxy:masterfrom
htuch:codec-transfer-encoding-fix
Mar 5, 2019
Merged

header_map/fuzz: improve robustness to embedded NULL in headers.#6170
htuch merged 2 commits intoenvoyproxy:masterfrom
htuch:codec-transfer-encoding-fix

Conversation

@htuch
Copy link
Member

@htuch htuch commented Mar 5, 2019

As discovered back in #5867, we have some situations where
we expect the codecs to reject embedded NULLs in header key/values. This PR improves
codec_impl_fuzz_test by having it ignore such invalid values and also adds a bunch of ASSERTs to
HeaderMapImpl to document/guard against any potential NULL creep, since its correctness is
predicated on this.

Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13447.

Risk level: Low
Testing: Corpus entry added.

Signed-off-by: Harvey Tuch htuch@google.com

As discovered back in envoyproxy#5867, we have some situations where
we expect the codecs to reject embedded NULLs in header key/values. This PR improves
codec_impl_fuzz_test by having it ignore such invalid values and also adds a bunch of ASSERTs to
HeaderMapImpl to document/guard against any potential NULL creep, since its correctness is
predicated on this.

Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13447.

Risk level: Low
Testing: Corpus entry added.

Signed-off-by: Harvey Tuch <htuch@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks good with one request for some comments.

/wait


private:
void lower() { std::transform(string_.begin(), string_.end(), string_.begin(), tolower); }
bool valid() const { return string_.find('\0') == std::string::npos; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some kind of comment of why this indicates valid, why we are doing this, it's only used for asserts, etc.? (Same for the other valid function, or just have a comment there to point to here or vice versa)

Signed-off-by: Harvey Tuch <htuch@google.com>
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@htuch htuch merged commit b2fe722 into envoyproxy:master Mar 5, 2019
@htuch htuch deleted the codec-transfer-encoding-fix branch March 5, 2019 18:06
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
…oyproxy#6170)

As discovered back in envoyproxy#5867, we have some situations where
we expect the codecs to reject embedded NULLs in header key/values. This PR improves
codec_impl_fuzz_test by having it ignore such invalid values and also adds a bunch of ASSERTs to
HeaderMapImpl to document/guard against any potential NULL creep, since its correctness is
predicated on this.

Fixes oss-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13447.

Risk level: Low
Testing: Corpus entry added.

Signed-off-by: Harvey Tuch <htuch@google.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
@htuch htuch mentioned this pull request Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants