Skip to content

[filters] Add RBAC condition fuzzer (CEL expressions)#9110

Merged
htuch merged 10 commits intoenvoyproxy:masterfrom
asraa:rbacmatcher
Dec 3, 2019
Merged

[filters] Add RBAC condition fuzzer (CEL expressions)#9110
htuch merged 10 commits intoenvoyproxy:masterfrom
asraa:rbacmatcher

Conversation

@asraa
Copy link
Copy Markdown
Contributor

@asraa asraa commented Nov 22, 2019

This adds a fuzzer for CEL expression matching. These conditions are used in the RBAC filter for complementing the existing principal/permission model.

About a quarter of the execution time is coming from google::api::expr::runtime::RegisterBuiltinFunctions. The test runs locally at about 250 exec/sec.

See: #7716

Risk Level: Low
Testing: Converted unit tests into corpus entries

Re-open of #8752 -- all history the same, merged to up to date master, and pushed all changes.
/review @htuch

asraa added 7 commits October 28, 2019 15:08
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
Signed-off-by: Asra Ali <asraa@google.com>
@lizan lizan requested a review from kyessenov November 22, 2019 17:50
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

This is really cool. A few point comments, looks like the right way to model this problem.
/wait

Protobuf::Arena arena;
Expr::evaluate(*expr, nullptr, stream_info, &request_headers, &response_headers,
&response_trailers);
} catch (const EnvoyException& e) {
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.

Does this only happen during proto validation? If so, maybe move Expr::evaluate outside the try/catch, to allow the fuzzer to discover any surprise evaluation exceptions.

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.

Ahh... it's an awkward case. The CEL expressions that are fuzzed have some required proto constraints that aren't enforced in proto validations, so they'll get caught in the code by an exception (for example, an expr_kind must be set).

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.

Can we add a dedicated EnvoyException subclass for this and do a narrower catch around that?

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.

Done! We throw CelException's for errors thrown in the CEL library

Signed-off-by: Asra Ali <asraa@google.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM modulo the one question around making the exception catch more precise.

@kyessenov
Copy link
Copy Markdown
Contributor

kyessenov commented Nov 26, 2019

Thanks! @TristonianJones FYI.

Signed-off-by: Asra Ali <asraa@google.com>
htuch
htuch previously approved these changes Dec 3, 2019
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

LGTM once CI passes.

Signed-off-by: Asra Ali <asraa@google.com>
Copy link
Copy Markdown
Member

@htuch htuch left a comment

Choose a reason for hiding this comment

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

Thanks!

@htuch htuch merged commit 210acff into envoyproxy:master Dec 3, 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.

3 participants