cpan-authors / IPC-Run

https://metacpan.org/pod/IPC::Run
Other
21 stars 38 forks source link

perms 644 on output [rt.cpan.org #69239] #91

Closed toddr closed 6 years ago

toddr commented 7 years ago

Migrated from rt.cpan.org#69239 (status was 'open')

Requestors:

Attachments:

From user42@zip.com.au on 2011-07-01 22:43:53:

IPC::Run 0.89 creates it's output files only 644, which prevents a user
giving group write permissions with umask.

The program foo.pl below shows how perl's open() or the shell ">foo"
output both follow the umask on output, giving group write perms, but
IPC::Run does not.

perlfunc.pod under sysopen() notes that 0644 is usually wrong, for this
reason.  Normally 0666 is right (or for something security related then
0600).

From toddr@cpan.org on 2012-08-22 14:00:29:

I agree. This is an issue we're hard coding the open and I don't see a reason to do so. 

PERHAPS we should observe the umask and force off the execute bit if seen.

https://github.com/toddr/IPC-Run/blob/master/lib/IPC/Run.pm#L1300

my $r = POSIX::open( $_[0], $_[1], 0644 );

From kryde@cpan.org on 2013-02-17 23:37:51:

On Wed Aug 22 10:00:29 2012, TODDR wrote:
> 
> PERHAPS we should observe the umask and force off the execute bit if
> seen.

I would suggest 0666 which is usual for an ordinary execute-off file,
and is what the shell does, if IPC::Run is to look vaguely like a shell
command line.  It's automatically reduced by the system according to umask.

Perhaps in the future some sort of option could control the mode on each
output file created, if there's room in the arg syntax for extras like that.
toddr commented 6 years ago

I can't determine there was a good reason to use 644. I've loosened permissions to 666 for now. Smoking in PR #105

toddr commented 6 years ago

merged