Low-severity security hygiene #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Low (hygiene)
Practical nits that will not by themselves dump a database, but are worth tightening.
Generated configs are world-readable.
GenerateExampleConfigwrites with0644and embeds a liveencryption_key(pkg/config/config.go). Use0600(same idea as the log file already using0600).PBKDF2 salt is derived from the password.
DeriveKeysalts withSHA256(password)[:16](pkg/encryption/encryption.go). That is not a salt; it does not stop precomputation of common passphrases. Either treat--generate-keyoutput as a raw 256-bit key (hex-decode, no PBKDF2) or store a random salt next to the key in the config.Key derivation on every encrypt/decrypt.
DeriveKey(100k PBKDF2 iterations) is called per handshake and per UDP packet. Cache the derived key at startup. This is a CPU footgun under UDP load even with rate limits on TCP accepts.Open recursive DNS when enabled. Unknown names are forwarded to
backup_server(default8.8.8.8:53) with no client ACL. If DNS is bound on all interfaces, the box is an open resolver. Restrict clients or disable recursion except for configured records.Rate limit is process-global, not per source IP. One noisy peer burns the token bucket for everyone (
pkg/ratelimit, serverAllow()). Fine for a single-user homelab; misleading if you think it stops a single attacker from starving others.keep_aliveis unused. It is in YAML and README but never applied to TCP conns. Long-lived forwards through NAT will die quietly; not a vuln, but operators will misread it as a liveness control.Triaged as low hygiene. 0600 configs, real salt or raw key, derive-once, no open recursive DNS, document global rate limit, wire or drop keep_alive. After #2/#3.