Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publisher delete and queryable reply messages to ACL #1259

Merged
merged 14 commits into from
Jul 24, 2024

Conversation

oteffahi
Copy link
Contributor

@oteffahi oteffahi commented Jul 24, 2024

Adds filtering of publisher delete and queryable reply messages to ACL. Follow-up to PR #1200
Example of ACL rules with delete and reply messages:

{
  "access_control":
    {
      "enabled": true,
      "default_permission": "deny",
      "rules":
      [
        {
          "id": "allow queryables",
          "permission": "allow",
          "flows": ["ingress", "egress"],
          "messages": [
            "query",
            "reply",
            "declare_queryable"
          ],
          "key_exprs": [
            "**"
          ]
        },
        {
          "id": "allow delete",
          "permission": "allow",
          "flows": ["ingress", "egress"],
          "messages": [
            "delete",
          ],
          "key_exprs": [
            "**"
          ]
        },
      ],
      // rest of ACL config
    }
}

@oteffahi
Copy link
Contributor Author

oteffahi commented Jul 24, 2024

Requesting reviews from @Mallets @OlivierHecart @fuzzypixelz @gabrik
Thanks!

@fuzzypixelz fuzzypixelz requested review from OlivierHecart, fuzzypixelz, gabrik and Mallets and removed request for OlivierHecart July 24, 2024 09:08
@fuzzypixelz fuzzypixelz added the new feature Something new is needed label Jul 24, 2024
@oteffahi oteffahi changed the title Add queryable reply messages to ACL Add publisher delete and queryable reply messages to ACL Jul 24, 2024
@oteffahi oteffahi requested a review from Mallets July 24, 2024 10:02
@@ -718,7 +718,7 @@ pub(crate) fn route_send_response(
ext_tstamp,
ext_respid,
},
"".to_string(), // @TODO provide the proper key expression of the response for interceptors
key_expr.to_string(),
Copy link
Member

Choose a reason for hiding this comment

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

This allocates everytime in the critical path. Why it should return a String and not a keyexpr?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's because RoutingContext<Msg> expects a String. In other instances where this is called no additional allocation is made, but here it is the case...
For more detail see here: https://github.com/eclipse-zenoh/zenoh/blob/main/zenoh/src/net/routing/mod.rs

Copy link
Member

Choose a reason for hiding this comment

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

Let's then return empty String for the time being until a proper solution is found.
Does returning an empty String impact the behaviour?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returning an empty string breaks the keyexpr matching (empty string does not match with any key expression, even **).
Also, rules are made on key expressions, so having an empty string on all replies would impact the behavior of ACL

Copy link
Member

Choose a reason for hiding this comment

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

Ok, understood. Can you then verify the impact on performance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into it 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Due to high impact on performance, this change will be reverted. We can use Response{ wire_expr, ... } in ACL code to only get the keyexpr when needed.

oteffahi added 2 commits July 24, 2024 14:36
… filtering of reply messages

This reverts commit 3a78d5d.
Ingress reply messages are not affected by the unimplemented key_expr in routing/dispatcher/queries.rs
Comment on lines +364 to +367
// @TODO: Remove wire_expr usage when issue #1255 is implemented
if self.action(AclMessage::Reply, "Reply (egress)", wire_expr.as_str())
== Permission::Deny
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will have to be adressed once #1255 is implemented.

@Mallets Mallets merged commit 7aeb4ad into eclipse-zenoh:dev/1.0.0 Jul 24, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Something new is needed
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants