Anti-spam content scanning systems need to scan more

It's long since past the time when anti-spam content scanning systemsshould decode and scan all the encoded attachments of email messages,especially encoded plaintext ones. Most content scanning systems alwaysbeen willing to decode base-64 encoded inline text and HTML (it's sortof a basic requirement), but I don't think very many of them scanattachments. The predictable result is that spammers have caught onthat attaching their spam in a base-64 encoded attachment works, and itshouldn


You should not use HTTP request parameters as filenames

One corollary of the danger of over-powerful introspection is that you should not use HTTP requestparameters directly as filenames for any reason, not just to avoidhard-coding allowed commands in your web application. Any time that youuse a request parameter as a filename, you create an opportunity for anattacker to escape from whatever directory your application is supposedto get its files from and thus to rummage all over your system.

(In fact, you should not directly use the URL for a filename either,because someday


A gotcha with Python's new signal.siginterrupt()

Python 2.6 added a siginterrupt() function to the signal module , so that you can dealwith the EINTR problem . Unfortunately it doesn'tnecessarily do what you want, because of CPython signal handlersemantics .

(Ob-attribution: signal.siginterrupt() was brought to my attention bya commentator on the EINTR entry .)

What you probably want when you combine siginterrupt() and a signalhandler, and what a lot of people probably think that they are getting,is that when your program


The danger of powerful generality, illustrated

When you are coding the framework for a web application, thereis a lot of annoying component registration boilerplate . It is tempting to get rid ofthe boilerplate by using some introspection-based abstraction, and insome ways it's the right thing to do; 'don't repeat yourself' is one ofthe tenets of modern programming.

When you do this, it's tempting to make it straightforwardlyfile-based. For example, a web application with various operations couldwork by having the framework work


Python modules should not reinvent OSError

In light of yesterday's entry , here is one of my newrules for Python modules, especially extension modules written in C:

If you're going to raise an exception because a system call failed,don't make up a new exception for it. Raise either IOError or OSError themselves.

Every deviation from this causes annoyancesfor Python programmers. This is especially visible in the situationwith signals and EINTR , where I really do not want tobe rewriting the same code over and over again with different exception


Link: Using colour well in data visualization

Why Should Engineers and Scientists Be Worried About Color? is abouthow straightforward use of colour in data visualizations can mislead youand hide information (and how to do better). Some of their examplesare eye-opening and alarming.

(Via Hacker News .)

(Since I took up photography I've had a muchincreased interest in how we perceive things, including colour.)


Python, signal handlers, and EINTR

One of the interesting effects of setting a signal handler inyour Python program is, well, let me quote the signal module :

  • When a signal arrives during an I/O operation, it is possiblethat the I/O operation raises an exception after the signal handlerreturns. This is dependent on the underlying Unix system's semanticsregarding interrupted system calls.

By 'an I/O operation' the manual means more than you might think; forexample, select.select() is affected by this.


Why user programs mapping page zero is so bad news on x86 hardware

The Linux kernel recently had a significant security issue or two wherethe root cause was that user programs could map memory at page zero, andthis lead to kernel level exploits. If you went through the same sort ofundergrad OS course that I did, you might be wondering how on earth auser process memory mapping issue leads to a kernel exploit; after all,as all of those little box diagrams tell us, the user program addressspace is one thing and the kernel address space is an entirely differentthing.


More accidental BitTorrent on our network

We've recently had another interesting case of 'accidental BitTorrent' on our network, different from the previoustimes. This time around it was through our VPN server, and just fromthat alone you can probably guess what happened.

Suppose that you are a user, sitting at home running BitTorrent in thebackground on your home machine while you do other things. You need toaccess some restricted on-campus thing; our generally supported way todo this is to fire up a VPN connection so that you are '


Testing versus extensibility

One of the test driven development mantras that I've heard is 'if youhaven't tested it, it doesn't work'. Which leaves me with a questionthat I don't know the answer to: how do you test an extendible format?

Suppose that you have a data file format (for example, an XML dialect)that allows more or less arbitrary extensions to be embedded in it, andalso that you have some agreement on how your program is supposed tohandle extension elements that