@tinycloud/operations 0.7.7-beta.2 → 0.7.7-beta.21

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/artifacts.js CHANGED
@@ -147,7 +147,8 @@ import { z } from "zod";
147
147
 
148
148
  // ../sdk-core/src/manifest.ts
149
149
  var import_ms = __toESM(require_ms(), 1);
150
- import { resolveSecretPath, SECRET_NAME_RE } from "@tinycloud/sdk-services";
150
+ import { resolveSecretPath, SECRET_NAME_RE, parseNetworkId } from "@tinycloud/sdk-services";
151
+ import { parseEncryptionResource } from "@tinycloud/sdk-services/encryption/resource";
151
152
  var DEFAULT_MANIFEST_SPACE = "applications";
152
153
  var SERVICE_SHORT_TO_LONG = Object.freeze({
153
154
  kv: "tinycloud.kv",
@@ -172,8 +173,12 @@ function expandActionShortNames(service, actions) {
172
173
  return `${service}/${a}`;
173
174
  });
174
175
  }
176
+ var KEY_SEGMENT = "[a-z0-9][a-z0-9._-]{0,63}";
177
+ var KEY_APP_ID = new RegExp(`^${KEY_SEGMENT}$`);
178
+ var KEY_PATH = new RegExp(`^${KEY_SEGMENT}(?:/${KEY_SEGMENT}){2,7}$`);
175
179
 
176
180
  // ../sdk-core/src/capabilities.ts
181
+ import { encryptionResourceContains } from "@tinycloud/sdk-services/encryption/resource";
177
182
  function normalizeSpace(space) {
178
183
  if (!space.startsWith("tinycloud:")) {
179
184
  return space;
@@ -197,10 +202,9 @@ function isCapabilitySubset(requested, granted) {
197
202
  const grantedActions = matchingScope.flatMap(
198
203
  (entry) => expandActionShortNames(entry.service, entry.actions)
199
204
  );
205
+ const namedKeyRequest = req.service === "tinycloud.encryption" && req.path.startsWith("urn:tinycloud:encryption:") && req.path.includes("/");
200
206
  const covered = requestedActions.every(
201
- (requestedAction) => grantedActions.some(
202
- (grantedAction) => actionContains(grantedAction, requestedAction)
203
- )
207
+ (requestedAction) => grantedActions.some((grantedAction) => namedKeyRequest ? grantedAction === requestedAction : actionContains(grantedAction, requestedAction))
204
208
  );
205
209
  if (!covered) {
206
210
  missing.push(cloneEntry(req));
@@ -215,7 +219,9 @@ function canonicalizeEntryScopeMatches(requested, granted) {
215
219
  if (normalizeSpace(requested.space ?? DEFAULT_MANIFEST_SPACE) !== normalizeSpace(granted.space ?? DEFAULT_MANIFEST_SPACE)) {
216
220
  return false;
217
221
  }
218
- if (!pathContains(granted.path, requested.path)) {
222
+ const namedKeyRequest = requested.service === "tinycloud.encryption" && requested.path.startsWith("urn:tinycloud:encryption:") && requested.path.includes("/");
223
+ const coveredPath = namedKeyRequest ? encryptionResourceContains(granted.path, requested.path) : pathContains(granted.path, requested.path);
224
+ if (!coveredPath) {
219
225
  return false;
220
226
  }
221
227
  if (!recapCaveatsEqual(requested.caveats, granted.caveats)) {