A system and methods are disclosed that permit mobile code, such as an applet,
to create a network connection with a content server on a network, without exposing
the client computer that is running the applet, or other computers with which the
client computer may communicate, to a DNS spoofing attack. This is achieved in
accordance with the principles of the present invention by using network restriction
software in the execution engine or runtime system under which the applet executes.
When the applet attempts to create a network connection to a content server, the
network restriction software checks a "name directory" on the content server for
the presence of an entry whose name corresponds to the name of the computer from
which the applet was downloaded. If such an entry is present, then the network
restriction software permits the network connection between the applet and the
content server to be created. If not, the applet may not create a network connection
with the content server. Additionally, address checks may be applied to assist
in preventing DNS spoofing attacks from succeeding.