adobe / helix-rum-js

Helix RUM Event Generator for JavaScript
Apache License 2.0
1 stars 7 forks source link

Using specific version (range) for rum enhancer #203

Open cziegeler opened 3 weeks ago

cziegeler commented 3 weeks ago

While it is possible to request a specific version of the rum script, e.g.

https://rum.hlx.page/.rum/@adobe/helix-rum-js@2.3.1/dist/rum-standalone.js

this script then always fetches the latest rum enhancer script.

It would be good to be able to get a specific version of the enhancer script and not just the latest.

One solution would be to pin point the rum enhancer script version when releasing a new rum js version. The downside is that this ties those versions together and when a new rum enhancer version is released, it requires a new rum js release.

trieloff commented 1 week ago

@chicharr I think this would play nicely with https://github.com/adobe/helix-rum-js/pull/207

cziegeler commented 5 days ago

This could be implemented by allowing two optional data attributes, data-enhancer-version and data-enhancer-hash. The first one determines the version of the rum enhancer script if set. In addition, data-enhancer-hash can be set which then results in adding subresource integrity to the included script tag for the rum enhancer, like:

script.integrity = value of data-enhancer-hash attribute script.setAttribute('crossorigin', 'anonymous');

kptdobe commented 5 days ago

It would be good to be able to get a specific version of the enhancer script and not just the latest.

What are the real life use cases ? If there are, there are other way to temporarily serve a specific version.

This adds an overhead in maintenance, especially that our customers will probably never upgrade. We also want them to use the latest and greatest and make the data collection evolve. We'll be stuck here.

Also, we discussed to use the Helix delivery instead of unpkg and jsdeliver. This will mean will have to add a lot more magic to serve the correct version.

I am definitively against this feature.

cziegeler commented 5 days ago

The real life use case is Subresource integrity and CSP - you can only specify a hash for the javascript if you know what file is served. Customers who do not care about that extra security do not need to use this feature, it is optional. But customers who care have a mechanism to do so.

kptdobe commented 5 days ago

ok but we are introducing a super generic solution that will be overused for a specific problem.

My understanding is: the only problem is for the CS script to be aligned with the hash of the rum-standalone.js and their respective release cycles (i.e. if we update rum-standalone.js, we need to update the CS script - and temporarily serve the old version and the new one, the time for everyone and all caches to be up-to-date).

Customers who do not care about that extra security do not need to use this feature, it is optional. But customers who care have a mechanism to do so.

It should be the other way around: we have 5 customers for which we have implemented a temporary hash solution, we need to productise it. So far, I though we've managed to fix their CSP none-sense... ?

cziegeler commented 5 days ago

I don't think that SRI is none-sense; and we are not talking about 5 customers here. Its at least 50, most likely increasing. The way SRI works is that you add the hash of the script to the script tag, something like (simplified):

Githubissues.
  • Githubissues is a development platform for aggregating issues.