Enable safe mode and then run import.
This does not seem to work if you use common libraries. When using ssh programmatically, you tend to send one command and get the result from that command. The next command is sent as a separate entity, having no relation to the previous command. This makes it difficult to enable safe mode.
I have tested that at least with Ruby, you cannot enter safe-mode using the standard Net::SSH interface. Any changes I make after sending ctrl-X unfortunately persist, even if the session is broken unexpectedly.
To get around that limitation, you can open a telnet-like session, but then you have to manualle detect when output is finished, e.g. by matching the prompt. That is what I currently do, but it is error-prone and unreliable. Expect-like interfaces are a lot more difficult to use than the standard SSH libraries that work with most other vendors.