Skip to content

[SIEM] add custom reputation link#57814

Merged
angorayc merged 43 commits intoelastic:masterfrom
angorayc:reputation-link
Feb 26, 2020
Merged

[SIEM] add custom reputation link#57814
angorayc merged 43 commits intoelastic:masterfrom
angorayc:reputation-link

Conversation

@angorayc
Copy link
Copy Markdown
Contributor

@angorayc angorayc commented Feb 17, 2020

Summary

#50489

Screenshot 2020-02-19 at 14 30 52

Screenshot 2020-02-19 at 14 30 33

Screenshot 2020-02-19 at 14 24 30

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@angorayc angorayc self-assigned this Feb 17, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/siem (Team:SIEM)

@angorayc
Copy link
Copy Markdown
Contributor Author

@tsg , I had a chat with @XavierM about this as well, he suggested that we can use a collapsable dialogue to handle links to display in zeekRowRenderer, so I did that and would like to know what you think?

Screenshot 2020-02-19 at 14 24 30

Aside from that, I found the links in zeekRowRenderer on sien-dev seems not very helpful , for example: https://www.virustotal.com/gui/search/ecbe15083b44d22796fac652693298d30dc8aee9

Screenshot 2020-02-19 at 14 37 58

interface DefaultFieldRendererProps {
rowItems: string[] | null | undefined;
interface DefaultFieldRendererProps<T = string> {
rowItems: T[] | null | undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To get some help from the compiler to ensure that only input that can really be rendered is passed in, is it possible to narrow the types here, and everywhere else where string[] was changed to T[]?

For example, would changing T with React.ReactNode, or whitelisting specific types, e.g. rowItems: string[] | Foo[] | Bar[] | null | undefined; work here, and throughout the rest of this PR where string[] was changed to T[]?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was considering using string | ReputationLinkSetting instead of T, but found this component is reused by embeddable, so I held back as not sure I should put ReputationLinkSetting this hight up, as it is only the case for zeekrenderer.

name: i18n.translate('xpack.siem.uiSettings.ipReputationLinks', {
defaultMessage: 'IP Reputation Links',
}),
value: IP_REPUTATION_LINKS_SETTING_DEFAULT,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any idea if we can do anything about the IP Reputation default value overflowing into the second column @angorayc? When looking around the source for field type format I'm not seeing any additional config that specifies an explicit width, so we may want to open a core kibana issue for this.

Our lengthy string default values look to be the cause (field type format has multiple spaces it can break on). I imagine the ideal fix would be to keep the column widths static and just have a scroll bar for the default value that is displayed?

Field type format name without overflow:

IP Reputation Link with overflow:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ahh, good catch! Thank you! I've created an issue and put it in Kibana's channel
#58102

@andrew-goldstein
Copy link
Copy Markdown
Contributor

@MikePaquette would you be willing to confirm the configuration of URLs should live in Kibana Advanced Settings, as opposed to kibana.yml?

<div>
<VirusTotalLink link={value}>{value}</VirusTotalLink>
<ReputationLink domain={value} overflowIndexStart={1} showDomain={true} />
<ExternalLinkIcon />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After changing the siem:ipReputationLinks advanced setting to an empty array [] to disable external links, the external link icon is still displayed, per the following screenshot:

empty-icon

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll take this into consideration and covers it with test!

?.slice(0, overflowIndexStart)
.map(({ name, url_template: urlTemplate }: ReputationLinkSetting, id) => (
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} key={`reputationLink-${id}`}>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I accidentally put key in its children, ExternalLink , moving to the proper place here.

overflowIndexStart={overflowIndexStart}
/>
</EuiFlexItem>
{ipReputationLinks.length && (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I shouldn't put ipReputationLinks.length like this, it actually prints the number

Copy link
Copy Markdown
Contributor

@andrew-goldstein andrew-goldstein left a comment

Choose a reason for hiding this comment

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

Thanks @angorayc for this feature! 🔗🙏
Tested locally with default, custom, and zero links
LGTM 🚀

@angorayc
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@angorayc
Copy link
Copy Markdown
Contributor Author

cla/check

@angorayc angorayc merged commit e97b451 into elastic:master Feb 26, 2020
angorayc added a commit to angorayc/kibana that referenced this pull request Feb 26, 2020
* add custom reputation link

* fix unit test

* add number of limitation to reputation links

* fix dependency

* apply defaultFieldRendererOverflow to reputation link

* fix unit test

* fix url template

* fix display links

* fix types

* fix for review

* update test case

* update snapshot

* add icons and tooltips

* fix style

* update test

* add external link component

* update test

* fix types

* fix style

* update snapshot

* remove useMemo

* update description

* code review

* review II

* code review

* update description

* fix unit test

* fix unit test

* fix unit test

* fix unit test

* fix types

* fix styles

* fix style

* fix style

* fix review

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
angorayc added a commit that referenced this pull request Feb 26, 2020
* add custom reputation link

* fix unit test

* add number of limitation to reputation links

* fix dependency

* apply defaultFieldRendererOverflow to reputation link

* fix unit test

* fix url template

* fix display links

* fix types

* fix for review

* update test case

* update snapshot

* add icons and tooltips

* fix style

* update test

* add external link component

* update test

* fix types

* fix style

* update snapshot

* remove useMemo

* update description

* code review

* review II

* code review

* update description

* fix unit test

* fix unit test

* fix unit test

* fix unit test

* fix types

* fix styles

* fix style

* fix style

* fix review

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants