This is easiest(?) explained through topological transformations.
Uh, well, hear me out, okay?
Start with a sealed metal box. This is a fine endpoint if you don't need anything into or out of the box -- you can break the seal just ever so slightly with, say, a small opening for optical transceivers (optoisolators, fiber..), and that doesn't really change anything (not at circuit frequencies anyway).
As soon as you stick a wire through such a hole, though... that's a path for noise to travel. Filter it at the opening, and you prevent interference.
It follows that, for any N wires, you can have N respective holes and filters. Or you can group the wires together at a common hole, again as long as the hole is small relative to the relevant frequencies, and impedance.
It's usually convenient to have the filters common to circuit ground as well, so you should tie that to the enclosure somewhere inside (and presumably outside as well), in which case ground does not need to be filtered as an independent signal. (Assuming ground remains ground, of course. The circuit board should be grounded, early and often, to the enclosure. Any impedance between the two, and the return currents from all the signal lines flows across that impedance, causing ground-loop voltages and currents.)
There can be [unoccupied] holes in the enclosure, as long as the poorer shielding isn't troublesome. Say you only need 40dB rather than say 120+ dB. And that at modest radio frequencies (100s MHz say). Openings can be a maximum of some cm across. Such a box may look less like a box, and more like a cube made from angle pieces (plus whatever's supporting the wire feed-thrus, of course).
With these topological transformations, we can start with a closed shield, and open it up strategically, without grossing affecting the electrical performance. In this way, we preserve important paths and connections, while turning the enclosure into Swiss cheese, or nearly flattening it into a plane.
It is for this reason, that it's very effective to use PCBs with solid ground plane design. All signals onboard are somewhat shielded by the fact that the board itself is solid metal. When connectors are placed towards the edge, filters inboard from them, and core circuitry in the center, we can maximize immunity and minimize emissions, by recreating the topology of a box with some holes.
As for signals you can't afford to filter individually -- for example, high speed data -- this can be shielded individually (e.g., coax; the shield should be tied to ground early and often, this sort of thing for example:
https://www.harwin.com/product-highlights/smt-cable-clips/ ), or passed as balanced pairs, with common mode chokes to reinforce balance (you're still filtering -- just as a pair together, rather than each wire individually).
Tim