Implement doc security protection

This is based on the design and implementation by Norman.

BugsId: 20468