Skip to content

Commit 69c7508

Browse files
authored
[system,windows] Fix security pipeline and powershell dashboard (#13546)
* Make security pipeline robust against wrong type fields * Fix powershell dashboard * Fix version in manifest * Fix typo
1 parent 1af890a commit 69c7508

File tree

7 files changed

+720
-611
lines changed

7 files changed

+720
-611
lines changed

packages/system/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "1.68.1"
3+
changes:
4+
- description: Change security pipeline to be defensive against different data types.
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/13546
27
- version: "1.68.0"
38
changes:
49
- description: Add new grok pattern to system (syslog) module to capture multiline logs with ISO 8601 timestamps.

packages/system/data_stream/security/elasticsearch/ingest_pipeline/standard.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,8 +2875,15 @@ processors:
28752875
}
28762876
}
28772877
if (ctx.winlog?.event_data?.AuditPolicyChanges != null) {
2878+
ArrayList policyChanges = null;
2879+
if (ctx.winlog.event_data.AuditPolicyChanges instanceof String) {
2880+
String[] tokens = ctx.winlog.event_data.AuditPolicyChanges.splitOnToken(",");
2881+
policyChanges = new ArrayList(Arrays.asList(tokens));
2882+
} else if (ctx.winlog.event_data.AuditPolicyChanges instanceof ArrayList) {
2883+
policyChanges = ctx.winlog.event_data.AuditPolicyChanges;
2884+
}
28782885
ArrayList results = new ArrayList();
2879-
for (elem in ctx.winlog.event_data.AuditPolicyChanges.splitOnToken(",")) {
2886+
for (elem in policyChanges) {
28802887
def code = elem.replace("%%","").trim();
28812888
if (params.descriptions.containsKey(code)) {
28822889
results.add(params.descriptions[code]);
@@ -2891,7 +2898,13 @@ processors:
28912898
if (ctx.winlog?.event_data?.AccessList != null) {
28922899
ArrayList codes = new ArrayList();
28932900
ArrayList results = new ArrayList();
2894-
for (elem in split(ctx.winlog.event_data.AccessList)) {
2901+
ArrayList accessList = null;
2902+
if (ctx.winlog.event_data.AccessList instanceof String) {
2903+
accessList = split(ctx.winlog.event_data.AccessList);
2904+
} else if (ctx.winlog.event_data.AccessList instanceof ArrayList) {
2905+
accessList = ctx.winlog.event_data.AccessList;
2906+
}
2907+
for (elem in accessList) {
28952908
def code = elem.replace("%%","").trim();
28962909
if (code != "") {
28972910
codes.add(code);
@@ -2923,8 +2936,14 @@ processors:
29232936
}
29242937
if (ctx.winlog?.event_data?.AccessMask != null) {
29252938
ArrayList list = new ArrayList();
2926-
long accessMask;
2927-
for (elem in split(ctx.winlog.event_data.AccessMask)) {
2939+
long lAccessMask;
2940+
ArrayList accessMask = null;
2941+
if (ctx.winlog.event_data.AccessMask instanceof String) {
2942+
accessMask = split(ctx.winlog.event_data.AccessMask);
2943+
} else if (ctx.winlog.event_data.AccessMask instanceof ArrayList) {
2944+
accessMask = ctx.winlog.event_data.AccessMask;
2945+
}
2946+
for (elem in accessMask) {
29282947
if (elem.length() == 0) {
29292948
continue;
29302949
}
@@ -2938,7 +2957,7 @@ processors:
29382957
}
29392958
try {
29402959
def longCode = Long.decode(code).longValue();
2941-
accessMask |= longCode;
2960+
lAccessMask |= longCode;
29422961
} catch (Exception e) {}
29432962
}
29442963
if (list.length > 0) {
@@ -2949,7 +2968,7 @@ processors:
29492968
def[] w = new def[] { null };
29502969
for (long b = 0; b < 32; b++) {
29512970
long flag = 1L << b;
2952-
if ((accessMask & flag) == flag) {
2971+
if ((lAccessMask & flag) == flag) {
29532972
w[0] = flag;
29542973
def fDesc = params.AccessMaskDescriptions[String.format("0x%08X", w)];
29552974
if (fDesc != null) {

packages/system/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
format_version: 3.0.2
22
name: system
33
title: System
4-
version: "1.68.0"
4+
version: "1.68.1"
55
description: Collect system logs and metrics from your servers with Elastic Agent.
66
type: integration
77
categories:

packages/windows/changelog.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# newer versions go on top
2+
- version: "2.5.4"
3+
changes:
4+
- description: Change security pipeline to be defensive against different data types.
5+
type: bugfix
6+
link: https://github.com/elastic/integrations/pull/13546
7+
- description: Fix powershell dashboard
8+
type: bugfix
9+
link: https://github.com/elastic/integrations/pull/13546
210
- version: "2.5.3"
311
changes:
412
- description: Fix powershell dashboard filters.

packages/windows/data_stream/forwarded/elasticsearch/ingest_pipeline/security_standard.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,8 +2875,15 @@ processors:
28752875
}
28762876
}
28772877
if (ctx.winlog?.event_data?.AuditPolicyChanges != null) {
2878+
ArrayList policyChanges = null;
2879+
if (ctx.winlog.event_data.AuditPolicyChanges instanceof String) {
2880+
String[] tokens = ctx.winlog.event_data.AuditPolicyChanges.splitOnToken(",");
2881+
policyChanges = new ArrayList(Arrays.asList(tokens));
2882+
} else if (ctx.winlog.event_data.AuditPolicyChanges instanceof ArrayList) {
2883+
policyChanges = ctx.winlog.event_data.AuditPolicyChanges;
2884+
}
28782885
ArrayList results = new ArrayList();
2879-
for (elem in ctx.winlog.event_data.AuditPolicyChanges.splitOnToken(",")) {
2886+
for (elem in policyChanges) {
28802887
def code = elem.replace("%%","").trim();
28812888
if (params.descriptions.containsKey(code)) {
28822889
results.add(params.descriptions[code]);
@@ -2891,7 +2898,13 @@ processors:
28912898
if (ctx.winlog?.event_data?.AccessList != null) {
28922899
ArrayList codes = new ArrayList();
28932900
ArrayList results = new ArrayList();
2894-
for (elem in split(ctx.winlog.event_data.AccessList)) {
2901+
ArrayList accessList = null;
2902+
if (ctx.winlog.event_data.AccessList instanceof String) {
2903+
accessList = split(ctx.winlog.event_data.AccessList);
2904+
} else if (ctx.winlog.event_data.AccessList instanceof ArrayList) {
2905+
accessList = ctx.winlog.event_data.AccessList;
2906+
}
2907+
for (elem in accessList) {
28952908
def code = elem.replace("%%","").trim();
28962909
if (code != "") {
28972910
codes.add(code);
@@ -2923,8 +2936,14 @@ processors:
29232936
}
29242937
if (ctx.winlog?.event_data?.AccessMask != null) {
29252938
ArrayList list = new ArrayList();
2926-
long accessMask;
2927-
for (elem in split(ctx.winlog.event_data.AccessMask)) {
2939+
long lAccessMask;
2940+
ArrayList accessMask = null;
2941+
if (ctx.winlog.event_data.AccessMask instanceof String) {
2942+
accessMask = split(ctx.winlog.event_data.AccessMask);
2943+
} else if (ctx.winlog.event_data.AccessMask instanceof ArrayList) {
2944+
accessMask = ctx.winlog.event_data.AccessMask;
2945+
}
2946+
for (elem in accessMask) {
29282947
if (elem.length() == 0) {
29292948
continue;
29302949
}
@@ -2938,7 +2957,7 @@ processors:
29382957
}
29392958
try {
29402959
def longCode = Long.decode(code).longValue();
2941-
accessMask |= longCode;
2960+
lAccessMask |= longCode;
29422961
} catch (Exception e) {}
29432962
}
29442963
if (list.length > 0) {
@@ -2949,7 +2968,7 @@ processors:
29492968
def[] w = new def[] { null };
29502969
for (long b = 0; b < 32; b++) {
29512970
long flag = 1L << b;
2952-
if ((accessMask & flag) == flag) {
2971+
if ((lAccessMask & flag) == flag) {
29532972
w[0] = flag;
29542973
def fDesc = params.AccessMaskDescriptions[String.format("0x%08X", w)];
29552974
if (fDesc != null) {

0 commit comments

Comments
 (0)