4 ms·
What? '-rf' is a specific set of flags for a specific program. You can't ban all possible flags for all programs in file names.
by hueving 10y ago
What? '-rf' is a specific set of flags for a specific program. You can't ban all possible flags for all programs in file names.
- quotemstr 10y agoYes, programs are free to interpret arguments any way they want. (See dd(1).) But in practice, almost all programs interpret a leading dash in an argument word to mean "here be options". By banning filenames with leading dashes, we close a large number of security holes at minimal cost. Of course it's not a total solution, but from a pragmatic perspective, it's the right thing to do, because it goes a long way toward solving a real problem.
- hueving 10y agoClose what security holes? If someone isn't escaping input they are still screwed if you ban dashes. It's like suggesting we don't allow sql to store quotes so we can use quotes to enclose data.
- quotemstr 10y agoIt's harm reduction. Yes, everyone should be escaping input. Yes, everyone should be using "./.foo" instead of just ".foo". But people don't, and they're not going to start. If we ban leading dashes, we stop these bugs from turning into security vulnerabilities. Your stance is like being against ASLR because developers just shouldn't have buffer overflow vulnerabilities in their code.
- kazinator 10y agoThe operating system could address it by having a separate argument list and option list at the kernel level, creating an unambiguous interface for calling a program, giving it a list op options and non-option arguments. Ambiguity would remain in how a given shell parses input to determine what are options and what are arguments: but this would at least be out of the control of individual programs. Notably, the shell would be the tool which parses the -- convention. Programs wouldn't see the -- delimiter which separates options from non-options, so it would be impossible for a program to neglect to implement support for --.