Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

codeigniter benchmark {memory_usage} security

I'm making a website with codeigniter.

If a user writes {memory_usage} in his comment 2.75MB will be shown to him. doesn't it bring security vulnerability to codes written by codeigniter? Any reasonable(and common) way to prevent such problem?

like image 298
besime Avatar asked Jun 10 '26 01:06

besime


1 Answers

Add this to your controller:

$this->output->parse_exec_vars = FALSE;

Parsing Execution Variables

CodeIgniter will parse the pseudo-variables {elapsed_time} and {memory_usage} in your output by default. To disable this, set the $parse_exec_vars class property to FALSE in your controller.

Update, you may need to modify a core file in /system/core/Output.php

Change:

protected $parse_exec_vars = TRUE;

To:

public $parse_exec_vars = TRUE;

Now you will be able to set $this->output->parse_exec_vars to FALSE in your controller.

like image 126
doitlikejustin Avatar answered Jun 13 '26 07:06

doitlikejustin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!