Document GoSec nosec skip comments

This commit is contained in:
Nick Meves
2020-08-09 07:55:40 -07:00
parent 2bb0160bf3
commit ad52587ae6
8 changed files with 20 additions and 31 deletions
+3
View File
@@ -1,6 +1,7 @@
package basic
import (
// We support SHA1 & bcrypt in HTPasswd
"crypto/sha1" // #nosec G505
"encoding/base64"
"encoding/csv"
@@ -29,6 +30,7 @@ type sha1Pass string
// NewHTPasswdValidator constructs an httpasswd based validator from the file
// at the path given.
func NewHTPasswdValidator(path string) (Validator, error) {
// We allow HTPasswd location via config options
r, err := os.Open(path) // #nosec G304
if err != nil {
return nil, fmt.Errorf("could not open htpasswd file: %v", err)
@@ -90,6 +92,7 @@ func (h *htpasswdMap) Validate(user string, password string) bool {
switch rp := realPassword.(type) {
case sha1Pass:
// We support SHA1 HTPasswd entries
d := sha1.New() // #nosec G401
_, err := d.Write([]byte(password))
if err != nil {
+1
View File
@@ -103,6 +103,7 @@ func newReverseProxy(target *url.URL, upstream options.Upstream, errorHandler Pr
proxy.FlushInterval = 1 * time.Second
}
// InsecureSkipVerify is a configurable option we allow
/* #nosec G402 */
if upstream.InsecureSkipTLSVerify {
proxy.Transport = &http.Transport{
+1
View File
@@ -12,6 +12,7 @@ func GetCertPool(paths []string) (*x509.CertPool, error) {
}
pool := x509.NewCertPool()
for _, path := range paths {
// Cert paths are a configurable option
data, err := ioutil.ReadFile(path) // #nosec G304
if err != nil {
return nil, fmt.Errorf("certificate authority file (%s) could not be read - %s", path, err)
+1
View File
@@ -30,6 +30,7 @@ func Validate(o *options.Options) error {
msgs = append(msgs, validateSessionCookieMinimal(o)...)
if o.SSLInsecureSkipVerify {
// InsecureSkipVerify is a configurable option we allow
/* #nosec G402 */
insecureTransport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},