Hlavní navigace

Názor k článku PHP okénko: Escapování od petr andrs - Teda přátelé, to stím escapováním dat před ukládáním...

  • Článek je starý, nové názory již nelze přidávat.
  • 22. 4. 2005 22:15

    petr andrs (neregistrovaný)
    Teda přátelé, to stím escapováním dat před ukládáním myslíte vážně? Není bezpečnějčí, elegantnější a "blbuvzdornější" použití navazování proměnných (omlouvám se překlad). Lepení vstupu do sql je kořenem všeho zla, použijte navazování proměnných. Viz. ospověď z jedné renomované databázové poradny:


    oh, defending against SQL injection is trivial!!! really, it is.

    Just never accept inputs from the end user that you glue into a sql
    statement.

    That's it -- never have something passed to you from the outside (outside YOUR
    CODE) that becomes part of the query! SQL injection = thing of the past.

    It is not dynamic sql that is the issue (all sql is dynamic in Oracle actually
    -- even static sql in pro*c/plsql!). It is "the construction" of this sql that
    is the problem.


    If a user gives you inputs - they should be BOUND into the query -- not
    concatenated. The second you concatenate user input into your SQL -- it is as
    if you gave them the ability to pass you code and you execute that code. Plain
    and simple.

    Don't concatenate, but rather bind their inputs, and wah-lah, you are done.


    The way to prevent it is via coding standards and design review. And -- best of
    all -- at the end of the day, we achieve that nirvana that is "the applications
    use binds!"