Skip to content

Commit b1beb5f

Browse files
committed
fix(uxp): ship hygiene — gate udt-smoke.js, restrict postMessage, block exec shim
- Gate udt-smoke.js behind localStorage opencut_debug=1 so the mutating test harness doesn't load in every production session - Restrict postMessage targetOrigin from "*" to window.location.origin - Block cep_node child_process.exec passthrough in the WebView shim (was an open shell execution path)
1 parent 199eec0 commit b1beb5f

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

extension/com.opencut.uxp/csinterface-shim.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@
4848
function _postToHost(action, params, callback) {
4949
const id = ++_callId;
5050
if (callback) _pendingCallbacks[id] = callback;
51+
var origin = window.location.origin || "*";
5152
window.parent.postMessage(
5253
{ _ocShimRequest: true, _callId: id, action: action, params: params },
53-
"*"
54+
origin
5455
);
5556
// Timeout: clean up if no response in 30s
5657
setTimeout(function () {
@@ -159,10 +160,8 @@
159160
// Route to UXP host for supported operations.
160161
if (mod === "child_process") {
161162
return {
162-
exec: function (cmd, cb) {
163-
_postToHost("exec", { command: cmd }, function (result) {
164-
if (cb) cb(null, result, "");
165-
});
163+
exec: function (_cmd, cb) {
164+
if (cb) cb(new Error("child_process.exec is not available in the WebView shim"), "", "");
166165
},
167166
};
168167
}

extension/com.opencut.uxp/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,10 @@ <h2 class="oc-workspace-guide-title" id="workspaceGuideTitle" data-i18n="uxp.gui
16501650
</div><!-- #app -->
16511651

16521652
<script type="module" src="main.js"></script>
1653-
<script type="module" src="udt-smoke.js"></script>
1653+
<script type="module">
1654+
if (localStorage.getItem("opencut_debug") === "1") {
1655+
import("./udt-smoke.js");
1656+
}
1657+
</script>
16541658
</body>
16551659
</html>

0 commit comments

Comments
 (0)