you could take some measure to prevent undesirable nodes :
1- use the option --nodiscover
Use this option to make sure that your node is not discoverable by people who do not manually add you.
Use this option to make sure that your node is not discoverable by people who do not manually add you.
2- use the option --maxpeers 0
Use maxpeers 0 if you do not want anyone else connecting to your test chain. Alternatively, you can adjust this number if you know exactly how many peers you want connecting to your private chain.