Skip to content

Commit

Permalink
webapp/alerts: safer handling of values that could be null
Browse files Browse the repository at this point in the history
Like an empty DNS queries array.

Spotted by Victor Julien.
  • Loading branch information
jasonish committed Nov 30, 2024
1 parent e6c6ed1 commit e60fe1a
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions webapp/src/Alerts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1042,45 +1042,45 @@ export function AlertDescription(props: { event: EventWrapper }) {
<Badge class={"bg-warning me-1"}>{alert.action.toUpperCase()}</Badge>
</Show>
{alert.signature}{" "}
<Show when={props.event._source.app_proto != "failed"}>
<span class="badge text-bg-secondary me-2">
{props.event._source.app_proto}
</span>
</Show>
<Show when={props.event._source.tls?.sni}>
<span class="badge text-bg-secondary me-2">
{props.event._source.tls!.sni}
</span>
</Show>
<Show when={props.event._source.quic?.sni}>
<span class="badge text-bg-secondary me-2">
{props.event._source.quic!.sni}
</span>
</Show>
<Show when={props.event._source.dns?.query}>
<span class="badge text-bg-secondary me-2">
{props.event._source.dns?.query![0].rrname}
</span>
</Show>
<Show when={props.event._source.dns?.queries}>
<span class="badge text-bg-secondary me-2">
{props.event._source.dns?.queries![0].rrname}
</span>
</Show>
<Show when={props.event._source.http?.hostname}>
<span class="badge text-bg-secondary me-2">
{props.event._source.http?.hostname}
</span>
</Show>
<Show
when={
props.event._source.tags &&
(props.event._source.tags.indexOf("evebox.auto-archived") > -1 ||
props.event._source.tags.indexOf("evebox.auto_archived") > -1)
}
>
<span class="badge text-bg-secondary me-2">auto-archived</span>
</Show>
<Show when={props.event._source.app_proto != "failed"}>
<span class="badge text-bg-secondary me-2">
{props.event._source.app_proto}
</span>
</Show>
<Show when={props.event._source.tls?.sni}>
<span class="badge text-bg-secondary me-2">
{props.event?._source?.tls?.sni}
</span>
</Show>
<Show when={props.event._source.quic?.sni}>
<span class="badge text-bg-secondary me-2">
{props.event?._source?.quic?.sni}
</span>
</Show>
<Show when={props.event._source.dns?.query}>
<span class="badge text-bg-secondary me-2">
{props.event?._source?.dns?.query?.[0]?.rrname}
</span>
</Show>
<Show when={props.event._source.dns?.queries}>
<span class="badge text-bg-secondary me-2">
{props.event?._source?.dns?.queries?.[0]?.rrname}
</span>
</Show>
<Show when={props.event._source.http?.hostname}>
<span class="badge text-bg-secondary me-2">
{props.event?._source?.http?.hostname}
</span>
</Show>
<Show
when={
props.event._source.tags &&
(props.event._source.tags.indexOf("evebox.auto-archived") > -1 ||
props.event._source.tags.indexOf("evebox.auto_archived") > -1)
}
>
<span class="badge text-bg-secondary me-2">auto-archived</span>
</Show>
</>
);
}
Expand Down

0 comments on commit e60fe1a

Please sign in to comment.