Minecraft lightning strike inside building

Lightning can and does affect entities through walls in an Area-Of-Effect style of causing damage. All entities within a 6x6x12 cuboid of the strike will take 5 HP of damage.

As long as your base is above ground and not in a "dry" biome (such as a mesa), you can be struck by lightning -- regardless of holes in your ceiling.

To avoid lightning strikes, either build your base underground or in such a place where lightning doesn't strike normally at all.

(source)