Excessive permissions granted when creating a directory. This warning is
triggered whenever permission greater than 0750
is given.
In general, all security rules follow the principle of least privilege, except when the created directory needs to be accessed by anyone other than the user creating it.
package main
import (
"fmt"
"os"
)
func main() {
err := os.Mkdir("/tmp/mydir", 0777)
if err != nil {
fmt.Println("Error when creating a directory!")
return
}
}
package main
import (
"fmt"
"os"
)
func main() {
err := os.Mkdir("/tmp/mydir", 0600)
if err != nil {
fmt.Println("Error when creating a directory!")
return
}
}