From 1678c70d6be626199f9643558a391398292901d0 Mon Sep 17 00:00:00 2001 From: Oleg Bespalov Date: Mon, 20 Nov 2023 14:58:23 +0100 Subject: [PATCH] Package comments and explanation why we use non-secure algorithms --- js/modules/k6/crypto/crypto.go | 9 +++++---- js/modules/k6/crypto/x509/x509.go | 3 ++- js/modules/k6/encoding/encoding.go | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/modules/k6/crypto/crypto.go b/js/modules/k6/crypto/crypto.go index c6d9bb75337..e6202dd4c75 100644 --- a/js/modules/k6/crypto/crypto.go +++ b/js/modules/k6/crypto/crypto.go @@ -1,10 +1,11 @@ +// Package crypto provides common hashing function for the k6 package crypto import ( "crypto/hmac" - "crypto/md5" + "crypto/md5" // #nosec G501 // MD5 is weak, but we need it for compatibility "crypto/rand" - "crypto/sha1" + "crypto/sha1" // #nosec G505 // SHA1 is weak, but we need it for compatibility "crypto/sha256" "crypto/sha512" "encoding/base64" @@ -13,8 +14,8 @@ import ( "fmt" "hash" - "golang.org/x/crypto/md4" - "golang.org/x/crypto/ripemd160" + "golang.org/x/crypto/md4" //nolint:staticcheck // #nosec G501 // MD4 is weak, but we need it for compatibility + "golang.org/x/crypto/ripemd160" // no lint:staticcheck // #nosec G501 // RIPEMD160 is weak, but we need it for compatibility "github.com/dop251/goja" diff --git a/js/modules/k6/crypto/x509/x509.go b/js/modules/k6/crypto/x509/x509.go index 06dab2951ee..318813028a9 100644 --- a/js/modules/k6/crypto/x509/x509.go +++ b/js/modules/k6/crypto/x509/x509.go @@ -1,7 +1,8 @@ +// Package x509 provides X.509 certificate parsing for the k6 package x509 import ( - "crypto/dsa" + "crypto/dsa" //nolint:staticcheck // #nosec G505 // DSA is weak, but we need it for compatibility "crypto/ecdsa" "crypto/rsa" "crypto/sha1" // #nosec G505 diff --git a/js/modules/k6/encoding/encoding.go b/js/modules/k6/encoding/encoding.go index 886b11ee260..a3a82212182 100644 --- a/js/modules/k6/encoding/encoding.go +++ b/js/modules/k6/encoding/encoding.go @@ -1,3 +1,4 @@ +// Package encoding provides encoding/decoding functionality for the k6 package encoding import (