Skip to content

ext_authz: support for buffering request body#5824

Merged
lizan merged 34 commits intoenvoyproxy:masterfrom
gsagula:buffered_authz
Apr 1, 2019
Merged

ext_authz: support for buffering request body#5824
lizan merged 34 commits intoenvoyproxy:masterfrom
gsagula:buffered_authz

Conversation

@gsagula
Copy link
Copy Markdown
Member

@gsagula gsagula commented Feb 4, 2019

This PR adds support to ext_authz filter for buffering the request data. This is useful when the authorization server needs to check the request body, e.g. HMAC validation.

Fixes #5676

Risk Level: low
Testing: unit
Docs Changes: yes
Release Notes: yes

Gabriel added 7 commits January 25, 2019 21:44
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
@htuch htuch requested a review from saumoh February 4, 2019 15:41
@htuch htuch assigned dio Feb 4, 2019
@htuch htuch requested a review from dio February 4, 2019 15:42
@htuch
Copy link
Copy Markdown
Member

htuch commented Feb 4, 2019

Please merge master to pick up #5827.

Signed-off-by: Gabriel <gsagula@gmail.com>
@stale
Copy link
Copy Markdown

stale bot commented Feb 12, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Feb 12, 2019
Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, @dio is sick.

@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Feb 12, 2019
@lizan lizan added the waiting label Feb 14, 2019
@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Feb 15, 2019

@lizan Thank you for looking at the PR. I had to work on some other things, but I will work on this by next week.

@stale
Copy link
Copy Markdown

stale bot commented Feb 22, 2019

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Feb 22, 2019
@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Feb 22, 2019

Sorry, another busy week. I will take a look at this later today or Monday.

@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Feb 22, 2019
Gabriel added 4 commits February 28, 2019 21:19
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Mar 7, 2019

@lizan I've addressed all your comments. Thanks for reviewing it.

const Buffer::Instance* buffer = sdfc->decodingBuffer();
if (max_request_bytes > 0 && buffer != nullptr) {
const uint64_t len = std::min(buffer->length(), max_request_bytes);
std::unique_ptr<char[]> data(new char[len]);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think I could use an std::string and then just move it. Not sure.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yeah I think you can do that.

Gabriel added 3 commits March 15, 2019 19:05
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Copy link
Copy Markdown
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Thanks for this. I think @lizan has gone through the critical bits. Mine is only small details.

Gabriel added 2 commits March 21, 2019 21:02
Signed-off-by: Gabriel <gsagula@gmail.com>
…fered_authz

Signed-off-by: Gabriel <gsagula@gmail.com>
@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Mar 22, 2019

@lizan @dio I think I addressed all your comments. Thank you for reviewing it.

@brectanus-sigsci
Copy link
Copy Markdown
Contributor

@gsagula Any update/ETA on this? Seems all comments were addressed.

@itstehkman
Copy link
Copy Markdown

Same! I would love for this to be merged, am also waiting on it as it will help me a lot, trying to do HMAC in ext-authz :)

…fered_authz

Signed-off-by: Gabriel <gsagula@gmail.com>
dio
dio previously approved these changes Mar 25, 2019
Copy link
Copy Markdown
Member

@dio dio left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @gsagula! Looks good.

Copy link
Copy Markdown
Member

@lizan lizan left a comment

Choose a reason for hiding this comment

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

sorry for the delay, one last question.

@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Mar 26, 2019

@lizan No worries, I've been pretty busy lately too. I found a couple of issues with the partial message feature, but I need to fix the broken tests now. I will try to get it out tomorrow. Thanks!

Gabriel added 4 commits March 26, 2019 20:30
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
…fered_authz

Signed-off-by: Gabriel <gsagula@gmail.com>
Gabriel added 4 commits March 27, 2019 20:56
Signed-off-by: Gabriel <gsagula@gmail.com>
Signed-off-by: Gabriel <gsagula@gmail.com>
…fered_authz

Signed-off-by: Gabriel <gsagula@gmail.com>
…fered_authz

Signed-off-by: Gabriel <gsagula@gmail.com>
@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Mar 28, 2019

Build failures seem unrelated. I will merge master and retry.

…fered_authz

Signed-off-by: Gabriel <gsagula@gmail.com>
buffer_data_ = config_->withRequestBody() &&
!(end_stream || (method && isHeaderOnlyMethod(method->value().getStringView())));

!(end_stream || Http::Utility::isWebSocketUpgradeRequest(headers) ||
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do filters get upgrade requests? I roughly remember this is handled by HCM now? cc @alyssawilk

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Apparently, they do but would be nice to hear from @alyssawilk. If this is ok, the same logic ^^ should be applied to the buffer filter.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah nvm I was in the old impression before we have new style websocket.

@gsagula
Copy link
Copy Markdown
Member Author

gsagula commented Mar 28, 2019

@lizan @dio I have addressed your concerns I believe. I also added a few tests for the logic around upgrade requests and did some manual testing. Feel free to take another look. Thanks!

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.

6 participants