Document issues found during code audit including: - Critical: broken error comparison, unchecked hash writes, URL path traversal - Important: goroutine leak, timestamp precision, missing context cancellation - Code quality: duplicate functions, inefficient calculations, missing validation
1.3 KiB
1.3 KiB
TODO
Critical
- Fix broken error comparison in
internal/checker/checker.go:195-errors.Is(err, errors.New("file does not exist"))always returns false becauseerrors.New()creates a new instance each call - Fix unchecked
hash.Write()errors inmfer/builder.go:52,mfer/serialize.go:56,internal/cli/freshen.go:340 - Fix URL path traversal risk in
internal/cli/fetch.go:116- path isn't URL-escaped, should useurl.JoinPath()or proper encoding
Important
- Fix goroutine leak in signal handler
internal/cli/gen.go:98-106- goroutine runs until channel closed, leaks if program exits normally - Fix timestamp precision in
mfer/serialize.go:16-22- uset.Nanosecond()instead of manual calculation - Add context cancellation check to filesystem walk in
internal/cli/freshen.go- Ctrl-C doesn't work during scan phase
Code Quality
- Consolidate duplicate
pathIsHiddenimplementations ininternal/scanner/scanner.go:385-402andinternal/cli/freshen.go:378-397 - Make
TotalBytes()ininternal/scanner/scanner.go:250-259track total incrementally instead of recalculating on every call - Add input validation to
AddFileWithHash()inmfer/builder.go:107-120- validate path, size, and hash inputs