Well I wana talk about gaskets! Did you know the whole world is basically held together by gaskets? It's extremely simple technology but so ubiquitous!
Any time you want a liquid to be one place and not the other, you probably have a gasket or two of some kind. This is a thing I just took off a sink I'm destroying, and it looks exactly like the type of thing I'd use if I wanted to get water from inside/outside of my boat on to the outside/inside of my boat. (of course right now I can just pass water through the various rust holes in the hull).
This thing works like: ocean - big nubby thing - gasket - hull of the boat - gasket - screw to clamp down the gasket - any hose with a valve to decide when water goes through the hole.
So you go out to the middle of the ocean with at least like 4 of these preventing the ocean from coming into your home. Or for this particular case it just prevents the sink from leaking into your cabinet. But the principle and even form factor is basically identical.