Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: looking for straight answer - what's the safest or joint-safest way to validate data?

  1. #1
    Join Date
    Jun 2006
    Location
    Birmingham
    Posts
    39
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Arrow looking for straight answer - what's the safest or joint-safest way to validate data?

    some people say some functions, others then say don't use them....etc

    i just want a straight answer - what's the best way to validate form data with php to prevent malicious injections?

    before you say "it depends what kind of data ur expecting" - i'll suggest that i'm expecting anything and everything and want to accept as much as possible whilst being secure as possible.

    please may there be some1 here knows php properly enough to help

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    before you say "it depends what kind of data ur expecting" - i'll suggest that i'm expecting anything and everything and want to accept as much as possible whilst being secure as possible.
    So, text, binary data, MySQL queries, shell commands, HTTP requests, emails...? There are just too many types of data out there (all of which need to be handled differently) to give a straightforward cure-for-everything.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jun 2006
    Location
    Birmingham
    Posts
    39
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    text, which could include all of the rest. for example, so clients could put code for any of the rest on a web page without inwanted processing.

    any offers for a simple answer?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    text, which could include all of the rest.
    No, it couldn't.
    for example, so clients could put code for any of the rest on a web page without inwanted processing.
    To convert text so it is safe for embedding in HTML, you should use the htmlentities() function.
    any offers for a simple answer?
    There is no simple answer, as I stated above.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jun 2006
    Location
    Birmingham
    Posts
    39
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Arrow

    well thanks for the htmlentities part of the response at least. it confirms what i've heard elsewhere.

    as for the "there's no simple answer" ... that's what everyone says until they master their stuff.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    How does one make an object safe for children? I want a simple answer that works for every possible object.
    as for the "there's no simple answer" ... that's what everyone says until they master their stuff.
    I really can't be bothered to answer this. I should note for your reference, however, that if you succeed in turning the thread into an argument as you appear to be attempting to do, the chance of your receiving an answer of any kind will decrease drastically.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Birmingham
    ... what's the best way to validate form data with php to prevent malicious injections?

    before you say "it depends what kind of data ur expecting"
    I wouldn't, because it doesn't. However, it does depend on what you are going to do with the data. Input from the client is nothing more than a stream of bytes (in an abstract sense); you can't be vulnerable to it until you start treating that data in a certain way.

    i'll suggest that i'm expecting anything and everything and want to accept as much as possible whilst being secure as possible.
    Do you really expect anyone to list every possible thing you could do with user input on the server, and vulnerabilities that might arise in each case?

    Mike

  8. #8
    Join Date
    Jun 2006
    Location
    Birmingham
    Posts
    39
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Arrow

    no, i don't expect that at all, but i do expect that there is one or a few php functions which are the safest and most recommended for data validation irrespective of what type of data is being validated. otherwise, php developers haven't been doing much useful development

  9. #9
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by Birmingham
    no, i don't expect that at all, but i do expect that there is one or a few php functions which are the safest and most recommended for data validation irrespective of what type of data is being validated. otherwise, php developers haven't been doing much useful development
    That is not the languages job. That is YOUR job as the developer.

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    As far as I know, there's no readMyMindAndMakeTheDataSafe() function in any current language.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •