@fabrika/auth-core 0.9.0-cloudflare.1 → 0.9.0-cloudflare.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 +1 -1
- package/src/contract-canonical.ts +1 -1
- package/src/contract.ts +5 -3
- package/src/framework-variables.ts +6 -0
- package/src/index.ts +1 -0
- package/src/managed-environment.ts +4 -0
- package/src/ops.ts +1217 -3
- package/src/public-egress.ts +166 -0
- package/types/src/contract.d.ts +5 -3
- package/types/src/framework-variables.d.ts +6 -1
- package/types/src/index.d.ts +1 -0
- package/types/src/managed-environment.d.ts +1 -1
- package/types/src/ops.d.ts +463 -2
- package/types/src/public-egress.d.ts +31 -0
package/package.json
CHANGED
|
@@ -65,7 +65,7 @@ export function canonicalizeArtifact(artifact: ContractArtifact): ContractArtifa
|
|
|
65
65
|
...(reach.actions === undefined ? {} : { actions: sorted(reach.actions) }),
|
|
66
66
|
...(reach.kicks === undefined ? {} : { kicks: sorted(reach.kicks) }),
|
|
67
67
|
...(reach.signs === undefined ? {} : { signs: sorted(reach.signs) }),
|
|
68
|
-
...(reach.egress === undefined ? {} : { egress: sorted(reach.egress) }),
|
|
68
|
+
...(reach.egress === undefined ? {} : { egress: typeof reach.egress === 'string' ? reach.egress : sorted(reach.egress) }),
|
|
69
69
|
})),
|
|
70
70
|
}),
|
|
71
71
|
...(artifact.directories === undefined ? {} : { directories: artifact.directories }),
|
package/src/contract.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import type { Locale } from './locale'
|
|
5
5
|
import type { MailTemplates } from './mail'
|
|
6
|
+
import type { DeclaredEgress } from './public-egress'
|
|
6
7
|
import type { TerminalArtifact } from './terminal'
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -754,10 +755,11 @@ export interface DeclaredReach {
|
|
|
754
755
|
*/
|
|
755
756
|
readonly signs?: readonly string[]
|
|
756
757
|
/**
|
|
757
|
-
* The HTTPS origins this site's code calls (`fetch`), sorted: a credentialed procedure, a webhook or a job.
|
|
758
|
-
*
|
|
758
|
+
* The HTTPS origins this site's code calls (`fetch`), sorted: a credentialed procedure, a webhook or a job. Or
|
|
759
|
+
* `'public'` (a cron job only): every public host over HTTPS or HTTP, never the installation or a private network
|
|
760
|
+
* (ADR-0071). Absent unless declared, so the digest stays.
|
|
759
761
|
*/
|
|
760
|
-
readonly egress?:
|
|
762
|
+
readonly egress?: DeclaredEgress
|
|
761
763
|
/**
|
|
762
764
|
* A public procedure's workload actions, sorted: all its handler holds, through the key Control issues for the
|
|
763
765
|
* endpoint (`contractWorkloads`). Present only on a public procedure's entry, so every other digest stays.
|
|
@@ -18,6 +18,11 @@ export const FABRIKA_TOKEN_KEYS = 'FABRIKA_TOKEN_KEYS'
|
|
|
18
18
|
export const FABRIKA_APP_ORIGIN = 'FABRIKA_APP_ORIGIN'
|
|
19
19
|
/** The digests of the environment's ops keys, which the object checks Control's key against (`parseOpsKeyDigests`, ADR-0069). */
|
|
20
20
|
export const FABRIKA_OPS_KEY_DIGESTS = 'FABRIKA_OPS_KEY_DIGESTS'
|
|
21
|
+
/**
|
|
22
|
+
* The installation's own hosts, which a cron job's public egress refuses (ADR-0071): Control's, IAM's, Operations' and
|
|
23
|
+
* every application environment's domain, normalized and joined by `,`. Written only for a contract with such a job.
|
|
24
|
+
*/
|
|
25
|
+
export const FABRIKA_EGRESS_REFUSED_HOSTS = 'FABRIKA_EGRESS_REFUSED_HOSTS'
|
|
21
26
|
/** The name of the object that serves an environment's ordinary traffic on Cloudflare; `application` without it. */
|
|
22
27
|
export const FABRIKA_APPLICATION_OBJECT = 'FABRIKA_APPLICATION_OBJECT'
|
|
23
28
|
/** The object names an ops request may target, all in the environment's own namespace (`parseApplicationObjects`). */
|
|
@@ -54,6 +59,7 @@ export const FRAMEWORK_VARIABLE_NAMES = [
|
|
|
54
59
|
FABRIKA_TOKEN_KEYS,
|
|
55
60
|
FABRIKA_APP_ORIGIN,
|
|
56
61
|
FABRIKA_OPS_KEY_DIGESTS,
|
|
62
|
+
FABRIKA_EGRESS_REFUSED_HOSTS,
|
|
57
63
|
FABRIKA_APPLICATION_OBJECT,
|
|
58
64
|
FABRIKA_APPLICATION_OBJECTS,
|
|
59
65
|
] as const
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { FABRIKA_CONTRACT_DIGEST } from './endpoint-digest'
|
|
|
3
3
|
import { FABRIKA_IAM_ISSUER } from './environment'
|
|
4
4
|
import {
|
|
5
5
|
FABRIKA_APP_ORIGIN,
|
|
6
|
+
FABRIKA_EGRESS_REFUSED_HOSTS,
|
|
6
7
|
FABRIKA_OPS_KEY_DIGESTS,
|
|
7
8
|
FABRIKA_TOKEN_KEYS,
|
|
8
9
|
FRAMEWORK_VARIABLE_PREFIXES,
|
|
@@ -35,6 +36,7 @@ export const MANAGED_VARIABLE_NAMES = [
|
|
|
35
36
|
FABRIKA_APP_ORIGIN,
|
|
36
37
|
FABRIKA_TOKEN_KEYS,
|
|
37
38
|
FABRIKA_OPS_KEY_DIGESTS,
|
|
39
|
+
FABRIKA_EGRESS_REFUSED_HOSTS,
|
|
38
40
|
] as const satisfies readonly FrameworkVariableName[]
|
|
39
41
|
|
|
40
42
|
export type ManagedVariableName = (typeof MANAGED_VARIABLE_NAMES)[number]
|
|
@@ -53,6 +55,8 @@ const PUBLIC_VARIABLES: ReadonlySet<string> = new Set<FrameworkVariableName>([
|
|
|
53
55
|
FABRIKA_APP_ORIGIN,
|
|
54
56
|
// SHA-256 of 256-bit random keys: a digest neither is a key nor lets anyone forge one.
|
|
55
57
|
FABRIKA_OPS_KEY_DIGESTS,
|
|
58
|
+
// Host names anyone can look up in DNS.
|
|
59
|
+
FABRIKA_EGRESS_REFUSED_HOSTS,
|
|
56
60
|
])
|
|
57
61
|
|
|
58
62
|
const PLATFORM_URL_VARIABLES: ReadonlySet<string> = new Set(PLATFORM_RECEIVERS.map((receiver) => platformTransportVariables(receiver).url))
|