Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Not editable fields are not XSS attack secure #644

Open
Asia321 opened this issue Jul 5, 2017 · 6 comments
Open

Not editable fields are not XSS attack secure #644

Asia321 opened this issue Jul 5, 2017 · 6 comments
Labels
can't reproduce Request for Comments If you care about this bundle, please share your thoughts about this issue.

Comments

@Asia321
Copy link

Asia321 commented Jul 5, 2017

I noticed in renderSingleField function(vendor/sg/datatablesbundle/Sg/DatatablesBundle/Datatable/Column/Column.php ) that if column is not editable then data is not rendered by Twig so the content is not escaped and allow XSS attack

@stwe
Copy link
Owner

stwe commented Aug 6, 2017

You have to explain more. The function renderSingleField calls renderTemplate for generating content. And renderTemplate calls $this->twig->render

@stwe stwe added can't reproduce Request for Comments If you care about this bundle, please share your thoughts about this issue. labels Aug 6, 2017
@Asia321
Copy link
Author

Asia321 commented Aug 7, 2017

Hi, thanks for your reply, it is rendered by twig only when $this->isEditableContentRequired($row) is true, but in my case I have field like this( $this->isEditableContentRequired($row) returns false):

 public function buildDatatable(array $options = array())
    {
            $this->columnBuilder
            ->add(
                'userDetails.firstName',
                Column::class,
                array(
                    'title' => $this->translator->trans('field.first_name')
                )
            )
          //more fields here
}

which can be edited in another action and it is not escaped from js/html tags.

@sonnguyenthai
Copy link

I got the same problem when using dev-master version. I use this bundle to list my objects (for example: Article ), in this datatable I show Article title. If I add an Article with title like <script>alert('hey you!');</script>, then return to the datatable I will see the alert. That's the problem.

@sonnguyenthai
Copy link

sonnguyenthai commented Jan 2, 2018

Not only column data, but also other outputs are unprotected when rendering a datatable. I tried above trick with username which is showed in the same view as datatable successfully.

@sspat
Copy link

sspat commented Jun 4, 2019

Still vulnerable, had to fork to fix this issue

@Seb33300
Copy link
Collaborator

Seb33300 commented Jun 5, 2019

Related to #845

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
can't reproduce Request for Comments If you care about this bundle, please share your thoughts about this issue.
Projects
None yet
Development

No branches or pull requests

5 participants