Skip to content

Commit d9de27b

Browse files
Rebuild with latest dependencies (#96)
Co-authored-by: mraible <17892+mraible@users.noreply.github.com>
1 parent e9d359c commit d9de27b

File tree

1 file changed

+29
-7
lines changed
  • ui/extensions/hello/src/dist

1 file changed

+29
-7
lines changed

ui/extensions/hello/src/dist/app.js

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,12 @@ var React$1 = /*#__PURE__*/_mergeNamespaces({
590590
default: React
591591
}, [reactExports]);
592592

593+
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;
594+
595+
function validate(uuid) {
596+
return typeof uuid === 'string' && REGEX.test(uuid);
597+
}
598+
593599
const byteToHex = [];
594600
for (let i = 0; i < 256; ++i) {
595601
byteToHex.push((i + 0x100).toString(16).slice(1));
@@ -632,10 +638,7 @@ function rng() {
632638
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
633639
var native = { randomUUID };
634640

635-
function v4(options, buf, offset) {
636-
if (native.randomUUID && true && !options) {
637-
return native.randomUUID();
638-
}
641+
function _v4(options, buf, offset) {
639642
options = options || {};
640643
const rnds = options.random ?? options.rng?.() ?? rng();
641644
if (rnds.length < 16) {
@@ -645,6 +648,12 @@ function v4(options, buf, offset) {
645648
rnds[8] = (rnds[8] & 0x3f) | 0x80;
646649
return unsafeStringify(rnds);
647650
}
651+
function v4(options, buf, offset) {
652+
if (native.randomUUID && true && !options) {
653+
return native.randomUUID();
654+
}
655+
return _v4(options);
656+
}
648657

649658
const VERSION = 'current';
650659

@@ -662,6 +671,13 @@ event) {
662671
const CONNECTION_TIMEOUT = 5_000;
663672
const API_TIMEOUT = 30_000;
664673
const NAVIGATION_TIMEOUT = 5_000;
674+
function sanitizeMessageId(messageId) {
675+
// Only allow valid UUID strings
676+
if (typeof messageId !== 'string' || !validate(messageId)) {
677+
return null;
678+
}
679+
return messageId;
680+
}
665681
function timeoutForMessage(message) {
666682
const timeout = message.type === 'connect'
667683
? CONNECTION_TIMEOUT
@@ -753,12 +769,18 @@ class Bridge {
753769
return;
754770
}
755771
const { messageId } = event.data.meta;
756-
const callback = this.pendingMessages.get(messageId);
757-
if (!callback) {
772+
// Sanitize messageId to prevent unvalidated dynamic method calls
773+
const sanitizedMessageId = sanitizeMessageId(messageId);
774+
if (!sanitizedMessageId) {
775+
this.throwError(`Received message with invalid messageId format`);
776+
return;
777+
}
778+
const callback = this.pendingMessages.get(sanitizedMessageId);
779+
if (!callback || typeof callback !== 'function') {
758780
this.throwError(`Received unexpected message`);
759781
return;
760782
}
761-
this.pendingMessages.delete(messageId);
783+
this.pendingMessages.delete(sanitizedMessageId);
762784
callback(message.payload);
763785
};
764786
throwError(message) {

0 commit comments

Comments
 (0)