@crowdstrike/foundry-js 0.19.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.
@@ -56,8 +56,7 @@ export interface PostEntitiesAppCommandV1QueryParams extends BaseUrlParams {
56
56
  appScriptVersion?: QueryParam;
57
57
  }
58
58
  export type PostEntitiesAppCommandV1ApiResponse = ApiResponsePayload;
59
- export interface PostEntitiesAppCommandV1PostData {
60
- }
59
+ export type PostEntitiesAppCommandV1PostData = Record<string, never>;
61
60
  export type PostEntitiesAppCommandV1ResponseMessage = BaseApiResponseMessage<PostEntitiesAppCommandV1ApiResponse>;
62
61
  export interface PostEntitiesAppCommandV1RequestMessage extends BaseApiRequestMessage<PostEntitiesAppCommandV1QueryParams, PostEntitiesAppCommandV1PostData> {
63
62
  api: RemoteResponseRequestApi;
@@ -68,8 +67,7 @@ export interface PostEntitiesAppSessionsV1QueryParams extends BaseUrlParams {
68
67
  timeoutDuration?: QueryParam;
69
68
  }
70
69
  export type PostEntitiesAppSessionsV1ApiResponse = ApiResponsePayload;
71
- export interface PostEntitiesAppSessionsV1PostData {
72
- }
70
+ export type PostEntitiesAppSessionsV1PostData = Record<string, never>;
73
71
  export type PostEntitiesAppSessionsV1ResponseMessage = BaseApiResponseMessage<PostEntitiesAppSessionsV1ApiResponse>;
74
72
  export interface PostEntitiesAppSessionsV1RequestMessage extends BaseApiRequestMessage<PostEntitiesAppSessionsV1QueryParams, PostEntitiesAppSessionsV1PostData> {
75
73
  api: RemoteResponseRequestApi;
@@ -77,8 +75,7 @@ export interface PostEntitiesAppSessionsV1RequestMessage extends BaseApiRequestM
77
75
  }
78
76
  export type PostEntitiesPutFilesV1QueryParams = BaseUrlParams;
79
77
  export type PostEntitiesPutFilesV1ApiResponse = ApiResponsePayload;
80
- export interface PostEntitiesPutFilesV1PostData {
81
- }
78
+ export type PostEntitiesPutFilesV1PostData = Record<string, never>;
82
79
  export type PostEntitiesPutFilesV1ResponseMessage = BaseApiResponseMessage<PostEntitiesPutFilesV1ApiResponse>;
83
80
  export interface PostEntitiesPutFilesV1RequestMessage extends BaseApiRequestMessage<PostEntitiesPutFilesV1QueryParams, PostEntitiesPutFilesV1PostData> {
84
81
  api: RemoteResponseRequestApi;
@@ -26,8 +26,7 @@ export interface GetQueriesUsersV1RequestMessage extends BaseApiRequestMessage<G
26
26
  }
27
27
  export type PostEntitiesUsersGetV1QueryParams = BaseUrlParams;
28
28
  export type PostEntitiesUsersGetV1ApiResponse = ApiResponsePayload;
29
- export interface PostEntitiesUsersGetV1PostData {
30
- }
29
+ export type PostEntitiesUsersGetV1PostData = Record<string, never>;
31
30
  export type PostEntitiesUsersGetV1ResponseMessage = BaseApiResponseMessage<PostEntitiesUsersGetV1ApiResponse>;
32
31
  export interface PostEntitiesUsersGetV1RequestMessage extends BaseApiRequestMessage<PostEntitiesUsersGetV1QueryParams, PostEntitiesUsersGetV1PostData> {
33
32
  api: UserManagementRequestApi;
@@ -28,8 +28,7 @@ export interface PostEntitiesExecuteV1QueryParams extends BaseUrlParams {
28
28
  depth?: QueryParam;
29
29
  }
30
30
  export type PostEntitiesExecuteV1ApiResponse = ApiResponsePayload;
31
- export interface PostEntitiesExecuteV1PostData {
32
- }
31
+ export type PostEntitiesExecuteV1PostData = Record<string, never>;
33
32
  export type PostEntitiesExecuteV1ResponseMessage = BaseApiResponseMessage<PostEntitiesExecuteV1ApiResponse>;
34
33
  export interface PostEntitiesExecuteV1RequestMessage extends BaseApiRequestMessage<PostEntitiesExecuteV1QueryParams, PostEntitiesExecuteV1PostData> {
35
34
  api: WorkflowsRequestApi;
@@ -39,8 +38,7 @@ export interface PostEntitiesExecutionActionsV1QueryParams extends BaseUrlParams
39
38
  actionName: QueryParam;
40
39
  }
41
40
  export type PostEntitiesExecutionActionsV1ApiResponse = ApiResponsePayload;
42
- export interface PostEntitiesExecutionActionsV1PostData {
43
- }
41
+ export type PostEntitiesExecutionActionsV1PostData = Record<string, never>;
44
42
  export type PostEntitiesExecutionActionsV1ResponseMessage = BaseApiResponseMessage<PostEntitiesExecutionActionsV1ApiResponse>;
45
43
  export interface PostEntitiesExecutionActionsV1RequestMessage extends BaseApiRequestMessage<PostEntitiesExecutionActionsV1QueryParams, PostEntitiesExecutionActionsV1PostData> {
46
44
  api: WorkflowsRequestApi;
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) {
@@ -3543,4 +3565,3 @@ __decorate([
3543
3565
  ], FalconApi.prototype, "logscale", null);
3544
3566
 
3545
3567
  export { Bridge, FalconApi as default };
3546
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdstrike/foundry-js",
3
- "version": "0.19.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-replace": "6.0.2",
57
58
  "@rollup/plugin-typescript": "12.1.4",
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.45.1",
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"