@fabrika/provider-zerops 0.5.2 → 0.5.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/provider-zerops",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,14 +43,14 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "zod": "^3.25.76",
46
- "@fabrika/auth": "0.5.2",
47
- "@fabrika/auth-core": "0.5.2",
48
- "@fabrika/email": "0.5.2",
49
- "@fabrika/iam-contract": "0.5.2",
50
- "@fabrika/installation-init": "0.5.2",
51
- "@fabrika/operations-contract": "0.5.2",
52
- "@fabrika/provider-contract": "0.5.2",
53
- "@fabrika/proxy-core": "0.5.2",
46
+ "@fabrika/auth": "0.5.3",
47
+ "@fabrika/auth-core": "0.5.3",
48
+ "@fabrika/email": "0.5.3",
49
+ "@fabrika/iam-contract": "0.5.3",
50
+ "@fabrika/installation-init": "0.5.3",
51
+ "@fabrika/operations-contract": "0.5.3",
52
+ "@fabrika/provider-contract": "0.5.3",
53
+ "@fabrika/proxy-core": "0.5.3",
54
54
  "yaml": "^2.9.1"
55
55
  }
56
56
  }
@@ -1,6 +1,6 @@
1
1
  import { appEnvironmentId } from '@fabrika/auth-core'
2
2
  import { decodeEnvelope, type ProviderNamespaceMember } from '@fabrika/provider-contract'
3
- import { isPolicyOrigin } from '@fabrika/proxy-core/headers'
3
+ import { isCrossOrigin, isPolicyOrigin, MAX_CROSS_ORIGINS } from '@fabrika/proxy-core/headers'
4
4
  import { contractProxyTable, type ProxyManifest } from '@fabrika/proxy-core/manifest'
5
5
  import { assertFabrikaManifestCoordinates, zeropsArtifactCodec } from '../manifest'
6
6
 
@@ -32,6 +32,14 @@ export function compileNamespaceProxyManifest(namespaceId: string, members: read
32
32
  if (operationsOrigin !== undefined && !isPolicyOrigin(operationsOrigin, ['https:', 'http:'])) {
33
33
  throw new Error(`Zerops proxy target ${member.appId}/${member.env} has an Operations ingest origin that is not an http(s) origin`)
34
34
  }
35
+ const crossOrigins = member.crossOrigins ?? []
36
+ if (
37
+ crossOrigins.length > MAX_CROSS_ORIGINS
38
+ || new Set(crossOrigins).size !== crossOrigins.length
39
+ || crossOrigins.some((origin) => !isCrossOrigin(origin) || new URL(origin).hostname === host)
40
+ ) {
41
+ throw new Error(`Zerops proxy target ${member.appId}/${member.env} has a cross-origin list the proxy manifest refuses`)
42
+ }
35
43
  apps.push({
36
44
  id,
37
45
  hosts: [host],
@@ -41,6 +49,7 @@ export function compileNamespaceProxyManifest(namespaceId: string, members: read
41
49
  scheme: 'https',
42
50
  ...contractProxyTable(access.contract),
43
51
  ...(operationsOrigin === undefined ? {} : { operationsOrigin }),
52
+ ...(crossOrigins.length === 0 ? {} : { crossOrigins: [...crossOrigins] }),
44
53
  })
45
54
  }
46
55
  return { apps }