Any 3D layer in After Effects can have a mask. Only the layer has 3D properties, however, so you cannot draw a mask on the Z axis. You can draw the mask, then rotate the layer on the Z axis though.
Collapsing Transformations can complicate masks on 3D layers . It's best to leave the collapse switch off.