Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.datadog.appsec.ddwaf;

import static datadog.trace.api.telemetry.LogCollector.SEND_TELEMETRY;
import static datadog.trace.util.stacktrace.StackTraceEvent.DEFAULT_LANGUAGE;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
Expand Down Expand Up @@ -557,6 +558,10 @@ private Waf.ResultWithData runWafTransient(
}

private Collection<AppSecEvent> buildEvents(Waf.ResultWithData actionWithData) {
if (actionWithData.data == null) {
log.debug(SEND_TELEMETRY, "WAF result data is null");
return Collections.emptyList();
}
Collection<WAFResultData> listResults;
try {
listResults = RES_JSON_ADAPTER.fromJson(actionWithData.data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1682,6 +1682,19 @@ class WAFModuleSpecification extends DDSpecification {
internal == libddwaf
}

void 'ResultWithData - null data'() {
def waf = new WAFModule()
Waf.ResultWithData rwd = new Waf.ResultWithData(null, null, null, null)
Collection ret

when:
ret = waf.buildEvents(rwd)

then:
noExceptionThrown()
ret.isEmpty()
}

/**
* Helper to return a concrete Waf exception for each WafErrorCode
*/
Expand Down