@automagik/omni 2.260717.2 → 2.260717.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/dist/index.js CHANGED
@@ -125164,7 +125164,7 @@ import { fileURLToPath } from "url";
125164
125164
  // package.json
125165
125165
  var package_default = {
125166
125166
  name: "@automagik/omni",
125167
- version: "2.260717.2",
125167
+ version: "2.260717.3",
125168
125168
  description: "LLM-optimized CLI for Omni",
125169
125169
  type: "module",
125170
125170
  bin: {
@@ -225883,7 +225883,7 @@ var init_sentry_scrub = __esm(() => {
225883
225883
  var require_package7 = __commonJS((exports, module) => {
225884
225884
  module.exports = {
225885
225885
  name: "@omni/api",
225886
- version: "2.260717.2",
225886
+ version: "2.260717.3",
225887
225887
  type: "module",
225888
225888
  exports: {
225889
225889
  ".": {
@@ -356775,15 +356775,17 @@ function normalizeOverrides(overrides) {
356775
356775
  denylistPresetKey: overrides.denylistPresetKey === null ? undefined : overrides.denylistPresetKey
356776
356776
  };
356777
356777
  }
356778
- function enforceMintCeiling(c, requestedScopes) {
356778
+ function enforceScopeCeiling(c, requestedScopes) {
356779
356779
  const callerScopes = c.get("apiKey")?.scopes ?? [];
356780
- const exceeding = requestedScopes.filter((scope) => !ApiKeyService.scopeAllows(callerScopes, scope));
356780
+ const signedByScopes = c.get("signedBy") ? c.get("signedByScopes") : undefined;
356781
+ const authorizerScopeSets = signedByScopes ? [callerScopes, signedByScopes] : [callerScopes];
356782
+ const exceeding = requestedScopes.filter((scope) => authorizerScopeSets.some((authorizerScopes) => !ApiKeyService.scopeAllows(authorizerScopes, scope)));
356781
356783
  if (exceeding.length === 0)
356782
356784
  return null;
356783
356785
  return c.json({
356784
356786
  error: {
356785
356787
  code: "FORBIDDEN",
356786
- message: `Cannot mint a key whose scopes exceed the caller's own. Disallowed: ${exceeding.join(", ")}`
356788
+ message: `Cannot grant scopes that exceed the caller's own. Disallowed: ${exceeding.join(", ")}`
356787
356789
  }
356788
356790
  }, 403);
356789
356791
  }
@@ -356798,7 +356800,7 @@ async function handleProfileCreate(c, data, services) {
356798
356800
  overrides: normalizeOverrides(data.overrides),
356799
356801
  denylistPresetKey: data.denylistPresetKey
356800
356802
  });
356801
- const ceilingDenied = enforceMintCeiling(c, resolved.scopes);
356803
+ const ceilingDenied = enforceScopeCeiling(c, resolved.scopes);
356802
356804
  if (ceilingDenied)
356803
356805
  return ceilingDenied;
356804
356806
  const result = await services.apiKeys.create({
@@ -356833,7 +356835,7 @@ async function handleLegacyCreate(c, data, services) {
356833
356835
  if (!data.scopes || data.scopes.length === 0) {
356834
356836
  return c.json({ error: { code: "VALIDATION_ERROR", message: "scopes is required when no profile is supplied" } }, 400);
356835
356837
  }
356836
- const ceilingDenied = enforceMintCeiling(c, data.scopes);
356838
+ const ceilingDenied = enforceScopeCeiling(c, data.scopes);
356837
356839
  if (ceilingDenied)
356838
356840
  return ceilingDenied;
356839
356841
  const result = await services.apiKeys.create({
@@ -356957,6 +356959,11 @@ var init_keys = __esm(() => {
356957
356959
  const id = c.req.param("id");
356958
356960
  const data = c.req.valid("json");
356959
356961
  const services = c.get("services");
356962
+ if (data.scopes) {
356963
+ const ceilingDenied = enforceScopeCeiling(c, data.scopes);
356964
+ if (ceilingDenied)
356965
+ return ceilingDenied;
356966
+ }
356960
356967
  try {
356961
356968
  const updated = await services.apiKeys.update(id, {
356962
356969
  ...data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260717.2",
3
+ "version": "2.260717.3",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {