Disallow leading dots

This is to avoid names like ".." which could have security implications.

Note that the first commit is just importing rewire. The second commit is the relevant one for review.