Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 241273
Next
Alex Hales
  • 0
Alex HalesTeacher
Asked: August 10, 20222022-08-10T03:28:08+00:00 2022-08-10T03:28:08+00:00In: Codeigniter, xss

Codeigniter – Disable XSS filtering on a post basis

  • 0

[ad_1]

working with CI 2.2 I think that the solution from treeface will leave input->get(), input->cookie() etc not being xss_cleaned. (we use get in oauth requests etc). The global config change stops them being escaped by the constructor and the core class still defaults xss_clean to FALSE on these methods…

I have basically implemented the same solution across more methods.

class MY_Input extends CI_Input {

    /* fixes to allow xss_clean to be disabled on a per field basis
    * [ e.g. tinymce html content with style / class / event attributes ]
    * initial ref : http://stackoverflow.com/questions/3788476/codeigniter-disable-xss-filtering-on-a-post-basis
    * this is based on CI 2.2
    * the above (stackoverflow) solution only updates the post method - which means all the rest ( get, get_post, cookie, server, request_headers, get_request_header)
    * NB : we need GET to allow oauth type activities !
    *
    *   1 - change the global config to xss_clean = false [ otherwise the constructor will 'xss_clean' everything before we have a chance to say no ! ]
    *   2 - make all of methods that take the xss_clean parameter use TRUE as default value
    *   3 - we can now pass the second parameter in as FALSE if we do not want to xss_clean
    */

    function get($index = '', $xss_clean = TRUE)
    {
        return parent::get($index, $xss_clean);
    }

    function post($index = '', $xss_clean = TRUE)
    {
        return parent::post($index, $xss_clean);
    }

    function get_post($index = '', $xss_clean = TRUE)
    {
        return parent::get($index, $xss_clean);
    }

    function cookie($index = '', $xss_clean = TRUE)
    {
        return parent::cookie($index, $xss_clean);
    }

    function server($index = '', $xss_clean = TRUE)
    {
        return parent::server($index, $xss_clean);
    }

    function request_headers($xss_clean = TRUE)
    {
        return parent::request_headers($xss_clean);
    }

    function get_request_header($index, $xss_clean = TRUE)
    {
        return parent::get_request_header($index, $xss_clean);
    }

}

hope this is of some help to someone

[ad_2]

  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 318 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 291 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 285 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.