May 14, 2007

FSFLA frees Brazilian tax software

Author: Bruce Byfield

The FSFLA, the Latin American sister organization of the Free Software Foundation, is claiming a last-minute victory in Brazil in its struggle to remove the requirement to use non-free software for filing taxes online. Having reversed-engineered a free command-line program for filing taxes, the FSFLA is jubilantly announcing that it has "freed the lion" -- "lion" being a colloquial term in Brazil for taxes.

This partial victory comes after months of campaigning. As previously reported, FSFLA launched a campaign in October 2006 against the software -- IRPF2007, as it is called in its current version -- that the Receita Federal (RF), the Brazilian equivalent of the IRS, provides for electronic filing of taxes. Both the Windows and the Java version, which requires proprietary classes, are non-free, and certain categories of users are required to use one of them. These categories include anybody with an income over R$100,000 ($47,000), or R$69,840 ($32,000) from a rural business, or with profits from sales of goods, rights, stocks, or futures, or a rural business.

According to the FSFLA, requiring taxpayers to use this software is a violation of two articles of the Brazilian constitution: Article 37, which forbids imposing obligations on citizens except via law and insists upon impartial treatment of individuals and citizens; and Article 170, which requires free market competition and consumer protection, and grants citizens "free exercise of any economic activity, regardless of any government authorization."

Since October, the FSFLA has been circulating petitions and encouraging a letter-writing campaign. In March, it also began direct negotiations with the RF in an effort to resolve the issues. Apparently in response to these negotiations, the RF released some but not all information about the file formats required by the software.

The RF also mentioned without giving any details an "implicit copyright license" in IRPF2007. When the FSFLA unarchived the software's zip and jar files, it failed to find the license, but did find that several free software libraries were used in violation of their licenses. One of those libraries, the Freedom Task Force of FSF Europe found, was GNU libc, which was used in the installer.

Armed with this information, the FSFLA renewed discussions with the RF. The RF agreed to look into the alleged license violations, but said that it could not do so before the April 30 deadline for filing taxes. Nor, it said, could it publish the software license before the deadline. The RF also refused to make an exception for those who have moral objections against using non-free software, or to grant a filing extension so that the objectors might have the time to develop free software for online filing.

The FSFLA's request that the complete file format specification or the original source code be published was also turned down, the RF claiming that they could be used to publish modified versions that would confuse users and possibly defraud them.

The reverse-engineered solution

Faced with the requirement to use IRPF2007 himself, Alexandre Oliva, an employee of Red Hat Brazil and an FSFLA board member, decided with the blessings of the organization to reverse-engineer his own solution using JODE, a free Java decompiler.

During the course of his work, Oliva discovered a copy of the GNU Lesser General Public License (LGPL) in the root directory of IRPF.jar. From its position, the FSFLA concluded that it was the implied copyright license mentioned by the RF, and that reverse-engineering was therefore legal. He also found a number of other licenses that were being violated in IRPF2007.

Hoping to produce a free version of the software, Oliva removed all non-free components, located source code for all the free libraries required, and fixed all license compliance problems. Unfortunately, when he completed his work, the compiled version would not run past the opening screen.

With time running out, Oliva decided to forgo a graphical solution and use the command line. Since IRPF2007 stores information in XML files, within a few hours, he had a solution. "Editing the XML file turned out to be much better than using the click-until-your-hand-hurt GUI version," Oliva says. "It was possible to reorder entries (such as goods, debts, dependents, etc.) in however way made sense to you. Copying and global string replacement worked, and you could make other changes that the limited GUI wouldn't let you."

Oliva had a bad moment when he submitted his tax declaration at the bank on April 25, and the file was rejected. However, the only problem turned out to be a missing receipt number. When he added a call to have the receipt number generated by IRPF2007, his declaration was accepted for processing.

The next day, the FSFLA announced its success and in a news release and posted its command-line hack, along with its source code.

The campaign continues

Despite this strategic victory, problems with the software remains. On May 2, the RF published a new version of IRPF2007 that fixed some licensing problems, but not all. It also issued a statement about some of the software that, according to Oliva, "explicitly permitted any taxpayer to use the program for the sole purpose of filling in income tax forms."

These developments address some of the FSFLA's concerns. "Taxpayers now have permission to run the program IRPF2007, to hire third parties who are taxpayers themselves to run it for them, and to modify the program so as to enable them to prepare their tax returns," Oliva says. "However, the distribution by RF was still illegal since it was not in compliance with third-party copyright licenses. And still, there's no corresponding source code anywhere to be seen."

In addition, Oliva notes that the explicit statement can be read as a limit on the use of the program, which would conflict with the LGPL. Moreover, the Java class files are now "obfuscated," according to Oliva, which may make decompilation more difficult.

The FSFLA is working to resolve these problems. The effort continues, but the organization is buoyed by the success at reverse-engineering, and by the recent discovery of additional legal justification for the effort. Recently, the FSFLA has learned that Article 6, IV of the Brazilian copyright law states that integration of a program into an application is not copyright violation if it is technically indispensable and solely for personal use. In addition, the FSFLA has learned that the regulation that approved the creation of IRPF2007 grants users the right to distribute the program.

"Take these two permissions together, and it doesn't even look like we needed the LGPL license to be able to publish the CLI tool along with the source code," Oliva says. Feeling that it is on firm legal ground, the FSFLA hopes in the near future to follow up on this strategic success with a decisive, final victory.

Bruce Byfield is a computer journalist who writes regularly for NewsForge, Linux.com, and IT Manager's Journal.

Click Here!