---
This patch allows the user to store their configuration file with laxer
permissions if it does not contain any actual secrets (i.e: paswords or
OAuth tokens).
I don't think this is the right approach, this is way to brittle.
The code that actually adds new auth schemes doesn't life in this function and
chances are this gets missed once a new scheme is introduced.
Meaning we now have a security problem waiting to happen.
++ outgoingWithPass, err := parseCredential(account.Outgoing, account.OutgoingCredCmd)+ if err != nil {+ return true+ }+ if account.Outgoing == outgoingWithPass {+ return true+ }+ if strings.Contains(account.Outgoing, "+oauthbearer://") {+ return true+ }+ }++ // No secrets have been identified+ return false+}+// checkConfigPerms checks for too open permissions
// printing the fix on stdout and returning an error
func checkConfigPerms(filename string) error {
@@ -637,7 +687,7 @@ func checkConfigPerms(filename string) error {
}
perms := info.Mode().Perm()
// group or others have read access
- if perms&044 != 0 {+ if perms&044 != 0 && hasSecrets(filename) { fmt.Fprintf(os.Stderr, "The file %v has too open permissions.\n", filename)
fmt.Fprintln(os.Stderr, "This is a security issue (it contains passwords).")
fmt.Fprintf(os.Stderr, "To fix it, run `chmod 600 %v`\n", filename)
--
2.31.1