Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De only/v1 #12217

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions src/detect-engine-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,7 @@ int SigPrepareStage4(DetectEngineCtx *de_ctx)
if (de_ctx->decoder_event_sgh != NULL) {
/* no need to set filestore count here as that would make a
* signature not decode event only. */
SigGroupHeadBuildNonPrefilterArray(de_ctx, de_ctx->decoder_event_sgh);
}

int dump_grouping = 0;
Expand Down
32 changes: 27 additions & 5 deletions src/output-json-alert.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,37 @@ static int AlertJsonDecoderEvent(ThreadVars *tv, JsonAlertLogThread *aft, const
continue;
}

JsonBuilder *jb = jb_new_object();
if (unlikely(jb == NULL)) {
JsonBuilder *jb =
CreateEveHeader(p, LOG_DIR_PACKET, "alert", NULL, json_output_ctx->eve_ctx);
if (unlikely(jb == NULL))
return TM_ECODE_OK;

AlertJsonHeader(p, pa, jb, json_output_ctx->flags, NULL, NULL);

if (PacketIsTunnel(p)) {
AlertJsonTunnel(p, jb);
}

/* just the timestamp, no tuple */
jb_set_string(jb, "timestamp", timebuf);
/* payload */
if (json_output_ctx->flags &
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems useless, as we won't have a payload for this case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not even for the decode-event:ipv6.frag_pkt_too_large kind?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that would put us in the first condition here?

    if (PacketIsIPv4(p) || PacketIsIPv6(p)) { 
        return AlertJson(tv, aft, p);
    } else if (p->alerts.cnt > 0) { 
        return AlertJsonDecoderEvent(tv, aft, p);
    }

(LOG_JSON_PAYLOAD | LOG_JSON_PAYLOAD_BASE64 | LOG_JSON_PAYLOAD_LENGTH)) {
AlertAddPayload(json_output_ctx, jb, p);
jb_set_uint(jb, "stream", 0);
}

AlertJsonHeader(p, pa, jb, json_output_ctx->flags, NULL, NULL);
/* base64-encoded full packet */
if (json_output_ctx->flags & LOG_JSON_PACKET) {
EvePacket(p, jb, 0);
}

char *pcap_filename = PcapLogGetFilename();
if (pcap_filename != NULL) {
jb_set_string(jb, "capture_file", pcap_filename);
}

if (json_output_ctx->flags & LOG_JSON_VERDICT) {
EveAddVerdict(jb, p);
}

OutputJsonBuilderBuffer(tv, p, p->flow, jb, aft->ctx);
jb_free(jb);
Expand Down
Loading