Skip to content

Commit 0ead7f6

Browse files
authored
Merge pull request #2209 from akto-api-security/feature/threat_ui_improvements
fixes
2 parents 6f132d3 + db4b763 commit 0ead7f6

File tree

3 files changed

+11
-35
lines changed

3 files changed

+11
-35
lines changed

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/threat_detection/api.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const threatDetectionRequests = {
1616
})
1717
},
1818

19-
fetchSuspectSampleData(skip, ips, apiCollectionIds, urls, types, sort, startTimestamp, endTimestamp, subCategory) {
19+
fetchSuspectSampleData(skip, ips, apiCollectionIds, urls, types, sort, startTimestamp, endTimestamp) {
2020
return request({
2121
url: '/api/fetchSuspectSampleData',
2222
method: 'post',
@@ -28,8 +28,7 @@ const threatDetectionRequests = {
2828
apiCollectionIds: apiCollectionIds,
2929
sort: sort,
3030
startTimestamp: startTimestamp,
31-
endTimestamp: endTimestamp,
32-
subCategory: subCategory
31+
endTimestamp: endTimestamp
3332
}
3433
})
3534
},

apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/threat_detection/components/SusDataTable.jsx

+4-27
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ const headers = [
2323
value: "endpointComp",
2424
title: "Api Endpoint",
2525
},
26-
{
27-
text: "Subcategory",
28-
value: "subCategory",
29-
title: "Subcategory",
30-
},
3126
{
3227
text: "Threat Actor",
3328
value: "actorComp",
@@ -85,7 +80,6 @@ function SusDataTable({ currDateRange, rowClicked }) {
8580
const collectionsMap = PersistStore((state) => state.collectionsMap);
8681
const threatFiltersMap = PersistStore((state) => state.threatFiltersMap);
8782

88-
const [subCategoryChoices, setSubCategoryChoices] = useState([]);
8983

9084
async function fetchData(
9185
sortKey,
@@ -100,8 +94,7 @@ function SusDataTable({ currDateRange, rowClicked }) {
10094
let sourceIpsFilter = [],
10195
apiCollectionIdsFilter = [],
10296
matchingUrlFilter = [],
103-
typeFilter = [],
104-
subCategoryFilter = [];
97+
typeFilter = [];
10598
if (filters?.actor) {
10699
sourceIpsFilter = filters?.actor;
107100
}
@@ -114,9 +107,6 @@ function SusDataTable({ currDateRange, rowClicked }) {
114107
if(filters?.type){
115108
typeFilter = filters?.type
116109
}
117-
if(filters?.subCategory){
118-
subCategoryFilter = filters?.subCategory
119-
}
120110
const sort = { [sortKey]: sortOrder };
121111
const res = await api.fetchSuspectSampleData(
122112
skip,
@@ -126,25 +116,21 @@ function SusDataTable({ currDateRange, rowClicked }) {
126116
typeFilter,
127117
sort,
128118
startTimestamp,
129-
endTimestamp,
130-
subCategoryFilter
119+
endTimestamp
131120
);
132-
const distinctSubCategories = Array.from(new Set(res?.maliciousEvents.map((x) => x?.subCategory)));
133-
setSubCategoryChoices(distinctSubCategories);
121+
// setSubCategoryChoices(distinctSubCategories);
134122
let total = res.total;
135123
let ret = res?.maliciousEvents.map((x) => {
136124
const severity = threatFiltersMap[x?.filterId]?.severity || "HIGH"
137125
return {
138126
...x,
139127
id: x.id,
140-
subCategory: x?.subCategory,
141128
actorComp: x?.actor,
142129
endpointComp: (
143130
<GetPrettifyEndpoint maxWidth="300px" method={x.method} url={x.url} isNew={false} />
144131
),
145132
apiCollectionName: collectionsMap[x.apiCollectionId] || "-",
146-
discoveredTs: dayjs(x.timestamp).format("DD-MM-YYYY HH:mm:ss"),
147-
subCategoryComp: x?.subCategory || "-",
133+
discoveredTs: dayjs(x.timestamp*1000).format("DD-MM-YYYY HH:mm:ss"),
148134
sourceIPComponent: x?.ip || "-",
149135
type: x?.type || "-",
150136
severityComp: (<div className={`badge-wrapper-${severity}`}>
@@ -168,9 +154,6 @@ function SusDataTable({ currDateRange, rowClicked }) {
168154
return { label: x, value: x };
169155
});
170156

171-
let subCategoryChoices = res?.subCategory.map((x) => {
172-
return { label: x, value: x };
173-
});
174157

175158
filters = [
176159
{
@@ -185,12 +168,6 @@ function SusDataTable({ currDateRange, rowClicked }) {
185168
title: "URL",
186169
choices: urlChoices,
187170
},
188-
{
189-
key: "subCategory",
190-
label: "Subcategory",
191-
title: "Subcategory",
192-
choices: subCategoryChoices,
193-
},
194171
{
195172
key: 'type',
196173
label: "Type",

apps/threat-detection-backend/src/main/java/com/akto/threat/backend/service/ThreatActorService.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,10 @@ public DailyActorsCountResponse getDailyActorCounts(String accountId, long start
237237
public ThreatActivityTimelineResponse getThreatActivityTimeline(String accountId, long startTs, long endTs) {
238238

239239
List<ThreatActivityTimelineResponse.ActivityTimeline> timeline = new ArrayList<>();
240-
long sevenDaysInSeconds = TimeUnit.DAYS.toSeconds(7);
241-
if (sevenDaysInSeconds < endTs - sevenDaysInSeconds) {
242-
startTs = endTs - sevenDaysInSeconds;
243-
}
240+
// long sevenDaysInSeconds = TimeUnit.DAYS.toSeconds(7);
241+
// if (startTs < endTs - sevenDaysInSeconds) {
242+
// startTs = endTs - sevenDaysInSeconds;
243+
// }
244244
MongoCollection<Document> coll = this.mongoClient
245245
.getDatabase(accountId)
246246
.getCollection(MongoDBCollection.ThreatDetection.MALICIOUS_EVENTS, Document.class);
@@ -253,7 +253,7 @@ public ThreatActivityTimelineResponse getThreatActivityTimeline(String accountId
253253
// Stage 2: Project required fields and normalize timestamp to daily granularity
254254
new Document("$project", new Document("dayStart",
255255
new Document("$dateTrunc", new Document("date",
256-
new Document("$toDate", new Document("$multiply", Arrays.asList("$detectedAt", 1000))))
256+
new Document("$toDate", new Document("$multiply", Arrays.asList("$detectedAt", 1000L))))
257257
.append("unit", "day")))
258258
.append("subCategory", "$subCategory")),
259259

0 commit comments

Comments
 (0)