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

Announcement title not properly escaped on delete #9408

Closed
asmecher opened this issue Oct 12, 2023 · 11 comments
Closed

Announcement title not properly escaped on delete #9408

asmecher opened this issue Oct 12, 2023 · 11 comments
Assignees
Milestone

Comments

@asmecher
Copy link
Member

Describe the bug
Announcement titles containing HTML special characters are not properly escaped in the delete confirmation modal.

@asmecher asmecher added this to the 3.3.0-16 milestone Oct 12, 2023
@asmecher asmecher self-assigned this Oct 12, 2023
asmecher added a commit to asmecher/ui-library that referenced this issue Oct 12, 2023
@asmecher
Copy link
Member Author

asmecher commented Oct 12, 2023

Draft PRs:

@jardakotesovec
Copy link
Contributor

jardakotesovec commented Oct 16, 2023

Added some comments to the PR.

Also found same problem when deleting contributor..

Screenshot 2023-10-16 at 12 10 48

And Highlights seems to have same implementation as Announcements (was not able to test it as main is broken for me now)

I also attempted to review all uses of browser side param replacement. And did not find anything that would look like it needs html for params. I think that mostly should be title right? Using any of other richtext fields as param is highly unlikely and did not see anything suggesting that. Therefore I would be inclined just to escape all params. If you think its risky for 3.3/3.4.

Than the other cases are ContributorsListPanel.vue

message: this.replaceLocaleParams(this.i18nConfirmDelete, {
	name: contributor.fullName,
}),

And HighlightsListPanel.vue

  message: this.replaceLocaleParams(this.i18nConfirmDelete, {
      title: this.localize(highlight.title),
  }),

Even though I agree this should be correctly handled by frontend, bit surprised that we don't attempt to filter these out during validation step, when data are submitted.

@jardakotesovec
Copy link
Contributor

Created frontend specific issue for me to circle back to it later on - #9421 .

@asmecher Not sure if you would want to also review validation on server side to not let such content in first place?

@asmecher asmecher modified the milestones: 3.3.0-16, 3.3.0-x Nov 17, 2023
@asmecher
Copy link
Member Author

Deferring; this is a privileged action anyway, so the risk is low.

asmecher added a commit to asmecher/ui-library that referenced this issue Jan 29, 2024
asmecher added a commit to asmecher/ui-library that referenced this issue Jan 29, 2024
@asmecher
Copy link
Member Author

@jardakotesovec, I've revisited my PR above after your comments -- thanks. I think you're looking for cases in stable-3_4_0, when I only grepped through stable-3_3_0 -- for example, both highlights and contributor deletion don't appear until 3.4.0. This is easy enough to grep for -- there aren't that many use cases for replaceLocaleParams. Do you mind if I go ahead with this expedient fix for stable-3_3_0 and stable-3_4_0?

@asmecher asmecher modified the milestones: 3.3.0-x, 3.3.0-17 Jan 29, 2024
@jardakotesovec jardakotesovec self-assigned this Jan 30, 2024
@jardakotesovec
Copy link
Contributor

@asmecher I found strong candidate for replacing v-html, intend to test that tomorrow. If thats successful and we would be able to do the sanitisation on vue.js level (using the allowed_html whitelist). Would that be good enough to cover this case in your opinion? It still would be possible to sneak in things like image via announcements to the dialog. Which is not ideal, but not security issue.

I still would like to explore whether there are better patterns to minimise even use of any 'v-html-restricted', but this could be good catch all approach across all versions, with minimal risk of regressing something.

@asmecher
Copy link
Member Author

Sounds good; I'll leave this open against 3.3.0-17 and let you come back to it.

@jardakotesovec
Copy link
Contributor

Testing locally seems promising.. now running tests on travis -#9421

@asmecher
Copy link
Member Author

asmecher commented Feb 9, 2024

@jardakotesovec, just to confirm, this is resolved in stable-3_3_0 and stable-3_4_0 by #9421, correct?

@jardakotesovec
Copy link
Contributor

@asmecher Yes, from security point of view. It still can show some 'safe' html in that dialog. This is one of the cases when it would be useful to 'label' translation to allow html or not.

@asmecher
Copy link
Member Author

Great, let's work through that in #9683 for main. Thanks!

@asmecher asmecher closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2024
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

No branches or pull requests

2 participants