@tomflow/proflow-execution-browser-extension 0.1.35 → 0.1.36

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.
@@ -47,7 +47,7 @@ export declare const behaviorAdapter: {
47
47
  ok: true;
48
48
  status: "SUCCEEDED";
49
49
  moduleRef: "execution-browser-extension";
50
- moduleVersion: "0.1.35";
50
+ moduleVersion: "0.1.36";
51
51
  data: {
52
52
  loadDir: string;
53
53
  };
@@ -60,7 +60,7 @@ export declare const behaviorAdapter: {
60
60
  readonly ok: true;
61
61
  readonly status: "SUCCEEDED";
62
62
  readonly moduleRef: "execution-browser-extension";
63
- readonly moduleVersion: "0.1.35";
63
+ readonly moduleVersion: "0.1.36";
64
64
  };
65
65
  observedEffects: never[];
66
66
  }>;
@@ -70,7 +70,7 @@ export declare const behaviorAdapter: {
70
70
  ok: true;
71
71
  status: "SUCCEEDED";
72
72
  moduleRef: "execution-browser-extension";
73
- moduleVersion: "0.1.35";
73
+ moduleVersion: "0.1.36";
74
74
  data: {
75
75
  setupStatus: "ACTION_REQUIRED" | "READY";
76
76
  runtimeStatus: "NOT_APPLICABLE";
@@ -95,7 +95,7 @@ export declare const behaviorAdapter: {
95
95
  result: {
96
96
  contract: "deployment.result.v1";
97
97
  moduleRef: "execution-browser-extension";
98
- moduleVersion: "0.1.35";
98
+ moduleVersion: "0.1.36";
99
99
  ok: false;
100
100
  status: "ACTION_REQUIRED";
101
101
  data: {
@@ -127,14 +127,14 @@ export declare const behaviorAdapter: {
127
127
  readonly ok: true;
128
128
  readonly status: "SUCCEEDED";
129
129
  readonly moduleRef: "execution-browser-extension";
130
- readonly moduleVersion: "0.1.35";
130
+ readonly moduleVersion: "0.1.36";
131
131
  };
132
132
  observedEffects: string[];
133
133
  } | {
134
134
  result: {
135
135
  contract: "deployment.result.v1";
136
136
  moduleRef: "execution-browser-extension";
137
- moduleVersion: "0.1.35";
137
+ moduleVersion: "0.1.36";
138
138
  ok: false;
139
139
  status: "FAILED";
140
140
  error: {
@@ -167,7 +167,7 @@ export declare const behaviorAdapter: {
167
167
  ok: true;
168
168
  status: "SUCCEEDED";
169
169
  moduleRef: "execution-browser-extension";
170
- moduleVersion: "0.1.35";
170
+ moduleVersion: "0.1.36";
171
171
  data: {
172
172
  docs: string;
173
173
  };
@@ -180,11 +180,11 @@ export declare const behaviorAdapter: {
180
180
  readonly ok: true;
181
181
  readonly status: "SUCCEEDED";
182
182
  readonly moduleRef: "execution-browser-extension";
183
- readonly moduleVersion: "0.1.35";
183
+ readonly moduleVersion: "0.1.36";
184
184
  } | {
185
185
  contract: "deployment.result.v1";
186
186
  moduleRef: "execution-browser-extension";
187
- moduleVersion: "0.1.35";
187
+ moduleVersion: "0.1.36";
188
188
  ok: false;
189
189
  status: "FAILED";
190
190
  error: {
@@ -201,7 +201,7 @@ export declare const behaviorAdapter: {
201
201
  readonly ok: true;
202
202
  readonly status: "SUCCEEDED";
203
203
  readonly moduleRef: "execution-browser-extension";
204
- readonly moduleVersion: "0.1.35";
204
+ readonly moduleVersion: "0.1.36";
205
205
  };
206
206
  observedEffects: never[];
207
207
  }>;
@@ -3,7 +3,7 @@ export declare const descriptor: {
3
3
  readonly contractVersion: "1.0.0";
4
4
  readonly moduleRef: "execution-browser-extension";
5
5
  readonly packageName: "@tomflow/proflow-execution-browser-extension";
6
- readonly moduleVersion: "0.1.35";
6
+ readonly moduleVersion: "0.1.36";
7
7
  readonly kind: "browser-extension";
8
8
  readonly templateVersion: "1.0.0";
9
9
  readonly platformCompatibility: ">=1.0.0 <2.0.0";
@@ -3,7 +3,7 @@ export const descriptor = {
3
3
  contractVersion: "1.0.0",
4
4
  moduleRef: "execution-browser-extension",
5
5
  packageName: "@tomflow/proflow-execution-browser-extension",
6
- moduleVersion: "0.1.35",
6
+ moduleVersion: "0.1.36",
7
7
  kind: "browser-extension",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
@@ -152,9 +152,13 @@ export async function createBrowserRealityBridgeServer(options) {
152
152
  const origin = request.headers.origin;
153
153
  if (!authorization?.startsWith("Bearer ") ||
154
154
  !safeEqual(authorization.slice(7), options.token) ||
155
- origin !== expectedOrigin)
155
+ (origin !== undefined && origin !== expectedOrigin))
156
156
  throw new BrowserRealityBridgeError("BRIDGE_AUTH_INVALID", "bridge authentication failed");
157
157
  };
158
+ const requireExtensionOrigin = (request) => {
159
+ if (request.headers.origin !== expectedOrigin)
160
+ throw new BrowserRealityBridgeError("BRIDGE_AUTH_INVALID", "bridge extension origin is required");
161
+ };
158
162
  const server = createServer(async (request, response) => {
159
163
  try {
160
164
  const url = new URL(request.url ?? "/", "http://127.0.0.1");
@@ -246,6 +250,7 @@ export async function createBrowserRealityBridgeServer(options) {
246
250
  return;
247
251
  }
248
252
  if (request.method === "POST" && url.pathname === "/v1/session/hello") {
253
+ requireExtensionOrigin(request);
249
254
  const body = await readJson(request);
250
255
  if (!isRecord(body) ||
251
256
  stringField(body, "extensionId") !== options.extensionId)
@@ -34,9 +34,9 @@ function text(value) {
34
34
  }
35
35
  function extensionIdentity(request) {
36
36
  const origin = request.headers.origin;
37
- const match = typeof origin === "string"
38
- ? /^chrome-extension:\/\/([a-z]{32})$/.exec(origin)
39
- : null;
37
+ if (origin === undefined)
38
+ return undefined;
39
+ const match = /^chrome-extension:\/\/([a-z]{32})$/.exec(origin);
40
40
  if (!match)
41
41
  throw new Error("PAIRING_AUTH_INVALID");
42
42
  return match[1];
@@ -47,7 +47,6 @@ function authenticate(request, token) {
47
47
  !safeEqual(authorization.slice(7), token)) {
48
48
  throw new Error("PAIRING_AUTH_INVALID");
49
49
  }
50
- return extensionIdentity(request);
51
50
  }
52
51
  export async function createBrowserExtensionPairingServer(options) {
53
52
  if (options.token.length < 32) {
@@ -75,9 +74,13 @@ export async function createBrowserExtensionPairingServer(options) {
75
74
  const server = createServer(async (request, response) => {
76
75
  try {
77
76
  const originId = extensionIdentity(request);
78
- response.setHeader("access-control-allow-origin", `chrome-extension://${originId}`);
79
- response.setHeader("vary", "origin");
77
+ if (originId) {
78
+ response.setHeader("access-control-allow-origin", `chrome-extension://${originId}`);
79
+ response.setHeader("vary", "origin");
80
+ }
80
81
  if (request.method === "OPTIONS") {
82
+ if (!originId)
83
+ throw new Error("PAIRING_AUTH_INVALID");
81
84
  response.setHeader("access-control-allow-headers", "authorization, content-type");
82
85
  response.setHeader("access-control-allow-methods", "GET, POST, OPTIONS");
83
86
  response.writeHead(204);
@@ -90,7 +93,7 @@ export async function createBrowserExtensionPairingServer(options) {
90
93
  const body = await readJson(request);
91
94
  const extensionId = text(body.extensionId);
92
95
  const extensionInstanceId = text(body.extensionInstanceId);
93
- if (extensionId !== originId)
96
+ if (!originId || extensionId !== originId)
94
97
  throw new Error("PAIRING_AUTH_INVALID");
95
98
  if (identity && identity.extensionId !== extensionId) {
96
99
  throw new Error("PAIRING_AUTH_INVALID");
@@ -99,7 +102,8 @@ export async function createBrowserExtensionPairingServer(options) {
99
102
  send(response, 200, { accepted: true });
100
103
  return;
101
104
  }
102
- if (!identity || originId !== identity.extensionId) {
105
+ if (!identity ||
106
+ (originId !== undefined && originId !== identity.extensionId)) {
103
107
  throw new Error("PAIRING_AUTH_INVALID");
104
108
  }
105
109
  if (url.searchParams.get("extensionInstanceId") !==
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "ProFlow Execution Browser",
4
- "version": "0.1.35",
4
+ "version": "0.1.36",
5
5
  "permissions": [
6
6
  "tabs",
7
7
  "storage"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/proflow-execution-browser-extension",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Execution-owned MV3 Browser executor, evidence provider and browser application surface.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -27,12 +27,12 @@
27
27
  "SETUP.md"
28
28
  ],
29
29
  "dependencies": {
30
- "@tomflow/proflow-module-contract": "^0.1.13",
31
- "@tomflow/proflow-execution-contracts": "^0.1.10"
30
+ "@tomflow/proflow-execution-contracts": "^0.1.10",
31
+ "@tomflow/proflow-module-contract": "^0.1.13"
32
32
  },
33
33
  "devDependencies": {
34
- "@tomflow/proflow-deployment-conformance": "^0.1.13",
35
- "@tomflow/proflow-execution-runtime": "^0.1.16"
34
+ "@tomflow/proflow-execution-runtime": "^0.1.16",
35
+ "@tomflow/proflow-deployment-conformance": "^0.1.13"
36
36
  },
37
37
  "keywords": [
38
38
  "proflow",
@@ -3,7 +3,7 @@
3
3
  "contractVersion": "1.0.0",
4
4
  "moduleRef": "execution-browser-extension",
5
5
  "packageName": "@tomflow/proflow-execution-browser-extension",
6
- "moduleVersion": "0.1.35",
6
+ "moduleVersion": "0.1.36",
7
7
  "kind": "browser-extension",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",