@fabrika/auth-core 0.9.0-dev.4 → 0.9.0-dev.5
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 -0
- package/src/contract.ts +6 -0
- package/src/dev-environment.ts +6 -0
- package/src/framework-release.ts +2 -0
- package/src/framework-variables.ts +9 -0
- package/src/index.ts +4 -0
- package/src/managed-environment.ts +136 -0
- package/src/ops.ts +1634 -0
- package/src/terminal.ts +105 -0
- package/src/token.ts +65 -5
- package/src/types.ts +4 -1
- package/src/wire.ts +6 -0
- package/types/src/contract.d.ts +6 -0
- package/types/src/dev-environment.d.ts +5 -0
- package/types/src/framework-release.d.ts +2 -0
- package/types/src/framework-variables.d.ts +7 -1
- package/types/src/index.d.ts +4 -0
- package/types/src/managed-environment.d.ts +32 -0
- package/types/src/ops.d.ts +610 -0
- package/types/src/terminal.d.ts +72 -0
- package/types/src/token.d.ts +29 -4
- package/types/src/types.d.ts +6 -1
- package/types/src/wire.d.ts +5 -0
package/types/src/token.d.ts
CHANGED
|
@@ -57,12 +57,20 @@ export declare const DEFAULT_TOKEN_TTL_SECONDS = 300;
|
|
|
57
57
|
*/
|
|
58
58
|
export declare const TOKEN_REFRESH_SKEW_SECONDS = 30;
|
|
59
59
|
/**
|
|
60
|
-
* The largest access token IAM signs, in bytes (a JWT is ASCII)
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
60
|
+
* The largest access token IAM signs, in bytes (a JWT is ASCII), except an application token below. A client sends
|
|
61
|
+
* such a token itself (an OAuth access token, a console bearer), so it crosses Caddy's `forward_auth` into the proxy's
|
|
62
|
+
* auth service and reaches installation services, which run on Bun with its default: a request's headers at most
|
|
63
|
+
* 16 KiB in total. 8 KiB leaves the rest for the request's own headers and cookies.
|
|
64
64
|
*/
|
|
65
65
|
export declare const MAX_ACCESS_TOKEN_BYTES = 8192;
|
|
66
|
+
/**
|
|
67
|
+
* The largest token IAM mints for the proxy to inject toward a contract application, in bytes. No client sends it; on
|
|
68
|
+
* that hop it travels twice (`X-Fabrika-Token`, and `Authorization` on a bearer request), so two copies and 16 KiB of
|
|
69
|
+
* the request's own headers fit the header limit the platform starts the application's Bun with.
|
|
70
|
+
*/
|
|
71
|
+
export declare const MAX_APPLICATION_TOKEN_BYTES = 24576;
|
|
72
|
+
/** The request-header limit the platform starts an application's Bun server with (`--max-http-header-size`). */
|
|
73
|
+
export declare const APPLICATION_SERVER_MAX_HEADER_BYTES = 65536;
|
|
66
74
|
/**
|
|
67
75
|
* The propustka access token. `perms` is always present (matched via `permits`); `ptype` is present
|
|
68
76
|
* only when `sub` is a principal. `label` is the audit actor — the principal's label when bound, the
|
|
@@ -101,11 +109,26 @@ export interface AccessTokenClaims {
|
|
|
101
109
|
* key carries what the key's own grants narrow, so a check that resolves the person's permissions requires this.
|
|
102
110
|
*/
|
|
103
111
|
session?: true;
|
|
112
|
+
/**
|
|
113
|
+
* Present only on a session token of a person an application asserted at an enrolled terminal (ADR-0067), and
|
|
114
|
+
* always together with `terminal`.
|
|
115
|
+
*/
|
|
116
|
+
amr?: TerminalAuthenticationMethod;
|
|
117
|
+
/** The terminal the person is signed in on; present exactly when `amr` is. */
|
|
118
|
+
terminal?: TerminalTokenClaims;
|
|
104
119
|
/** Present only on an OAuth resource token (`aud` is then a resource URI, not an app id). */
|
|
105
120
|
oauth?: OAuthTokenClaims;
|
|
106
121
|
/** Present only on a share-link token, which has no `ptype`: `sub` is then the link key's id. */
|
|
107
122
|
link?: LinkTokenClaims;
|
|
108
123
|
}
|
|
124
|
+
/** The `amr` value of a session an application asserted at a terminal. */
|
|
125
|
+
export declare const TERMINAL_AUTHENTICATION_METHOD = "terminal_assertion";
|
|
126
|
+
export type TerminalAuthenticationMethod = typeof TERMINAL_AUTHENTICATION_METHOD;
|
|
127
|
+
/** The terminal a person's session was asserted on: its principal id and the label an administrator gave it. */
|
|
128
|
+
export interface TerminalTokenClaims {
|
|
129
|
+
id: string;
|
|
130
|
+
label: string;
|
|
131
|
+
}
|
|
109
132
|
/** What a share-link token adds: the link mount that issued the key and the chain the key is bound to. */
|
|
110
133
|
export interface LinkTokenClaims {
|
|
111
134
|
mount: string;
|
|
@@ -171,6 +194,8 @@ export interface AccessTokenParams {
|
|
|
171
194
|
email?: string;
|
|
172
195
|
/** Minted from a signed-in session; refused on a token without `type` or of a workload. */
|
|
173
196
|
session?: true;
|
|
197
|
+
/** The terminal of a person's session asserted on one; sets `amr` too, and requires a user `type` and `session`. */
|
|
198
|
+
terminal?: TerminalTokenClaims;
|
|
174
199
|
permissions: PermissionEntry[];
|
|
175
200
|
issuedAt: number;
|
|
176
201
|
expiresAt: number;
|
package/types/src/types.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export declare function isWorkloadKind(value: unknown): value is WorkloadKind;
|
|
|
22
22
|
* - 'grant' — explicit `grants` row
|
|
23
23
|
* - 'bootstrap' — IAM_BOOTSTRAP_ADMINS env match (resolution-time only)
|
|
24
24
|
* - `group:${groupRef}` — IdP group → role mapping (the `<org>/<team>` ref)
|
|
25
|
+
* - 'terminal' — a grant of the terminal a person is signed in on (ADR-0067)
|
|
25
26
|
*/
|
|
26
|
-
export type PermissionSource = 'grant' | 'bootstrap' | `group:${string}`;
|
|
27
|
+
export type PermissionSource = 'grant' | 'bootstrap' | 'terminal' | `group:${string}`;
|
|
27
28
|
/**
|
|
28
29
|
* A flat, app-owned scope coordinate — one dimension (`type`) and an opaque value.
|
|
29
30
|
* Dimensions are INDEPENDENT: there is NO hierarchy/containment between them.
|
|
@@ -165,6 +166,10 @@ export interface AppSchema {
|
|
|
165
166
|
};
|
|
166
167
|
/** `labels`: a holder of the app's `members.list` also sees each member's label. Absent, labels stay with `members.manage`. */
|
|
167
168
|
directory?: 'labels';
|
|
169
|
+
/** The app's identification page for a person at an enrolled terminal (ADR-0067); absent, no terminal lists it. */
|
|
170
|
+
terminal?: {
|
|
171
|
+
identify: string;
|
|
172
|
+
};
|
|
168
173
|
}
|
|
169
174
|
/**
|
|
170
175
|
* A job, a webhook or a public procedure (`public`, named by its endpoint id) of a contract application, or a consuming
|
package/types/src/wire.d.ts
CHANGED
|
@@ -51,6 +51,11 @@ export declare const FABRIKA_PROXY_SECRET = "FABRIKA_PROXY_SECRET";
|
|
|
51
51
|
* the name carries a digest of the id rather than the id.
|
|
52
52
|
*/
|
|
53
53
|
export declare function proxySecretVariable(id: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* The variable holding the secret the platform proxy sends IAM's installation entry in `PROXY_SECRET_HEADER`. The proxy
|
|
56
|
+
* and IAM hold it under this one name. It proves only who wrote IAM's client-address and request-id headers.
|
|
57
|
+
*/
|
|
58
|
+
export declare const IAM_PROXY_SECRET_VARIABLE = "FABRIKA_INSTALLATION_PROXY_SECRET_IAM";
|
|
54
59
|
/**
|
|
55
60
|
* Every `X-Fabrika-*` name a proxy hop carries to an application. Caddy's first step and the Cloudflare proxy Worker
|
|
56
61
|
* delete each of them from the client's request before anything else, then set only what the decision asserts. A new
|