fix: fix for issues reported by deepsource

This commit is contained in:
Vikram Rangnekar 2020-05-03 16:08:17 -04:00
parent 04bb88f74b
commit 279f5616d1
3 changed files with 5 additions and 5 deletions

View File

@ -3,7 +3,7 @@ package core
import (
"bytes"
"context"
"crypto/sha1"
"crypto/sha256"
"database/sql"
"encoding/hex"
"fmt"
@ -251,7 +251,7 @@ func (sg *SuperGraph) initAllowList() error {
// nolint: errcheck
func stmtHash(name string, role string) string {
h := sha1.New()
h := sha256.New()
io.WriteString(h, strings.ToLower(name))
io.WriteString(h, role)
return hex.EncodeToString(h.Sum(nil))

View File

@ -109,7 +109,7 @@ func cmdDBNew(cmd *cobra.Command, args []string) {
// Write new migration
mpath := filepath.Join(migrationsPath, mname)
mfile, err := os.OpenFile(mpath, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0666)
mfile, err := os.OpenFile(mpath, os.O_CREATE|os.O_EXCL|os.O_WRONLY, 0600)
if err != nil {
log.Fatalf("ERR %s", err)
}

View File

@ -2,7 +2,7 @@ package serv
import (
"bytes"
"crypto/sha1"
"crypto/sha256"
"encoding/hex"
"io"
"os"
@ -16,7 +16,7 @@ import (
// nolint: errcheck
func gqlHash(b string, vars []byte, role string) string {
b = strings.TrimSpace(b)
h := sha1.New()
h := sha256.New()
query := "query"
s, e := 0, 0