-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Bug/59374 regression missing commit message comments in work packages after upgrade to 1501 #17594
base: dev
Are you sure you want to change the base?
Conversation
@wielinde I need your feedback on my open questions mentioned above. thank you! |
|
||
def render_committer_name(committer) | ||
render(Primer::Beta::Text.new(font_weight: :bold, mr: 1)) do | ||
committer.gsub(%r{<.+@.+>}, "").strip |
Check failure
Code scanning / CodeQL
Incomplete multi-character sanitization High
<script
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 5 days ago
To fix the problem, we should ensure that all potentially dangerous HTML tags are removed from the committer string. The best way to achieve this is to use a well-tested sanitization library, such as the sanitize
gem, which is designed to handle various edge cases and ensure effective sanitization.
- Install the
sanitize
gem if it is not already included in the project. - Update the
render_committer_name
method to use thesanitize
gem to remove any potentially dangerous HTML tags from the committer string.
-
Copy modified lines R1-R2 -
Copy modified line R80
@@ -1 +1,3 @@ | ||
require 'sanitize' | ||
|
||
module WorkPackages | ||
@@ -77,3 +79,3 @@ | ||
render(Primer::Beta::Text.new(font_weight: :bold, mr: 1)) do | ||
committer.gsub(%r{<.+@.+>}, "").strip | ||
Sanitize.fragment(committer.gsub(%r{<.+@.+>}, "").strip) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jjabari-op - this looks sensible, wdyt?
@akabiru I've added the change requested by Parimal. I would appreciate your feedback when you have some spare minutes. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one @jjabari-op code looks good to me, I did not manage to test against a subversion instance.
If we can resolve https://github.com/opf/openproject/pull/17594/files#r1918204882 before merge, that would be good.
Ticket
59374
What are you trying to accomplish?
Screenshots
What approach did you choose and why?
Open questions/limitations:
Steps to test locally
../testrepo/.git
)repo = Repository.first; puts "Found repo: #{repo.inspect}"; repo&.fetch_changesets
(- Optionally map an OP user (User button in the repo config page))