Skip to content

Commit

Permalink
fix: uri and request parsing;
Browse files Browse the repository at this point in the history
  • Loading branch information
m.gougam committed Feb 27, 2023
1 parent 51fda8b commit bec585d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/extensions/nginx-app-protect/monitoring/processor/nap.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var (
clientApplicationVersion,
transportProtocol,
httpURI,
request,
}
)

Expand Down Expand Up @@ -450,11 +451,6 @@ func parseNAP(logEntry string, logger *logrus.Entry) (*NAPConfig, error) {
}
}

err := setValue(&waf, request, strings.Join(values[len(logFormatKeys):], ","), logger)
if err != nil {
return &NAPConfig{}, err
}

return &waf, nil
}

Expand Down Expand Up @@ -506,13 +502,13 @@ func setValue(napConfig *NAPConfig, key, value string, logger *logrus.Entry) err
case httpServerPort:
napConfig.HTTPServerPort = value
case httpURI:
napConfig.HTTPURI = value
napConfig.HTTPURI = strings.ReplaceAll(value, "%2C", ",")
case isTruncated:
napConfig.IsTruncated = value
case policyName:
napConfig.PolicyName = value
case request:
napConfig.Request = value
napConfig.Request = strings.ReplaceAll(value, "%2C", ",")
case requestOutcome:
napConfig.RequestOutcome = value
case requestOutcomeReason:
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/nap_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewNAPMonitoring(env core.Environment, cfg *config.Config) (*NAPMonitoring,
log.Warnf("NAP Monitoring report count must be between %v and %v. Defaulting to %v",
minReportCountDelimiter,
maxReportCountDelimiter,
config.Defaults.NAPMonitoring.ReportInterval)
config.Defaults.NAPMonitoring.ReportCount)
cfg.NAPMonitoring.ReportCount = config.Defaults.NAPMonitoring.ReportCount
}

Expand Down

0 comments on commit bec585d

Please sign in to comment.