@autumnsgrove/groveengine 0.9.7 → 0.9.71

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.
@@ -48,13 +48,18 @@ export function validateCSRF(request) {
48
48
  if (!isLocalhost && originUrl.protocol !== "https:") {
49
49
  return false;
50
50
  }
51
- // STRICT: Require exact hostname match (same-origin)
51
+ // STRICT: Require exact origin match (same-origin policy)
52
52
  // This prevents cross-tenant CSRF attacks where tenant1.grove.place
53
53
  // could make requests to tenant2.grove.place
54
54
  const hostUrl = host ? new URL(`https://${host}`) : null;
55
55
  const isSameHost = hostUrl && originUrl.hostname === hostUrl.hostname;
56
- // Only allow same-host or localhost
57
- if (!isLocalhost && !isSameHost) {
56
+ // Check port match - same-origin policy requires protocol + host + port
57
+ // Default ports: 443 for https, 80 for http (empty string in URL.port)
58
+ const originPort = originUrl.port || (originUrl.protocol === "https:" ? "443" : "80");
59
+ const hostPort = hostUrl?.port || "443"; // host header typically omits default port
60
+ const isSamePort = originPort === hostPort;
61
+ // Only allow same-host AND same-port, or localhost
62
+ if (!isLocalhost && (!isSameHost || !isSamePort)) {
58
63
  return false;
59
64
  }
60
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autumnsgrove/groveengine",
3
- "version": "0.9.7",
3
+ "version": "0.9.71",
4
4
  "description": "Multi-tenant blog engine for Grove Platform. Features gutter annotations, markdown editing, magic code auth, and Cloudflare Workers deployment.",
5
5
  "author": "AutumnsGrove",
6
6
  "license": "AGPL-3.0-only",
@@ -10,8 +10,7 @@
10
10
  "directory": "packages/engine"
11
11
  },
12
12
  "publishConfig": {
13
- "registry": "https://registry.npmjs.org",
14
- "access": "public"
13
+ "registry": "https://npm.pkg.github.com"
15
14
  },
16
15
  "keywords": [
17
16
  "blog",