Skip to content

Remove string-replace-webpack-plugin to fix critical security warning.#7127

Closed
na9da wants to merge 3 commits into
mainfrom
remove-string-replace-loader
Closed

Remove string-replace-webpack-plugin to fix critical security warning.#7127
na9da wants to merge 3 commits into
mainfrom
remove-string-replace-loader

Conversation

@na9da

@na9da na9da commented May 2, 2024

Copy link
Copy Markdown
Collaborator

What this PR does

Removes string-replace-webpack-plugin which generates a security warning due to one of its stale dependency.

The plugin was mainly used for replacing babel generated getters with superGet in mobx 4. But after mobx upgrade this is no longer required.

It is currently only used for updating the credit string in Ion.js that is shown when using the default Ion token.

It looks like this:
image

I'm not sure if it is a very useful customization to have, so I have dropped it in favor of keeping the build script simpler. However if the consensus is to add it back, I can use a more updated webpack plugin like string-replace-loader or see if we can customize it run time instead of build time.

Test me

Shouldn't affect the app except it will now show Cesium's default credit line when a default access token is used.

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated relevant documentation in doc/.
  • I've updated CHANGES.md with what I changed.
  • I've provided instructions in the PR description on how to test this PR.

na9da added 2 commits May 2, 2024 13:28
The plugin was mainly used for replacing babel generated getters with `superGet` in
mobx 4. But after mobx upgrade this is no longer required.

It is currently only used for upadting the credit string in Ion.js that is shown when using the
default Ion token. I have dropped that in favour of keeping the build script simpler.
Comment on lines -98 to -113
config.module.rules.push({
test: /\.js?$/,
include: path.resolve(cesiumDir, "Source", "ThirdParty"),
loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /\/\*[\S\s]*?\*\//g, // find multi-line comments
replacement: function (match) {
// replace http:// and https:// with a spelling-out of it.
return match.replace(/(https?):\/\//g, "$1-colon-slashslash ");
}
}
]
})
});

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sprintf credits this was trying to replace is no longer a dependency of Cesium.

Comment on lines -77 to -88
{
pattern: /Please assign <i>Cesium.Ion.defaultAccessToken<\/i>/g,
replacement: function () {
return 'Please set "cesiumIonAccessToken" in config.json';
}
},
{
pattern: / before making any Cesium API calls/g,
replacement: function () {
return "";
}
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's pretty important. The default message is flat out wrong.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll work out a way to include it - I thought it was too small to read.

@tephenavies

Copy link
Copy Markdown
Contributor

I think substituting the Cesium Ion key default message is important to us

@pjonsson

Copy link
Copy Markdown
Contributor

This dependency was removed in #7351, so this PR should probably be closed.

@zoran995

zoran995 commented Mar 12, 2025

Copy link
Copy Markdown
Collaborator

this was moved to terriajs-cesium

@zoran995 zoran995 closed this Mar 12, 2025
@zoran995 zoran995 deleted the remove-string-replace-loader branch March 12, 2025 19:08
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.

4 participants