Why it matters
Any local account can change what this program later reads.
How to fix it
Use 0o600 for files and 0o700 or 0o750 for directories.
Example
The rule's own test fixtures, verbatim: the test suite requires the rule to report the first and not the second.
package fixture
import "os"
func save(path string, data []byte) error {
return os.WriteFile(path, data, 0666)
}package fixture
import "os"
func save(path string, data []byte) error {
if err := os.MkdirAll("/var/lib/app", 0o750); err != nil {
return err
}
return os.WriteFile(path, data, 0o600)
}What TrustIvan reads
Runs on repository scans of Go source once static analysis is turned on (SAST_RULES and the separately built analyzer image); it is off by default.
Weakness classes and references
Related checks
- HTTP server without timeouts (Go)
GoSeverity: Medium
trustivan-go-http-server-without-timeouts - Zip slip (Go)
GoSeverity: High
trustivan-go-zip-slip - SSH host key not verified (Go)
GoSeverity: High
trustivan-go-ssh-host-key-not-verified - JWT parse unverified (Go)
GoSeverity: High
trustivan-go-jwt-parse-unverified - TLS old minimum version (Go)
GoSeverity: Medium
trustivan-go-tls-old-minimum-version - Hardcoded password connection string (Go)
GoSeverity: High
trustivan-go-hardcoded-password-connection-string
Terms: SAST (static application security testing), Taint analysis, CWE (Common Weakness Enumeration), OWASP Top 10
All static analysis (SAST) checks · The whole catalogue · How this works in TrustIvan · Documentation