Should the pagination offset value be checked for security? |
[eluser]Unknown[/eluser]
I'm using a non-active record SQL query to generate pagination results. Does this open up a security vulnerability through the offset value or is the offset value escaped automatically? If this is a vulnerability, should I manually scrub the offset value to solve it? My code is below : Code: $offset = $this->uri->segment(3);
[eluser]theprodigy[/eluser]
Quote:Does this open up a security vulnerability through the offset value or is the offset value escaped automatically? The way you have your query written, I don't believe it will be escaped. Is there any particular reason you aren't using the active record? I would suggest either escaping it yourself, or running your own validation ( like is_numeric($offset) ) also, why do you have: Code: if($offset) Just do: Code: if(!$offset)
[eluser]SpooF[/eluser]
The uri class does not automatically escape, its raw from the url. Also: Code: $this->uri->segment(3,0); Will return the value of segment 3, or it will set it to 0 if its not provided.
[eluser]pistolPete[/eluser]
Have a look at the user guide: http://ellislab.com/codeigniter/user-gui...eries.html Escaping Queries |
Welcome Guest, Not a member yet? Register Sign In |