artifacty 0.10.3 → 0.10.4

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.
@@ -44,9 +44,9 @@ When Artifacty binds outside loopback, startup output includes a warning that th
44
44
 
45
45
  ## Browser Write Behavior
46
46
 
47
- Remote browsers can read shared pages, but write actions are intentionally conservative. Mutating browser routes reject non-local `Origin` headers to reduce CSRF risk. For LAN sharing, prefer API or MCP writes with an explicit token header.
47
+ Remote browsers can read shared pages and can submit browser forms when the request is same-origin with the Artifacty host, for example `Origin: http://10.0.0.50:8787` with `Host: 10.0.0.50:8787`. Mutating browser routes reject cross-origin requests to reduce CSRF risk. For scripts and agents, prefer API or MCP writes with an explicit token header.
48
48
 
49
- Do not relax the origin check just to make remote browser writes easier. A future team dashboard should use a dedicated policy that combines same-origin remote requests, explicit token validation, and clear operator intent.
49
+ Do not disable the origin check just to make remote browser writes easier. Same-origin central dashboard writes should pass; writes initiated from another website should fail with `NON_LOCAL_ORIGIN`.
50
50
 
51
51
  ## Renderer Guidance
52
52
 
@@ -68,9 +68,10 @@ reachable from the user's browser.
68
68
 
69
69
  Controls:
70
70
 
71
- - Mutating browser routes reject non-local `Origin` headers.
71
+ - Mutating browser routes allow loopback or same-origin requests and reject
72
+ cross-origin writes.
72
73
  - API routes require a token when configured.
73
- - LAN/team mode does not relax browser-origin checks.
74
+ - LAN/team mode does not allow arbitrary browser origins.
74
75
 
75
76
  ### Untrusted Artifact Rendering
76
77
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "artifacty",
3
- "version": "0.10.3",
3
+ "version": "0.10.4",
4
4
  "description": "Local artifact exchange for heterogeneous LLM agents via HTTP and MCP.",
5
5
  "type": "module",
6
6
  "keywords": [
package/src/server.js CHANGED
@@ -816,11 +816,25 @@ export function assertLocalOrigin(request) {
816
816
  return;
817
817
  }
818
818
 
819
- const parsed = new URL(origin);
819
+ let parsed;
820
+ try {
821
+ parsed = new URL(origin);
822
+ } catch {
823
+ throw Object.assign(new Error(`Rejected invalid origin: ${origin}`), {
824
+ statusCode: 403,
825
+ code: "NON_LOCAL_ORIGIN"
826
+ });
827
+ }
828
+
820
829
  const hostname = parsed.hostname.toLowerCase();
821
- const allowed = hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
830
+ const host = String(request.headers.host || "").toLowerCase();
831
+ const allowed =
832
+ hostname === "localhost" ||
833
+ hostname === "127.0.0.1" ||
834
+ hostname === "::1" ||
835
+ (host && parsed.host.toLowerCase() === host && (parsed.protocol === "http:" || parsed.protocol === "https:"));
822
836
  if (!allowed) {
823
- throw Object.assign(new Error(`Rejected non-local origin: ${origin}`), {
837
+ throw Object.assign(new Error(`Rejected untrusted origin: ${origin}`), {
824
838
  statusCode: 403,
825
839
  code: "NON_LOCAL_ORIGIN"
826
840
  });