From: Caleb Clausen Date: 2010-04-08T06:06:14+09:00 Subject: Re: $SAFE=0 for setuid? On 4/7/10, Brian Candler wrote: > Well, obviously you don't give setuid permissions to a file and then > allow anyone to edit it :-) It would have to be stored in a trusted > location. Ditto the path to the ruby interpreter itself. > > The C program could validate that the script lives in a trusted location > (that only an administrator could modify). Or calculate an SHA1. Or I believe that using a sha1 in this way would create a TOCTOU race condition; in other words, it's not secure. Don't do that.