Past Articles
Ive had to rely at times on silence and on talking quick / Defending myself with nothing but my walking stick. Buck65
Here are nine easy tips that will help you communicate better at your next conference.

Dan Grigsbys presentation at RubyFringe was an intentional example of this. All the titles were at the top, with humorous stock photos below.
Keep it in the top third, if possible.

Giles Bowkett is such an entertaining speaker that people once skipped the first 20 minutes of lunch to hear the remainder of his presentation at RubyFringe (which involved more than 400 slides).
He also used only the typefaces included with Mac OS X, including Futura Condensed Medium and Condensed ExtraBold, which work really well in bright colors on black. So even if you dont choose to buy a single typeface, you can assemble a great-looking presentation.
- Giles Bowkett Videos Start 5 minutes in to see the slides.

Its easy with either:
Copy as RTF A TextMate plugin. You can paste the syntax-highlighted text and even edit it afterward in Keynote.
pygments A command-line syntax highlighter written in Python. Its used at GitHub to emit HTML but can also emit RTF from any source file. The resulting rich text can be pasted into Keynote.
pygmentize -f rtf -o out.rtf code.rb
Choosing just the right transition can soak up a lot of time and adds absolutely nothing to the content that people remember afterward.
Dan Grigsby also noted that transitions and multi-step builds make it difficult to go back and forth in the presentation since you have to wait for the transition to finish. Unless

Useful Keynote shortcuts (while the presentation is playing).
<table><tr><td>Key</td><td>Description</td></tr><tr><td>/</td><td>Show a list of keyboard shortcuts.</td></tr><tr><td>H</td><td>Pause the presentation and go to the last used application (useful for demos). Command-tab back to Keynote to resume the presentation.</td></tr><tr><td>= or -</td><td>Show a thumbnail menu that can be used to jump forward or backward to a specific slide. Use the arrow keys to select and the enter key to jump.</td></tr><tr><td>B</td><td>Pause and show a black screen.</td></tr></table>
I love live coding but often it goes awry, creating an awkward situation for both the presenter and the audience.
Give yourself some insurance and either record a short screencast that you can narrate during the presentation, or take screenshots that you can refer to.
Extra Credit!

If youre speaking at a conference, youre probably doing it to promote yourself, your projects, or your business. Make it stick in peoples minds by distinguishing yourself with a color scheme and a typeface that communicate the attitude you want to be remembered for.
Choose a color scheme and use it for all your presentations. Ideally, it would be the color scheme of your company or personal blog. If youve paid for a corporate identity, use it!
Resources
- Color Burn Widget A Mac OS X dashboard widget with a new color scheme every day.
- ColourLovers.com Tons of color combinations for every attitude.

Again, buy a typeface and use it on your blog and in your presentations.
Theyre not as expensive as you might think! You can get a single font for $20.
Here are some nice condensed ones as mentioned above:
Or try these shops:

I saved my favorite for the end
A presentation remote gives you the freedom to step away from the lectern and talk directly to the audience. The remote that comes with Mac laptops doesnt count! It only works if you have a direct line of sight to the infrared receiver on the front edge of the laptop.
A radio frequency transmitter works much better. The Kensington Presentation Remote can be bought for about $40. It works out of the box without the need to install any drivers, and its less distracting than phone-based options.
See you in Berlin!
Ill be in Berlin at RailsConf starting this Sunday. Find me and get a free PeepCode t-shirt!
PeepCode Screencasts Learn Ruby on Rails and Javascript! Hour-long screencasts for $9.

For the third year in a row, its the Seattle.RBBQ at Geoffs house in Seattle!
- Tuesday, August 26, 7-9 pm.
- Ill provide pizza. Bring any other beverages or food that you want to eat.
- Directions and Bus Numbers
PeepCode Screencasts Learn Ruby on Rails and Javascript! Hour-long screencasts for $9.
UPDATE Thanks for the 40 replies right away! Weve hired an individual for the position.
Dublin

I had a great time in Dublin at the end of June. I spoke at an open source conference and met several other Rubyists while I was there.
Ive frequently felt that I should bring home some tchotchke from each of the places I visit. While in Dublin I realized that its not extra things that I really want, its people!
If youre traveling for business or pleasure, I highly suggest that you find the local Ruby group or find a local co-working space and meet people there. I had breakfast with Ana Nelson, who introduced me to Paul Campbell of Contrast, who is working on an error reporting webapp for Rails developers.
He introduced me to Eamon Leonard and David Coallier who happen to be a few musically inclined PHP developers. We had a great time exploring the pubs of Dublin, and I learned that Guinness beer has a different taste in Dublin than anywhere else in the world.
Oh, and a few members of Ruby Ireland hosted a nice dinner in the city.
So the next time you find yourself in an unknown city, meet the locals!



Elsewhere
I just published a new PeepCode screencast about Phusion Passenger (technical editing by Phusion staff).
Ill be speaking about podcasting and entrepreneurship at BizJam Seattle on Wednesday, July 9.
Jim Freeze wanted me to mention that the Lone Star Ruby Conference is open for registration. Ill be at RailsConf in Berlin at that time, but Im sure it will be a great conference if you can get yourself to Texas. I frequently post other worldwide conference and workshop events at Ruby on Rails Workshops.
Also, Ive helped to launch a Deck-like ad network for Ruby blogs. We have several top quality publishers and have a few spots for advertisers. If you have a product, website, or service that would be of interest to Rubyists, check out Ruby Row.
PeepCode Screencasts Learn Ruby on Rails and Javascript! Hour-long screencasts for $9.
I truly feel that I have the coolest job in the world.
Two weeks ago, I was asked to speak at the IOTC Conference in Dublin on June 18-20. Not only that, but they will be streaming live video of the event as it happens!

Few conferences record even the audio of their lectures, so Im not sure how they managed to pull this off. They must be using some of this new open source software that everyone is talking about!
They tell me that youll be able to view it via a link that will be posted here, next Thursday at 10:25am Dublin time.
Ill also be hanging out with members of Ruby Ireland in Dublin on Thursday night.
Then Ill be hurrying back home to be with my son, who aspires to be the next mini me.
At PeepCode
The ever diligent Ryan Daigle has updated our Rails 2 PDF for Rails 2.1. If you purchased the first copy, you can login or revisit the link originally sent to you for the free update.
If not, now is a great time to buy a copy!
And then
Also, I just bought by plane ticket for RubyFringe where Ill attempt to resolve my degree in Philosophy with my current career in computer programming. There are definitely some interesting talks scheduled!
PeepCode Screencasts Learn Ruby on Rails and Javascript! Hour-long screencasts for $9.

Some of the things Ill be bringing to RailsConf 2008 in Portland next week:
<table><tr><th>Item</th><th>Qty</th><th>Purpose</th><th>Location</th></tr><tr><td>PeepCode T-Shirts</td><td>45</td><td>Free!</td><td>Find me!</td></tr><tr><td>Mannequin</td><td>1</td><td>Bodyguard</td><td>Heroku booth</td></tr><tr><td>Utilikilt</td><td>1</td><td></td></tr><tr><td>Samson Microphones</td><td>4</td><td>Podcasting</td><td>Heroku booth at lunch and afternoon break</td></tr><tr><td>Life-size poster of Peter Cooper</td><td>2</td><td>Why not?</td><td>Conference walls</td></tr><tr><td>PeepCode Coupons</td><td>?</td><td>Try it!</td><td>Heroku booth</td></tr></table>Live Podcast Interviews!
My friends at Heroku have offered me a couch at their booth in the exhibit hall to perform a few podcasts. Come see a Rails Podcast recorded live during lunch and afternoon breaks!
<table><tr><th>Time</th><th>Event</th></tr><tr><td>Friday, Lunch</td><td>Ryan Singer of 37signals</td></tr><tr><td>Friday 3:40</td><td>GitHub founders</td></tr><tr><td>Saturday, Lunch</td><td>Phusion Passenger (mod_rails)</td></tr><tr><td>Saturday, 3:40</td><td>Adam Keys interviews me</td></tr></table>Sessions
Ill be moderating one panel and attending an evening session.
<table><tr><th>Time</th><th>Event</th></tr><tr><td>Friday 2:50pm</td><td>The Profitable Programmer</td></tr><tr><td>Friday 9-10pm</td><td>Podcasting BOF</td></tr></table>PeepCode Screencasts Learn Ruby on Rails and Javascript! Hour-long screencasts for $9.

Welcome to the sixth addition of This Week in Rails, where well take a look of the past two weeks of innovation in the Rails community. If youd rather listen to this content on your ipod with additional Ruby news, check out the Rails Envy Podcast #47 and #48.
The Rails Guides Hackfest is in full swing, improving the Rails documentation by leaps and bounds. Rails Routing from the Outside In by Mike Gunderloy is a great read if youre ever confused by Rails Routing. If you want to help with the Guide hackfest, there are several guides up that you can help review.
If you ever need to build a website which allows users to upload videos and then needs to encode them, definitely check out Panda, an open source video encoding application which uses EC2, S3, and SimpleDB. The application itself is written in Merb, but its designed to run separately on ec2 and can easily integrate with your rails app on the front end.
If youd like to ensure your Rails application is well written, Matt More wrote up a Rails Code Quality Checklist which serves as a great guide to Rails best practices. Also, if you need help discovering where your code might need a little re-factoring check out Roodi a new gem by Marty Andres that gives you instant feedback about your Ruby code by examining a few metrics including cyclomatic complexity, method length, bad method names, and blank blocks or loops. Lastly, if youve been following the skinny controller, fat model best practice, you may have found yourself with really fat models (not so good). Paul Barry suggests one way to deal with this using concerned_with.
If youre about to start a new Rails application then you might consider using Bort, a Rails starter application from Jim Neath. Bort contains RESTful Auth, Will Paginate, Exception Notifier, Asset Packager, a Capistrano Recipe, and everything is tested by RSpec. If youd rather start your system with email login instead of username, Matt Hall put together a fork of bort for this.
Implementing a page with multiple file uploads in Rails is no easy task. Luckily, Brian Getting wrote up a tutorial which makes it look easy.
Clemens Kofler wrote up a Guide to Memoization which walks through all the details of this convention and looks at the new memoize helper in Edge Rails ActiveSupport. If you dont know what this word means, please do take the time to read his tutorial.
If youve ever developed a plugin, you may have just decided to manually run your tests every time you change your code. Last week Ken Collins recently put out a new library called Autotest Railsplugin which makes it dirt simple to run autotest on plugins youre developing.
Lastly, if youre looking for other Ruby/Rails podcasts, check out the Rails Podcast which recently featured Jim Weirich at erubycon, Rubyology which recently interviewed Avi Bryant, the Learning Rails podcast which recently covered how to deploy your rails app, Railscasts which recently covered starling and workling, and the Rails Brazil Podcast if you speak Portuguese.
Thats all for now. If you create or discover any notable tools or blog posts this week, feel free to send me an email (Gregg@RailsEnvy).
Image Credit: Still on the right track by janusz l
Welcome to the fifth edition of This Week in Rails, a weekly report with highlights from the Rails community. Antonio Cangiano (the original author) has been pretty busy, so I figured Id step in this week.
As you probably already know, Rails 2.0.4 and Rails 2.1.1 were released this week. Both are mostly bug fixes, but checkout the changelog if you want all the details.
If your Rails app has alot of heavy duty SQL Queries you may want to take a look at a plugin by Fernando Blat called Query memcached. This plugin overwrites Rails default query cache functionality, storing all database queries in memcached for use by sequential requests.
Have you ever implemented an advanced search page for a Rails application? If yes, you may have ended up with bloated controller code. One solution to the problem is Searchgasm by Binary Logic which helps you do object based searching, and keep your search code clean and simple.
Ryan Daigle told us about some great new features in Rails Edge, including Connection Pooling, Shallow Routes, and Mailer Layouts. We should be getting a Rails 2.2 beta any day now, so stay tuned for that.
If you have any Java friends who use Apache Derby who are looking to try out JRuby, Michael Galpin wrote up an introduction to Rails using JRuby and Derby.
Last week Mark Imbriaco from 37 Signals put together a great blog entry and screencast which shows how they use HAProxy in their server setup. If youre not familiar with the benefits of using HAProxy over the apache round robin load balancer, you need to watch his screencast.
Perhaps youve started using jQuery instead of Prototype for Rails. You might have used a plugin for this (ex. jQuery on Rails), but if you started from scratch you might have run into that problem with sending authenticity tokens with your AJAX requests. Lawrence Pit posted the jQuery code youll need to take care of this.
Neverblock is a library that allows you to use Ruby Fibers to write non-blocking concurrent code. This project recently released a non-blocking PostgreSQL adapter, a non-blocking MySQL adapter, and most recently got their Fiber library running on Ruby 1.8 with Rails with some amazing benchmarks! Its still a very young project, but its one more step towards a safely multi-threaded Rails stack.
Lastly, Ive got some events to tell you about. Ruby DCamp is taking place October 11th-12th in Arlington, VA, the Rails Summit Latin America is taking place October 15th and 16 in Sao Paulo, Brazil, and the South Carolina Ruby Conference is on October 18th in Columbia, SC.
Thanks for reading! If you would have rather listened to this information (with slightly more detail), you should check out the Rails Envy Podcast #46 which came out today. Its no mistake that its covering the same material (I help with the podcast).
Sven Fuchs gave a great presentation at RailsConf Europe about the history and details of the forth-coming I18n support in Rails 2.2. Well worth reading if youre in need of internationalization services for your current or future app.
Rails 2.1.1 is another maintenance release that includes a bunch of bug fixes and a fix for the REXML vulnerability. Ive extracted all the changes from the CHANGELOGs into a single Gist. Enjoy!
To install, just do: gem install rails --version 2.1.1.
Next upcoming release will be Rails 2.2 beta which is quite close.
Im pleased to finally announce the Rails Guides Hackfests. And we got really exciting prizes too! There is a list of guides available at Lighthouse You can select one of those, update the ticket and start writing the guide straight away.
For each completed guide, the author will receive all of the following prizes :
- $200 from Caboose Rails Documentation Project
- 1 year of GitHub Micro account
- 1 year of RPM Basic (Production performance management) for up to 10 hosts
You can find more details at http://hackfest.rubyonrails.org/guide
Special thanks to GitHub, Newrelic & Caboose documentation project for making the hackfest a lot more exciting!
A photographer talks about how he edits his photos and collects editing approaches from other photographers as well.
You usually have a hunch, but the great thing about photography is that it's so unpredictable, so you never quite understand how and when a good photograph comes about. But when editing, I do contact sheets, then machine prints and then select from that.
And when asked what makes one image stand out more than another, is it emotional or an intellectual reaction he answers: "It must be intuitive. If it were intellectual, I'd be able to explain what happens. That's why I'm a photographer. I express myself visually, not verbally.
Two main themes emerge: 1) take some time off from your images in order to evaluate them more fairly, and 2) edit with an outside party, someone you trust to be tough but fair. (via conscientious)
The New Yorker devotes the entire Talk of the Town section in their latest issue to their endorsement for President. As you might guess, Obama gets the endorsement and John McCain receives no quarter from the editors. The key part of the article concerns the candidates' possible appointments to the Supreme Court and their consequences. A more conservative court scares the shit out of me.
A new study suggests that HIV jumped from apes to humans around the turn of the 20th century, which coincides with the development of colonial cities in sub-Saharan Africa.
HIV was and remains a "relatively poorly transmitted" virus, he said, so the key to the success of the virus was possibly the development of cities such as Leopoldville in the early 1900s.
The large numbers of people living in close proximity would have allowed more opportunity for new infections.
"I think the picture that has emerged here, is that changes the human population experienced may have opened to the door to the spread of HIV," he said.
Evan Roth has been putting metal plates with messages and symbols cut into them into his carry-on luggage when he goes through security at the airport.
Here's Roth's idea, which he calls "TSA Communication" and tells me has already made it through three trial airport runs: Take a metal plate, stencil and cut out a message -- words or an image -- place the plate at the bottom of your carry-on bag, and watch what happens as the TSA employee operating the airport X-ray machine notices ... or doesn't notice.
So far, he's used plates with outlines of the American flag, a "NOTHING TO SEE HERE" message, and something he calls The Exact Opposite Of A Box Cutter, a plate with a box cutter shape cut out of it.
Several photo series of fashion models transforming into different outfits. It's amazing how different they can look with changes in makeup, hair, and clothes.

Ruby Manor is an interesting new event that will hopefully become a regular fixture on the Ruby events calendar! Taking place in London (at the University of London Union) on November 22, Ruby Manor is taking an "all hands on deck" approach to event organization, with intense discussion between attendees as to how it should be run. The initial organizers are Murray Steele and James Adam.
Back in March 2008, Vidar Hokstad - a London based Norwegian developer - began to write a series of blog posts on writing a compiler in Ruby from the ground up. Early on, I took objection to some elements of his approach, but it still stands as a great series of posts. Vidar recently reached post 11, providing enough of a landmark to introduce the series as a whole (which is already scheduled to go up to at least 20
JS.Class is an attempt at making JavaScript more Ruby-like. More specifically, it's a library that makes object oriented development easier in JavaScript (in comparison to JS's prototype technique, at least) by implementing Ruby's core object, module, and class systems as well as some of Ruby's meta-programming techniques.
As well as ports of Enumerable, Observable, Comparable, and Forwardable, you get subclassing, mixins, reflection, late-binding arguments, singleton methods, method binding, and Ruby-like inheritance. Of course, JavaScript gives access to many of these elements already,
Garry Dolley has developed a Ruby module called "Immutable" (Github repository). It allows you to make your methods immutable. As Gary says, "provide it a list of methods you dont want touched and itll make sure they cant be redefined." Effectively, it's a smack-down against monkeypatching.
Gary developed immutable to ensure that ActiveSupport wouldn't interfere with his attempts to improve Rails' loading time by reimplementing some ActiveSupport methods in C (by redefining his own changes).
Remember RubyFringe, the avant-garde Ruby conference held in Canada this September? According to most reports, it went down as possible the best Ruby conference ever and spawned some very interesting presentations - that those of us who didn't go wouldn't have seen..
Luckily, in conjunction with InfoQ, videos from RubyFringe are making it online - so far there are four to check out:
Oct 06 2008
Subscribers
Click to see all subscribers
Subscriptions
-
Molto Benni moltobenni -
Just Surfin News steve -
Just Surfin News steve -
Greek News Greek Traveler -
The Lost Generation Donna Hyatt
Click to see all subscriptions
So far the only gotchas were, I was using the MySQL plugin and not the gem. I’ve since configured my Site5 account to use gems so that’s not a problem and I had a few outdated conventions that I fixed. I’m hoping that I got everything, I mean, after all, my tests passed so everything should be fine! If you guys come across anything out of the ordinary, any error, anything I’d love it if you’d please let me know
Also, I’ve got 6 pounce invites if anyone still is looking for those. :)
I caught up with this thread on Joel’s discussion board today. We software developers will take any opportunity to rant about the bass-ackwards code we have to deal with on a regular basis. For passionate developers, it’s understandable that most code wouldn’t live up to our standardsonly a select few projects have the amount of resources necessary to truly pursue perfection. Over time the exposure to imperfect code can condition us with unfair knee-jerk reaction to new code.
How bad is the code really?
The world is full of terrible code. Usually that becomes painfully obvious at maintenance time. When an existing project is opened up for the first time by a new team member, I think the instinct is to see the flaws before the brilliance. What kinds of things make code stinky? Well it depends who you ask, but some possible reasons are:
- Unnecessary duplication of code (under-abstracted)
- Overly complicated code (over-abstracted or unnecessarily clever)
- Too many files/classes
- Giant monolithic classes
- Wrong design patterns applied
- Stupid algorithms
- Failure to use appropriate libraries or framework features (reinventing the wheel)
- Inconsistency (lack of conventions)
- Numerous obvious comments
- No documentation
Anyone whose done their share of code maintenance has probably been annoyed by most of the things on this list one time or another. “If only they had done it this way.” It’s easy to just assume the code sucks based on a first impression. Once you jump to that conclusion, every minor flaw affirms your prejudice.
Pet peeves
Let’s step back a minute and give ourselves an ego check. To an experienced developer there are hundreds of nuances that will stick out like a sore thumb, but they are likely to annoy you far more than they actually impact your productivity were you to consider them objectively.
If you’re not careful, your concern for the code boils over into judgement of the previous programmers. Maybe the last guy wasn’t up to snuff in this language, maybe his pet peeves were different, maybe he was just a blathering idiot. Whatever the case, why dwell on it?
I’ve managed to make it through a lot of bad code without slowing down much. Every once and a while a refactoring or straight-up delete and rewrite was necessary, but most of the time I was able to grit my teeth and get some changes done relatively quickly.
Real reasons code “sucks”
The problem facing you is likely to be different from what the last programmer faced. It would be foolish to assume that the software was designed with the same requirements that you have in front of you today. Who’s to say the business goals haven’t changed drastically since then?
You and the last developer have different information. Even after you’ve spent a lot of time on the code and understand all the intricacies and business goals, you still may not know the history of the project. Maybe the code has grown and shrunk and morphed into something completely different from when it started. If it’s time to refactor, maybe that’s your job.
It’s also quite possible that refactoring is not worth it. Good developers innately want maintainable and aesthetically pleasing code, but there is a cost. We can’t write perfect software before we understand it, and we can’t refactor without spending time. The developer is usually in a better position than the manager to assess the long-term cost of not refactoring, but he also has a vested interested in exaggerating that cost. To make a fair assessment, the developer must have a direct business interest. Even then there’s a great deal of uncertainty. It’s always a gamble.
Cognitive dissonance
Developers are conditioned to be right. Our job requires a fiercely logical thought process and the ability to make absolute assertions. Being wrong means things are broken, sometimes spectacularly so. And because we think so hard about things in this way, our conclusions are usually well-reasoned. But we are still human, and we still have the same defense mechanisms around our belief systems as everybody else. The insidious thing is that our reasoning blinds us to our own subjectivity. Our open-mindedness is a badge of pride, but also a set of subconscious blinders.
The only really objective thing about software is its output.
Software engineering is about making choices. Some choices are pragmatic (C++ for performance), some are philosophical (Ruby vs Python), but most are an intangible mixture of past experience and future expectations. When you see some code for the first time, the chances that it will mesh with your experience and philosophy are pretty slim. Eventually you may come to appreciate it for what it is, but in the meantime every tradeoff that didn’t follow your current line of thought will irk you.
Software is messy
None of this is to say that there aren’t real quality problems in the software industryof course there are. But I think it’s worth carefully considering our own motivations and biases before judging how bad the problem really is.
We may not like dealing with inadequately-funded balls of mud, but that’s probably where most of the paying work is. Even in relatively clean code bases, reasonable people can disagree on style or architecture points. Regardless of initial code quality, there will always be difficult and inelegant maintenance that needs to be done. My goal is to keep emotion out of it, and just fix problems. Refactoring is great if a business case can be made, otherwise just slog through as fast as possible without complaining.
Easier said than done, I know.
RubyConf 2008 is sold out
However, there is a waiting list you can join in case of cancellations.
Pearson Education is running a Voices That Matter Ruby conference this fall in Boston. The conference, from the same people who Addison-Wesley's Professional Ruby Series, will give you a chance to meet and learn from those very same authors. Don't miss a chance to interact with so many Ruby professionals.
There is a DoS vulnerability in the REXML library included in the Ruby Standard Library. A so-called "XML entity explosion" attack technique can be used for remotely bringing down (disabling) any application which parses user-provided XML using REXML.
Most Rails applications will be vulnerable because Rails parses user-provided XML using REXML by default.
Impact
<!-- RDLabel: "Impact" -->An attacker can cause a denial of service by causing REXML to parse a document containing recursively nested entities such as:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE member [ <!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;"> <!ENTITY b "&c;&c;&c;&c;&c;&c;&c;&c;&c;&c;"> <!ENTITY c "&d;&d;&d;&d;&d;&d;&d;&d;&d;&d;"> <!ENTITY d "&e;&e;&e;&e;&e;&e;&e;&e;&e;&e;"> <!ENTITY e "&f;&f;&f;&f;&f;&f;&f;&f;&f;&f;"> <!ENTITY f "&g;&g;&g;&g;&g;&g;&g;&g;&g;&g;"> <!ENTITY g "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">]><member>&a;</member>
Vulnerable versions
<!-- RDLabel: "Vulnerable versions" -->1.8 series
<!-- RDLabel: "1.8 series" -->- 1.8.6-p287 and all prior versions
- 1.8.7-p72 and all prior versions
1.9 series
<!-- RDLabel: "1.9 series" -->- all versions
Solution
<!-- RDLabel: "Solution" -->Please download the following monkey patch to fix this problem.
Then fix your application to load rexml-expansion-fix.rb before using REXML.
require "rexml-expansion-fix"...doc = REXML::Document.new(str)...
If you have a Rails application, copy rexml-expansion-fix.rb into a directory on the load path (such as RAILS_ROOT/lib/), and put the following line into config/environment.rb.
require "rexml-expansion-fix"
If your application is Rails 2.1 or later, you can simply copy rexml-expansion-fix.rb to RAILS_ROOT/config/initializers and it will be required automatically.
By default, XML entity expansion limit is 10000. You can change it by changing REXML::Document.entity_expansion_limit. e.g.
REXML::Document.entity_expansion_limit = 1000
This fix will be made available as a gem and used by future versions of rails, but users should take corrective action immediately.
Credit
<!-- RDLabel: "Credit" -->Credit to Luka Treiber and Mitja Kolsek of ACROS Security for disclosing the problem to Ruby and Rails Security Teams.
Credit to Michael Koziarski of Rails Core Team for creating the monkey patch to fix the vulnerability.
Changes
<!-- RDLabel: "Changes" -->- 2008-08-29 18:46 +09:00 fixed the summary not to mislead that this vulnerability is Rails specific.
Ruby 1.8.7-p72 and 1.8.6-p287 have been released. The last releases were incomplete, and the new releases include fixes of the previously announced vulnerability of dl.
The released source archives are available at:
- <URL:ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p287.tar.gz>
- <URL:ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p287.tar.bz2>
- <URL:ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p287.zip>
- <URL:ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz>
- <URL:ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.bz2>
- <URL:ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.zip>
Checksums:
MD5(ruby-1.8.6-p287.tar.gz)= f6cd51001534ced5375339707a757556SHA256(ruby-1.8.6-p287.tar.gz)= 6463d1932c34ff72b79174ac7d2c28940d29d147928250928a00a0dbee43db57SIZE(ruby-1.8.6-p287.tar.gz)= 4590393MD5(ruby-1.8.6-p287.tar.bz2)= 80b5f3db12531d36e6c81fac6d05dda9SHA256(ruby-1.8.6-p287.tar.bz2)= ac15a1cb78c50ec9cc7e831616a143586bdd566bc865c6b769a0c47b3b3936ceSIZE(ruby-1.8.6-p287.tar.bz2)= 3956902MD5(ruby-1.8.6-p287.zip)= e555d51f5b387fdd52ae53d9bafa13f5SHA256(ruby-1.8.6-p287.zip)= 844c66c015565839531a34b83e0526cd4fa2a71cc0f5cc8ddb0d4c158403543aSIZE(ruby-1.8.6-p287.zip)= 5606238MD5(ruby-1.8.7-p72.tar.gz)= 5e5b7189674b3a7f69401284f6a7a36dSHA256(ruby-1.8.7-p72.tar.gz)= e15ca005076f5d6f91fc856fdfbd071698a4cadac3c6e25855899dba1f6fc5efSIZE(ruby-1.8.7-p72.tar.gz)= 4805594MD5(ruby-1.8.7-p72.tar.bz2)= 0b215c46b89b28d7ab8d56d96e72d5b9SHA256(ruby-1.8.7-p72.tar.bz2)= a8f8a28e286dd76747d8e97ea5cfe7a315eb896906ab8c8606d687d9f6f6146eSIZE(ruby-1.8.7-p72.tar.bz2)= 4127450MD5(ruby-1.8.7-p72.zip)= b44fe5a12d4bf138ba0d3660e13a8216SHA256(ruby-1.8.7-p72.zip)= 77e67be4aa8c3e041e1d20d24e5fcf2e33ad9bccb3da3332b6c0a5b648334903SIZE(ruby-1.8.7-p72.zip)= 5855902
For a full list of all changes, see the bundled files named ChangeLog, which are also available at the following locations:
Multiple vulnerabilities have been discovered in Ruby. It's recommended that you upgrade to the latest versions.
Details
<!-- RDLabel: "Details" -->The following vulnerabilities have been discovered.
Several vulnerabilities in safe level
<!-- RDLabel: "Several vulnerabilities in safe level" -->Several vulnerabilities in safe level have been discovered.
untrace_var is permitted at safe level 4.
trace_var(:$VAR) {|val| puts "$VAR = #{val}" }Thread.new do $SAFE = 4 eval %q{ proc = untrace_var :$VAR proc.first.call("aaa") }end.join$PROGRAM_NAME may be modified at safe level 4.
Thread.new do $SAFE = 4 eval %q{$PROGRAM_NAME.replace "Hello, World!"}end.join$PROGRAM_NAME #=> "Hello, World!"Insecure methods may be called at safe level 1-3.
class Hello def world Thread.new do $SAFE = 4 msg = "Hello, World!" def msg.size self.replace self*10 # replace string 1 # return wrong size end msg end.value endend$SAFE = 1 # or 2, or 3s = Hello.new.worldif s.kind_of?(String) puts s if s.size < 20 # print string which size is less than 20end
Syslog operations are permitted at safe level 4.
require "syslog"Syslog.openThread.new do $SAFE = 4 eval %q{ Syslog.log(Syslog::LOG_WARNING, "Hello, World!") Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_EMERG) Syslog.info("masked") Syslog.close }end.join
These vulnerabilities were reported by Keita Yamaguchi.
DoS vulnerability in WEBrick
<!-- RDLabel: "DoS vulnerability in WEBrick" -->WEBrick::HTTP::DefaultFileHandler is faulty of exponential time taking requests due to a backtracking regular expression in WEBrick::HTTPUtils.split_header_value.
Exploitable server:
require 'webrick'WEBrick::HTTPServer.new(:Port => 2000, :DocumentRoot => "/etc").start
Attack:
require 'net/http'res = Net::HTTP.start("localhost", 2000) { |http| req = Net::HTTP::Get.new("/passwd") req['If-None-Match'] = %q{meh=""} + %q{foo="bar" } * 100 http.request(req)}p resThe request likely won't finish in this universe.
This vulnerability was reported by Christian Neukirchen.
Lack of taintness check in dl
<!-- RDLabel: "Lack of taintness check in dl" -->dl doesn't check taintness, so it could allow attackers to call dangerous functions.
require 'dl'$SAFE = 1h = DL.dlopen(nil)sys = h.sym('system', 'IP')uname = 'uname -rs'.taintsys[uname]This vulnerability was reported by sheepman.
DNS spoofing vulnerability in resolv.rb
<!-- RDLabel: "DNS spoofing vulnerability in resolv.rb" -->resolv.rb allow remote attackers to spoof DNS answers. This risk can be reduced by randomness of DNS transaction IDs and source ports, so resolv.rb is fixed to randomize them.
- see also: CVE-2008-1447
This vulnerability was reported by Tanaka Akira.
Vulnerable versions
<!-- RDLabel: "Vulnerable versions" --><dl>- 1.8.5 and all prior versions
- 1.8.6-p286 and all prior versions
- 1.8.7-p71 and all prior versions
- r18423 and all prior revisions
Solution
<!-- RDLabel: "Solution" --><dl>Please check out the latest version using Subversion.
$ svn co http://svn.ruby-lang.org/repos/ruby/trunk ruby
Please note that a package that corrects this weakness may already be available through your package management software.
Credit
<!-- RDLabel: "Credit" -->Credit to Keita Yamaguchi, Christian Neukirchen, sheepman, and Tanaka Akira for disclosing these problems to Ruby Security Team.
Changes
<!-- RDLabel: "Changes" -->- 2008-08-08 12:21 +09:00 fixed the revision number of ruby 1.9.
- 2008-08-11 11:23 +09:00 fixed the patchlevel of ruby 1.8. see the release announcement of Ruby 1.8.7-p72 and 1.8.6-p287










