222 points · by vvoyer · 7y ago · 97 comments
It's possible to check subresource with es6 module but only if you know the signature first.(https://stackoverflow.com/questions/45804660/is-it-possible-...).
Even Webpack will not handle it with webpack-subresource-integrity (https://www.npmjs.com/package/webpack-subresource-integrity)
Of course HTTPS is strong but not a foolproof solution against man-in-the-middle attack.
If an attacker is in a position to be man-in-the-middle and can already get around HTTPS, they might as well compromise the page loading those resources.
If, say, you serve example.com from one source, and link js via pika.cdn - then if pika is compromised, your site would be too. If using sri, the example.com infrastructure would have to be subverted.
All things being equal, mitm ssl or subverting a well run cdn is hard - but if you double the number of cdns in play, you make compromise of one of them twice as likely/easy. With sri, you get to keep your single point of compromise - but can leverage the benefit of a besboke cdn for your js. If any.
SRI might be impossible to implement in this case, not only because of the Differential Serving feature but the fact, based on their examples, that developers should link to the major versions of projects, which would mean that the content under the URL will change.
This is where a reliable IPFS-like CDN would shine.
- Strip SSL by for instance blocking port 443 and hoping they fall back to HTTP.
- Get your own root certificate installed on the equipment of the user you are attacking. This is fairly common in corporate environments for instance.
- MD5 collision attacks (although almost every certificate would be SHA signed these days)
Chrome also hasn't trusted certs with MD5 since version 65.
Just FYI, you're missing out on some dollars because of that. For better or worse, the bean counters at my work place won't approve anything less. I have a feeling I'm not alone.
If you can quickly whip up some boilerplate business checkout with an invoice, you'd make more than a few dollars today.
They're seriously leaving money on the table, businesses would have no problem dropping 50k/yr on a service like this.
This is something we've been looking for at my job, but we don't have the technical expertise to do it ourselves (a CDN is tricky business, not in our core competency). If an SLA that included support and/or customization as well as had a direct line to high level support for feedback, you could easily net 50K or more.
Seriously. I know my organization would be willing to pay even more than that. If you're reading this Pika founders, you should really give this some thought.
I love not having to use build tools for my personal projects anymore - everything feels so light and "old school". Here's my Minecraft-ish clone in native modules and WebGL2: https://github.com/mrspeaker/webgl2-voxels. No dot files, nothin' to build... just view source!
I do wonder how modular css fits into the picture of es modules though.
But it's perfectly possible to write a modern PWA using modern js, modules, and a library like react (loaded from a cdn) without any build step at all. I've done it, and it's not all that hard as long as you don't mind only targeting the latest browsers (and writing out a bunch of file names manually).
I think the reason it is like that is because there were many problems with JS "back in the day", and so people felt they had to come up with solutions.
Just look at Svelte. It's a library about compiling JS to get back to the "just JS" days. I mean, it's more than that, but it's about reducing runtime complexity. So another way to think about it is that writing "old style simple JS" is so convoluted that the author felt the need to write a translation layer from modern frameworks to old style JS. Sort of a mindblower to me haha (though, I love and agree with Svelte, to be clear).
The great thing though is that you can still use plain old JS, right? Nothing has changed for you if you don't want it. So is there really a problem?
This "modern web" stuff is just people solving problems. Some of these problems are the fault of old JS/web. Some of them are problems of our own making. Remember how amazing modern UI frameworks were? It's because we had PTSD from horrible jQuery codebases. A problem of our own making.
So stick with what you like, and other people can use the more complex stuff. It's a win win, no?
But I still like:
https://www.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool...
And the accompanying example repo:
https://github.com/keithamus/npm-scripts-example
I'm not eniterly clear on what parcel/webpack does better/simpler - maybe windows support?
I certainly see how one might prefer yarn over npm for dependency management, though - so maybe npm isn't as nice a build tool anymore?
But you can, if you build the project and then serve the "build" directory.
If that's the step that's bothering you, you can just not use Webpack, that's completely possible for all major libraries I encountered.
ES modules could also bring sanity to dependency management within the ecosystem. It is interesting to see the approach Deno JS is taking here as well.
Is the JS world trending away from Webpack now? When did this happen?
Webpack's complexity seems born out of necessity since back in the day a lot of things were just not there.
Parcel has no baggage and it shows in it's very lean offering that works without you needing to troll through stackoverflow, old github issues and forum links.
Retrieving critical content from a 3rd-party CDN has a number of issues:
- New TCP connection has to be created with added cost of TLS negotiation and it's own slow-start phase
- If you're using HTTP/2 then prioritisation only occurs over a single connection so it can't be prioritised against other content
Benchmark for your users.
- Safari double keys it's cache to prevent 3rd-parties tracking across sites - Usage of common libraries is just too low for their to be a critical mass
A whole site running on a CDN still involves only one connection, will make use of the throughput growing the TCP congestion window grows, and a decent CDN is likely to be more reliable than the origin
Won't this break for any situation in which users with different browsers share a proxy server?
(also tried with Chrome, didn't see a Vary there either)
CDNJS is actually orders of magnitude more likely to have a cache hit than this new offering.
CDNJS is just a standard CDN that serves up files as they're packaged, but if you want a high hit-ratio then https://jsDelivr.com has the most marketshare currently, and more features.
Are you sure it has the most marketshare?
CDNJS is only using Cloudflare, JsDelivr has a bigger network with more partners and support for both npm and github.
I struggled to see the value-add, I think it does automatic bundling & inserts polyfills based on UA strings. The whole pika project looks like a rewrite/alternative to the npm servers, kind of like MetaCPAN is for perl's CPAN+search.cpan.org
I struggled because the landing page & about were very light on the project/product's overview, too details-focused for me and I suppose anyone else who wasn't already aware of it.
My company is in adtech so our final bundles are 14kb (single TCP congestion window) for modern browsers, 30kb for Safari/iOS 10, and 75kb for IE11/IE10. We've seen similar doubling-of-size in other libraries for backwards compatibility, although we can probably drop IE10 soon and cut IE11 down by half.
I'd love to use something like this for teaching, tutorials, and even small projects, but there's some things I still need a transpiler for.
I also realize I could use the `htm` package instead of JSX, which gives a lot of benefits over JSX, including not requiring transpiling, but, since it's not widely used by the wider ecosystem, I'd be a little hesitant to include it in my projects.
Let's call it "retro"? :)
Nothing is free and I didn't find this in crunchbase.
Something is paying for it. Is it tracking people and selling it?
> Love Pika? Go Pro! Pika CDN will always be free, but you can support the project with a Pro Membership donation on Patreon. Get early access to upcoming production-only features.
What if in 5-10 years the volume is too big to be funded by donations? Will Pika sell to a malicious company? Will it shut down and kill everyone that depends on it?
The referred by string in the request tells them what page the user is loading which requires a script from this CDN.
They could have other business angles as well, but user tracking is certainly one possibility.
I get that they might have a User-Agent mapping to features. But how do they know which feature are needed by the loaded modules?
Also, wasn't clear to me whether they support SRI or an equivalent supported by the browser. If they don't, it could also be a centralized vulnerability for user-targeted injection.
(Solution: the best sites will pay to serve their own JS.)
import {Component, render} from 'https://cdn.pika.dev/preact/v8';May or may not be an issue for this project. Just bringing it up for visibility.