Skip to content

Commit 49e5e75

Browse files
committed
fix: properly check file perms
1 parent c7455b9 commit 49e5e75

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cli/configssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func (r *RootCmd) configSSH() *serpent.Command {
441441

442442
if !bytes.Equal(configRaw, configModified) {
443443
sshDir := filepath.Dir(sshConfigFile)
444-
if err := os.MkdirAll(sshDir, os.ModePerm); err != nil {
444+
if err := os.MkdirAll(sshDir, 0700); err != nil {
445445
return xerrors.Errorf("failed to create directory %q: %w", sshDir, err)
446446
}
447447

cli/configssh_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func TestConfigSSH_MissingDirectory(t *testing.T) {
207207
// Check that the directory has proper permissions (0700)
208208
sshDirInfo, err := os.Stat(sshDir)
209209
require.NoError(t, err)
210-
require.Equal(t, os.ModePerm, sshDirInfo.Mode().Perm(), "directory should have 0700 permissions")
210+
require.Equal(t, os.FileMode(0700), sshDirInfo.Mode().Perm(), "directory should have 0700 permissions")
211211
}
212212

213213
func TestConfigSSH_FileWriteAndOptionsFlow(t *testing.T) {

0 commit comments

Comments
 (0)