Skip to content

Commit

Permalink
Addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifercr07 committed Oct 6, 2024
1 parent 76464b3 commit 6d27e8f
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions internal/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"errors"
"fmt"
"log/slog"
"net/http"
"strings"
Expand Down Expand Up @@ -102,13 +101,7 @@ func (s *HTTPServer) HealthCheck(w http.ResponseWriter, request *http.Request) {
func (s *HTTPServer) CliHandler(w http.ResponseWriter, r *http.Request) {
diceCmd, err := util.ParseHTTPRequest(r)
if err != nil {
http.Error(w, errorResponse("error parsing http request"), http.StatusBadRequest)
return
}

// Check if the command is blocklisted
if err := util.BlockListedCommand(diceCmd.Cmd); err != nil {
http.Error(w, errorResponse(fmt.Sprintf("ERR unknown command '%s'", diceCmd.Cmd)), http.StatusForbidden)
http.Error(w, errorResponse(err.Error()), http.StatusBadRequest)
return
}

Expand Down

0 comments on commit 6d27e8f

Please sign in to comment.