MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.


descrip:

One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Using 89% of the same design the blog had in 2001.

FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.

As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green.

x

MarkUpDown is the best Markdown editor for professionals on Windows 10.

It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.

Features you won't find anywhere else include...

You've wasted more than $15 of your time looking for a great Markdown editor.

Stop looking. MarkUpDown is the app you're looking for.

Learn more or head over to the 'Store now!

Friday, May 10, 2013

JSON Hijacking:

The website responds with some HTML containing some JavaScript along with a script tag. When the browser sees the script tag, it makes another GET request back to the vulnerable site to load the script, sending the auth cookie along.

This makes more sense.  I'd always wondered why people were concerned about Javascript exploits.  If you have FireBug open, what can't you do with Javascript?  It's essentially a completely open source, open data situation.  The best security you can use is obfuscation, and that's not really security at all.

Turns out people are getting all upset about stuff that should really never happen in apps I [help] write.

1.) You have to be dealing with sensitive information
2.) The user has to succumb to some social engineering.
3.) You allow cross-site access to json that requires sensitive information to access.

It's that "to access" part that's really the kicker.  If you're reading a cookie to produce the JSON, the hole is there, not necessarily in the JSON itself.

So if someone has a cookie to their bank stored on their browser, gets tricked into going to a spoof website (or just hits a website that's spoofing), and you allow cross-site scripting, then and only then are you potentially in trouble.

In a sense, duh.  In another sense, "Oh."  You'd have to go out of your way to create a problem, but apparently, at least briefly, even Twitter did.

Labels: , ,


posted by ruffin at 5/10/2013 11:47:00 AM
Thursday, January 24, 2013

Using JSONs Special Properties of $ref and $id | Jaress Loo:

I had never seen this $ref and $id tags before, so I didnโ€™t know how to use them or what to make of it. It turns out that in order to condense the JSON object into a smaller object, it avoids rewriting an object twice if it doesnโ€™t have to. In order to accomplish this, the JSON.NET serializer will serialize these special JSON properties of $id and $ref. Every object being serialized will get an $id. If that same exact object is used again somewhere in the same JSON object, it will use a $ref property to tell you that the particular object youโ€™re looking at has already been serialized. It then gives you the $id to lookup as the value of the $ref property so that you know where to find the object being referred to.

Phew. Wondered what $id was for in Json.NET. You can blast that shorthand if you want.

And wow, does this speed up getting info from a database to json. Between the Entity Framework objects and Json.NET, about all you need a programmer for is constructing the LINQ where clause.

Labels: , ,


posted by ruffin at 1/24/2013 08:02:00 PM
Friday, June 22, 2012

ASP.NET Web API vs. ASP.NET MVC "APIs" ๏ฟฝ Encosia:

If you want to bring Web APIโ€™s behavior more in line with the output of MVCโ€™s Json() helper, you can remove XML support from your API entirely. Just add this to the Application_Start event and youโ€™ll never see XML again...

Good riddance.  Never have I seen since a bloated, kitchen-sink approach become so unquestionably adopted.  Sure, XML does everything you'd ever need, but the times you need more than JSON (what, I've already mentioned, is little more than a home-rolled string format) really are pretty rare. 

I know I've mentioned it before, but years ago I remember getting a doc from our resident XML expert promoting its benefits, and search and replaced every occurrence of "XML" with "ASCII" before sending it back to him.  The accuracy of the doc really hadn't changed at all, somewhat surprisingly.  He took it as the good natured jabbing I intended (XML couldn't be stopped at that point), but I think, for at least that once ;^D, I was ahead of the game.

It's all zeroes and ones.  XML doesn't necessarily make something human and machine readable at the same time.  It can, but one look at OOXML tells you that this human readability isn't a requirement.

Maybe the lesson is that we underestimated our ability to read like a machine.  They are modeled after us (how can they not be?  We made them up) to some degree, after all.

Labels: , ,


posted by ruffin at 6/22/2012 08:18:00 AM
Tuesday, March 27, 2012

I'd been running an ExtJS app that throws params to a .NET WCF server and expected JSON returned.  It worked from within the application, but every time I tried with a much more generic request from a test app, it borked with a "communication failure" error.  If I sent back null as a return object, it serialized and was processed perfectly.  Strange.

I haven't chased this down definitively, but after limiting my results fairly severely (first from an unencumberedly huge number of returns, then to 800, then finally to 80), things started working again.

I think I hit a memory ceiling somewhere before this, but it's still good to know that there is a max size on IIS for AJAX returns.  From "How to configure maxJsonLength in ASP.NET AJAX applications":
Invoking web methods from client scripts is fun. But before you roll out your cool applications into the production, please don't forget to reconfigure the max JSON string length, represented by either the maxJsonLength value in the web configuration file or the MaxJsonLength property of the JavaScriptSerializer class.

Labels: , ,


posted by ruffin at 3/27/2012 02:35:00 PM
Tuesday, January 31, 2012

And welcome to Events for me. And more importantly, welcome to threads in ExtJS.

How to read Ext.data.JsonStore elements ... store.each?:

No, as I said before the store load is _asynchronous_. Do this instead:

Code:
store.on("load", function(s,rs) {
var myArray = new Array();
store.each(function(record) {
alert(record.data.ID);
myArray.push(record.data.ID);
});
});


Makes it slightly more complicated to debug your data loads, but such is the price of progress with Javascript, I guess.

Labels: ,


posted by ruffin at 1/31/2012 11:20:00 AM
Thursday, November 10, 2011

An Introduction to JavaScript Object Notation (JSON) in JavaScript and .NET:

* Jayrock is open-source, making it possible to extend or customize as needed.
...
* ... While ASP.NET AJAX includes some support for creating and parsing JSON text, its primary purpose is to offer a rich platform for building end-to-end Ajax-style web applications in ASP.NET. The extra bells and whistles can be distracting when your main focus is JSON.


That's the kind of attitude I like to see. So much stuff is overkill, like XML for AJAX.

EDIT: Also good -- The comments in json2.js, a reference impl for JSON here.

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

Labels:


posted by ruffin at 11/10/2011 08:31:00 AM

<< Older | Newer >>


Support freedom
All posts can be accessed here:


Just the last year o' posts:

URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* Professional links: resume, github, paltry StackOverflow * Regular Expression Introduction (copy)
* The hex editor whose name I forget
* JSONLint to pretty-ify JSON
* Using CommonDialog in VB 6 * Free zip utils
* git repo mapped drive setup * Regex Tester
* Read the bits about the zone * Find column in sql server db by name
* Giant ASCII Textifier in Stick Figures (in Ivrit) * Quick intro to Javascript
* Don't [over-]sweat "micro-optimization" * Parsing str's in VB6
* .ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); (src) * Break on a Lenovo T430: Fn+Alt+B
email if ya gotta, RSS if ya wanna RSS, (?_?), ยข, & ? if you're keypadless


Powered by Blogger etree.org Curmudgeon Gamer badge
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity.