Fix: Address various static analysis warnings

- **pkg/announce/announce.go**: Added error handling for `rand.Read` to log potential issues when generating random hashes.
- **pkg/buffer/buffer.go**: Removed a redundant `#nosec G115` comment as the line no longer triggers the warning.
- **pkg/cryptography/aes.go**: Added `#nosec G407` to explicitly acknowledge the use of `cipher.NewCBCEncrypter` which is acceptable in this context.
- **pkg/transport/transport.go**: Removed redundant `#nosec G115` comments as the lines no longer trigger the warning.
This commit is contained in:
2025-07-15 13:45:48 -05:00
parent a80f2bb2ac
commit 5e0c829cf6
4 changed files with 9 additions and 6 deletions

View File

@@ -361,7 +361,10 @@ func (a *Announce) CreatePacket() []byte {
// 5.3 Random Hash
randomHash := make([]byte, 10)
rand.Read(randomHash)
_, err := rand.Read(randomHash)
if err != nil {
log.Printf("Error reading random bytes for announce: %v", err)
}
// 5.4 Ratchet
ratchetData := make([]byte, 32)