php - cakePHP security: can others view/tamper variables i set for my views? -


I have a CakePHP application with User Authentication via 'Eth' component.
On the role of the user to customize based ideas, I added rows in my code below:

  Public function before filter () {.... $ this - & gt; Set ('Login', $ this-> Auth-> User ('ID')); $ This- & gt; Set ('role', $ this-> Auth-> users ('role')); ....}  

Then inside my .cp view files, I will check the user role (Admin, User, Moderator, ...) and then if using View / Ales Change will fit with the user role.
I want to know that the end users of the application can tamper with '$ roll' so that they can change the application unmatched or all aspects of the application will be handled on the server side and on such view. Is optimization safe enough?

A short answer: No should not be possible. But it really depends on how your application has been protected. By default, KPHHP is a very solid and secure framework, in the last 5 years there are only one or two serios problems.

Firstly you should use to avoid the form of tampering. For example, I can go to my profile, add a hidden field "role" and set this value to "admin" and submit it. My role will be updated in DB and I am an administrator.

Another possibility file may be uploaded that are not seen properly Many people have forgotten that is_uploaded_file () the most stupid example: I upload a php file, this app / webbrowse / upload / Ends in hack.fpp and I can execute it by calling foo.com/uploads/hack.php and then whatever I want in the worst case, for example to modify the files of my application Your app is set up properly To read and write application files, I can still read App / Config / Database.php and then whatever I want with credentials. So make sure your file system permission is configured correctly. Only the App / TMP should be eligible to be written.

Since you process it, whenever you want Always , input, post, GET, a CSV file, man-made or machine may arise. In order to validate this and ensure that incoming data has been signed and validated. Trust is not a pretty basic security rule.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -