@fungi.computer/oyster 0.27.0 → 0.28.0
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/dist/apps/gate.js +1 -4
- package/dist/apps/installation.js +8 -10
- package/dist/apps/permissions.d.ts +2 -0
- package/dist/apps/permissions.js +2 -2
- package/dist/embed-metafiles.js +1 -1
- package/dist/host.js +7 -4
- package/dist/page/app-access.js +1 -0
- package/dist/page/app-permissions.js +1 -0
- package/dist/page-script.js +2 -2
- package/dist/standalone/computer.d.ts +8 -1
- package/dist/standalone/computer.js +17 -10
- package/dist/standalone/dashboard-approval.js +1 -2
- package/dist/standalone/media.d.ts +15 -2
- package/dist/standalone/media.js +8 -0
- package/dist/standalone/tenancy.d.ts +6 -0
- package/dist/standalone/tenancy.js +57 -0
- package/dist/tenancy/cloudflare/registry.d.ts +3 -0
- package/dist/tenancy/cloudflare/registry.js +43 -2
- package/dist/tenancy/cloudflare-access.d.ts +28 -0
- package/dist/tenancy/cloudflare-access.js +99 -0
- package/docs/api/README.md +69 -6
- package/docs/api/apps.md +14 -8
- package/docs/api/modules.md +37 -36
- package/docs/api/tenancy/cloudflare-access.md +82 -0
- package/docs/api/tenancy/cloudflare.md +1 -0
- package/examples/standalone/wrangler.jsonc +7 -0
- package/package.json +15 -11
package/dist/apps/gate.js
CHANGED
|
@@ -72,7 +72,6 @@ function grantsResource(resources, resource) {
|
|
|
72
72
|
/** Intersect stored approvals with the current verified Release without widening resource selectors. */
|
|
73
73
|
export function grantsFor(installation, declaration, snapshot, capability, resource = "any") {
|
|
74
74
|
if (installation.status !== "enabled" ||
|
|
75
|
-
snapshot.digest !== installation.authority.declaredOperationsDigest ||
|
|
76
75
|
snapshot.artifactDigest !== installation.artifactDigest ||
|
|
77
76
|
!declaration.capabilities.includes(capability))
|
|
78
77
|
return null;
|
|
@@ -137,9 +136,7 @@ function admissionRefusal(facts) {
|
|
|
137
136
|
const { installation, principal } = facts;
|
|
138
137
|
if (installation.status !== "enabled")
|
|
139
138
|
return refusal("unavailable");
|
|
140
|
-
if (facts.declaredOperations.
|
|
141
|
-
installation.authority.declaredOperationsDigest ||
|
|
142
|
-
facts.declaredOperations.artifactDigest !== installation.artifactDigest ||
|
|
139
|
+
if (facts.declaredOperations.artifactDigest !== installation.artifactDigest ||
|
|
143
140
|
(facts.pins !== undefined &&
|
|
144
141
|
(facts.pins.authorityVersion !==
|
|
145
142
|
installation.authority.authorityVersion ||
|
|
@@ -113,10 +113,7 @@ export function applyGrantCommand(current, rawCommand, context) {
|
|
|
113
113
|
if ((current === null && command.kind !== "install") ||
|
|
114
114
|
(current !== null && command.kind === "install"))
|
|
115
115
|
return refuse("invalid_command");
|
|
116
|
-
if ((context.expectedVersion ?? 0) !== (current?.authorityVersion ?? 0)
|
|
117
|
-
(current !== null &&
|
|
118
|
-
command.kind !== "select-release" &&
|
|
119
|
-
current.declaredOperationsDigest !== context.declaredOperations.digest))
|
|
116
|
+
if ((context.expectedVersion ?? 0) !== (current?.authorityVersion ?? 0))
|
|
120
117
|
return refuse("stale_authority");
|
|
121
118
|
if (context.principal.role === null ||
|
|
122
119
|
(command.kind === "change-grants" && context.principal.role !== "owner"))
|
|
@@ -155,7 +152,12 @@ export function applyGrantCommand(current, rawCommand, context) {
|
|
|
155
152
|
}
|
|
156
153
|
const changed = new Map(command.changes.map((change) => [change.capability, change.grant]));
|
|
157
154
|
grants = [
|
|
158
|
-
...grants
|
|
155
|
+
...grants
|
|
156
|
+
.filter((grant) => !changed.has(grant.capability))
|
|
157
|
+
.map((grant) => ({
|
|
158
|
+
...grant,
|
|
159
|
+
operations: grant.operations.filter((operation) => declared(grant.capability).includes(operation)),
|
|
160
|
+
})),
|
|
159
161
|
...command.changes.flatMap(({ capability, grant }) => grant === null ||
|
|
160
162
|
(grant.resources !== "tenant-scope" && grant.resources.length === 0)
|
|
161
163
|
? []
|
|
@@ -277,11 +279,7 @@ export function applyInstallationCommand(current, rawCommand, context) {
|
|
|
277
279
|
if (current !== null && release.appId !== current.appId)
|
|
278
280
|
return refuse("release_app_mismatch");
|
|
279
281
|
if (context.declaredOperations.artifactDigest !==
|
|
280
|
-
release.artifact.artifactDigest
|
|
281
|
-
(current !== null &&
|
|
282
|
-
command.kind !== "select-release" &&
|
|
283
|
-
context.declaredOperations.digest !==
|
|
284
|
-
current.authority.declaredOperationsDigest))
|
|
282
|
+
release.artifact.artifactDigest)
|
|
285
283
|
return refuse("stale_authority");
|
|
286
284
|
const version = (current?.authority.authorityVersion ?? 0) + 1;
|
|
287
285
|
const grantCommand = command.kind === "install" || command.kind === "select-release"
|
|
@@ -164,6 +164,7 @@ export declare const permissionPinsSchema: z.ZodObject<{
|
|
|
164
164
|
storeGeneration: z.ZodString;
|
|
165
165
|
authorityVersion: z.ZodNumber;
|
|
166
166
|
artifactDigest: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@fungi.computer/puffball").Sha256Digest, unknown>>;
|
|
167
|
+
declaredOperationsDigest: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@fungi.computer/puffball").Sha256Digest, unknown>>;
|
|
167
168
|
}, z.core.$strict>;
|
|
168
169
|
/** Generation, authority version and artifact digest fencing a permission edit. */
|
|
169
170
|
export type PermissionPins = z.output<typeof permissionPinsSchema>;
|
|
@@ -172,6 +173,7 @@ export declare const permissionSaveSchema: z.ZodObject<{
|
|
|
172
173
|
storeGeneration: z.ZodString;
|
|
173
174
|
authorityVersion: z.ZodNumber;
|
|
174
175
|
artifactDigest: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@fungi.computer/puffball").Sha256Digest, unknown>>;
|
|
176
|
+
declaredOperationsDigest: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@fungi.computer/puffball").Sha256Digest, unknown>>;
|
|
175
177
|
command: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
176
178
|
kind: z.ZodLiteral<"install">;
|
|
177
179
|
}, z.core.$strict>, z.ZodObject<{
|
package/dist/apps/permissions.js
CHANGED
|
@@ -17,8 +17,6 @@ export function pendingCapabilities(authority, declaration, declaredOperations)
|
|
|
17
17
|
}
|
|
18
18
|
/** Bound the real SDK request; an Allow never silently widens selected resources. */
|
|
19
19
|
export function grantRequestFor(authority, facts, request, window) {
|
|
20
|
-
if (authority.declaredOperationsDigest !== facts.declaredOperations.digest)
|
|
21
|
-
return { kind: "refused", code: "stale_authority" };
|
|
22
20
|
const requested = [
|
|
23
21
|
...new Set([
|
|
24
22
|
...(request.agents ?? []),
|
|
@@ -246,6 +244,8 @@ export const permissionPinsSchema = z.strictObject({
|
|
|
246
244
|
storeGeneration: z.string().min(1),
|
|
247
245
|
authorityVersion: z.number().int().positive(),
|
|
248
246
|
artifactDigest: ownerCodec(sha256DigestSchema),
|
|
247
|
+
/** The declared-operations digest the owner saw; a save against a changed host snapshot is refused. */
|
|
248
|
+
declaredOperationsDigest: ownerCodec(sha256DigestSchema),
|
|
249
249
|
});
|
|
250
250
|
/** Permission edit command coupled to the version pins read by the owner. */
|
|
251
251
|
export const permissionSaveSchema = permissionPinsSchema.extend({
|