The effect of the new national-security law that China imposed on Hong Kong is extending far beyond the territory to American college campuses.

Classes at some elite universities will carry a warning label this fall: This course may cover material considered politically sensitive by China. And schools are weighing measures to try to shield students and faculty from prosecution by Chinese authorities.

At Princeton University, students in a Chinese politics class will use codes instead of names on their work to protect their identities. At Amherst College a professor is considering anonymous online chats so students can speak freely. And Harvard Business School may excuse students from discussing politically sensitive topics if they are worried about the risks.

The issue has become particularly pressing because at least the first semester at many universities will be taught online, meaning some students from China and Hong Kong will connect with their U.S. classmates via video links. Some academics fear the classes could be recorded and ultimately end up in the hands of Chinese authorities.