Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: disabling sri integration #835

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions tests/specs/csp.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ describe('Content Security Policy', () => {
}]))
})

it('should load async chunk with subresource integrity', async () => {
await Promise.all([
browser.testHandle.expectRum(),
browser.url(await browser.testHandle.assetURL('subresource-integrity-capture.html'))
.then(() => browser.waitForAgentLoad())
])

const foundIntegrityValues = await browser.execute(function () {
return window.chunkIntegratyValues
})

expect(foundIntegrityValues.length).toEqual(1)
expect(foundIntegrityValues[0]).toMatch(/^sha512-[a-zA-Z0-9=/+]+$/)
})
// it('should load async chunk with subresource integrity', async () => {
// await Promise.all([
// browser.testHandle.expectRum(),
// browser.url(await browser.testHandle.assetURL('subresource-integrity-capture.html'))
// .then(() => browser.waitForAgentLoad())
// ])
//
// const foundIntegrityValues = await browser.execute(function () {
// return window.chunkIntegratyValues
// })
//
// expect(foundIntegrityValues.length).toEqual(1)
// expect(foundIntegrityValues[0]).toMatch(/^sha512-[a-zA-Z0-9=/+]+$/)
// })
})
31 changes: 21 additions & 10 deletions tools/webpack/configs/common.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import webpack from 'webpack'
import TerserPlugin from 'terser-webpack-plugin'
import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity'
import NRBAChunkingPlugin from '../plugins/nrba-chunking/index.mjs'
// import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity'

/**
* @typedef {import('../index.mjs').WebpackBuildOptions} WebpackBuildOptions
Expand Down Expand Up @@ -36,7 +35,22 @@ export default (env, asyncChunkName) => {
chunks: 'async',
cacheGroups: {
defaultVendors: false,
default: false
default: false,
'agent-chunk': {
name: asyncChunkName,
enforce: true,
test: (module, { chunkGraph }) => chunkGraph.getModuleChunks(module).filter(chunk => !['recorder', 'compressor'].includes(chunk.name)).length > 0
},
recorder: {
name: `${asyncChunkName}-recorder`,
enforce: true,
test: (module, { chunkGraph }) => chunkGraph.getModuleChunks(module).filter(chunk => !['recorder'].includes(chunk.name)).length === 0
},
compressor: {
name: `${asyncChunkName}-compressor`,
enforce: true,
test: (module, { chunkGraph }) => chunkGraph.getModuleChunks(module).filter(chunk => !['compressor'].includes(chunk.name)).length === 0
}
}
}
},
Expand All @@ -63,14 +77,11 @@ export default (env, asyncChunkName) => {
moduleFilenameTemplate: 'nr-browser-agent://[namespace]/[resource-path]?[loaders]',
publicPath: env.PUBLIC_PATH,
append: env.SUBVERSION === 'PROD' ? false : '//# sourceMappingURL=[url]'
}),
new SubresourceIntegrityPlugin({
enabled: true,
hashFuncNames: ['sha512']
}),
new NRBAChunkingPlugin({
asyncChunkName
})
// new SubresourceIntegrityPlugin({
// enabled: true,
// hashFuncNames: ['sha512']
// })
]
}
}
35 changes: 0 additions & 35 deletions tools/webpack/plugins/nrba-chunking/index.mjs

This file was deleted.

37 changes: 0 additions & 37 deletions tools/webpack/plugins/nrba-sri/index.mjs

This file was deleted.