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

SNOW-1825790 Implement safer file based token cache #1327

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
21 changes: 21 additions & 0 deletions os_specific_posix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//go:build darwin || linux

package gosnowflake

import (
"fmt"
"os"
"syscall"
)

func provideFileOwner(filepath string) (uint32, error) {
info, err := os.Stat(filepath)
if err != nil {
return 0, err
}
nativeStat, ok := info.Sys().(*syscall.Stat_t)
if !ok {
return 0, fmt.Errorf("cannot cast file info for %v to *syscall.Stat_t", filepath)
}

Check warning on line 19 in os_specific_posix.go

View check run for this annotation

Codecov / codecov/patch

os_specific_posix.go#L18-L19

Added lines #L18 - L19 were not covered by tests
return nativeStat.Uid, nil
}
9 changes: 9 additions & 0 deletions os_specific_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// go:build windows

package gosnowflake

import "errors"

func provideFileOwner(filepath string) (uint32, error) {
return 0, errors.New("provideFileOwner is unsupported on windows")

Check warning on line 8 in os_specific_windows.go

View check run for this annotation

Codecov / codecov/patch

os_specific_windows.go#L7-L8

Added lines #L7 - L8 were not covered by tests
}
Loading