The usual wood finishes all do well in a bathroom, with the possible
exception of (1) no finish (OK for redwood or cedar, but condensation
will occur and maple or oak will spalt) or (2) shellac (which can
turn milky, i.e. shows water spots).
Regardless of finish, DO NOT rely on flakeboard or MDF materials
for any kind of shelf. Even if you like the idea of flipping it
when it sags, that'll get old, fast.