input-sanitization

How to use JSON Sanitizer at Server Side?

大兔子大兔子 提交于 2019-12-05 11:39:52
I want to implement the 'JSON Sanitizer' validation as mentioned by OWASP. My understanding is that this needs to be done in two places: JSON data (in Request) received from Client or Other Systems - This needs to be sanitized at Server side before being processed JSON data (in Response) to be sent to Client - This needs to be sanitized at Server side before being sent to client Is it sufficient that I just call a sanitizing method in JSON Sanitizing library on that JSON Data ? Will that perform all sanitization or are there any other validations to be done in this regard ? The OWASP JSON

Sanitizing a Date

柔情痞子 提交于 2019-12-03 16:14:22
I am using a javascript date picker that allows the user to select a date. However, I would like to also sanitize the posted date data before entering into the database. I am not seeing any sanitize filter here: http://us2.php.net/manual/en/filter.filters.sanitize.php What would be the best method to sanitize a date before entering into a database? This would be the original value from the post: $datepick = $_POST['date']; // wich is 04/12/2014 Then I convert it for the database: $date = date("Y-m-d", strtotime($datepick)); Thanks! If your date is like "03/02/2014" then you can simply clean

Sanitizing input but output not as expected

孤街浪徒 提交于 2019-12-02 02:40:07
This is one of my forms(PHP+MySQL, textarea replaced by TinyMCE). It records description with paragraphs, bullets, headings and text alignment (right, left, center and justify). Once submitted, the record appears as <p style="text-align: justify;"><strong>Introduction</strong></p> <p style="text-align: justify;">The death of the pixel leaves you with a flowing, magazine-quality canvas to design for. A canvas where curves are curves, not ugly pixel approximations of curves. A canvas that begins to blur the line between what we consider to be real and what we consider to be virtual.</p> <p style

JavaScript-based X/HTML & CSS sanitization

谁说我不能喝 提交于 2019-12-01 20:27:39
问题 Before everyone tells me that I shouldn't do client-side sanitization (I do in fact intend to do it on a client, though it could work in SSJS as well), let me clarify what I'm trying to do. I'd like something, akin to Google Caja or HTMLPurifier but for JavaScript: a whitelist-based security approach which processes HTML and CSS (not already inserted into the DOM of course, which would not be safe, but first obtained in string form) and then selectively filters out unsafe tags or attributes,

JavaScript-based X/HTML & CSS sanitization

会有一股神秘感。 提交于 2019-12-01 18:40:27
Before everyone tells me that I shouldn't do client-side sanitization (I do in fact intend to do it on a client, though it could work in SSJS as well), let me clarify what I'm trying to do. I'd like something, akin to Google Caja or HTMLPurifier but for JavaScript: a whitelist-based security approach which processes HTML and CSS (not already inserted into the DOM of course, which would not be safe, but first obtained in string form) and then selectively filters out unsafe tags or attributes, ignoring them or optionally including them as escaped text or otherwise allowing them to be reported to

PHP input sanitizer?

纵饮孤独 提交于 2019-11-30 23:05:11
What are some good PHP html (input) sanitizers? Preferably, if something is built in - I'd like to us that. UPDATE : Per the request, via comments, input should not allow HTML (and obviously prevent XSS & SQL Injection, etc). html purifier -> http://htmlpurifier.org/ I've always used PHP's addslashes() and stripslashes() functions, but I also just saw the built-in filter_var() function ( link ). Looks like there are quite a few built-in filters . If you want to run a query that use let's say $_GET['user'] a nice solution would be to do something like this using mysql_real_escape_string() : <

PHP input sanitizer?

和自甴很熟 提交于 2019-11-30 17:51:13
问题 What are some good PHP html (input) sanitizers? Preferably, if something is built in - I'd like to us that. UPDATE : Per the request, via comments, input should not allow HTML (and obviously prevent XSS & SQL Injection, etc). 回答1: html purifier -> http://htmlpurifier.org/ 回答2: I've always used PHP's addslashes() and stripslashes() functions, but I also just saw the built-in filter_var() function (link). Looks like there are quite a few built-in filters. 回答3: If you want to run a query that

How can I protect against SQL injection attacks using Perl's DBI?

。_饼干妹妹 提交于 2019-11-28 05:15:48
Is there a function i can use in Perl to sanitize input before putting it into a MySQL db? I don't know regex very well so before I make my own function i was wondering if there was already one made. friedo The proper way to sanitize data for insertion into your database is to use placeholders for all variables to be inserted into your SQL strings. In other words, NEVER do this: my $sql = "INSERT INTO foo (bar, baz) VALUES ( $bar, $baz )"; Instead, use ? placeholders: my $sql = "INSERT INTO foo (bar, baz) VALUES ( ?, ? )"; And then pass the variables to be replaced when you execute the query:

How can I protect against SQL injection attacks using Perl's DBI?

我怕爱的太早我们不能终老 提交于 2019-11-27 00:51:41
问题 Is there a function i can use in Perl to sanitize input before putting it into a MySQL db? I don't know regex very well so before I make my own function i was wondering if there was already one made. 回答1: The proper way to sanitize data for insertion into your database is to use placeholders for all variables to be inserted into your SQL strings. In other words, NEVER do this: my $sql = "INSERT INTO foo (bar, baz) VALUES ( $bar, $baz )"; Instead, use ? placeholders: my $sql = "INSERT INTO foo

How to escape strings in SQL Server using PHP?

你。 提交于 2019-11-25 23:18:25
问题 I\'m looking for the alternative of mysql_real_escape_string() for SQL Server. Is addslashes() my best option or there is another alternative function that can be used? An alternative for mysql_error() would also be useful. 回答1: addslashes() isn't fully adequate, but PHP's mssql package doesn't provide any decent alternative. The ugly but fully general solution is encoding the data as a hex bytestring, i.e. $unpacked = unpack('H*hex', $data); mssql_query(' INSERT INTO sometable (somecolumn)