-
Notifications
You must be signed in to change notification settings - Fork 1
Support multiple RPC urls for EvmRpc #9
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
base: main
Are you sure you want to change the base?
Conversation
src/plugins/evmRpc.ts
Outdated
| const { pluginId, urls, scanAdapters } = opts | ||
|
|
||
| // Use random URL for logging if safeUrl not provided | ||
| const safeUrl = opts.safeUrl ?? pickRandom(urls) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole "safeUrl" concept needs to go away. The idea was to present both the "real" URL with the API key, and the "safe" URL with the API key redacted. But now that we have an array of URL's, we'd either need to (from worse to better):
- Have a matching array of safe URL's. Kinda annoying.
- Stop caring about logging API keys. If somebody can access our box, they can just read the keys from the config anyhow. This is only a problem if we integrate Loki or something.
- Use a regexp to sanitize URL's.
- Use the same
https://somebody?apiKey={{keyName}}syntax we use in accountbased, and then substitute the API key for thefetchcall, but leave it un-substituted for logging.
I leave it up to you how to address this. It's not even clear that we have API keys in any of the URL's, in which case 2 might be a sensible choice.
| url: 'https://polygon-amoy-bor-rpc.publicnode.com' | ||
| urls: [ | ||
| 'https://api.zan.top/polygon-amoy', // yellow privacy | ||
| 'https://polygon-amoy-public.nodies.app', // yellow privacy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's with all these privacy comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are from chainlist.org. They're there to verify sorting by privacy first (green).
- Remove safeUrl parameter from BlockbookOptions and EvmRpcOptions interfaces - Add sanitizeUrlForLogging utility function that removes API keys from URLs - Use sanitization function in blockbook plugin (API keys are added to URLs) - Stub sanitization function in evmRpc plugin with TODO (API keys not yet used for RPC URLs) - Remove safeUrl usage from allPlugins.ts
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
none