Skip to content

Commit

Permalink
Fixing wildcard interactions retrieval (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mzack9999 authored Apr 21, 2023
1 parent 2a09d86 commit 770429e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pkg/server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ func (h *HTTPServer) logger(handler http.Handler) http.HandlerFunc {
func (h *HTTPServer) handleInteraction(uniqueID, fullID, reqString, respString, hostPort string) {
correlationID := uniqueID[:h.options.CorrelationIdLength]

// host, _, _ := net.SplitHostPort(hostPort)
interaction := &Interaction{
Protocol: "http",
UniqueID: uniqueID,
Expand Down Expand Up @@ -402,10 +401,13 @@ func (h *HTTPServer) pollHandler(w http.ResponseWriter, req *http.Request) {
var tlddata, extradata []string
if h.options.RootTLD {
for _, domain := range h.options.Domains {
tlddata, _ = h.options.Storage.GetInteractionsWithId(domain)
interactions, _ := h.options.Storage.GetInteractionsWithId(domain)
// root domains interaction are not encrypted
tlddata = append(tlddata, interactions...)
}
}
if h.options.Token != "" {
// auth token interactions are not encrypted
extradata, _ = h.options.Storage.GetInteractionsWithId(h.options.Token)
}
response := &PollResponse{Data: data, AESKey: aesKey, TLDData: tlddata, Extra: extradata}
Expand Down
5 changes: 3 additions & 2 deletions pkg/storage/storagedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,10 @@ func (s *StorageDB) getInteractions(correlationData *CorrelationData, id string)
encryptedDataItem, err := AESEncrypt(correlationData.AESKey, []byte(dataItem))
if err != nil {
errs = append(errs, errors.Wrap(err, "could not encrypt event data"))
continue
data[i] = dataItem
} else {
data[i] = encryptedDataItem
}
data[i] = encryptedDataItem
}
return data, multierr.Combine(errs...)
}
Expand Down

0 comments on commit 770429e

Please sign in to comment.