Skip to content

Commit

Permalink
check trusted apps before saving an insight
Browse files Browse the repository at this point in the history
  • Loading branch information
szwarckonrad committed Jan 23, 2025
1 parent 7588ebe commit 489ea37
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ const CustomEuiCallOut = styled(EuiCallOut)`
}
`;

const ScrollableContainer = styled(EuiPanel)`
max-height: 500px;
overflow-y: auto;
padding: 0;
`;

export const WorkflowInsightsResults = ({
results,
scanCompleted,
Expand Down Expand Up @@ -127,7 +133,7 @@ export const WorkflowInsightsResults = ({
<EuiText size={'s'} color={'subdued'}>
{insight.message}
</EuiText>
<EuiText size={'xs'} color={'subdued'}>
<EuiText size={'xs'} color={'subdued'} css={'word-break: break-word'}>
{item.entries[0].type === 'match' &&
item.entries[0].field === 'process.executable.caseless' &&
item.entries[0].value}
Expand Down Expand Up @@ -173,7 +179,7 @@ export const WorkflowInsightsResults = ({
<EuiSpacer size={'s'} />
</>
) : null}
{insights}
<ScrollableContainer hasBorder>{insights}</ScrollableContainer>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const useFetchInsights = ({ endpointId, onSuccess }: UseFetchInsightsConf
query: {
actionTypes: JSON.stringify([ActionType.Refreshed]),
targetIds: JSON.stringify([endpointId]),
size: 100,
},
});
onSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export async function buildIncompatibleAntivirusWorkflowInsights(
const codeSignaturesHits = (
await esClient.search<FileEventDoc>({
index: FILE_EVENTS_INDEX_PATTERN,
size: eventIds.length,
query: {
bool: {
must: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ describe('helpers', () => {
const filter = generateTrustedAppsFilter(insight);

expect(filter).toContain(
'exception-list-agnostic.attributes.entries.entries.value:(*Example*Inc.*)'
'exception-list-agnostic.attributes.entries.entries.value:(*Example,*Inc.*)'
);
});

Expand Down Expand Up @@ -342,7 +342,7 @@ describe('helpers', () => {
const filter = generateTrustedAppsFilter(insight);

expect(filter).toContain(
'exception-list-agnostic.attributes.entries.entries.value:(*Example*Inc.*http//example.com*[example]*) AND exception-list-agnostic.attributes.entries.value:"example-value"'
'exception-list-agnostic.attributes.entries.entries.value:(*Example,*\\(Inc.\\)*http\\://example.com*[example]*) AND exception-list-agnostic.attributes.entries.value:"example-value"'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export const generateTrustedAppsFilter = (insight: SecurityWorkflowInsight): str
(entry.field === 'process.Ext.code_signature' && typeof entry.value === 'string')
) {
const sanitizedValue = (entry.value as string)
.replace(/[\)\(\<\>\}\{\"\:\\,]/gm, '')
.replace(/[)(<>}{":\\]/gm, '\\$&')
.replace(/\s/gm, '*');
return `exception-list-agnostic.attributes.entries.entries.value:(*${sanitizedValue}*)`;
}
Expand Down

0 comments on commit 489ea37

Please sign in to comment.