Hacker News new | ask | show | jobs
by maxmcd 1995 days ago
The service can call itself, forever

    import urllib.request
    import json
    import threading

    def do_request():
        data = {"lang":"python", "code": open(__file__).read(), "stdin": ""}
        req = urllib.request.Request(
            "https://www.sharepad.io/run", 
            data=json.dumps(data).encode('utf-8'), 
            headers={
                'Content-Type': 'application/json'
            }
        )

        f = urllib.request.urlopen(req)
        print(f.read().decode('utf-8'))
    x = threading.Thread(target=do_request)
    x.start()
    do_request()
    x.join()
2 comments

Oh, I was not aware of this, definitely need to fix this, thanks!
I disabled access to the VM's public IP from the host. I may eventually need to completely disable the network stack for the containers in the future.