If people have access to change the content of the script then they can also change foo-1.2.3-src.tar.gz or foo-1.2.3-linux-amd64.gz. These are all general problems with downloading anything from the internet.
[0] https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...