Skip to content

Conversation

@drewmendenhall
Copy link

@drewmendenhall drewmendenhall commented Feb 4, 2020

This change protects the loading of rollbar.js via the Browser JS Snippet from the cdn attack vector via Subresource Integrity.

I made a few changes to the build system in order to make this happen:

  • The webpack config that builds the snippet has been broken out into a separate config file. This config also exports a function so that the manifest can be read later in the build pipeline.
  • webpack-assets-manifest outputs the sha256 hash of the file which ends up on the cdn (minified vanilla config) to a file dist/manifest.json
  • Grunt builds rollbar.js via the webpack node api, not the grunt-webpack. This is done because the snippet build depends on the assets output from the vanilla build.
    • I'm pretty rusty with Grunt, so I couldn't find a good way to get things to work "the grunt way". I can put up another WIP branch if you'd like.

It might be nice to leverage multi-compiler mode in order to avoid reading from disk. Also, I'm not sure if it's useful to publish dist/manifest.json.

@drewmendenhall drewmendenhall closed this by deleting the head repository Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant