Code Monkey home page Code Monkey logo

bobby-tables's People

Contributors

alexhaible avatar andreycha avatar bigpresh avatar brsa avatar coke avatar daxim avatar deadmoose avatar deltaf1 avatar dupuy avatar janihur avatar jasperhorn avatar jcbwlkr avatar justin-gooch avatar kimmel avatar lethal-guitar avatar mangstadt avatar mason-mcglothlin avatar mjangda avatar mrnovalles avatar n0nag0n avatar pcurry avatar petdance avatar pfreitag avatar pioto avatar svenvh avatar theory avatar thiefmaster avatar tswicegood avatar tyil avatar zspitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bobby-tables's Issues

Covert to github pages

Drop all the build chain for the site, directly host with GitHub and put in a crecord for the domain.

Named parameters in ASP

Hi!
As far as I am aware (and able to test) ASP (classic) does not support named parameters, so the example on the page will not work.
In ASP, you use questionmarks, in place of parameternames in the query.

Allow links without .html extension

I'm pretty sure these used to work where links like http://bobby-tables.com/php would display the correct content. Now it seems that you're required to add .html which adds needless clutter to the URL.

The shorter the links are, the easier they are to fit into comments or notes, especially where character counts are relevant.

Wordpress support potentially misleading

http://bobby-tables.com/php.html

I should point out, that the Wordpress DB "parameter binding" is not only sprintf like, but is in fact, implemented in terms of sprintf and the queries are interpolated and sent as single queries to the database after throwing mysql_real_escape_string at them ( and a bunch of other regular expressions ).

As such, I don't believe calling it parameter binding is truthful in anyway, and there are potential security leaks hiding in wordpresses custom escaping logic.

rebase/merge l10n

As requested, a ticket for the l10n feature. Since I cannot change the web server configuration, I made the decision to use subdirectories for languages other than English. This is now finished, i.e. make builds the complete site, and you just need to pull in all my changes from daxim/bobby-tables@36294d6.

The advertising for it is commit daxim/bobby-tables@00f40c1.

Python code doesn't work.

The Python code doesn't function as described. execute(sql, a, b) immediately does newsql=sql % (a,b), at least when I looked at it in the code I'm currently running.

feature request: syntax highlighter

I have been playing around with client side JavaScript source code highlighters in other projects and I think it would be useful here as well. The two key features I believe users benefit most from:

  1. Language specific syntax highlighting
  2. Line numbers

I am more than willing to add this feature in.

Add a "Why?" page

Write a page that explains why parametrized queries are a better solution than escaping all your user input.

Consolidate C#, .NET, and ASP pages into single .NET page (with or without subpages)

The information for avoiding SQL injection in .NET is currently fragmented over 3 different pages: C#, .NET, and ASP. It should really be consolidated into a single page (with or without subpages as appropriate), and should be structured as follows:

This information is the same for any .NET language -- C#, VB.NET, F#, IronPython -- and for every .NET programming environment -- ASP.NET, WPF, console application, WinForms. At best it might be good to have examples for various languages on each subsection.

One important note: some providers support named parameters (e.g. the SQL Server provider); some providers support position parameters (e.g. the OLE DB provider).

Page: Translations

Add back a translations page and explain why I removed them from the main site. Explain that anyone is free to translate the site and host it on their own site. Provide links to such sites.

Encoding issue in tt/header.tt output

To reproduce, inject some non-ascii to the related string, for example for de_DE :

msgid "Bobby Tables: A guide to preventing SQL injection"
msgstr "Bobby Tables: Ein Leitfaden gegen SQL-Einschleusungşığ"

And the header will include some garbage.

No idea how to fix that. I'll instead use html entities for this string in my translation.

Add a page for Node

I think that client-side Node is different enough from local storage that they should be done separately.

Hall of Shame

I was thinking a hall of shame for tutorials and examples not using parameterization when applicable.

PHP code

The PHP SQL injection protection is missing. Here it is:

$dbh = new PDO('mysql:dbname=testdb;host=127.0.0.1', $user, $password);
$stmt = $dbh->prepare('UPDATE people SET name = :new_name WHERE id = :id');
$stmt->execute( array('new_name' => $name, 'id' => $id) );

Android examples

I don't know whether you'd want to list it under "Java" or "Android" -- I note that you have both "C#" and ".NET" -- but the platform provides its own database API.

The object you're running queries against can be either a ContentResolver:

Cursor result = contentResolver.query(uri, projection, selection, args, orderBy);

or an SQLiteDatabase object:

Cursor result = database.query(table, projection, selection, args, groupBy, having, orderBy);

In either case, your selection string should contain question marks, which are bound to the args array from left to right, as in this example:

static final String my_table = "users";
static final String[] my_projection = new String[] { "username", "last_login" };
String checkdate = "2015-11-01";
Cursor result = object.query(my_table, my_projection, "date(last_login) < date(?)", new String[] { checkdate }, null, null, null);

Explain why tainted data is bad

From Steve Davis [email protected]

Hey Andy,

Thanks for your bobby-tables page and language examples.

I see your todo list includes “explain why creating code from outside data is bad” and am wondering when you are going to get to that.

I definitely understand the problem of SQL injection having had one of my early sites injected and then a crude “pay me or I will show you more of your data” attempt. However I don’t understand “why creating code from outside data is bad” or even what you mean exactly.

So a rundown on the whole thing and how pg_query_params prevents injection would be excellent.

Thanks in advance

All the best

Steve

"Entity Framework" label wrapping

(Screenshot of home page)
image

If the label text would be EF that would also be fine.

I should note this is using Chromium 67.0.3396.79 on LXDE Fedora 28.
Google Chrome on Windows doesn't wrap the label.

Add a page for Javascript

HTML 5 has localstorage and SQL database functionality that lets you write Javascript code that will be susceptible to the same pitfalls as any other language.

PHP: literal $ inside double quotes for eg "$1".

On the page http://bobby-tables.com/php.html it says
Note that the query must be in single-quotes or have the $ escaped to
avoid PHP trying to parse it as a variable

In fact, surprisingly, but by design, PHP treats double-quoted $x as
literal in the special case where x is a number. (note that variable names
must begin with a letter).

Thus:
$name="Bobby"; echo "Hello $name, this is parameter $1\n";
prints:
Hello Bobby, this is parameter $1

I also expected that this should create a parse error, and reported a bug
on it - but it is intentional in PHP.

Specify language in the <title>

Right now the titles say "Bobby Tables: A guide to preventing SQL injection" but on the language pages we should specify "Bobby Tables: A guide to preventing SQL injection in (Perl, Java, whatever)" outside the top page.

Make the translations more obvious

The English / Deutsch only show up in the footer of the page. The only way someone would see them is by accident. Let's put something obvious in the main page that says "Hey, there are other versions available". Or maybe even make a "Bobby Tables in other languages" page that gives links to the German and Russian pages, and also gives instructions for people who want to contribute.

Suggest oursql instead of MySQLdb for Python

MySQLdb doesn't actually do parameterized queries, but simply quietly escapes and interpolates the passed-in values behind the scenes. This means that under certain (encoding) circumstances, it could be vulnerable to SQL injection.

oursql has actual parameterization, and should probably be recommended for MySQL instead.

backtick versus <code> block

If you look at the generated java page you will notice all the PreparedStatement are breaking the paragraphs and the links do not work.

This I believe is a limitation in Markdown with the link inside the backtick. That is why I left those parts within '' blocks so it would look correct and be a link.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.