Skip to content

admin: fix field mask parameter - #17214

Merged
mattklein123 merged 3 commits into
envoyproxy:mainfrom
paul-r-gall:MaskParamFix
Jul 8, 2021
Merged

mattklein123 merged 3 commits into
envoyproxy:mainfrom
paul-r-gall:MaskParamFix

Conversation

@paul-r-gall

Copy link
Copy Markdown
Contributor

Signed-off-by: Paul Gallagher [email protected]

Commit Message: admin: fix field mask parameter
Additional Description: PR #16979 caused a regression where providing field masks without providing a resource did not work. This change makes it so that providing a bad field mask fails silently when a resource is not provided.
Risk Level: low
Testing: unit test added to detect regression so that it will be caught in the future.

Signed-off-by: Paul Gallagher <[email protected]>
@paul-r-gall

Copy link
Copy Markdown
Contributor Author

@jmarantz could you take a look at this fix?

return absl::optional<std::pair<Http::Code, std::string>>{std::make_pair(
Http::Code::BadRequest, absl::StrCat("FieldMask ", field_mask.DebugString(),
" could not be successfully used."))};
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

WDYT about just including in the output text the error message that we had before. IIUC you were taking a case that had an instructive error message before about what was wrong, and then making it just return an empty string.

Maybe collect the names of the fields that had invalid masks and return them in one error message?

We might also return an http error when none of the clusters had a useful mask. WDYT?

@paul-r-gall paul-r-gall Jul 2, 2021 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm considering the case in the test, when someone just supplies mask=bootstrap. Intended behavior there is just that the bootstrap config is returned, with no error message. However, that mask is invalid for the majority of protos in the dump (which is why this was failing before).

I think that returning an HTTP error when no protos had a useful mask is a good idea.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sgtm.

@jmarantz jmarantz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/wait

@jmarantz jmarantz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great with one minor nit.

/assign-from @envoyproxy/senior-maintainers

@repokitteh-read-only

Copy link
Copy Markdown

@envoyproxy/senior-maintainers assignee is @lizan

🐱

Caused by: a #17214 (review) was submitted by @jmarantz.

see: more, trace.

@mattklein123
mattklein123 merged commit 550253e into envoyproxy:main Jul 8, 2021
leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
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.

4 participants