Skip to content

Conversation

@JeremyRubin
Copy link
Contributor

Related to #23259, a draft of what a simple external REST API Server would look like. Benefits of this approach would be that we can drop the messy HTTP/Rest code and it should be easier to extend this code for other public information RPCs. Further, using whitelistrpc'd credentials, it improves the security of the REST API to not be able to access any internal state (e.g., a buffer overflow can't write out memory from our core process).

I copied the Authproxy code from the test framework.

The rest_getutxos is not implemented as I don't think it has valid REST semantics, so we could discuss making it valid rest (using query parameters for multiple args) or hacking it another way.

@JeremyRubin JeremyRubin force-pushed the rest-python branch 2 times, most recently from 20acaf9 to 74c56c6 Compare October 19, 2021 19:21
@practicalswift
Copy link
Contributor

practicalswift commented Oct 20, 2021

Strong concept ACK on providing a REST API which is built with the intention to be secure.

The current situation where we don't want to vouch for the security of our REST API and instead suggest that our users should roll their own sanitisation via an nginx proxy if they want to use it in settings where security might be needed feels really weird for a security critical project. We can do better! :)

@sipa
Copy link
Member

sipa commented Oct 20, 2021

@practicalswift That seems entirely orthogonal here. The concern with REST (and also RPC, though RPC has additional exposure) is that it isn't designed to be DoS resistant, so it's assumed to only be exposed to clients that are trusted to not DoS attack the node. Putting in a Python wrapper that translates REST to RPC seems like that would only worsen this.

@JeremyRubin
Copy link
Contributor Author

@sipa it's not worse because a python rest server can enforce things like rate limiting or be configured to use a pool of nodes. If attacked directly, the python server's slowdowns can also function as rate limiting.

@JeremyRubin
Copy link
Contributor Author

Made a few mods here:

  • Use Tornado's Async HTTP Client
  • Add a load balancer if you want to be backed by >1 node (-1 on consistency across calls, but you can mitigate this by having 1 external node connected to a fan out of mirror listener nodes serving RPCs)

@JeremyRubin
Copy link
Contributor Author

@stickies-v you might be interested in helping with this as well :)

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 23, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@achow101 achow101 marked this pull request as draft October 12, 2022 18:42
@bitcoin bitcoin locked and limited conversation to collaborators Dec 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants