<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>PresidentBeef.com</title>
    <link>http://presidentbeef.com/blog/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>PresidentBeef.com</description>
    <item>
      <title>Manually Vendoring Rails 1.2.3...</title>
      <description>A few days ago, my shared hosting provider ( &lt;a href="http://www.site5.com/in.php?id=38643"&gt;Site5&lt;/a&gt; &amp;#8211; I do recommend them ) moved my account to a new server. Understandably, this new server had new versions of Ruby and Ruby on Rails. Sadly, my site uses &lt;a href="http://ozimodo.rubyforge.org/"&gt;Ozimodo&lt;/a&gt;, a (ancient) tumblelog application built for Rails 1.2.3, and I had been unknowingly depending on the global version of Rails. Naturally, my site went &lt;em&gt;kerplumpf&lt;/em&gt; once it was moved to the new server.

After fighting with it for some time, I foolishly thought that I was able to just switch directly to Rails 2.3.8. This actually seemed to work for a moment (the main page displayed!) but everything else was still broken.

I attempted to vendor Rails (that is, have a copy of the right version of Rails inside my rails app in &lt;code&gt;vendor/rails&lt;/code&gt;) but I kept getting errors like this:

&lt;code&gt;
&lt;pre&gt;
$ rake rails:freeze:gems
(in /home/fair/pkgs/ozimodo)
rake aborted!
undefined method `manage_gems' for Gem:Module
&lt;/pre&gt;
&lt;/code&gt;

After fussing about for a long while, trying to use different versions of RubyGems and all sorts of silly ideas, I went ahead and found the &lt;code&gt;rails:freeze:gems&lt;/code&gt; task (it&amp;#8217;s in &lt;a href="https://github.com/rails/rails/blob/v1.2.3/railties/lib/tasks/framework.rake"&gt;framework.rake&lt;/a&gt;) and manually completed what it is supposed to do automatically:

  # Install Rails 1.2.3 if you have not already
  # Create &lt;code&gt;vendor/rails&lt;/code&gt;
  # &lt;code&gt;gem unpack&lt;/code&gt; actionmailer (1.3.3), actionpack (1.13.3), actionwebservice (1.2.3), activerecord (1.15.3), activesupport (1.4.2), and rails (1.2.3) into `vendor/rails`
  # Rename each directory without the version name (e.g., &amp;#8220;actionmailer-1.3.3&amp;#8221; -&amp;gt; &amp;#8220;actionmailer&amp;#8221;) except &lt;code&gt;rails&lt;/code&gt;.
  # Rename &lt;code&gt;rails-1.2.3&lt;/code&gt; to &lt;code&gt;railties&lt;/code&gt;

You may also need to set &lt;code&gt;GEM_PATH&lt;/code&gt; to &lt;code&gt;/home/yourname/ruby/gems&lt;/code&gt;, I can&amp;#8217;t remember if that was necessary or not.

This was the process, as well as I can remember, which got this site back up and running again.</description>
      <pubDate>Mon,  6 Jun 2011 18:58:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2011/06/06/#206</guid>
      <link>http://presidentbeef.com/blog/2011/06/06/#206</link>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>Pushing Brakeman</title>
      <description>I have been trying to do a bit more advertising of &lt;a href="http://brakemanscanner.org"&gt;Brakeman&lt;/a&gt; lately. I have two reasons for doing so: firstly, I think it&amp;#8217;s a really useful tool and will make the world a safer place. Secondly, I keep hoping someone else will find bugs in it for me.

One of my design decisions for Brakeman is that it should &lt;em&gt;never&lt;/em&gt; crash and should always output some kind of report. I don&amp;#8217;t always meet this goal, so I am very interested in any cases where a Rails app will actually make Brakeman fall on its face.

Lately, I have (finally) been putting together a test suite. I&amp;#8217;m already finding issues with features I thought were working. Hopefully it will help me avoid embarrassing regressions in the future, too.

If you are in the Los Angeles area, I will be presenting on using Brakeman with &lt;a href="http://jenkins-ci.org/"&gt;Jenkins&lt;/a&gt; at the LA &lt;a href="https://www.owasp.org/index.php/Los_Angeles"&gt;&lt;span class="caps"&gt;OWASP&lt;/span&gt;&lt;/a&gt; on Wednesday the 25th. Then, next month, I have a similar but unconfirmed talk at &lt;a href="http://www.meetup.com/laruby/"&gt;LA Ruby&lt;/a&gt;. The difference between the two is that I will talk more about Ruby and Rails at the &lt;span class="caps"&gt;OWASP&lt;/span&gt; meeting. At least, I think I will. This blog post is part of my avoiding actually making the slides.

Oh, what is Brakeman? It is a static analysis tool for finding security vulnerabilities in Ruby on Rails applications. It does a pretty good job, most of the time.</description>
      <pubDate>Mon, 23 May 2011 22:17:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2011/05/23/#205</guid>
      <link>http://presidentbeef.com/blog/2011/05/23/#205</link>
      <category>ruby</category>
      <category>rails</category>
      <category>brakeman</category>
    </item>
    <item>
      <title>Brakeman Updates</title>
      <description>&lt;a href="http://brakemanscanner.org"&gt;Brakeman&lt;/a&gt; is a static analysis tool for Ruby on Rails that looks for security vulnerabilities. The cool thing about Brakeman is that pretty much all you need is your code: there is no need to set up a database or a web server or anything of that sort. The code doesn&amp;#8217;t even need to be working completely.

Brakeman has been working pretty well for Rails 2.x code, but no one really cares about that any more. Rails 3.x is the new hotness. So I have been working on getting Brakeman to work with Rails 3. The latest gems will attempt to detect Rails 3 automatically (otherwise, there is the `-3` options). There are &lt;em&gt;some&lt;/em&gt; known issues to be fixed, but I think it&amp;#8217;s past the &amp;#8220;catastrophic crash and burn&amp;#8221; stage. I would encourage people to try it out.

Also, I have released a &lt;a href="https://github.com/presidentbeef/brakeman-jenkins-plugin"&gt;Jenkins/Hudson plugin&lt;/a&gt; for Brakeman With a minimal amount of setup, you can have &lt;a href="http://jenkins-ci.org/"&gt;Jenkins&lt;/a&gt; run Brakeman automatically. It uses another nice plugin to make &lt;a href="https://wiki.jenkins-ci.org/display/JENKINS/Static+Code+Analysis+Plug-ins"&gt;pretty graphs&lt;/a&gt; and tracks the vulnerabilities found so you can see right away when things go wrong.</description>
      <pubDate>Sat, 14 May 2011 19:52:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2011/05/14/#204</guid>
      <link>http://presidentbeef.com/blog/2011/05/14/#204</link>
      <category>ruby</category>
      <category>programming</category>
      <category>rails</category>
      <category>brakeman</category>
    </item>
    <item>
      <title>Life at the End of April</title>
      <description>I have started to feel guilty about neglecting this site, so here is a recap of my life right now:

&lt;em&gt;School&lt;/em&gt; drags on, but if all goes well I will at least advance to candidacy at the end of this week. I&amp;#8217;m pretty nervous about it, though.

&lt;em&gt;Work&lt;/em&gt; is weird because I work &lt;em&gt;at&lt;/em&gt; &lt;a href="http://attinteractive.com/"&gt;AT&amp;#38;T Interactive&lt;/a&gt; but I work &lt;em&gt;for&lt;/em&gt; AT&amp;#38;T, yet I &lt;em&gt;do&lt;/em&gt; work for AT&amp;#38;T Interactive. Even more confusingly, the sign outside the building still says YellowPages.com.

My &lt;em&gt;hobbies&lt;/em&gt; now include archery, which is thoroughly addictive, so you will find me on the range most Saturdays and Sundays and even on some weekday evenings.

In my more &lt;em&gt;personal&lt;/em&gt; life, I will be getting married in approximately five months. I&amp;#8217;m pretty happy about that.

And that&amp;#8217;s a pretty good summary of where I am right now. A good portion of my activities can been seen on &lt;a href="http://github.com/presidentbeef"&gt;GitHub&lt;/a&gt; if you like more frequent updates.</description>
      <pubDate>Sun, 24 Apr 2011 23:16:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2011/04/24/#203</guid>
      <link>http://presidentbeef.com/blog/2011/04/24/#203</link>
      <category>personal</category>
    </item>
    <item>
      <title>Writing Code for You</title>
      <description>From &lt;cite&gt;Tom Sawyer&lt;/cite&gt;:

bq. ...Work consists of whatever a body is obliged to do, and that Play consists of whatever a body is not obliged to do.

It is common in the open source world to hear that someone wrote some software to &amp;#8220;scratch their own itch.&amp;#8221; The implication is usually that they wrote the code to meet some need (or annoyance?) they had, and it may, by mere coincidence, be useful to others as well. Sometimes this phrase also used to excuse the software or lack of support for it. It may also be used to provide guidance for those wanting to write software: do something useful for yourself.

I think there is a considerable amount of wisdom in this approach. Nothing motivates a person like a genuine interest in a project. The best learning (in my non-scientific opinion) occurs when a person is &lt;em&gt;driven&lt;/em&gt; by their own interest. Outside pressures can only do so much.

I often see &lt;a href="http://projecteuler.net/"&gt;Project Euler&lt;/a&gt; or some kind of &amp;#8220;programming koans&amp;#8221; offered up as suggestions to improve one&amp;#8217;s programming skills. I find these to be unhelpful for me, as I cannot make myself be interested in them. In fact, I should not need to &lt;em&gt;force&lt;/em&gt; myself to be interested at all: that pushes the activity into the &amp;#8220;work&amp;#8221; category and the exercise has already failed.

For programmers, we should be writing code which we &lt;em&gt;want&lt;/em&gt; to write, solving problems we &lt;em&gt;want&lt;/em&gt; to solve, and producing something we &lt;em&gt;want&lt;/em&gt; to make.

Along the way, we may accidentally learn all kinds of new things, but only because those things are on the path of building our project. It is not about making something useful, or good, or desirable. It is about the joy of creation.

That does not mean it is all bunnies and sunshine, though. I have hit my head against the wall more times over software I was writing for fun than any homework problem. Why? Because they were problems I intensely desired to overcome &amp;#8211; for myself.

The point, in case I have not beaten it to death already, is that you should write code for you. It doesn&amp;#8217;t matter if it isn&amp;#8217;t perfect or won&amp;#8217;t compile on anyone else&amp;#8217;s machine. It doesn&amp;#8217;t matter if twenty other programs exist that do the same thing. All that matters is that you write it. Learning is merely a side effect.</description>
      <pubDate>Sun, 13 Mar 2011 00:49:00 CST</pubDate>
      <guid>http://presidentbeef.com/blog/2011/03/13/#202</guid>
      <link>http://presidentbeef.com/blog/2011/03/13/#202</link>
      <category>personal</category>
      <category>programming</category>
      <category>random</category>
    </item>
    <item>
      <title>An actually decent Ruby chat se...</title>
      <description>There are a few examples around the &amp;#8216;net of chat servers in Ruby, which seem to me to be unnecessarily complex or else too simplistic.

This is a simple version, too, as it is intended to meet the requirements over at &lt;a href="http://rosettacode.org/wiki/Chat_server"&gt;RosettaCode&lt;/a&gt;. However, I think I&amp;#8217;ve covered most of the common failure points.

&lt;br&gt;

&lt;script src="https://gist.github.com/767666.js?file=gistfile1.rb"&gt;&lt;/script&gt;

h2. Caution

If connecting with a client like PuTTY, use &amp;#8220;raw&amp;#8221; mode to avoid telnet negotiation.</description>
      <pubDate>Wed,  5 Jan 2011 23:45:00 CST</pubDate>
      <guid>http://presidentbeef.com/blog/2011/01/05/#201</guid>
      <link>http://presidentbeef.com/blog/2011/01/05/#201</link>
      <category>ruby</category>
      <category>programming</category>
    </item>
    <item>
      <title>Brakeman: A Vulnerability Scann...</title>
      <description>I spent this summer doing an internship at &lt;a href="http://attinteractive.com/"&gt;ATTi&lt;/a&gt;, during which I developed a static analysis tool called &lt;a href="http://github.com/presidentbeef/brakeman"&gt;brakeman&lt;/a&gt; for finding security vulnerabilities in &lt;a href="http://rubyonrails.org/"&gt;Ruby on Rails&lt;/a&gt; applications.

h3. What it is

Brakeman uses Ryan Davis&amp;#8217; &lt;a href="http://parsetree.rubyforge.org/ruby_parser/"&gt;Ruby Parser&lt;/a&gt; to parse the code of your RoR application, mangles it a bit, extracts some information, and then runs various checks on the result. It then uses &lt;a href="http://www.rubyreports.org/"&gt;Ruport&lt;/a&gt; to generate a report.

The &lt;span class="caps"&gt;HTML&lt;/span&gt; reports look &lt;a href="http://presidentbeef.com/files/brakeman_sample_report.html"&gt;like this&lt;/a&gt;.

Because brakeman analyzes the source code, there is no need to wait until the application is deployed to start testing it. Brakeman can be run at any point in the development process.

h3. What it can do

Right now, brakeman can find these kinds of problems:

* Cross site scripting vulnerabilities
* &lt;span class="caps"&gt;SQL&lt;/span&gt; injection
* Command injection
* Unsafe redirects
* Unrestricted mass assignments
* Insufficient validation regexes
* Default routes
* Dynamic render paths

It can also check configuration settings, such as cross site request forgery protection and session secret length.

Unfortunately, it is not (yet?) compatible with Rails 3.0. Hopefully it will still be of use to a lot of people, though.

h3. Installation

Brakeman can be installed as a gem (and, in fact, that is how I would recommend doing it):

&lt;code&gt;gem install brakeman&lt;/code&gt;

(may require &lt;code&gt;sudo&lt;/code&gt;).

h3. Documentation

&lt;code&gt;brakeman -h&lt;/code&gt; provides information on the options available. I&amp;#8217;ve also been working on fleshing out the &lt;a href="http://github.com/presidentbeef/brakeman/wiki"&gt;wiki&lt;/a&gt; with more detailed info.

h3. Problems?

I really want this to be a useful tool, so if it does not work for you or there are any problems, please file an &lt;a href="http://github.com/presidentbeef/brakeman/issues"&gt;issue&lt;/a&gt; or even just leave a comment on this post. I&amp;#8217;ll do my best to get everything fixed up.</description>
      <pubDate>Tue,  7 Sep 2010 17:36:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2010/09/07/#200</guid>
      <link>http://presidentbeef.com/blog/2010/09/07/#200</link>
      <category>ruby</category>
      <category>programming</category>
      <category>rails</category>
      <category>brakeman</category>
    </item>
    <item>
      <title>Spellcheck/Suggest for RubyGems...</title>
      <description>As a result of a &lt;a href="http://wiki.github.com/rdp/ruby_bounties/ruby-bounties"&gt;Ruby bounty&lt;/a&gt;, I wrote a patch for &lt;a href="http://rubygems.org/"&gt;RubyGems&lt;/a&gt; which provides suggestions when you try to install a gem and you get the name a little wrong. You can see all the details &lt;a href="http://rubyforge.org/tracker/index.php?func=detail&amp;#38;aid=28149&amp;#38;group_id=126&amp;#38;atid=577"&gt;here&lt;/a&gt;.

Now that RubyGems 1.3.7 is out, I&amp;#8217;m going to go ahead and provide a patched version for those who frequently forget, mistype, or misspell gem names (this includes myself).

&lt;a href="http://presidentbeef.com/files/software/rubygems-1.3.7-suggest.tar.gz"&gt;Download .tar.gz&lt;/a&gt;

&lt;a href="http://presidentbeef.com/files/software/rubygems-1.3.7-suggest.zip"&gt;Download .zip&lt;/a&gt;

After decompressing, I recommend installing it with

&lt;code&gt;ruby setup.rb --no-rdoc --no-ri&lt;/code&gt;

(and probably &lt;code&gt;sudo&lt;/code&gt;).

Here are some examples of what this adds to your RubyGems experience:

&lt;pre&gt;&lt;code&gt;$ gem install Blah
ERROR:  Could not find a valid gem 'Blah' (&amp;gt;= 0) in any repository
        Possible alternatives: blahblahblah

$ gem install Nkojiri
ERROR:  Could not find a valid gem 'Nkojiri' (&amp;gt;= 0) in any repository
        Possible alternatives: nokogiri

$ gem install blue
ERROR:  Could not find a valid gem 'blue' (&amp;gt;= 0) in any repository
        Possible alternatives: bluecloth, BlueCloth, bluefeather,
         blue_light_special, blue_light_special_heroku_fork, glue, bluepill,
         blueprintr, blueprints, bluepay, ...

$ gem install sinatar-capcha
ERROR:  Could not find a valid gem 'sinatar-capcha' (&amp;gt;= 0) in any repository
        Possible alternatives: sinatra-captcha, sinatra-cache, sinatra-cas, sinatra-auth,
         sinatra, sinatra-any, sinatra_app_gen, sinatra-flash, sinatra-dm, sinatra-dm-auth,
         sinatra-doc, sinatra-erb, sinatra-compass, ...
&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Fri, 14 May 2010 16:31:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2010/05/14/#199</guid>
      <link>http://presidentbeef.com/blog/2010/05/14/#199</link>
      <category>ruby</category>
      <category>programming</category>
    </item>
    <item>
      <title>git revert a single file</title>
      <description>&lt;code&gt;git checkout &amp;lt;filename&amp;gt;&lt;/code&gt;

I&amp;#8217;m putting that first for people who don&amp;#8217;t need a story.

To be honest, I cannot believe it took me so long to find this out. It seems like such a simple thing. You have a &lt;a href="http://git-scm.com/"&gt;git&lt;/a&gt; repo. You&amp;#8217;ve made changes to a few different files, when you realize you just want to start over on &lt;em&gt;one&lt;/em&gt; of them. You could do &lt;code&gt;git reset --hard&lt;/code&gt;, but then you lose all of your changes. You could commit all the other changed files, then do a &lt;code&gt;git reset&lt;/code&gt;, but what if you aren&amp;#8217;t done with editing the other files?

In &lt;a href="http://subversion.apache.org/"&gt;Subversion&lt;/a&gt; you can &lt;code&gt;svn revert&lt;/code&gt; a single file. Since that is what I fairly frequently wish to do, I searched high and low for a way to do this seemingly simple operation.

Then, one day glorious day, I &lt;a href="http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file"&gt;found it.&lt;/a&gt; And now so have you.</description>
      <pubDate>Fri, 16 Apr 2010 21:37:00 CDT</pubDate>
      <guid>http://presidentbeef.com/blog/2010/04/16/#198</guid>
      <link>http://presidentbeef.com/blog/2010/04/16/#198</link>
      <category>programming</category>
      <category>git</category>
    </item>
    <item>
      <title>Carrot Carnage</title>
      <description>&lt;object width="400" height="300"&gt;&lt;param name="allowfullscreen" value="true" /&gt;&lt;param name="allowscriptaccess" value="always" /&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=9101640&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=9101640&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;p&gt;Yum.&lt;/p&gt;</description>
      <pubDate>Sun, 31 Jan 2010 04:43:00 CST</pubDate>
      <guid>http://presidentbeef.com/blog/2010/01/31/#197</guid>
      <link>http://presidentbeef.com/blog/2010/01/31/#197</link>
      <category>turtles</category>
    </item>
  </channel>
</rss>
