Django XSS - can it happen in server side (views.py)?









up vote
0
down vote

favorite












My understanding is that Django has great default settings to minimize the risk that there is client size XSS attack, for example if you had <p>Hello user.username </p> in your template, where the user could type in anything they want for their username.



I don't see any references to XSS in client side Python files. Is my understanding correct that there is no major concern for a client side XSS attack?



As an example situation, the user can input anything they want into an input box. The results from that input box are stored in a database. That input is then queried from a database and sent in an email.



email = EmailMessage(
ExtendedUser.objects.filter(user__username=username)[0].email_subject,
ExtendedUser.objects.filter(user__username=username)[0].email_content,
'me@mysite.com',
['me@mysite.com']
)
email.content_subtype = "html"
email.send()



In situations like this, is there any need to strip any tags or sanitize anything anything? I'm not sure when I need to be concerned about malicious user inputted data.



EDIT: I know Django project writes "XSS attacks allow a user to inject client side scripts into the browsers of other users." I'm interested if there are any client side reasons to strip user inputted data of malicious tags.










share|improve this question

























    up vote
    0
    down vote

    favorite












    My understanding is that Django has great default settings to minimize the risk that there is client size XSS attack, for example if you had <p>Hello user.username </p> in your template, where the user could type in anything they want for their username.



    I don't see any references to XSS in client side Python files. Is my understanding correct that there is no major concern for a client side XSS attack?



    As an example situation, the user can input anything they want into an input box. The results from that input box are stored in a database. That input is then queried from a database and sent in an email.



    email = EmailMessage(
    ExtendedUser.objects.filter(user__username=username)[0].email_subject,
    ExtendedUser.objects.filter(user__username=username)[0].email_content,
    'me@mysite.com',
    ['me@mysite.com']
    )
    email.content_subtype = "html"
    email.send()



    In situations like this, is there any need to strip any tags or sanitize anything anything? I'm not sure when I need to be concerned about malicious user inputted data.



    EDIT: I know Django project writes "XSS attacks allow a user to inject client side scripts into the browsers of other users." I'm interested if there are any client side reasons to strip user inputted data of malicious tags.










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      My understanding is that Django has great default settings to minimize the risk that there is client size XSS attack, for example if you had <p>Hello user.username </p> in your template, where the user could type in anything they want for their username.



      I don't see any references to XSS in client side Python files. Is my understanding correct that there is no major concern for a client side XSS attack?



      As an example situation, the user can input anything they want into an input box. The results from that input box are stored in a database. That input is then queried from a database and sent in an email.



      email = EmailMessage(
      ExtendedUser.objects.filter(user__username=username)[0].email_subject,
      ExtendedUser.objects.filter(user__username=username)[0].email_content,
      'me@mysite.com',
      ['me@mysite.com']
      )
      email.content_subtype = "html"
      email.send()



      In situations like this, is there any need to strip any tags or sanitize anything anything? I'm not sure when I need to be concerned about malicious user inputted data.



      EDIT: I know Django project writes "XSS attacks allow a user to inject client side scripts into the browsers of other users." I'm interested if there are any client side reasons to strip user inputted data of malicious tags.










      share|improve this question













      My understanding is that Django has great default settings to minimize the risk that there is client size XSS attack, for example if you had <p>Hello user.username </p> in your template, where the user could type in anything they want for their username.



      I don't see any references to XSS in client side Python files. Is my understanding correct that there is no major concern for a client side XSS attack?



      As an example situation, the user can input anything they want into an input box. The results from that input box are stored in a database. That input is then queried from a database and sent in an email.



      email = EmailMessage(
      ExtendedUser.objects.filter(user__username=username)[0].email_subject,
      ExtendedUser.objects.filter(user__username=username)[0].email_content,
      'me@mysite.com',
      ['me@mysite.com']
      )
      email.content_subtype = "html"
      email.send()



      In situations like this, is there any need to strip any tags or sanitize anything anything? I'm not sure when I need to be concerned about malicious user inputted data.



      EDIT: I know Django project writes "XSS attacks allow a user to inject client side scripts into the browsers of other users." I'm interested if there are any client side reasons to strip user inputted data of malicious tags.







      python django xss






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 11 at 3:07









      benjo

      12




      12






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You should look into the documentation for %csrft token% tag






          share|improve this answer




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245507%2fdjango-xss-can-it-happen-in-server-side-views-py%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            You should look into the documentation for %csrft token% tag






            share|improve this answer
























              up vote
              0
              down vote













              You should look into the documentation for %csrft token% tag






              share|improve this answer






















                up vote
                0
                down vote










                up vote
                0
                down vote









                You should look into the documentation for %csrft token% tag






                share|improve this answer












                You should look into the documentation for %csrft token% tag







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 11 at 4:31









                robotHamster

                343115




                343115



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245507%2fdjango-xss-can-it-happen-in-server-side-views-py%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Top Tejano songwriter Luis Silva dead of heart attack at 64

                    ReactJS Fetched API data displays live - need Data displayed static

                    政党