Magic box, objects inside visible only through hole
For the magic box, the material of the front face is a simple principled shader (the default one) and the material of the side faces is a simple transparent shader.

The material of the other cubes is the same (or at least they both have this structure), like shown in the picture:



(You probably want to disable the little cube's shadow)

So you get this:



if you want to make the internal faces opaque, your sides need to be solid (you can do it with a solidify modifier)



the outer sides are completely transparent, the front is a simple principled shader, in the internal faces you need to use this material:



If you want the red cube to be visible, just make it a simple principled shader.

Here is the final result:



NOTE: if you can still see a dark shadow of the blu cube through the lateral sides, you need to increase the transparency light bounces 



NOTE 2: I think you should work a bit on the shadows and decide which objects should cast shadows and which shouldn't (for example right now the front face creates a shadow on the inner faces)