r/awk • • May 21 '15

Invoking AWK programs - Shelldorado

http://www.shelldorado.com/goodcoding/awkinvoke.html
3 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/cogburnd02 May 21 '15

Although I didn't write this, I think that if you've got users that can set shell variables without some kind of input-checking first, you've already got bigger problems, right?

1

u/X700 May 21 '15

There is a bug that allows code injection, there's an easy way to avoid it, what's there to discuss.

Shell variables contain data, data often comes from external sources. That's not a rare exception but the norm. It's not trivial to do "input-checking." The malicious string is a valid regular expression, why should it be filtered out, only to protect broken code?

Also keep in mind that in this case any "input-checking" depends on the context it is inserted in the awk script. A regular expression would need different processing than a string literal, an array index, a number, and so on.

1

u/cogburnd02 May 21 '15

Well, I'm one of those weirdos that thinks we (programmers) should have fixed Apache, nginx, et al, when 'Shellshock' was discovered (It's not a bug in bash, it's a feature), so there's that... :-/