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

Working with Pub/Sub topics and subscriptions without looking them up #93

Open
alexeyinkin opened this issue Feb 3, 2024 · 0 comments

Comments

@alexeyinkin
Copy link

alexeyinkin commented Feb 3, 2024

To use an existing subscription, we must look it up with pubsub.lookupSubscription(name).
This translates to ProjectsSubscriptionsResource.get in package:googleapis/pubsub/v1.dart, which requires "Pub/Sub Viewer" role.

However, this role is not needed to actually pull messages. Pulling translates to ProjectsSubscriptionsResource.pull, for which the subscription name is enough, and it only requires "Pub/Sub Subscriber".

If code knows its subscriptions, it's more secure to run without a privilege of viewing all topics and subscriptions.

I propose making a method in PubSub to create a Subscription object from supplied parameters without looking up the subscription. Naming is hard though, because get is used in the underlying package to request it from the API, and create is used to create a subscription through the API.

The same problem likely applies to topics and publishing, although I haven't tried it yet.

@devoncarew devoncarew transferred this issue from dart-archive/gcloud Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants