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

RHPAM-4719: Persistent Cross-Site Scripting (XSS) #1393

Merged
merged 6 commits into from
Jul 13, 2023

Conversation

domhanak
Copy link
Contributor

Fixes RHPAM-4716 & RHPAM-4717 by using StringEscapeUtils:: escapeHtml4() meth
od in ProjectResource and by implementing helper method, using escapeHtml4(), to escape contributors names in OrganizationalUnitServiceImpl

JIRA: RHPAM-4719

Resulted contributor page after calling update with XSS valid name.
Screenshot from 2023-06-15 09-17-19

@domhanak
Copy link
Contributor Author

domhanak commented Jun 15, 2023

@paulovmr @adrielparedes @tomasdavidorg Hello there, submitting early version of the PR for testing purposes, I am working on adding some tests in the meantime. Initial manual testing looks to be working well.

@domhanak
Copy link
Contributor Author

jenkins execute compile downstream build

@domhanak
Copy link
Contributor Author

jenkins do fdb

@domhanak
Copy link
Contributor Author

jenkins do cdb

Copy link
Contributor

@tomasdavidorg tomasdavidorg left a comment

Choose a reason for hiding this comment

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

Looks good to me when the build is green.

@domhanak
Copy link
Contributor Author

Logging the discussions here:
As per @paulovmr comment -> https://stackoverflow.com/questions/50762964/escaping-characters-to-avoid-xss-in-java
Suggestion is to use escapeHtml from spring framework to also escape ' single quotes. Do we want to swap?

@domhanak domhanak force-pushed the RHPAM-4719 branch 2 times, most recently from fb0c235 to 72ea5ed Compare June 27, 2023 07:45
@domhanak
Copy link
Contributor Author

@tomasdavidorg @paulovmr added the replace("'", "") as requested, only thing that is missing is unit coverage for some new lines, will be added soon.

Still ready for some additional tests

@domhanak
Copy link
Contributor Author

jenkins do fdb

1 similar comment
@domhanak
Copy link
Contributor Author

jenkins do fdb

@domhanak
Copy link
Contributor Author

@tomasdavidorg @paulovmr updated let me know

@domhanak
Copy link
Contributor Author

jenkins test this

@domhanak
Copy link
Contributor Author

jenkins do fdb

1 similar comment
@domhanak
Copy link
Contributor Author

jenkins do fdb

@paulovmr
Copy link
Member

jenkins do fdb

@domhanak domhanak added the backport-7.67.x Generate backport PR for 7.67.x branch label Jul 3, 2023
@paulovmr
Copy link
Member

paulovmr commented Jul 3, 2023

jenkins do fdb

1 similar comment
@domhanak
Copy link
Contributor Author

domhanak commented Jul 4, 2023

jenkins do fdb

Fixes RHPAM-4716 & RHPAM-4717 by using StringEscapeUtils::
escapeHtml4() method in ProjectResource and by implementing
helper method, using escapeHtml4(), to escape conrtributors
names in OrganizationalUnitServiceImpl
Refactors unit tests to use same methods as in main classes
Add some unit tests
Moves methods for escaping out of services
@sonarcloud
Copy link

sonarcloud bot commented Jul 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@paulovmr
Copy link
Member

jenkins do cdb

@paulovmr paulovmr merged commit a3396ef into kiegroup:main Jul 13, 2023
4 of 6 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 13, 2023
* RHPAM-4719: Persistent Cross-Site Scripting (XSS)

Fixes RHPAM-4716 & RHPAM-4717 by using StringEscapeUtils::
escapeHtml4() method in ProjectResource and by implementing
helper method, using escapeHtml4(), to escape conrtributors
names in OrganizationalUnitServiceImpl

* RHPAM-4719: Add unit test cases for XSS data

* RHPAM-4719: Replace single qoute with nothing

* RHPAM-4917: Expand escaping to RepositoryService

Refactors unit tests to use same methods as in main classes
Add some unit tests

* Fix code duplication

Moves methods for escaping out of services

* Increase coverage and remove code smells
@mareknovotny mareknovotny added the backport-7.67.x-blue Generate backport PR for 7.67.x-blue branch label Jul 18, 2023
github-actions bot pushed a commit that referenced this pull request Jul 18, 2023
* RHPAM-4719: Persistent Cross-Site Scripting (XSS)

Fixes RHPAM-4716 & RHPAM-4717 by using StringEscapeUtils::
escapeHtml4() method in ProjectResource and by implementing
helper method, using escapeHtml4(), to escape conrtributors
names in OrganizationalUnitServiceImpl

* RHPAM-4719: Add unit test cases for XSS data

* RHPAM-4719: Replace single qoute with nothing

* RHPAM-4917: Expand escaping to RepositoryService

Refactors unit tests to use same methods as in main classes
Add some unit tests

* Fix code duplication

Moves methods for escaping out of services

* Increase coverage and remove code smells
mareknovotny pushed a commit that referenced this pull request Aug 11, 2023
* RHPAM-4719: Persistent Cross-Site Scripting (XSS)

Fixes RHPAM-4716 & RHPAM-4717 by using StringEscapeUtils::
escapeHtml4() method in ProjectResource and by implementing
helper method, using escapeHtml4(), to escape conrtributors
names in OrganizationalUnitServiceImpl

* RHPAM-4719: Add unit test cases for XSS data

* RHPAM-4719: Replace single qoute with nothing

* RHPAM-4917: Expand escaping to RepositoryService

Refactors unit tests to use same methods as in main classes
Add some unit tests

* Fix code duplication

Moves methods for escaping out of services

* Increase coverage and remove code smells

Co-authored-by: Dominik Hanák <domhanak@users.noreply.github.com>
mareknovotny pushed a commit that referenced this pull request Aug 11, 2023
* RHPAM-4719: Persistent Cross-Site Scripting (XSS)

Fixes RHPAM-4716 & RHPAM-4717 by using StringEscapeUtils::
escapeHtml4() method in ProjectResource and by implementing
helper method, using escapeHtml4(), to escape conrtributors
names in OrganizationalUnitServiceImpl

* RHPAM-4719: Add unit test cases for XSS data

* RHPAM-4719: Replace single qoute with nothing

* RHPAM-4917: Expand escaping to RepositoryService

Refactors unit tests to use same methods as in main classes
Add some unit tests

* Fix code duplication

Moves methods for escaping out of services

* Increase coverage and remove code smells

Co-authored-by: Dominik Hanák <domhanak@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.67.x Generate backport PR for 7.67.x branch backport-7.67.x-blue Generate backport PR for 7.67.x-blue branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants