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 a 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

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:03:20+00:00 2026-06-15T14:03:20+00:00

As far as learned from my previous post , xss_clean will filter $this->input->post(‘text_url’) after

  • 0

As far as learned from my previous post, xss_clean will filter $this->input->post('text_url') after calling $this->form_validation->run(). The question is will it also filter $this->input->post('textarea_content') in callback function?

Thanks

$this->form_validation->set_rules('text_url', 'Website link', 'trim|xss_clean|callback_minimum_fields[' . $this->input->post('textarea_content') . ']');

$this->form_validation->run();

//Filtered
$text_url = $this->input->post('text_url');

//Filtered as well?
$textarea_content = $this->input->post('textarea_content');

CALLBACK

public function minimum_fields($url, $content)
{
    if ($url == '' && $content == '')
    {
        $this->form_validation->set_message('minimum_fields', 'Please provide info for at least one of these: "Website link" and "Content".');
        return false;
    }

    return true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:03:20+00:00Added an answer on June 15, 2026 at 2:03 pm
    //Filtered as well?
    $textarea_content = $this->input->post('textarea_content');
    

    No, you didn’t set a “prepping” rule in your form validation. In fact, you haven’t validated the textarea_content field at all.

    Besides that, you haven’t run the form validation at the time you set the rules, so passing any POST data into a callback function will be the original data.

    Passing post data like that into a callback here, where the rules are just strings, is very dangerous and likely to break your script. Consider:

    $_POST['textarea_content'] = ']|var_dump|exit|some_nonsense[';
    
    $this->form_validation->set_rules(
        'text_url',
        'Website link',
        'callback_minimum_fields[' . $this->input->post('textarea_content') . ']'
    );
    
    // Produces this rule:
    // callback_minimum_fields[]|var_dump|exit|some_nonsense[]
    

    Those “rules” would be injected into your form validation rules, since in this context, it’s just a string. It might be better to have your callback read the postdata directly or to take another approach, but this is very unsafe. Even if you xss_clean it first, it doesn’t matter.

    Once again, I urge you to spend more time understanding what XSS is and then decide if it makes any sense to worry about in this situation. XSS only occurs on output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, thanks for all the help I've received so far from StackOverflow. I've learned
UPDATE: I recently learned from this question that in the entire discussion below, I
From what I have learned so far: In Objective-C you can send any message
So far, I've used this approach to access this from the scope of an
from the scarcely documented FB api, I have thus far learned that I need
So to add onto what I learned from this question I asked: F# Records:
I'm new to MVC but from what I have learned so far (for example
So far I have learned about generating thread dump and heap dump using jstack
So far I have only been updated a view from within its controller. I
As far as I can see this is not the case, however, I thought

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

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.