-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Description
Action item for CVE-2019-15226
Following up on the patch for CVE-2019-15226 (#8520), where we added a cached_byte_size_ optional in HeaderMap that is updated with modifications to the HeaderMap, we should take steps to maintain an always-valid internal byte size count:
This would involve eliminating the non-const inline header access functions defined here:
envoy/include/envoy/http/header_map.h
Lines 351 to 355 in 48c7c20
| #define DEFINE_INLINE_HEADER(name) \ | |
| virtual const HeaderEntry* name() const PURE; \ | |
| virtual HeaderEntry* name() PURE; \ | |
| virtual HeaderEntry& insert##name() PURE; \ | |
| virtual void remove##name() PURE; |
And the non-const get method for any
HeaderEntry:envoy/include/envoy/http/header_map.h
Line 502 in 48c7c20
| virtual HeaderEntry* get(const LowerCaseString& key) PURE; |
After removing these accessors and changing uses of them to favor other HeaderMap modifiers, we should remove refreshByteSize().
Detail
- Add functionality for modifying inline headers directly.
- Port over any sets to inline header macros for
setReference,setCopyandsetInteger
- Port over any sets to inline header macros for
- Add functionality for appending and adding Header values to inline headers.
- Grepping for
insert[A-Z]shows we have 8 references ofinsert##nameleft. 4 of these are for usingappendToHeader. 2 are const, and 2 are to setGrpcTimeoutwithCommon::toGrpcTimeout.
- Grepping for
- Remove non-const inline header entry accessor:
##name()andinsert##name() - Remove non-const
HeaderEntry* HeaderMapImpl::get(const LowerCaseString& key).- Grepping for
get([^)]shows we have 2 non-const refs forget(const LowerCaseString& key):
source/extensions/filters/http/lua/wrappers.cc:84
source/extensions/filters/http/ext_authz/ext_authz.cc:169
- Grepping for
- Fuzz inline header methods
- Remove unnecessary inline header methods for integer types.
- Wrap up misc TODOs in
header_map.h, i.e. string -> string_view conversions
Reactions are currently unavailable