News for hackers. Stuff that matters.
Re:The Correct Way to Validate Email Addresses by Hydraulix989 on Thursday September 08, 2016 @02:26AM (#12450713)
Even Linux tools like GNOME Archive Manager in Linux Mint 18 rejected my RAR password containing a $ as the incorrect password, even though it was the correct password for the RAR file I was trying to extract. I then used the command-line unrar utility with the exact same password, and it extracted successfully.

Now, why would you preemptively (and explicitly) throw out a candidate password string based on its characters?

At least make the validation consistent.

I also had trouble with connecting to a wifi network with a WPA password containing an ampersand in Arch Linux using the Arch Wiki's recommended command line network manager utility (netctl, if my memory serves me correctly), and I tried all sorts of ways of escaping it and quoting it in the configuration file.

The Arch devs on IRC just told me to change my AP settings so that the wifi network doesn't use a password containing an ampersand character. Well, that would have been a good idea, but it wasn't my network, so I didn't have the ability to change its WPA password.

Re:The Correct Way to Validate Email Addresses by flukus on Thursday September 08, 2016 @03:18AM (#12450915)
I'm guessing both are because the are calling command line tools. One of my pet peeves with linux is that many of these tools are only callable via text and don't expose an API for other programs.
Re:The Correct Way to Validate Email Addresses by zAy0LfpBZLC8mAC on Thursday September 08, 2016 @06:25AM (#12451718)
"callable via text"? What does that even mean? The command line is an API, isn't it? If people don't manage to pass an ampersand to another program via the command line, that's really no different than people failing to pass an ampersand as a URI parameter to an HTTP resource: Failure to encode properly. There is absolutely nothing that prevents you from passing an ampersand (or any other characters) to a program via its command line.
Re:The Correct Way to Validate Email Addresses by flukus on Thursday September 08, 2016 @07:25PM (#12458366)
> "callable via text"? What does that even mean?

It means you have to execute commands through a shell. A real API would be something you could include in your program, execute a method against and get a list of objects back. Instead all these basic command are replicated in every framework.

As far as encoding properly, you're preaching to the choir, but out in the real world there is still injection attacks everywhere.

Re:The Correct Way to Validate Email Addresses by zAy0LfpBZLC8mAC on Friday September 09, 2016 @04:51AM (#12460524)
> It means you have to execute commands through a shell.

Except you don't. There is no need to involve a shell.

> A real API would be something you could include in your program, execute a method against and get a list of objects back.

So, Web APIs are not APIs?

Also, you can execute methods against command line programs, method names usually start with a dash.

Re:The Correct Way to Validate Email Addresses by Filligree on Thursday September 08, 2016 @10:05AM (#12453097)
Word-splitting, escape character interpretation and so forth is done by the shell. The shell is only invoked if you use the system() call to run said tool.

Which you shouldn't. execve (and friends) will let you pass an explicit array of flags, and you should always use one of those functions if you're calling another program. No interpretation.

Re:The Correct Way to Validate Email Addresses by int_19h on Friday September 09, 2016 @08:14PM (#12466968)
On a Unix system, a console application is effectively just a vararg function taking a bunch of const char* arguments. There's no limitation on what characters you can pass as those arguments, so that doesn't sound like a valid excuse.

(There are some characters that are treated specially by shells, and require escaping - but you don't normally spawn child processes via a shell.)

Re:The Correct Way to Validate Email Addresses by kalleboo on Thursday September 08, 2016 @07:24AM (#12451997)
But even PHP has a way to escape shell arguments safely
Re:The Correct Way to Validate Email Addresses by flukus on Thursday September 08, 2016 @07:26PM (#12458368)
Having a way and being used everywhere are different things. That's why we still have sql injection attacks.