Security concerns while using MongoDB PHP driver -
Security concerns while using MongoDB PHP driver -
i have experiences securing sql injections on mysql, should careful on mongodb using php driver? in of pages info via get/post , searching/inserting system. search via udid / other fields, , can insert string value. user's cookies via javascript.
so when get/post, i'm adding each variable htmlentities function?
what replace mysql_real_escape_string? should utilize it?
so, example, when doing
$download = array( 'url' => $_get['url'] ); $downloads->insert($download); is ok?
is there way check if string uid?
any think else should aware when using mongodb , php? cookies using javascript, , searching in db using cookies. that?
so when get/post, i'm adding each variable htmlentities function?
no need to. should however, utilize htmlentities when outputting user-generated info browser, prevent xss attacks.
what replace mysql_real_escape_string? should utilize it?
you shouldn't utilize mysql_real_escape_string it's mysql. nil replaces on mongodb, driver takes care of escaping info you.
is there way check if string uid?
the way validate query mongodb string , check if exists.
you can however, validate if format correct:
$id = '4f1b166d4931b15415000000'; $a = new mongoid($id); var_dump($a->{'$id'} == $id); // true $id = 'foo'; $a = new mongoid($id); var_dump($a->{'$id'} == $id); // false any think else should aware when using mongodb , php? cookies using javascript, , searching in db using cookies. that?
not much. web application, discouraged storing sensitive info in cookies, such user identifiers, passwords, etc. can tempered , used access parts of application should restricted, or impersonate other users.
php security mongodb
Comments
Post a Comment