Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
DES (des.NewCipher) and 3DES (des.NewTripleDESCipher) have a 64-bit block and are considered insecure (Sweet32, brute-force), while RC4 (rc4.NewCipher) has well-known keystream biases and is forbidden by RFC 7465. For OAuth/OIDC this means tokens, client secrets, and other sensitive material are not adequately protected and may be recovered by an attacker.
Use authenticated AES instead: load the key with crypto/aes (aes.NewCipher(key)) and wrap it in cipher.NewGCM(block) to get AES-GCM, which provides both confidentiality and integrity.
VULNERABLE
vulnerable.go
package mainimport ( "crypto/cipher" "crypto/des" "crypto/rc4")// DES is a broken 64-bit block cipher.func desCipher(key []byte) (cipher.Block, error) { // ruleid: auth.go.crypto.weak-cipher return des.NewCipher(key)}// 3DES is deprecated (Sweet32, 64-bit block).func tripleDESCipher(key []byte) (cipher.Block, error) { // ruleid: auth.go.crypto.weak-cipher return des.NewTripleDESCipher(key)}// RC4 has well-known keystream biases and is forbidden by RFC 7465.func rc4Cipher(key []byte) (*rc4.Cipher, error) { // ruleid: auth.go.crypto.weak-cipher return rc4.NewCipher(key)}
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.