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

Suggestion: add anti-XSS measures #8628

Closed
fokkog opened this issue Apr 15, 2021 · 3 comments
Closed

Suggestion: add anti-XSS measures #8628

fokkog opened this issue Apr 15, 2021 · 3 comments
Assignees
Milestone

Comments

@fokkog
Copy link

fokkog commented Apr 15, 2021

After doing some POC development with ABP Framework I am greatly impressed, finding it a tremendous productivity booster. One thing I did notice is that the DataTables grids I initially ended up with show unencoded data. This is visible in the starter template, by entering this role name:
<script>alert('xss');</script>
This is also visible in the tutorial results, by entering this value as a book name. In both cases the JavaScript gets executed and the alert gets displayed.

One way to prevent this is to add a render function for data columns (see also https://datatables.net/manual/data/renderers#Text-helper):
render: $.fn.dataTable.render.text()

Version: 4.2.2
User interface: MVC / Razor Pages
Database provider: n/a
Exception message/stack trace: n/a

@maliming
Copy link
Member

See #8114

@fokkog
Copy link
Author

fokkog commented Apr 15, 2021

My bad for raising a duplicate issue. I did a Google search and found nothing, should have done a GitHub issue search.

@fokkog fokkog closed this as completed Apr 15, 2021
@realLiangshiwei realLiangshiwei self-assigned this Apr 15, 2021
@realLiangshiwei realLiangshiwei added this to the 4.3-final milestone Apr 15, 2021
@realLiangshiwei
Copy link
Member

We should var name = '<span>' + $.fn.dataTable.render.text().display(data) + '</span>'; //prevent against possible XSS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants