Effluxion

by Jon Crosby

CloudKit 0.10.0 Released: Rack 0.9, Batch URI Resolution

A new 0.10.0 CloudKit gem is out.

To install:

gem install cloudkit

To update:

gem update cloudkit

This was originally going to be 0.9.2 with support for this week’s Rack 0.9 release. However, the new batch URI resolution in the REST API was too valuable to hold back for the 1.0 release so it was pulled in and the minor version number was incremented to reflect its presence. This release contains no breaking API changes.

The exact details of the new feature are in the updated REST API document and cURL tutorial on the site. I will attempt to summarize with an embedded cURL log:

As always, thank you for the feedback on GitHub, Twitter, the mailing list, and elsewhere.

OAuth, Phishing, and Twitter

In the midst of what might seem like a crisis when viewed from within the web’s echo chamber, it can be difficult to sort fact from fiction, threat from hysteria. Such was the case last weekend when three terms that typically evoke passionate responses were combined in a single meme — OAuth, Phishing, and Twitter.

The source of concern was a scam spreading on Twitter via fake direct messages. These messages mimicked Twitter’s own opt-in email notifications that go out when users of the service receive a direct message. You can read the details on Twitter’s blog, released in a responsible and timely fashion during the incident. Engineers no doubt worked overtime to mitigate this while the rest of us enjoyed holiday leftovers and more relaxing weekends.

It didn’t take long for some to try and link the incident to Twitter’s lack of OAuth support in their API. Some, such as Chris Messina, clearly understood the distinction but others seemed to blur the line. This post is an attempt to demonstrate the orthogonality of OAuth and phishing with regard to this specific incident.

Phishing Defined

Let’s start with a precise definition of phishing, taken from Wikipedia and quoted on Twitter’s own blog covering the incident:

“Phishing is the criminally fraudulent process of attempting to acquire sensitive information such as usernames, passwords and credit card details by masquerading as a trustworthy entity in an electronic communication.”

If your inbox looks like mine, phishing attempts are nothing new. Links typically contain misleading subdomains, misspelled top level domains, and other tactics in an attempt to establish enough trust to get a click, after which a fake site mirroring the original attempts to collect the sensitive information.

This was the tactic employed by the scammers over the weekend in their attack against Twitter users and it is almost completely unrelated to OAuth or lack thereof in Twitter’s API. The end-to-end flow of receiving an email, clicking a link, and logging into what looks like a legitimate site does not change when using OAuth. This exact attack is equally possible for sites using OAuth.

Authentication vs. Authorization

OAuth provides a method of secure API authorization where as the act of logging into a site is the act of authentication. For sites that use OAuth, users normally must authenticate prior to authorizing third party API access. These are two separate steps. The difference between authentication and authorization isn’t mere pedantry; it is critical to the understanding of OAuth and its place along side complementary technologies such as session-based logins or OpenID.

Remember that authentication answers more of the “Who am I?” question, sometimes merely validating a claim such as “I have control of this URL,” as is the case with OpenID. Authorization handles the “I, having been authenticated, am authorized to perform this action” part of the equation.

OAuth allows scoped API access (a la valet keys) to user data. The user remains in control, having the ability to disable a particular third party’s access to data while leaving others intact. Service providers can take this as far as they want, scoping each OAuth token to specific actions rather than an all-or-nothing approach. Users under this system have no reason to give their passwords to any third parties and sites can message strongly against it without worries of curtailing API usage and its related marketing benefits.

Tying (or rather, not tying) this back to Twitter, the phishing scam was an attack to gain authentication credentials for Twitter users and had nothing to do with authorization, the domain of OAuth.

CloudKit 0.9.1 Released

A new CloudKit 0.9.1 gem has been released. Thank you to everyone who sent feedback via the mailing list, GitHub, Twitter, and personal email.

To install:

gem install cloudkit

To update:

gem update cloudkit

From the change log:

  • Fixed Rack::Lint/rackup errors related to Content-Type headers
  • Patched Rack to support StringIO#string in Rack::Lint::InputWrapper
  • Fixed server_url encoding in OpenIDStore
  • Added sqlite3-ruby dependency in gemspec
  • Updated documentation

Release: CloudKit 0.9 - An Open Web JSON Appliance

How many lines of code does it take to deploy a fully discoverable, RESTful, GET-optimized, auto-versioned, JSON API?

Two. First, install the gem:

CloudKit is Rack middleware, so let’s create a rackup file called config.ru like this:

Fire it up with Thin, for example:

You now have a running JSON container managing collections of “notes” and “projects.” For the full REST API spec, see the CloudKit site. Don’t miss the curl tutorial while you’re there.

Let’s say we want to add both OpenID and OAuth support to this API. How many more lines of code?

Zero. Simply change “expose” to “contain” and you’re ready to go:

CloudKit is built around HTTP and JSON for the purpose of building efficient APIs quickly. It’s a bit like CouchDB with baked-in Open Web auth plus the entire spectrum of Rack middleware at its disposal. The automatic version history for each JSON document is provided as an aid for decentralized or occasionally-connected clients, allowing a progressive diff/merge against history to “catch up” in the case of conflicts.

Thanks to Rack, you can run CloudKit on its own or alongside other Rack-based apps or middleware components such as Rails, Merb, or Sinatra. Any requests outside of the named collection scopes or authentication endpoints are passed along to the next piece in the stack.

If you’re interested in hacking, the source is on GitHub.

Rack::Config 0.9 Released

Smaller than its own README, Rack::Config is a straightforward method of configuring a stack of Rack middleware that needs to share information.

To install:

Example config.ru:

JSCocoa bridges Cocoa to JavascriptCore (WebKit’s JS engine). It allows you to call C code, ObjC code, use C structs, and build Javascript classes inheriting from ObjC classes. JSCocoa — A bridge from JavascriptCore to Cocoa
However, the NDA has created too much of a burden on developers, authors and others interested in helping further the iPhone’s success, so we are dropping it for released software. iPhone Developer Program
SquirrelFish Extreme runs JavaScript quite a bit faster than the original SquirrelFish. It’s available in Mac and Windows nightlies and you can take it for a spin yourself. [webkit-dev] SquirrelFish Extreme?
Peace, Hope & Surveilance (via get directly down)

Peace, Hope & Surveilance (via get directly down)