Archive for May, 2008

Workflow SpringModule

Saturday, May 31st, 2008

I have introduced the Workflow SpringModule at Friday’s Spring User Group meeting in London; I was very pleased to see that people are interested in the module. Unfortunately, it is not available in the main SpringModules project yet, but I will make it available from our subversion repository tomorrow or on Monday.
I look forward to hearing any comments from the early adopters; depending on the feedback, I will include a more detailed discussion of the workflow module in my Spring One talk on Thursday 12th June.

Spring User Group – Jan & Aleksa presenting

Wednesday, May 28th, 2008

As you may already know the Spring User Group UK is having its first meeting on the afternoon of 30th May at the the Crypt, in St. James Church, next to Skills Matter.

The organisers have put together a very interesting event, with speakers from SpringSource, Cake and UBS. Followed by interactive breakout sessions to chat with the speakers and other User Group members, this is a fantastic opportunity to learn, share your experience, broaden your network and join this community. Come join us and find out about the exciting new developments of the Spring framework and how practitioners are enabling their businesses, by using Spring as a core construct of their solutions.

Event Details What: London Spring User Group : First London Spring User Group Event
Where: The Crypt, St. James Church, Clerkenwell, EC1R
When: This Friday – 30 May 2008 Starts at 12:00

* Dave Syer of Spring Source will be telling us about Spring Batch
* Rob Purcell & Manoj Bajaj of UBS will give a talk on reliable database/messaging transactions without 2PC
* Jan Machacek of Cake will present a case study of a project at Central Government, where Spring was used successfully.

SpringSource, Skills Matter and Cake Solutions! are all sponsors of the event.

Please register here

I hope to see you there.

Brand New Site Around the Corner

Thursday, May 8th, 2008

When I’ve had a spare hour or two between projects I have been working on the brand-spanking new cake site.

It will have some smooth UI tweaks thanks to jQuery and pretty interesting features on the contact page with integrated Google Maps.

The site is almost ready. Just a few odds and ends to tie up.

Once the site is launched I’ll blog a quick feature tour with some insights into the technologies used.

Email Header Injection security

Thursday, May 8th, 2008

If you web application sends emails based on information entered in the form, you should pay attention to the possibility of Email header injection attack.
Email header injection attack is based on flaws in the email protocol. Headers in the MIME message are recognized by SMTP servers by the line feed ([LF]). So typical email message looks like this:

[LF]to: recipient@domain.com
[LF]Subject: recipient@domain.com
[LF]Content type: recipient@domain.com
[LF]Message body

Now if a user can enter recipient email in the form he/she can do something like this:

recipient email: johndoe@serbiancafe.com%0Asubject:this is new even subject.

%0A is actually line feed.
Now, it will depend from SMTP server and email client which subject will it show, some use first one, some the lates one, some append all subjects to email.

Malicious user can change any header of your message this way, to, cc, bcc fields, content-type, even the actual message.

Message body can be changed in the same way, only without the header name. But note that body added like this will be PREPENDED to the email message. So if someone uses your email form to send an email message with new body he/she can enter the follwing in the available form filed (in our case recipient address):

recipient email: johndoe@serbiancafe.com%0Asubject:this is new even subject.%0AThe Spam message body, you didnt want this, but it will come to your inbox

And without knowing it, your ‘email this page to a friend’ form will become the source of spam!

Now how to resolve this issue?
You shpuld check all the fields that are available for user input in your email form for and characters (’\n’ and ‘\r’ in your java code).

You have two approaches available. You can either:
1. reject to send any email that contains any of these characters (recommended)
2. remove the characters and send the email as it is

The java code that does this is very simple:


public static boolean isHeaderInjection(String value) {
if (value == null) return false;
if ((value.indexOf("\n") != -1 || value.indexOf("\r") != -1) || value.indexOf("%0A") != -1) {
return true;
}
return false;
}

Make sure to check all your email form fields, and you should be safe from this kind of attack.

RDBMS

Thursday, May 8th, 2008

Here’s another in the series of our internal talks, this time on our old friends, the relational database management systems — also known under their misleading alias — databases.
In the talk, I’ve explained some of the concepts of relational algebra and shown that if all our tables were indeed relations, the RDBMSs could do a lot of optimisations. For further reading, I recommend an excellent book by C. J. Date Database in Depth — Relational Theory for Practitioners.
To cut a potentially long entry short, download the presentation as PDF.