我正在研究一个场景,其中一些 JavaScript 文件将托管在 CDN 上。我希望有一些机制,以便当这些文件在用户端下载时,我可以确保这些文件没有被篡改,并且确实来自指定的 CDN。
我理解,如果我使用 SSL,这项任务非常容易,但是,我仍然希望确保即使在没有 SSL 的 HTTP 上也能提供正确的文件。
据我所知,目前还没有像 JavaScript 文件的数字签名这样的跨平台支持的机制。也许不需要?
浏览器是否内置了某种方法来验证 JavaScript 文件的作者?我能做些什么来保证安全吗?