Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqitch.conf file permission mask #839

Open
fluca1978 opened this issue Nov 19, 2024 · 2 comments
Open

sqitch.conf file permission mask #839

fluca1978 opened this issue Nov 19, 2024 · 2 comments
Assignees
Labels

Comments

@fluca1978
Copy link
Collaborator

Using sqitch 1.4.1 from CPAN.
I noted that sqitch.conf has default read permission for everyone:

% sqitch --version
sqitch (App::Sqitch) v1.4.1

 % ls -l sqitch.conf
-rw-rw-r-- 1 luca luca 222 nov 19 09:41 sqitch.conf

Apparently the application is working even if permissions are set for only the user, thus:

% chmod 600 sqitch.conf

Shouldn't this be default permission mask since sqitch.conf could possibly contain connection passwords?

@theory
Copy link
Collaborator

theory commented Nov 19, 2024

Never thought about it. It defaults to whatever the current directory's umask is.

@theory theory self-assigned this Dec 30, 2024
@theory theory added the todo label Dec 30, 2024
@theory
Copy link
Collaborator

theory commented Dec 31, 2024

Looks like Config::GitLike, which creates the file, does not have any support for custom permissions:

    sysopen(my $fh, "${filename}.lock", O_CREAT|O_EXCL|O_WRONLY)
        or die "Can't open ${filename}.lock for writing: $!\n";

Looks like it would require another attribute on the object, similar to encoding, to specify permissions to pass as the fourth argument to sysopen, something like:

sysopen(my $fh, "${filename}.lock", O_CREAT|O_EXCL|O_WRONLY, $self->permissions || 0666)

If they added such an option I'd be happy to use it in Sqitch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants