Differences
This shows you the differences between two versions of the page.
docs:programming:php:security [2007/03/23 22:39] – created billh | docs:programming:php:security [2008/08/03 00:25] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Security ====== | ||
+ | |||
+ | ===== Error Reporting ===== | ||
+ | By default, php is usually configured to be in a verbose error reporting mode. This is helpful for debugging, while the project is being coded. | ||
+ | * see [[error_handling]] for more information | ||
+ | |||
+ | ===== Security Recap (Tips) ===== | ||
+ | Source: Programming PHP, 2nd Edition, Chapter 12 | ||
+ | * Filter input to be sure that all data you receive from remote sources is the data you expect. | ||
+ | * Escape output to be sure that your data isn't misinterpreted by a remote system. | ||
+ | * Always initialize your variables. | ||
+ | * Disable register_globals, | ||
+ | * Whenever you construct a filename, check the components with basename() and realpath(). | ||
+ | * Store includes outside of the document root. It is better to not name your included files with the .inc extension. | ||
+ | * Always call session_regenerate_id() whenever a user's privilege level changes. | ||
+ | * Whenever you construct a filename from a user-supplied component, check the components with basename() and realpath(). | ||
+ | * Don't create a file and then change its permissions. | ||
+ | * Don't use user-supplied data with eval(), preg_replace() with the /e option, or any of the system commands (exec(), system(), popen(), passthru(), and the backtick(``) operator). | ||