Generally speaking, we don't connect directly to unknown computers, but there are other reasons for that.
Security is addressed at a few levels (here are 6 of them).
1. Access to native resources requires specific permission.
2. All processes (including those with access to native resources) can only be addressed by their 288-bit process identifier (128-bits of which are random). The only identifiers known to a process are its own, those of its children, and ones explicitly given to it.
3. The Actor model means each process can independently decide which messages to reply to, which to ignore, and how long to wait for a response (if at all).
4. Each node has a unique RSA key-pair. The 160-bit fingerprint of the public key is the non-random part of every process identifier. This allows nodes to verify the remote processes they communicate with. (And if necessary, encrypt messages sent to them.)
5. Hash-based distribution makes it easy to blacklist poorly-written or maliciously-crafted code, once it's been identified as such.
6. System services in Skynet are always kept current with live, on-the-fly updates.