@crowdstrike/foundry-js 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,9 @@
1
+ var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
2
+
3
+ function validate(uuid) {
4
+ return typeof uuid === 'string' && REGEX.test(uuid);
5
+ }
6
+
1
7
  const byteToHex = [];
2
8
  for (let i = 0; i < 256; ++i) {
3
9
  byteToHex.push((i + 0x100).toString(16).slice(1));
@@ -40,10 +46,7 @@ function rng() {
40
46
  const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
41
47
  var native = { randomUUID };
42
48
 
43
- function v4(options, buf, offset) {
44
- if (native.randomUUID && true && !options) {
45
- return native.randomUUID();
46
- }
49
+ function _v4(options, buf, offset) {
47
50
  options = options || {};
48
51
  const rnds = options.random ?? options.rng?.() ?? rng();
49
52
  if (rnds.length < 16) {
@@ -53,6 +56,12 @@ function v4(options, buf, offset) {
53
56
  rnds[8] = (rnds[8] & 0x3f) | 0x80;
54
57
  return unsafeStringify(rnds);
55
58
  }
59
+ function v4(options, buf, offset) {
60
+ if (native.randomUUID && true && !options) {
61
+ return native.randomUUID();
62
+ }
63
+ return _v4(options);
64
+ }
56
65
 
57
66
  const VERSION = 'current';
58
67
 
@@ -70,6 +79,13 @@ event) {
70
79
  const CONNECTION_TIMEOUT = 5_000;
71
80
  const API_TIMEOUT = 30_000;
72
81
  const NAVIGATION_TIMEOUT = 5_000;
82
+ function sanitizeMessageId(messageId) {
83
+ // Only allow valid UUID strings
84
+ if (typeof messageId !== 'string' || !validate(messageId)) {
85
+ return null;
86
+ }
87
+ return messageId;
88
+ }
73
89
  function timeoutForMessage(message) {
74
90
  const timeout = message.type === 'connect'
75
91
  ? CONNECTION_TIMEOUT
@@ -161,12 +177,18 @@ class Bridge {
161
177
  return;
162
178
  }
163
179
  const { messageId } = event.data.meta;
164
- const callback = this.pendingMessages.get(messageId);
165
- if (!callback) {
180
+ // Sanitize messageId to prevent unvalidated dynamic method calls
181
+ const sanitizedMessageId = sanitizeMessageId(messageId);
182
+ if (!sanitizedMessageId) {
183
+ this.throwError(`Received message with invalid messageId format`);
184
+ return;
185
+ }
186
+ const callback = this.pendingMessages.get(sanitizedMessageId);
187
+ if (!callback || typeof callback !== 'function') {
166
188
  this.throwError(`Received unexpected message`);
167
189
  return;
168
190
  }
169
- this.pendingMessages.delete(messageId);
191
+ this.pendingMessages.delete(sanitizedMessageId);
170
192
  callback(message.payload);
171
193
  };
172
194
  throwError(message) {
@@ -1055,6 +1077,217 @@ class AlertsApiBridge {
1055
1077
  }
1056
1078
  }
1057
1079
 
1080
+ /**
1081
+ *
1082
+ * This file is autogenerated.
1083
+ *
1084
+ * DO NOT EDIT DIRECTLY
1085
+ *
1086
+ **/
1087
+ class CloudSecurityAssetsApiBridge {
1088
+ bridge;
1089
+ constructor(bridge) {
1090
+ this.bridge = bridge;
1091
+ }
1092
+ getBridge() {
1093
+ return this.bridge;
1094
+ }
1095
+ async getAggregatesResourcesCountByManagedByV1(urlParams = {}) {
1096
+ const message = {
1097
+ type: 'api',
1098
+ api: 'cloudSecurityAssets',
1099
+ method: 'getAggregatesResourcesCountByManagedByV1',
1100
+ payload: {
1101
+ params: urlParams,
1102
+ },
1103
+ };
1104
+ return this.bridge.postMessage(message);
1105
+ }
1106
+ }
1107
+
1108
+ /**
1109
+ *
1110
+ * This file is autogenerated.
1111
+ *
1112
+ * DO NOT EDIT DIRECTLY
1113
+ *
1114
+ **/
1115
+ class CloudregistrationApiBridge {
1116
+ bridge;
1117
+ constructor(bridge) {
1118
+ this.bridge = bridge;
1119
+ }
1120
+ getBridge() {
1121
+ return this.bridge;
1122
+ }
1123
+ async getCloudSecurityRegistrationAwsCombinedAccountsV1(urlParams = {}) {
1124
+ const message = {
1125
+ type: 'api',
1126
+ api: 'cloudregistration',
1127
+ method: 'getCloudSecurityRegistrationAwsCombinedAccountsV1',
1128
+ payload: {
1129
+ params: urlParams,
1130
+ },
1131
+ };
1132
+ return this.bridge.postMessage(message);
1133
+ }
1134
+ }
1135
+
1136
+ /**
1137
+ *
1138
+ * This file is autogenerated.
1139
+ *
1140
+ * DO NOT EDIT DIRECTLY
1141
+ *
1142
+ **/
1143
+ class ContainerSecurityApiBridge {
1144
+ bridge;
1145
+ constructor(bridge) {
1146
+ this.bridge = bridge;
1147
+ }
1148
+ getBridge() {
1149
+ return this.bridge;
1150
+ }
1151
+ async getAggregatesClustersCountV1(urlParams = {}) {
1152
+ const message = {
1153
+ type: 'api',
1154
+ api: 'containerSecurity',
1155
+ method: 'getAggregatesClustersCountV1',
1156
+ payload: {
1157
+ params: urlParams,
1158
+ },
1159
+ };
1160
+ return this.bridge.postMessage(message);
1161
+ }
1162
+ async getAggregatesContainersCountV1(urlParams = {}) {
1163
+ const message = {
1164
+ type: 'api',
1165
+ api: 'containerSecurity',
1166
+ method: 'getAggregatesContainersCountV1',
1167
+ payload: {
1168
+ params: urlParams,
1169
+ },
1170
+ };
1171
+ return this.bridge.postMessage(message);
1172
+ }
1173
+ async getAggregatesContainersGroupByManagedV1(urlParams = {}) {
1174
+ const message = {
1175
+ type: 'api',
1176
+ api: 'containerSecurity',
1177
+ method: 'getAggregatesContainersGroupByManagedV1',
1178
+ payload: {
1179
+ params: urlParams,
1180
+ },
1181
+ };
1182
+ return this.bridge.postMessage(message);
1183
+ }
1184
+ async getAggregatesContainersSensorCoverageV1(urlParams = {}) {
1185
+ const message = {
1186
+ type: 'api',
1187
+ api: 'containerSecurity',
1188
+ method: 'getAggregatesContainersSensorCoverageV1',
1189
+ payload: {
1190
+ params: urlParams,
1191
+ },
1192
+ };
1193
+ return this.bridge.postMessage(message);
1194
+ }
1195
+ async getAggregatesImagesCountByStateV1(urlParams = {}) {
1196
+ const message = {
1197
+ type: 'api',
1198
+ api: 'containerSecurity',
1199
+ method: 'getAggregatesImagesCountByStateV1',
1200
+ payload: {
1201
+ params: urlParams,
1202
+ },
1203
+ };
1204
+ return this.bridge.postMessage(message);
1205
+ }
1206
+ async getAggregatesNodesCountV1(urlParams = {}) {
1207
+ const message = {
1208
+ type: 'api',
1209
+ api: 'containerSecurity',
1210
+ method: 'getAggregatesNodesCountV1',
1211
+ payload: {
1212
+ params: urlParams,
1213
+ },
1214
+ };
1215
+ return this.bridge.postMessage(message);
1216
+ }
1217
+ async getAggregatesPodsCountV1(urlParams = {}) {
1218
+ const message = {
1219
+ type: 'api',
1220
+ api: 'containerSecurity',
1221
+ method: 'getAggregatesPodsCountV1',
1222
+ payload: {
1223
+ params: urlParams,
1224
+ },
1225
+ };
1226
+ return this.bridge.postMessage(message);
1227
+ }
1228
+ async getAggregatesUnidentifiedContainersCountV1(urlParams = {}) {
1229
+ const message = {
1230
+ type: 'api',
1231
+ api: 'containerSecurity',
1232
+ method: 'getAggregatesUnidentifiedContainersCountV1',
1233
+ payload: {
1234
+ params: urlParams,
1235
+ },
1236
+ };
1237
+ return this.bridge.postMessage(message);
1238
+ }
1239
+ async getCombinedClustersV1(urlParams = {}) {
1240
+ const message = {
1241
+ type: 'api',
1242
+ api: 'containerSecurity',
1243
+ method: 'getCombinedClustersV1',
1244
+ payload: {
1245
+ params: urlParams,
1246
+ },
1247
+ };
1248
+ return this.bridge.postMessage(message);
1249
+ }
1250
+ }
1251
+
1252
+ /**
1253
+ *
1254
+ * This file is autogenerated.
1255
+ *
1256
+ * DO NOT EDIT DIRECTLY
1257
+ *
1258
+ **/
1259
+ class CspmRegistrationApiBridge {
1260
+ bridge;
1261
+ constructor(bridge) {
1262
+ this.bridge = bridge;
1263
+ }
1264
+ getBridge() {
1265
+ return this.bridge;
1266
+ }
1267
+ async getCspmregistrationCloudConnectCspmAzureCombinedAccountsV1(urlParams = {}) {
1268
+ const message = {
1269
+ type: 'api',
1270
+ api: 'cspmRegistration',
1271
+ method: 'getCspmregistrationCloudConnectCspmAzureCombinedAccountsV1',
1272
+ payload: {
1273
+ params: urlParams,
1274
+ },
1275
+ };
1276
+ return this.bridge.postMessage(message);
1277
+ }
1278
+ async getCspmregistrationCloudConnectCspmGcpCombinedAccountsV1(urlParams = {}) {
1279
+ const message = {
1280
+ type: 'api',
1281
+ api: 'cspmRegistration',
1282
+ method: 'getCspmregistrationCloudConnectCspmGcpCombinedAccountsV1',
1283
+ payload: {
1284
+ params: urlParams,
1285
+ },
1286
+ };
1287
+ return this.bridge.postMessage(message);
1288
+ }
1289
+ }
1290
+
1058
1291
  /**
1059
1292
  *
1060
1293
  * This file is autogenerated.
@@ -2300,6 +2533,34 @@ class PluginsApiBridge {
2300
2533
  }
2301
2534
  }
2302
2535
 
2536
+ /**
2537
+ *
2538
+ * This file is autogenerated.
2539
+ *
2540
+ * DO NOT EDIT DIRECTLY
2541
+ *
2542
+ **/
2543
+ class RegistryAssessmentApiBridge {
2544
+ bridge;
2545
+ constructor(bridge) {
2546
+ this.bridge = bridge;
2547
+ }
2548
+ getBridge() {
2549
+ return this.bridge;
2550
+ }
2551
+ async getAggregatesRegistriesCountByStateV1(urlParams = {}) {
2552
+ const message = {
2553
+ type: 'api',
2554
+ api: 'registryAssessment',
2555
+ method: 'getAggregatesRegistriesCountByStateV1',
2556
+ payload: {
2557
+ params: urlParams,
2558
+ },
2559
+ };
2560
+ return this.bridge.postMessage(message);
2561
+ }
2562
+ }
2563
+
2303
2564
  /**
2304
2565
  *
2305
2566
  * This file is autogenerated.
@@ -2513,9 +2774,6 @@ class FalconPublicApis {
2513
2774
  assertConnection(this.api);
2514
2775
  return new MitreApiBridge(this.api.bridge);
2515
2776
  }
2516
- /**
2517
- * @internal
2518
- */
2519
2777
  get plugins() {
2520
2778
  assertConnection(this.api);
2521
2779
  return new PluginsApiBridge(this.api.bridge);
@@ -2532,27 +2790,38 @@ class FalconPublicApis {
2532
2790
  assertConnection(this.api);
2533
2791
  return new WorkflowsApiBridge(this.api.bridge);
2534
2792
  }
2535
- /**
2536
- * @internal
2537
- */
2793
+ get cloudSecurityAssets() {
2794
+ assertConnection(this.api);
2795
+ return new CloudSecurityAssetsApiBridge(this.api.bridge);
2796
+ }
2797
+ get cloudregistration() {
2798
+ assertConnection(this.api);
2799
+ return new CloudregistrationApiBridge(this.api.bridge);
2800
+ }
2801
+ get containerSecurity() {
2802
+ assertConnection(this.api);
2803
+ return new ContainerSecurityApiBridge(this.api.bridge);
2804
+ }
2805
+ get cspmRegistration() {
2806
+ assertConnection(this.api);
2807
+ return new CspmRegistrationApiBridge(this.api.bridge);
2808
+ }
2538
2809
  get customobjects() {
2539
2810
  assertConnection(this.api);
2540
2811
  return new CustomobjectsApiBridge(this.api.bridge);
2541
2812
  }
2542
- /**
2543
- * @internal
2544
- */
2545
2813
  get faasGateway() {
2546
2814
  assertConnection(this.api);
2547
2815
  return new FaasGatewayApiBridge(this.api.bridge);
2548
2816
  }
2549
- /**
2550
- * @internal
2551
- */
2552
2817
  get loggingapi() {
2553
2818
  assertConnection(this.api);
2554
2819
  return new LoggingapiApiBridge(this.api.bridge);
2555
2820
  }
2821
+ get registryAssessment() {
2822
+ assertConnection(this.api);
2823
+ return new RegistryAssessmentApiBridge(this.api.bridge);
2824
+ }
2556
2825
  }
2557
2826
  __decorate([
2558
2827
  Memoize()
@@ -2584,6 +2853,18 @@ __decorate([
2584
2853
  __decorate([
2585
2854
  Memoize()
2586
2855
  ], FalconPublicApis.prototype, "workflows", null);
2856
+ __decorate([
2857
+ Memoize()
2858
+ ], FalconPublicApis.prototype, "cloudSecurityAssets", null);
2859
+ __decorate([
2860
+ Memoize()
2861
+ ], FalconPublicApis.prototype, "cloudregistration", null);
2862
+ __decorate([
2863
+ Memoize()
2864
+ ], FalconPublicApis.prototype, "containerSecurity", null);
2865
+ __decorate([
2866
+ Memoize()
2867
+ ], FalconPublicApis.prototype, "cspmRegistration", null);
2587
2868
  __decorate([
2588
2869
  Memoize()
2589
2870
  ], FalconPublicApis.prototype, "customobjects", null);
@@ -2593,6 +2874,9 @@ __decorate([
2593
2874
  __decorate([
2594
2875
  Memoize()
2595
2876
  ], FalconPublicApis.prototype, "loggingapi", null);
2877
+ __decorate([
2878
+ Memoize()
2879
+ ], FalconPublicApis.prototype, "registryAssessment", null);
2596
2880
 
2597
2881
  class ApiIntegration {
2598
2882
  falcon;
@@ -3281,4 +3565,3 @@ __decorate([
3281
3565
  ], FalconApi.prototype, "logscale", null);
3282
3566
 
3283
3567
  export { Bridge, FalconApi as default };
3284
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/foundry-js",
3
- "version": "0.18.0",
3
+ "version": "0.20.0",
4
4
  "description": "foundry-js is the JavaScript SDK for authoring UI Extensions for CrowdStrike's Foundry platform.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,36 +45,36 @@
45
45
  "test": "vitest"
46
46
  },
47
47
  "dependencies": {
48
- "emittery": "^1.0.3",
49
- "typescript-memoize": "^1.1.1",
50
- "uuid": "^11.1.0"
48
+ "emittery": "1.2.0",
49
+ "typescript-memoize": "1.1.1",
50
+ "uuid": "13.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@changesets/changelog-github": "^0.5.0",
54
- "@changesets/cli": "^2.27.3",
53
+ "@changesets/changelog-github": "0.5.1",
54
+ "@changesets/cli": "2.29.7",
55
+ "@eslint/js": "9.36.0",
55
56
  "@rollup/plugin-node-resolve": "16.0.1",
56
- "@rollup/plugin-replace": "^6.0.2",
57
- "@rollup/plugin-typescript": "12.1.3",
58
- "@types/uuid": "10.0.0",
59
- "@typescript-eslint/eslint-plugin": "^5.59.2",
60
- "@typescript-eslint/parser": "^8.34.0",
61
- "concurrently": "^9.1.2",
62
- "eslint": "^8.40.0",
63
- "eslint-config-prettier": "^10.1.5",
64
- "eslint-plugin-import": "^2.28.1",
65
- "eslint-plugin-prettier": "^5.0.0",
66
- "eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
67
- "happy-dom": "^18.0.1",
68
- "jsdom": "^26.1.0",
69
- "p-event": "^6.0.1",
70
- "prettier": "^3.2.5",
71
- "rollup": "4.44.0",
57
+ "@rollup/plugin-replace": "6.0.2",
58
+ "@rollup/plugin-typescript": "12.1.4",
59
+ "@typescript-eslint/eslint-plugin": "8.45.0",
60
+ "@typescript-eslint/parser": "8.45.0",
61
+ "concurrently": "9.2.1",
62
+ "eslint": "9.36.0",
63
+ "eslint-config-prettier": "10.1.8",
64
+ "eslint-plugin-import": "2.32.0",
65
+ "eslint-plugin-prettier": "5.5.4",
66
+ "eslint-plugin-sort-imports-es6-autofix": "0.6.0",
67
+ "happy-dom": "20.0.0",
68
+ "jsdom": "27.0.0",
69
+ "p-event": "7.0.0",
70
+ "prettier": "3.6.2",
71
+ "rollup": "4.52.3",
72
72
  "tslib": "2.8.1",
73
- "typedoc": "^0.28.5",
74
- "typedoc-plugin-missing-exports": "^4.0.0",
75
- "typedoc-plugin-rename-defaults": "^0.7.0",
76
- "typescript": "5.8.3",
77
- "vitest": "^3.1.4"
73
+ "typedoc": "0.28.13",
74
+ "typedoc-plugin-missing-exports": "4.1.0",
75
+ "typedoc-plugin-rename-defaults": "0.7.3",
76
+ "typescript": "5.9.2",
77
+ "vitest": "3.2.4"
78
78
  },
79
79
  "engines": {
80
80
  "node": ">=22"