anvil-works / anvil-runtime

The runtime engine for hosting Anvil web apps
https://anvil.works/open-source
Other
904 stars 117 forks source link

How to fully uninstall anvil-runtime? #41

Closed jkleckner closed 3 years ago

jkleckner commented 3 years ago

After listening to a podcast, I tried creating a virtual env (conda py 3.7) and installed/ran the todo application on my personal Mac (Catalina).

I can't find a description of how to fully uninstall it. After removing the virtual environment and fully removing the contents of the temporary application directory for the todo application, the route http://127.0.0.1:3030 continues to serve up content including javascript to connect to services like Stripe even after a reboot. This is quite alarming.

How can I reverse this without having to do a complete reinstall of Catalina or reversion to a recent Time Machine backup?

Update:

Anvil is installing a persistent service worker to support "PWA". See comment below to clear the data associated with it. Note that this means any Chrome browser that visits the application will have this running until you do clear it.

jkleckner commented 3 years ago

This seems to be some remnant left in Chrome. Clearing the cache and cookies for that URL or a hard-reload in dev doesn't get rid of it and I don't want to clear all of my stored data. There isn't anything served on the 3030 port. Will look into this more tomorrow.

jkleckner commented 3 years ago

Ok, fresh in the morning I was able to locate the culprit.

There was a persistent service worker that had been installed that was serving up authentication to Stripe, Google, and a lot of others.

No amount of clearing cookies or app data would solve this - I didn't try nuke of everything since that is very disruptive indeed.

So I ran across the solution [1] which was "How to Force Remove Service Worker from Chrome".

After you clear everything from 127.0.0.1:3030 you should restart and then inspect the service workers [2] [3] to satisfy yourself that it is gone. And looking at that list [3] may prompt you to go ahead and clear the global cache anyway...

This reference shows how to unregister all with the JS console [4]. Also, this security FAQ [5] is interesting.

Weirdly hard to find for me, as I am not a web developer by day.

[1] https://dev.to/damcclean/how-to-force-remove-service-worker-from-chrome-1n2f [2] https://www.chromium.org/blink/serviceworker/service-worker-faq [3] chrome://serviceworker-internals/ [4] https://www.stefanjudis.com/snippets/how-to-unregister-all-installed-service-workers-in-chrome/ [5] https://chromium.googlesource.com/chromium/src/+/main/docs/security/service-worker-security-faq.md

meredydd commented 3 years ago

Closing as you seem to have resolved this!

jkleckner commented 3 years ago

While it is true that I was able to sleuth how to recover, it seems that at the least there should be some documentation of this and at best some support for uninstall.