STP Root Guard

Root Guard is an STP feature that prevents a port from becoming a root port. This prevents a downstream switch from becoming a root bridge. This is useful when you have a multi-tenant situation where you don’t have direct control over all of the switches connecting to the network, and you want to make sure that your STP topology remains stable.

Root guard isn't limited to being applied only on root bridges. It can also be applied on non-root ports of downstream switches to prevent them from accepting a superior BPDU.

For additional STP fine tuning features, take a look at STP fine tuning the spanning tree protocol.

Links:

https://forum.networklessons.com/t/spanning-tree-rootguard/1144/52?u=lagapidis

https://networklessons.com/spanning-tree/spanning-tree-rootguard

https://www.ciscopress.com/articles/article.asp?p=2995351&seqNum=3