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

Enabling tauri's http module #125

Open
mattyg opened this issue Jan 28, 2023 · 0 comments
Open

Enabling tauri's http module #125

mattyg opened this issue Jan 28, 2023 · 0 comments

Comments

@mattyg
Copy link
Member

mattyg commented Jan 28, 2023

Is your feature request related to a problem? Please describe.
I want to be able to make arbitrary http requests to the web. This will enable oracles, email, push notifications, other external apis, scraping website content, website screenshots, etc.

Describe the solution you'd like
Tarui has a built in http module that lets you make requests outside of the browser context to avoid cors restrictions.

This introduces security risk of agents being unintentionally used in a botnet or contribute to a ddos. To mitigate these risks we can:

  • Rate-limit all requests
  • Use an allow list to restrict which urls can be requested. This allow list can also use glob matching syntax for a range of urls i.e. https://api.weather.com/**
  • Restrict each allow list item to a single happ
  • Require agent signature to modify the allow list
  • Require manual user approval to add items to the allow list by clicking "Accept" on a dialog prompt
  • Optionally expire each allow list items after a predefined time
  • Optionally expire each allow list items after a predefined number of requests

I'm imagining something like this exposed to the frontend:

addToAllowlist(urlGlob: string, expiration_ms: number | null, expiration_requests_count: number | null): Promise<AllowList> // add a given url glob to the allowlist for the current happ
removeFromAllowlist(urlGlob: string) : Promise<AllowList> // remove a given url glob from the allowlist for the current happ
getAllowlist(): Promise<AllowList> // get the current list of allowed url globs for the current happ
fetch(...): Promise<Response> // make an http request, assuming the url is allowed, throw error if not allowed

Describe alternatives you've considered

  • If the conductor supported making http requests from coordinator zomes, that would make this feature unnecessary. It would also enable http requests from headless DNAs that don't rely on to tauri (as far as I understand). I'm not sure how the HC core team is thinking about this, but would be interested to hear if this is an option or completely off the table.
  • If we had a generic launcher plugin system (see Enable plugin system #42), we could create a "web request plugin" instead of using tauri's built-in http module. The plugin system would enable a much wider range of functionality and allow us to connect to other software like search databases, or media rendering integrated into happs. This has a lot more security considerations so it seems like just using tauri's http module may be a simpler step forward.

Additional context

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

No branches or pull requests

1 participant