Repository navigation
stateful_session: encode expiry time and reject expired cookies - #26761
Conversation
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
|
/assign |
|
Json is great. But would it be better to use some simple way to extended this cookie value? For example, a simple space could be used to seperate different fields in the value. |
|
/wait-any |
That was my first approach - to separate by say |
|
For encoding the data I would strongly recommend something like a base64 encoded protobuf. This will be much easier to deal with if we add more fields in the future. |
|
@mattklein123 Thanks for your suggestion. Let me refactor the code to use protobuf. |
SGTM. |
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
wbpcode
left a comment
There was a problem hiding this comment.
Thanks for your quick update and some comments are added to start the review.
|
@wbpcode Thanks for reviewing. I tried to address all your comments. |
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
|
/retest |
|
/retest |
|
Retrying Azure Pipelines: |
Signed-off-by: Christoph Pakulski <[email protected]>
|
/retest |
|
Retrying Azure Pipelines: |
|
Could merge the main and try the CI again. |
Signed-off-by: Christoph Pakulski <[email protected]>
wbpcode
left a comment
There was a problem hiding this comment.
LGTM overall and only one single comment, thanks again for your time, patience and great works.
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
Signed-off-by: Christoph Pakulski <[email protected]>
|
@wbpcode Thanks for code reviews! It really helps. |
…yproxy#26761) * Hacked version with expiry added after semicolon. Signed-off-by: Christoph Pakulski <[email protected]> * Implemented cookie in JSON format. Signed-off-by: Christoph Pakulski <[email protected]> * Added integration tests. Signed-off-by: Christoph Pakulski <[email protected]> * Helper class to simplify comparing JSON encoded cookies in tests. Signed-off-by: Christoph Pakulski <[email protected]> * Log when old cookie format is detected. Signed-off-by: Christoph Pakulski <[email protected]> * Formatting. Signed-off-by: Christoph Pakulski <[email protected]> * Updated release notes. Signed-off-by: Christoph Pakulski <[email protected]> * Typo. Signed-off-by: Christoph Pakulski <[email protected]> * Changed cookie encoding from JSON to protobuf. Signed-off-by: Christoph Pakulski <[email protected]> * Fixed clang-tidy. Signed-off-by: Christoph Pakulski <[email protected]> * Changed cookie expiry type to uint64. Signed-off-by: Christoph Pakulski <[email protected]> * Generate single log regardless of number of old-style cookies. Signed-off-by: Christoph Pakulski <[email protected]> * Used ENVOY_LOG_ONCE to supress subsequent logs. Signed-off-by: Christoph Pakulski <[email protected]> * Always reply in new format, regardless of received cookie's format. Signed-off-by: Christoph Pakulski <[email protected]> * Remove unnecessary intermediate local variables. Signed-off-by: Christoph Pakulski <[email protected]> * Kick CI Signed-off-by: Christoph Pakulski <[email protected]> --------- Signed-off-by: Christoph Pakulski <[email protected]>
…yproxy#26761) * Hacked version with expiry added after semicolon. Signed-off-by: Christoph Pakulski <[email protected]> * Implemented cookie in JSON format. Signed-off-by: Christoph Pakulski <[email protected]> * Added integration tests. Signed-off-by: Christoph Pakulski <[email protected]> * Helper class to simplify comparing JSON encoded cookies in tests. Signed-off-by: Christoph Pakulski <[email protected]> * Log when old cookie format is detected. Signed-off-by: Christoph Pakulski <[email protected]> * Formatting. Signed-off-by: Christoph Pakulski <[email protected]> * Updated release notes. Signed-off-by: Christoph Pakulski <[email protected]> * Typo. Signed-off-by: Christoph Pakulski <[email protected]> * Changed cookie encoding from JSON to protobuf. Signed-off-by: Christoph Pakulski <[email protected]> * Fixed clang-tidy. Signed-off-by: Christoph Pakulski <[email protected]> * Changed cookie expiry type to uint64. Signed-off-by: Christoph Pakulski <[email protected]> * Generate single log regardless of number of old-style cookies. Signed-off-by: Christoph Pakulski <[email protected]> * Used ENVOY_LOG_ONCE to supress subsequent logs. Signed-off-by: Christoph Pakulski <[email protected]> * Always reply in new format, regardless of received cookie's format. Signed-off-by: Christoph Pakulski <[email protected]> * Remove unnecessary intermediate local variables. Signed-off-by: Christoph Pakulski <[email protected]> * Kick CI Signed-off-by: Christoph Pakulski <[email protected]> --------- Signed-off-by: Christoph Pakulski <[email protected]> Signed-off-by: Ryan Eskin <[email protected]>
|
This change is not backwards compatible. TTL was optional in the raw encoding but becomes mandatory for the new proto encoding. I think a required TTL is a better security posture, but this definitely would break someone upgrading that didn't set TTL. |
|
Is it because cookie is instantly expired when ttl is zero? I did not change API, so if you do not set ttl, the value is zero. If so, the fix should be relatively easy. |
|
Yes, TTL set to 0 (as recommended by docs for sessions) makes it expire immediately. I'll send a patch. |
|
OK. Thanks! |
Commit Message:
encode expiry time and reject expired cookies
Additional Description:
Changed internal format of cookies to protobuf. Added
expiresfield. When processing received cookie,expirestimestamp is compared to the current time. Expired cookies are ignored and new upstream host is selected. Backwards compatibility is preserved, so cookies in "old" non-proto format are accepted, but support for them will be removed in the future.Risk Level: Low
Testing: Expanded unit and integration tests.
Docs Changes: No.
Release Notes: Yes.
Platform Specific Features:
Runtime guard: envoy.reloadable_features.stateful_session_encode_ttl_in_cookie
Fixes #26347