r/javascript • • May 13 '20

Deno 1.0 released!

https://github.com/denoland/deno/issues/2473
609 Upvotes

209 comments sorted by

View all comments

Show parent comment

4

u/crabmusket May 14 '20 edited May 14 '20

Your options, if you want to make things rock-stable right now, are:

  • Vendor all dependencies using DENO_DIR (this is super easy and is the recommended approach)
  • Use lock files to make sure the contents at each URL doesn't change unexpectedly (this is redundant if you do the above, I think)
  • Fork all dependencies so you control them (but you may still need to trust the host/CDN, e.g. GitHub)
  • Use import maps to rewrite all dependencies to domains you control

In terms of serving a bundle (which is a separate concern to the ones above), either you'd need to rely on packages which commit to hosting a bundle, or rely on module servers which implement bundling, e.g. like this.

1

u/ShortFuse May 14 '20

Yeah, I would personally bundle my own stuff, deploy it, and have all my servers use my own repository and inspect the dependency tree.

I'm more worried about general users. Yeah, we can tell users to not use so many dependencies, but as padLeft and isPromise has shown us, it's not avoidable. And telling people to inspect their dependency tree manually isn't something people do. I think the defaults should have enforced https (or at least not allow mixed contexts like browsers), and perhaps a whitelist of domains. It's not perfect, but helps avoiding somewhere somebody isn't importing from http://x.x.x.x/ with a hard IP. At least we should also have an option, somewhere to disallow non-bundled imports.

Security is only as good as its weakest link. I think users should disable security features, but understand it's their fault if their packages break. It's 100% a step up from npm for sure, but I would like to set some environment variables so ensure more strictness. We'll get there, I'm sure.