From: Hugh Sasse Staff Elec Eng Date: 2001-12-05T02:49:58+09:00 Subject: [ruby-talk:27467] Re: Shebangikowksy On Wed, 5 Dec 2001, Martin Weber wrote: > On Wed, Dec 05, 2001 at 01:48:37AM +0900, Hugh Sasse Staff Elec Eng wrote: > > Those are good reasons, it seems to me. So why the assertions about > > arrogance, etc? If there are good reasons to refute the security > > claims, then I'd like to know what they are. They don't add the case > > where the invoker's environment has been munged. > > A) You assert every user of your script knows exactly what's happening > when there's the message 'bash(or insert your shell here): cannot execute ' This won't occur if the path is correct. Otherwise: If the user is downloading your script, then they'd better know what they are doing in any case. Changing the first line in the odd cases where it won't work is no big deal. If the administrator is installing the script it's no problem, they will know. I think that only leaves the clueless user, whom you'd rather not have doing this sort of thing anyway. > > B) I wouldn't (and don't) use perl as root (there have been rumours it should > help you with systems administration, I've found awk/sed/shell much more > readable and a C program most of the time shorter and clearer than the perl slang) OK, personal choice, but we are talking about #! lines for ruby anyway here :-) so values of readability may differ :-) Besides, whilest I respect your choice, it doesn't seem to bear on how to search for the executables scripts need, where this must be done. > > C) I assumed you don't have the cwd in your path ('.') because who would ever do this ;p (*hum*) Agreed, but we are talking about the script (whereever it is) finding ruby. This point answers another [important] question. > > D) it *is* a non-portable construct. If you want to write for different platforms, > no one is helped by searching for their perl executables first everytime they > install your scripts It is not completely portable, agreed, but it is not a huge deal to change it. /usr/bin/env won't work on VMS either! :-) In many cases it will work, and it is not like it is buried in a binary. > > E) How should one install something in a standard directory of the searchpath ? Say you hve > /bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:~/bin > if someone can actually create shit in those directories you're long fucked anyways. Agreed. But isn't it less likely that a use can install a script in those places (~/bin granted) than it is likely their path is wrong, possibly dangerously wrong? The directories are protected by permissions, whereas users can modify their environment variables. I feel that while you have made good points about security, you have not addressed this aspect. > > If you have good points standing against them, let me know pls > > > > > > > > > Martin Weber > > > Hugh