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(github): Sanitize mentions in commit bodies #30842

Merged

Conversation

zharinov
Copy link
Collaborator

Changes

Although GitHub doesn't render Markdown in the commit bodies, the mentions are triggered anyway.

Users can configure Renovate in such a way changelogs are rendered in the commit body, which may cause undesired notifications for GitHub users mentioned in the changelogs.

This PR fixes the problem by adding zero-width space after every occurrence of @ character.

Context

  • Closes: #30828

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@zharinov zharinov requested review from rarkins and viceice August 16, 2024 20:28
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

🤷‍♂️

@rarkins rarkins added this pull request to the merge queue Aug 20, 2024
Merged via the queue into renovatebot:main with commit 0220eb7 Aug 20, 2024
38 checks passed
@rarkins rarkins deleted the fix/github-sanitize-mentions-in-commit-body branch August 20, 2024 08:43
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 38.44.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ceisele-r
Copy link

@zharinov @rarkins @viceice could it be that this now causes strange Chinese characters to appear in commit messages (displayed in Github and TortoiseGit)?
I am now facing such commit messages
in TortoiseGit
image
and Github
image
using renovate 38.44.2 (via renovatebot/github-action).

I guess it's because the zero-width space is interpreted as "舃" in these locations.

@rarkins
Copy link
Collaborator

rarkins commented Aug 20, 2024

@ceisele-r plesse start a new discussion then link here. Can you reproduce it on GitHub.com or it needs specific local settings?

zharinov added a commit to zharinov/renovate that referenced this pull request Aug 20, 2024
@ceisele-r
Copy link

Follow-up discussion: #30911

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants