I want to let users open my web app through a link that already contains the URL to the external resource. Then the web app needs to fetch this external resource and render content on the page based off of it.
This feature is important to me in order to allow users to integrate my app with their app or their own datasource.
Assuming my web app is hosted at example.com, a user needs to be able to open a link such as
https://example.com/view?resource=https%3A%2F%2Fexternal-hosting.net%2Ffile%2F24345
then based on this my code will
const data = await fetch('https://external-hosting.net/file/24345')
const dataJSON = await data.json()
Is it possible to safely retrieve such JSON data directly in the browser, if there's no way to make sure that the URL can be trusted?
What security vulnerabilities does this introduce and can they be mitigated?