Skip to content

Commit

Permalink
Make tags hyperlinks to mitre attack web pages in detection rules (#692
Browse files Browse the repository at this point in the history
…) (#698)

* made rule tags links to mitre attack webpage



* updated workflow file



---------

Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan authored Sep 5, 2023
1 parent b6c3f58 commit df3272f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
branches:
- "*"
env:
OPENSEARCH_DASHBOARDS_VERSION: '2.9'
SECURITY_ANALYTICS_BRANCH: '2.x'
OPENSEARCH_DASHBOARDS_VERSION: '2.9.0'
SECURITY_ANALYTICS_BRANCH: '2.9'
jobs:
tests:
name: Run Cypress E2E tests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,29 @@ export const RuleContentViewer: React.FC<RuleContentViewerProps> = ({
gutterSize="s"
data-test-subj={'rule_flyout_rule_tags'}
>
{ruleData.tags.map((tag: any, i: number) => (
<EuiFlexItem grow={false} key={i}>
<EuiBadge color={'#DDD'}>{tag.value}</EuiBadge>
</EuiFlexItem>
))}
{ruleData.tags.map((tag: { value: string }, i: number) => {
const isLinkable = !!tag.value.match(/attack\.t[0-9]+/);
let tagComponent: React.ReactNode = tag.value;

if (isLinkable) {
const link = `https://attack.mitre.org/techniques/${tag.value
.split('.')
.slice(1)
.join('/')
.toUpperCase()}`;
tagComponent = (
<EuiLink href={link} target="_blank">
{tag.value}
</EuiLink>
);
}

return (
<EuiFlexItem grow={false} key={i}>
<EuiBadge color={'#DDD'}>{tagComponent}</EuiBadge>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
) : (
<div>{DEFAULT_EMPTY_DATA}</div>
Expand Down

0 comments on commit df3272f

Please sign in to comment.