While I agree that there is a potential security hole, I think it is
something that you could possibly tackle with the OS security mechanisms. I
don't know much about Windows, or other Unix platforms, but if they are the
same as HP-UX doing the following will let you have a group writable
directory, with a .ghci only modifyable by the owner (and not deletable or
renamable either). Make sure the permissions on things are as follows:

   - The directory should have any permissions you wish so for user, group
     and other. So, for example, to have user and group read/write and other
     read only, you want the following in the "ls -l" output:

         "drwxrwxr-t"

     The last "t" is the sticky bit and it means that a user may not alter a
     directory entry unless they have write permission on the file on which
     they are trying to act; normally you only need access to just the
     directory to do this. To get this permission:

         $ chmod u=rwx,g=rwx,o=rxt DirectoryName

   - Create the .ghci file you want in this directory, and give it user
write
     permission only:

         $ chmod u=rw,g=r,o=r .ghci

No one other than the user (owner) may touch the contents of the file then
even though others may use the directory.

Regards,
Andy.

> -----Original Message-----
> From: Matt Harden [mailto:[EMAIL PROTECTED]]
> Sent: 27 April 2001 01:27
> To: Michael Weber
> Cc: GHC Bugs list; Michal Politowski; [EMAIL PROTECTED]
> Subject: Re: [Fwd: Bug#94739: ./.ghci -- isn't it dangerous?]
> 
> 
> I agree that this feature is dangerous.  I would prefer it be 
> turned off
> by default and an option given to enable it.  Better yet, why not turn
> it off altogether and add a builtin command that sources 
> another file. 
> That way, users could add:
> 
> >   :source ./.ghci
> 
> to their $HOME/.ghci file to get the current behavior, and users could
> also take steps to protect themselves before sourceing the 
> other file. I
> would also suggest checking that $HOME/.ghci is owned by the current
> user and not group- or world- writeable before sourcing it.
> 
> Michael Weber wrote:
> > 
> > Please, preserve the Cc: when replying.
> > 
> > 
> > ghci will load .ghci from current directory and it can 
> contain :! shell
> > commands, so if I run ghci in a directory writable by 
> others bad things can
> > happen eg. to my files.
> > On the other hand it's useful.
> > Maybe it could be less dangerous if the immediately 
> damaging stuff (:!) was
> > disabled and some warning printed if the file was writable 
> (or owned) by someone else?
> 
> Thanks,
> Matt Harden
> 
> _______________________________________________
> Glasgow-haskell-bugs mailing list
> [EMAIL PROTECTED]
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
> 

_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to