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

Hotfix for possible SVG spearsphishing attack vector #3394

Merged
merged 6 commits into from Sep 8, 2021
Merged

Conversation

boutell
Copy link
Member

@boutell boutell commented Sep 7, 2021

This is low probability, but possible. This initial PR is against a base branch that matches 3.3.1. I like this procedure better than starting out with a PR against main, because this way no error-prone cherry-picking is required, just a merge to main after release.

@boutell boutell requested a review from abea September 7, 2021 20:19
@linear
Copy link

linear bot commented Sep 7, 2021

PRO-1971 Implement solution to SVG XSS attack risk

See PRO-1859 for the background on this.

  • Filter what's incoming
  • Offer a migration for what's not filtered
  • Do this for A2 & A3

@@ -707,7 +734,10 @@ module.exports = {
const batchSize = 100;
let lastId = '';
while (true) {
const docs = await self.db.find({ _id: { $gt: lastId } }).limit(batchSize).sort({ _id: 1 }).toArray();
const docs = await self.db.find({
...(criteria || {}),
Copy link
Member Author

Choose a reason for hiding this comment

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

A bug that got in the way: the each method for attachment migrations was ignoring its criteria argument.

Copy link
Contributor

@abea abea left a comment

Choose a reason for hiding this comment

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

Also an eslint error

@@ -402,6 +405,16 @@ module.exports = {
}
info.length = await self.apos.util.fileLength(file.path);
info.md5 = await self.apos.util.md5File(file.path);
if (info.extension === 'svg') {
try {
await self.sanitizeSvg(file, info);
Copy link
Contributor

Choose a reason for hiding this comment

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

The info parameter isn't used in the method.

@boutell boutell requested a review from abea September 7, 2021 21:08
abea
abea previously approved these changes Sep 8, 2021
@boutell boutell changed the base branch from hotfix-3.3.2-final to main September 8, 2021 14:19
@boutell boutell dismissed abea’s stale review September 8, 2021 14:19

The base branch was changed.

@boutell boutell requested a review from abea September 8, 2021 14:22
@boutell boutell merged commit 981233c into main Sep 8, 2021
@abea abea deleted the pro-1971 branch September 12, 2021 22:27
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.

None yet

2 participants