|
-
Jan 21st, 2006, 06:07 AM
#1
Thread Starter
Addicted Member
Secure Application
Which are best guidelines to follow for developing secure web application in php ?
Thank You.
-
Jan 21st, 2006, 06:54 AM
#2
Re: Secure Application
The primary guideline is simple: check all user input. Never let anything unchecked slip into database queries or output. Never use string concatenation to build queries; use prepared queries instead. (PEAR::DB emulates them for drivers that don't have native support, like the old MySQL. As does PDO.) Never directly output anything coming from the user; always at least escape it with htmlentities().
The SQL thing protects you against SQL injection, which compromises the security of your data. The output thing protects you against XSS attacks, which compromise the authenticity of your site's actions and can be used to leak session cookies, passwords, etc.
Beyond that, make sure the site only accepts requests over HTTPS and get a properly signed certificate. Have a proper login system: make sure nothing can be reached without proper authorization. The security of accounts is, in the end, a matter of the users. You can reject really bad passwords, but you can't prevent the user from writing it down and leave it where others find it.
That's all there is to it, really. It's mostly a matter of being careful, not forgetting anything. A single unchecked query is often enough.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 21st, 2006, 07:07 AM
#3
Thread Starter
Addicted Member
Re: Secure Application
How to make sure that no request to page is reaching without proper authentication ?
-
Jan 21st, 2006, 08:45 AM
#4
Re: Secure Application
Before doing anything else on a page, check that there is a valid user logged in and with the necessary privileges (e.g. user administration requires admin privileges).
Login systems have been discussed a few times here, so searching the forum should turn up a few useful threads.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|