fix: fix for issues reported by deepsource
This commit is contained in:
parent
04bb88f74b
commit
279f5616d1
|
@ -3,7 +3,7 @@ package core
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/sha1"
|
"crypto/sha256"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -251,7 +251,7 @@ func (sg *SuperGraph) initAllowList() error {
|
||||||
|
|
||||||
// nolint: errcheck
|
// nolint: errcheck
|
||||||
func stmtHash(name string, role string) string {
|
func stmtHash(name string, role string) string {
|
||||||
h := sha1.New()
|
h := sha256.New()
|
||||||
io.WriteString(h, strings.ToLower(name))
|
io.WriteString(h, strings.ToLower(name))
|
||||||
io.WriteString(h, role)
|
io.WriteString(h, role)
|
||||||
return hex.EncodeToString(h.Sum(nil))
|
return hex.EncodeToString(h.Sum(nil))
|
||||||
|
|
|
@ -109,7 +109,7 @@ func cmdDBNew(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// Write new migration
|
// Write new migration
|
||||||
mpath := filepath.Join(migrationsPath, mname)
|
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 {
|
if err != nil {
|
||||||
log.Fatalf("ERR %s", err)
|
log.Fatalf("ERR %s", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package serv
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/sha1"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
@ -16,7 +16,7 @@ import (
|
||||||
// nolint: errcheck
|
// nolint: errcheck
|
||||||
func gqlHash(b string, vars []byte, role string) string {
|
func gqlHash(b string, vars []byte, role string) string {
|
||||||
b = strings.TrimSpace(b)
|
b = strings.TrimSpace(b)
|
||||||
h := sha1.New()
|
h := sha256.New()
|
||||||
query := "query"
|
query := "query"
|
||||||
|
|
||||||
s, e := 0, 0
|
s, e := 0, 0
|
||||||
|
|
Loading…
Reference in New Issue