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

Make tags hyperlinks to mitre attack web pages in detection rules #692

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/cypress-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
env:
OPENSEARCH_DASHBOARDS_VERSION: '2.9.0'
OPENSEARCH_VERSION: '2.9.0-SNAPSHOT'
SECURITY_ANALYTICS_BRANCH: '2.x'
SECURITY_ANALYTICS_BRANCH: '2.9'
GRADLE_VERSION: '7.6.1'

# If this variable is not empty, the package.json, opensearch_dashboards.json, and yarn.lock files will be replaced
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