Skip to content

Commit

Permalink
Skip permissionless being written to call log #15
Browse files Browse the repository at this point in the history
  • Loading branch information
iann0036 committed Feb 18, 2021
1 parent 5b39559 commit d88f1a2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ func setCSMConfigAndFileFlush() {
}

func listenForEvents() {
var iamMap iamMapBase

addr := net.UDPAddr{
Port: 31000,
IP: net.ParseIP(*hostFlag),
Expand All @@ -140,6 +142,11 @@ func listenForEvents() {
}
defer conn.Close()

err = json.Unmarshal(bIAMMap, &iamMap)
if err != nil {
panic(err)
}

var buf [1048576]byte
for {
rlen, _, err := conn.ReadFromUDP(buf[:])
Expand All @@ -149,6 +156,7 @@ func listenForEvents() {

entries := strings.Split(string(buf[0:rlen]), "\n")

EntryLoop:
for _, entry := range entries {
var e Entry

Expand All @@ -157,6 +165,13 @@ func listenForEvents() {
panic(err)
}

// checked if permissionless
for _, permissionlessAction := range iamMap.SDKPermissionlessActions {
if strings.ToLower(permissionlessAction) == fmt.Sprintf("%s.%s", strings.ToLower(e.Service), strings.ToLower(e.Method)) {
continue EntryLoop
}
}

if e.Type == "ApiCall" {
callLog = append(callLog, e)
handleLoggedCall()
Expand Down

0 comments on commit d88f1a2

Please sign in to comment.