security

Do I need to clean user input for DB::query calls in laravel?

你。 提交于 2020-01-02 09:51:50
问题 Reading the Laravel documentation I see that: Note: The Laravel query builder uses PDO parameter binding throughout to protect your application against SQL injection attacks. There is no need to clean strings being passed as bindings. Does that still apply if I only craft queries in the following manner? DB::query("SELECT * from table WHERE id like " . $id); 回答1: Let's take that sentence and emphasise the key phrase: There is no need to clean strings being passed as bindings . In your example

How to avoid users getting 500 Errors when server throw exception

牧云@^-^@ 提交于 2020-01-02 09:25:25
问题 I get the following errors in my server log. 2012-03-06 09:20:43 HTTP JVM: CLFAD0211E: Exception thrown. For more detailed information, please consult error-log-0.xml located in D:/Lotus/Domino/data/domino/workspace/logs 2012-03-06 09:20:43 HTTP JVM: CLFAD0229E: Security exception occurred servicing request for: /demo.nsf/home.xsp - HTTP Code: 500. For more detailed information, please consult error-log-0.xml located in D:/Lotus/Domino/data/domino/workspace/logs The user only sees this in the

How to avoid users getting 500 Errors when server throw exception

一笑奈何 提交于 2020-01-02 09:24:15
问题 I get the following errors in my server log. 2012-03-06 09:20:43 HTTP JVM: CLFAD0211E: Exception thrown. For more detailed information, please consult error-log-0.xml located in D:/Lotus/Domino/data/domino/workspace/logs 2012-03-06 09:20:43 HTTP JVM: CLFAD0229E: Security exception occurred servicing request for: /demo.nsf/home.xsp - HTTP Code: 500. For more detailed information, please consult error-log-0.xml located in D:/Lotus/Domino/data/domino/workspace/logs The user only sees this in the

Hiding my security key from java reflection

风格不统一 提交于 2020-01-02 08:38:14
问题 The below class is my security key provider for encryption. public class MySecretKey { private String key="2sfdsdf7787fgrtdfg#$%@cj5"; ... //Some Util methods goes on Here . } First I didn't belive that one can access the private data without a getter, but, My goodness, I am able to see the key in the console now . And somewhere else using reflection we can see the code like below : public static void main(String[] args) throws Exception { Stacker myClass = new Stacker(); Field key= myClass

Restrict access to RESTful Resources

房东的猫 提交于 2020-01-02 08:29:32
问题 In designing a REST API for an application, some services are supposed to be public, while other services are preferred to be kept private (i.e not publicly accessible). OAuth is used by the service application. What are the measures to be taken into account ? Some ideas in mind: Publish private resources under obfuscated URI. Require a special access keys. (to be only known by authorized clients). 回答1: The most scalable way is designing the URLs such that it is trivial for an intermediary to

Is validating $_GET id in database match secure enough?

孤者浪人 提交于 2020-01-02 07:30:10
问题 I have 2 pages on the website, one is index.php and index page list all posts that exist in database, and other page is post.php and post page display single post when clicked on specific post on index page. Now the code that i used to list all posts on index.php is: $postslist = mysqli_query($db, "SELECT * FROM posts"); while ($post = mysqli_fetch_array($postlist)) { echo '<a href="' .SITEURL.'/post.php?p='.$post['postid'].'>'.$post['title'].'</a>'; } And this works and i have all posts

NHibernate and shared web hosting

限于喜欢 提交于 2020-01-02 06:46:40
问题 Has anyone been able to get an NHibernate-based project up and running on a shared web host? NHibernate does a whole lot of fancy stuff with reflection behind the scenes but the host that I'm using at the moment only allows applications to run in medium trust, which limits what you can do with reflection, and it's throwing up all sorts of security permission errors. This is the case even though I'm only using public properties in my mapping files, though I do have some classes defined as

How secure (hardened) is this script?

笑着哭i 提交于 2020-01-02 06:27:13
问题 The script below, test.php, is intended to be placed in a specific directory of all my wordpress sites. Its purpose is to grab the file at the $source address below and extract it to the directory in which it resides. That's all its intended to do. For example, I will have a dashboard interface on my central server that lists all my sites in which this script is present. I will then execute a cURL routine that iterates over every site and performs a call on this script, effectively sending

Anyone really using Code Access Security to protect their assemblies and/or methods?

笑着哭i 提交于 2020-01-02 06:12:10
问题 Seems to me most of developers completely ignore this features. People prefer handling security exceptions as generic ones relying on standard windows roles and rights instead of learning to use CAS ways of enhancing security - probably because CAS is quite confusing in its logic and naming. Can anyone suggest any general rule-of-thumb/best practices for using CAS at his best in a clean way? 回答1: Yes and no. Unfortunately, you're right - developers rarely use CAS at all, let alone utilize it

WCF Data Services ability to restrict returned fields

吃可爱长大的小学妹 提交于 2020-01-02 05:38:10
问题 I'm using WCF Data Services to provide data to be consumed from authorised clients. Is possible to limit which fields are returned (or perhaps strip out the data with query interceptor)? For a very simplistic example, say I have the following table: Id Name DateOfBirth I'm exposing this entity through WCF Services and it's being consumed by a Kendo UI grid. I would only want the DateOfBirth field returned if the user was an admin. The grid configuration would reflect this. I could use Web API