-
Notifications
You must be signed in to change notification settings - Fork 673
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(mocknet): change HTTP request logic #10023
Conversation
We'll change things to bind to "localhost" instead of "0.0.0.0", and make HTTP requests by SSH + curl on the remote server. It's also possible to set up an explicit SSH/SOCKS proxy, but that would require one for each server and would be long-lived, which might be a bit annoying for people running the test scripts
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.
Security-wise this seems good. I just submitted a comment for an issue I saw, I’ll let @wacban make the call on whether, from a code standpoint, this approach is the best one :)
'jsonrpc': '2.0' | ||
} | ||
body = json.dumps(body) | ||
r = run_cmd(node, f'curl localhost:3000 -d \'{body}\'') |
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.
Not sure if that’s important? but here if method
or params
contain a quote, then this will fail. Might need to replace all '
in body
with '"'"'
first
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.
I would feel slightly better with some escaping provided by a library but as long as this works it's ok.
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.
LGTM
Thanks for fixing!
'jsonrpc': '2.0' | ||
} | ||
body = json.dumps(body) | ||
r = run_cmd(node, f'curl localhost:3000 -d \'{body}\'') |
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.
I would feel slightly better with some escaping provided by a library but as long as this works it's ok.
We'll change things to bind to "localhost" instead of "0.0.0.0", and make HTTP requests by SSH + curl on the remote server. It's also possible to set up an explicit SSH/SOCKS proxy, but that would require one for each server and would be long-lived, which might be a bit annoying for people running the test scripts