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

feat:pubsub support for contract call auth #209

Merged
merged 84 commits into from
Dec 14, 2023
Merged

feat:pubsub support for contract call auth #209

merged 84 commits into from
Dec 14, 2023

Conversation

cbrit
Copy link
Member

@cbrit cbrit commented Jun 26, 2023

No description provided.

Copy link
Contributor

@EricBolten EricBolten left a comment

Choose a reason for hiding this comment

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

A few final comments.

go.mod Outdated
google.golang.org/grpc v1.45.0
google.golang.org/protobuf v1.27.1
github.com/ory/dockertest/v3 v3.10.0
github.com/peggyjv/gravity-bridge/module/v4 v4.0.0-20231211214131-bf2a31eb986f
Copy link
Contributor

Choose a reason for hiding this comment

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

We can point at the v4.0.0 release now without a commit tag.

src/pubsub.rs Outdated
s.publisher_domain
);

return;
Copy link
Contributor

@EricBolten EricBolten Dec 14, 2023

Choose a reason for hiding this comment

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

Wouldn't we want the blocklist to be enforced in the authorization handler rather than in the cache? That would have immediate effect, although I suppose a config change requires the process to restart anyway, so I'm not sure there.

In either case, we don't need to process the block list twice, we can create the overall mappings and then filter out blocked entries.

Also one more question: in a for_each like this, is return what we want? I guess it's because it's a code block in the iterator rather than an actual loop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah I'll move it outside.

Yeah because it's a closure, return acts like continue inside of the for_each method

src/pubsub.rs Outdated

// if there is already a default entry for this subscription ID under
// a different publisher, we remove it from that set of IDs.
if let Some(p) = subscription_mappings.keys().find(|k| {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what we're doing here is maybe the reverse order of what we want. We're creating subscription mappings with the publisher as the key, which means we have to do a bunch of weird searching. What if instead the subscription ID is the key, and the publisher is the value? Then it would look like this:

  1. Write out default subscription mapping
  2. Run through subscriberIntent mapping -- simply overwrite the publisher key, if the subscriber is using the default it won't change, if they've customized it it will

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that would be simpler

Copy link
Contributor

@EricBolten EricBolten left a comment

Choose a reason for hiding this comment

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

LGTM

@EricBolten EricBolten merged commit 0522bee into main Dec 14, 2023
11 checks passed
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.

2 participants