Аналогично решению пользователя Archemar, применяется только при распаковке tar. Замена .*/
пустой строкой.
pv python_files.tar| ssh some_user@some_server 'cat | tar xz --transform=s,.*/,, -C /some/path/on/server'
Can an attacker ever gain access to the command line via that exposed port?
Если в вашем приложении есть уязвимости, да.
what are the most important things I need to take care of so that the app can't be exploited to get access to the box?
Это очень сложный вопрос.
docker
или любым другим облегченным контейнером/гипервизором пользовательского пространства