vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
|
33cbbc9d
Keenan Nemetz
2d ago
|
1 | //go:build !unix && !windows |
|
215f8aeb
Keenan Nemetz
2d ago
|
2 | |
| 3 | package secure | |
| 4 | ||
| 5 | import ( | |
| 6 | "fmt" | |
| 7 | "os" | |
| 8 | "runtime" | |
| 9 | ) | |
| 10 | ||
| 11 | // File modes are a unix control, and pretending otherwise would weaken the | |
| 12 | // guarantee this package exists for. On Windows, Chmod(0600) only sets the | |
| 13 | // read-only attribute — it would make a secret unreadable by its own service | |
| 14 | // while granting nobody less access — and os.Stat reports any writable file as | |
| 15 | // 0666, so a mode check there is neither applicable nor a check. | |
| 16 | // | |
| 17 | // The ACL-backed equivalent is not implemented yet. Until it is, a secret cannot | |
| 18 | // be created or accepted on this platform at all, and the instance refuses to | |
| 19 | // start instead of running with files it cannot protect. | |
| 20 | func tightenFile(path string, _ os.FileMode) (bool, error) { | |
| 21 | return false, fmt.Errorf("%s: cannot restrict a secret file to mode %04o on %s: the permission check has no equivalent there yet", path, FileMode, runtime.GOOS) | |
| 22 | } | |
| 23 | ||
| 24 | // tightenDir is tightenFile's directory half: world access is a unix mode bit, | |
| 25 | // and the platform that has no such bit cannot be given a weaker promise. | |
| 26 | func tightenDir(path string, _ os.FileMode) (bool, error) { | |
| 27 | return false, fmt.Errorf("%s: cannot remove world access from a secret directory on %s: the permission check has no equivalent there yet", path, runtime.GOOS) | |
| 28 | } |