Saturday, January 16, 2010

Bulletproof SSO with SAML 2.0

Bulletproof status is difficult to achieve. Even bulletproof glass is a myth. Is it possible to achieve bulletproof status with an SSO implementation? First, lets start with a code review checklist of assertions that must all pass in order to achieve bulletproof status.

Code Review Checklist for a Web Browser SSO Profile


The Web Browser SSO Profile with Redirect/POST bindings is the most common SSO implementation. The checklist will focus primarily on this profile. If interested, Google has an extremely helpful static demo and reference implementation of this SSO profile online.

Validate Message Confidentiality and Integrity

  • SSL 3.0 is the most common solution to guarantee message confidentiality and integrity. Refer to SAML Security (section 4) for additional information. This step will help counter the following attacks:
    • Eavesdropping 7.1.1.1
    • Theft of User Authentication Information 7.1.1.2
    • Theft of the Bearer Token 7.1.1.3
    • Message Deletion 7.1.1.6
    • Message Modification 7.1.1.7
    • Man-in-the-middle 7.1.1.8

  • A digitally signed message with a certified key is the most common solution to guarantee message integrity and authentication. Refer to SAML Security (section 4) for additional information. This step will help counter the following attacks:
    • Man-in-the-middle 6.4.2
    • Forged Assertion 6.4.3

Validate Protocol Usage

This is a common area for security gaps. In fact, Google's original SSO implementation suffered from a severe security flaw in this area. The flaw was identified with SATMC, a state-of-the-art model checker for security protocols. Their SSO profile was vulnerable to a Man-in-the-middle attack from a malicious SP (Service Provider). As ironic as it seems, the SSO Web Browser Profile is most susceptible to attacks from trusted partners. This particular security flaw was exposed because the SAML Response did not contain all of the required data elements necessary for a secure message exchange. Following the SAML Profile usage requirements for AuthnRequest (4.1.4.1) and Response (4.1.4.2) will help counter this attack. The Formal Analysis team documented these requirements in much simpler notation. Their documentation for required data elements were as follows:
  • AuthnRequest(ID, SP); An AuthnRequest must contain and ID and SP. Where ID is a string uniquely identifying the request and an SP identifies the Service Provider that initiated the request. Furthermore, the request ID attribute must be returned in the response (InResponseTo="<requestId>"). InResponseTo helps guarantee authenticity of the response from the trusted IdP. This was one of the missing attributes that left Google's SSO vulnerable.

  • Response(ID, SP, IdP, {AA} K -1/IdP); A Response must contain all these elements. Where ID is a string uniquely identifying the response. SP identifies the recipient of the response. IdP identifies the identity provider authorizing the response. {AA} K -1/IdP is the assertion digitally signed with the private key of the IdP.

  • AuthAssert(ID, C, IdP, SP); An authentication assertion must exist within the Response. It must contain an ID, a client (C), an identity provider (IdP), and a service provider (SP) identifier.

Validate Protocol Processing Rules

This is another common area for security gaps simply because of the vast number of steps to assert. Processing a SAML response is an expensive operation but all steps must be validated.
  • Validate AuthnRequest processing rules. Refer to SAML Core (3.4.1.4) for all AuthnRequest processing rules. This step will help counter the following attacks:
    • Man-in-the-middle (6.4.2)

  • Validate Response processing rules. Refer to SAML Profiles (4.1.4.3) for all Response processing rules. This step will help counter the following attacks:
    • Stolen Assertion (6.4.1)
    • Man-in-the-middle (6.4.2)
    • Forged Assertion (6.4.3)
    • Browser State Exposure (6.4.4)

Validate Binding Implementation

  • For an HTTP Redirect Binding refer to SAML Binding (3.4). To view an encoding example, you may want to reference RequestUtil.java found within Google's reference implementation.

  • For an HTTP POST Binding refer to SAML Binding (3.5). The caching considerations are also very important. If a SAML protocol message gets cached, it can subsequently be used as a Stolen Assertion (6.4.1) or Replay (6.4.5) attack.

Validate Security Countermeasures

Revisit each security threat that exists within the SAML Security document and assert you have applied the appropriate countermeasures for threats that may exist for your particular implementation. Additional countermeasures considererd should include:
  • Prefer IP Filtering when appropriate. For example, this countermeasure could have prevented Google's initial security flaw if Google provided each trusted partner with a separate endpoint and setup an IP filter for each endpoint. This step will help counter the following attacks:
    • Stolen Assertion (6.4.1)
    • Man-in-the-middle (6.4.2)

  • Prefer short lifetimes on the SAML Response. This step will help counter the following attacks:
    • Stolen Assertion (6.4.1)
    • Browser State Exposure (6.4.4)

  • Prefer OneTimeUse on the SAML Response. This step will help counter the following attacks:
    • Browser State Exposure (6.4.4)
    • Replay (6.4.5)


Need an architectural diagram? The SAML technical overview contains the most complete diagrams. For the Web Browser SSO Profile with Redirect/POST bindings refer to the section 4.1.3. In fact, of all the SAML documentation, the technical overview is the most valuable from a high-level perspective.

Monday, November 30, 2009

97 Things Every Project Manager Should Know


I have now finished reading each book within the 97 series:


As expected, most topics within this book emphasized the importance of communication and people. Barbee Davis, the author of the book also has a 60-minute Webcast about this book that you may be interested in if you can not get your hands on the book.

My Favorite Tips:

  • Success Is Always Measured in Business Value (Page 36) by Barbee Davis
    • Favorite Quote:
      "We need to focus on the fact that the project is only as successful as the business value it adds to the organization."

    • Key Message:
      It is extremely important that everyone involved on the project is aware of the business value the project will deliver. This will clarify the project objective and it allows the team to focus on a single team goal. Most developers focus on code quality, good design principles, and code maintenance. While all of those attributes are valuable, none is more important than the business value that your team ultimately delivers for your customer.

  • Value Results, Not Just Effort (Page 58) by Venkat Subramaniam
    • Favorite Quote:
      "Encourage programmers to report the progress they make, rather than how long they work. Let them know that you care about getting results rather than keeping track of how long they spent at the computer."

    • Key Message:
      We typically track effort because it is the simpler of the two metrics to calculate. The time sheet will show effort. Alternatively, results will require a calculation of hours worked and velocity. Ultimately, the focus must be on maximizing velocity and not just effort.

  • Developer Productivity: Skilled Versus Average (Page 26) by Neal Ford
    • Favorite Quote:
      "Understand that really good software developers are much more productive than average ones. In fact, some statistics say that really good developers are multiple orders of magnitude better than poor ones."

    • Key Message:
      Dave Thomas gave a similar talk about this topic in 2003. Continuous learning is the key point within this post. Combined with the right tools and knowledge you will see greater efficiency gains on your projects. The real challenge is allocating time to focus on your continuous learning efforts.

  • Provide Regular Time to Focus (Page 40) by James Leigh
    • Favorite Quote:
      "Typically, a person takes about 20 minutes to regain his train of thought after one of these interruptions. A 5-minute question actually costs 25 minutes. Interruptions and recovery time consume 28% of a typical knowledge worker's day."

    • Key Message:
      Interruptions are not going away. In fact, actually responding to questions and attending meetings will improve productivity for others within the team. What's the solution to the interruption problem? There is no ideal solution to this problem. However, if you provide good documentation, training, and education, interruptions should be diminished. If you still find that distractions are an occurrence, try working several hours outside of core hours. There will be fewer interruptions outside core hours. While interruptions will not go away, you can configure your daily schedule to find more ideal focus time.

  • Add Talents, Not Skills, to Your Team (Page 14) by Richard Sheridan
    • Favorite Quote:
      "My advice to anyone seeking to build a strong team is to hire for talents, not for skills. What talents do I look for when hiring technologists for my development teams? Good kindergarten skills:"

    • Key Message:
      This tip changed the way thought about hiring. I was a believer in tech skills first and team skills second. Tech skills can be learned relatively quickly. The same can not always be said about team skills.

Friday, October 30, 2009

97 Things Every Programmer Should Know



The 97 series now consists of the following titles:

The architect book was very good. The programming topics were also good but I found more value within the architecture discussions. I definitely want to get my hands on the project management book soon. I have a feeling that one will be a bit more humorous.


My Favorite Things Programmers Should Know:

  • The Professional Programmer by Uncle Bob
    • Favorite Quote:
      "Professionals are responsible. They take responsibility for their own careers. They take responsibility for making sure their code works properly. They take responsibility for the quality of their workmanship. They do not abandon their principles when deadlines loom. Indeed, when the pressure mounts, professionals hold ever tighter to the disciplines they know are right".

    • Key Message:
      This post was unquestionably at the top of the my list. The entire message is about personal responsibility. This one's a wall hanger. Print it out, frame it, and hang it up! This post reminded me of the talk I heard Dave Thomas give many years ago at No Fluff Just Stuff.


  • Don't Rely on "Magic Happens Here" by Alan Griffiths
    • Favorite Quote:
      "You don't have to understand all the magic that makes your project work, but it doesn't hurt to understand some of it — or to appreciate someone who understands the bits you don't."

    • Key Message:
      Can you fulfill the roles of every individual on your last project? Image how valuable you'd be if you could. Again, the more knowledge you have, the more efficient you and your project will be.


  • Hard Work Does not Pay off by Olve Maudal
    • Favorite Quote:
      "programming and software development as a whole involve a continuous learning process."

    • Key Message:
      Continuous learning is the key point within this post. Combined with the right tools and knowledge you will see greater efficiency gains on your projects. The real challenge is allocating time to focus on your continuous learning efforts.


  • First Write, Second Copy, third Refactor by Mario Fusco
    • Favorite Quote:
      "So the first time you are implementing something new, write it in the most readable, plain, and effective way. It is definitely too early to put the general part of your algorithm in an abstract class and move its specialization to the concrete one or to employ any other generalization pattern".

      "The second time you face a problem that resembles the one you solved before, the temptation to refactor that first implementation in order to accommodate both these needs is even stronger. But it may still be too early. It may be a better idea to resist that temptation and do the quickest, safest, and easiest thing it comes you in mind: Copy your first implementation".

      "When you need that solution for the third time, even if to satisfy a slightly different requirement, the time is right to put your brain to work and look for a general solution that elegantly solves all your three problems. Now you are using that algorithm in three different places and for three different purposes, so you can easily isolate its core and make it usable for all three cases".


    • Key Message:
      The Rule of Three also applies for reuseability. For example, in order for a solution to be classified as a design pattern the rule of three must apply. If you can successfully apply the same pattern across three separate systems you have a design pattern. Furthermore, this rule also applies to API design. If your API can successfully be consumed by three separate clients, you have a very concrete and proven design. Applying the Rule of Three for shared services or libraries is also valuable.

Wednesday, September 30, 2009

YUI to the rescue

Are you still rolling your own HTML user interface components? If you are, take a look at what YUI has to offer. The advantages of leveraging YUI's standard components are abundant.

YUI Advantages:

  • Saves cost on development effort. The suite of controls are already developed and tested. This allows your team to work on more valuable tasks.
  • Excellent performance. YUI has adopted many of the great performance improvement practices that were identified in Best Practices for Speeding Up Your Web Site. Several of the performance improvements include:
    • Minified JavaScript and CSS files. This will improve page load performance with smaller files to download.
    • Aggregated or rolled-up JavaScript and CSS files. This will improve page load performance with fewer HTTP requests.
    • Yahoo will host the files on their own Content Delivery Network. In addition, Yahoo will compress and cache all of their controls for even greater performance. They also manage versioning.
  • Components are supported across all A-Grade browsers
  • Helps non-UI experts design beautiful user interfaces. Yahoo provides the design and CSS layout for all of their components.
  • 508 compliant. All components are screen reader accessible.
  • All components already have extensive documentation with many examples.
  • Reusable. You can apply the YUI controls everywhere because they are not proprietary.
  • Technology agnostic. These controls can be applied across all Web environments regardless of technology (Java, .NET, Rails, etc.).
  • Support many features that allow you to change behavior without customizing the code.
  • Thier code is clean. I validated their JavaScript with JSLint and few errors were reported. I also validated their CSS files and no major issues existed either.


YUI Disadvantages:

  • Some controls are not bullet proof. For example, there is a sorting issue with their datatable control if you embed the component within a table. However, this is not an issue if you are working in a CSS based design.
  • They do not have everything but the list is extensive.


Recommendations:

  • Try to avoid customizations. Customizing the code will make it difficult to migrate to newer versions in the future.