I haven't tested it, so speaking from my impressions. Liquids containers are not leaking. But all liquids containers that both have something in them and have free space can passively take in liquids from outside if you are submerged deeply enough. I don't know what counts as "deep enough" but it feels overtuned against you, just like many other things in this game.
I don't think it matters where a liquids container is on you - hands, bag, or a worn backpack. Or maybe it does and the bag must physically get submerged, I don't know.
Empty containers you have will never get anything in them from outside, unless you actually drop said container into the liquid, or pour a bit of some liquid into it first. Which suggests that there IS a bottle cap mechanic, but you don't have access to controlling it, it just auto-activates with an empty bottle.
The only container that doesn't seem to take in outside liquids is the one you can wear in the same slot as a fanny pack.