Skip to content

Commit

Permalink
chore: clean up SCA warning level findings
Browse files Browse the repository at this point in the history
  • Loading branch information
superlinkx committed Jan 23, 2024
1 parent a507f16 commit 5df823c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions cmd/api/src/api/middleware/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/specterops/bloodhound/src/api"
)

var unsupportedEncodingError = errors.New("content encoding is not supported")
var errUnsupportedEncoding = errors.New("content encoding is not supported")

type GzipResponseWriter struct {
http.ResponseWriter
Expand Down Expand Up @@ -66,7 +66,7 @@ func CompressionMiddleware(next http.Handler) http.Handler {
if err != nil {
errMsg := fmt.Sprintf("failed to create reader for %s encoding: %v", encoding, err)
log.Warnf(errMsg)
if errors.Is(err, unsupportedEncodingError) {
if errors.Is(err, errUnsupportedEncoding) {
api.WriteErrorResponse(request.Context(), api.BuildErrorResponse(http.StatusUnsupportedMediaType, fmt.Sprintf("Error trying to read request: %s", errMsg), request), responseWriter)
} else {
api.WriteErrorResponse(request.Context(), api.BuildErrorResponse(http.StatusBadRequest, fmt.Sprintf("Error trying to read request: %s", errMsg), request), responseWriter)
Expand Down Expand Up @@ -107,7 +107,7 @@ func wrapBody(encoding string, body io.ReadCloser) (io.ReadCloser, error) {
newBody, err = zlib.NewReader(body)
default:
log.Infof("unsupported encoding detected: %s", encoding)
err = unsupportedEncodingError
err = errUnsupportedEncoding
}
return newBody, err
}
4 changes: 2 additions & 2 deletions cmd/api/src/bootstrap/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ package bootstrap
import (
"context"
"fmt"
"os"

"github.com/specterops/bloodhound/dawgs"
"github.com/specterops/bloodhound/dawgs/drivers/neo4j"
_ "github.com/specterops/bloodhound/dawgs/drivers/neo4j"
"github.com/specterops/bloodhound/dawgs/drivers/pg"
"github.com/specterops/bloodhound/dawgs/graph"
"github.com/specterops/bloodhound/dawgs/util/size"
"github.com/specterops/bloodhound/log"
"github.com/specterops/bloodhound/src/api/tools"
"github.com/specterops/bloodhound/src/config"
"os"
)

func ensureDirectory(path string) error {
Expand Down
4 changes: 0 additions & 4 deletions cmd/ui/src/views/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,3 @@ const Home: React.FC = () => {
};

export default Home;

// TODO: Remove before merge to fix linter messages
const arr = [].reduce(function(prev: never, curr: never, idx: number, arr: never[]) {})

0 comments on commit 5df823c

Please sign in to comment.