@automagik/omni 2.260719.4 → 2.260719.6

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
@@ -125191,7 +125191,7 @@ import { fileURLToPath } from "url";
125191
125191
  // package.json
125192
125192
  var package_default = {
125193
125193
  name: "@automagik/omni",
125194
- version: "2.260719.4",
125194
+ version: "2.260719.6",
125195
125195
  description: "LLM-optimized CLI for Omni",
125196
125196
  type: "module",
125197
125197
  bin: {
@@ -227026,7 +227026,7 @@ var init_sentry_scrub = __esm(() => {
227026
227026
  var require_package7 = __commonJS((exports, module) => {
227027
227027
  module.exports = {
227028
227028
  name: "@omni/api",
227029
- version: "2.260719.4",
227029
+ version: "2.260719.6",
227030
227030
  type: "module",
227031
227031
  exports: {
227032
227032
  ".": {
@@ -358053,6 +358053,43 @@ function isAuthoritySubset(requested, allowed) {
358053
358053
  return false;
358054
358054
  return [...requested].every((instanceId) => allowed.has(instanceId));
358055
358055
  }
358056
+ function deriveProfileAllowlistAuthorities(input) {
358057
+ if (!isStringArray(input.chatAllowlist) || !isStringArray(input.outboundRecipientAllowlist))
358058
+ return null;
358059
+ if (input.profile !== null && (typeof input.profile !== "string" || !KNOWN_API_KEY_PROFILES.has(input.profile))) {
358060
+ return null;
358061
+ }
358062
+ return {
358063
+ chat: isLockActive(input.profile, "chatAllowlist", input.chatAllowlist) ? new Set(input.chatAllowlist) : null,
358064
+ outboundRecipient: isLockActive(input.profile, "outboundRecipientAllowlist", input.outboundRecipientAllowlist) ? new Set(input.outboundRecipientAllowlist) : null
358065
+ };
358066
+ }
358067
+ function enforceProfileAllowlistCeilings(c, requestedAuthority) {
358068
+ const apiKey = c.get("apiKey");
358069
+ if (!apiKey || apiKey.profile === undefined || !isStringArray(apiKey.chatAllowlist) || !isStringArray(apiKey.outboundRecipientAllowlist)) {
358070
+ return c.json({
358071
+ error: {
358072
+ code: "FORBIDDEN",
358073
+ message: "Cannot grant chat or recipient access that exceeds the caller's own."
358074
+ }
358075
+ }, 403);
358076
+ }
358077
+ const callerAuthorities = deriveProfileAllowlistAuthorities({
358078
+ profile: apiKey.profile,
358079
+ chatAllowlist: apiKey.chatAllowlist,
358080
+ outboundRecipientAllowlist: apiKey.outboundRecipientAllowlist
358081
+ });
358082
+ const childAuthorities = deriveProfileAllowlistAuthorities(requestedAuthority);
358083
+ const exceedsCaller = callerAuthorities === null || childAuthorities === null || !isAuthoritySubset(childAuthorities.chat, callerAuthorities.chat) || !isAuthoritySubset(childAuthorities.outboundRecipient, callerAuthorities.outboundRecipient);
358084
+ if (!exceedsCaller)
358085
+ return null;
358086
+ return c.json({
358087
+ error: {
358088
+ code: "FORBIDDEN",
358089
+ message: "Cannot grant chat or recipient access that exceeds the caller's own."
358090
+ }
358091
+ }, 403);
358092
+ }
358056
358093
  function enforceInstanceCeiling(c, requestedAuthority) {
358057
358094
  const apiKey = c.get("apiKey");
358058
358095
  if (!apiKey || apiKey.profile === undefined || !isStringArray(apiKey.instanceAllowlist)) {
@@ -358100,6 +358137,13 @@ async function handleProfileCreate(c, data, services) {
358100
358137
  });
358101
358138
  if (instanceCeilingDenied)
358102
358139
  return instanceCeilingDenied;
358140
+ const allowlistCeilingDenied = enforceProfileAllowlistCeilings(c, {
358141
+ profile: resolved.profile,
358142
+ chatAllowlist: resolved.chatAllowlist,
358143
+ outboundRecipientAllowlist: resolved.outboundRecipientAllowlist
358144
+ });
358145
+ if (allowlistCeilingDenied)
358146
+ return allowlistCeilingDenied;
358103
358147
  const result = await services.apiKeys.create({
358104
358148
  name: data.name,
358105
358149
  description: data.description,
@@ -358142,6 +358186,13 @@ async function handleLegacyCreate(c, data, services) {
358142
358186
  });
358143
358187
  if (instanceCeilingDenied)
358144
358188
  return instanceCeilingDenied;
358189
+ const allowlistCeilingDenied = enforceProfileAllowlistCeilings(c, {
358190
+ profile: null,
358191
+ chatAllowlist: [],
358192
+ outboundRecipientAllowlist: []
358193
+ });
358194
+ if (allowlistCeilingDenied)
358195
+ return allowlistCeilingDenied;
358145
358196
  const result = await services.apiKeys.create({
358146
358197
  name: data.name,
358147
358198
  description: data.description,
@@ -358281,6 +358332,13 @@ var init_keys = __esm(() => {
358281
358332
  profile: next.profile,
358282
358333
  instanceAllowlist: next.instanceAllowlist
358283
358334
  });
358335
+ if (authorityDenied)
358336
+ return false;
358337
+ authorityDenied = enforceProfileAllowlistCeilings(c, {
358338
+ profile: next.profile,
358339
+ chatAllowlist: next.chatAllowlist,
358340
+ outboundRecipientAllowlist: next.outboundRecipientAllowlist
358341
+ });
358284
358342
  return authorityDenied == null;
358285
358343
  });
358286
358344
  if (result.status === "denied") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260719.4",
3
+ "version": "2.260719.6",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {