@acarmisc/backstage-plugin-litellm-backend 0.16.1 → 0.17.1

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.
@@ -343,15 +343,15 @@ function registerKeysRoutes(router, ctx) {
343
343
  try {
344
344
  const { keyId } = req.params;
345
345
  const { tokenEntityRef, key } = await authorizeKeyAction(req, keyId);
346
- // Check if the key can be unblocked:
347
- // - Owner can unblock a self-blocked key (metadata.blocked_by === tokenEntityRef)
348
- // - Otherwise require the unblock permission
349
- const isOwnerUnblockingOwnBlock = key.metadata?.blocked_by === tokenEntityRef;
350
- if (!isOwnerUnblockingOwnBlock) {
351
- if (!(await assertPermission(req, backstage_plugin_litellm_common_1.litellmKeyUnblockPermission))) {
352
- sendPermissionDenied(res, backstage_plugin_litellm_common_1.litellmKeyUnblockPermission);
353
- return;
354
- }
346
+ // Unblocking always needs the dedicated permission, on top of ownership.
347
+ // `metadata.blocked_by` is deliberately NOT trusted here: it lives in a
348
+ // record the owner can influence (older keys, or a stale value left after
349
+ // an admin unblocked in the LiteLLM UI), so "I blocked it myself" can't be
350
+ // told apart from "an admin blocked it". Grant `litellm.key.unblock` only
351
+ // to roles that may lift blocks; everyone else asks an administrator.
352
+ if (!(await assertPermission(req, backstage_plugin_litellm_common_1.litellmKeyUnblockPermission))) {
353
+ sendPermissionDenied(res, backstage_plugin_litellm_common_1.litellmKeyUnblockPermission);
354
+ return;
355
355
  }
356
356
  await client.unblockKey(keyId);
357
357
  // Clear the block record on unblock. Set the fields to null rather than
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acarmisc/backstage-plugin-litellm-backend",
3
- "version": "0.16.1",
3
+ "version": "0.17.1",
4
4
  "description": "The Backstage backend plugin for LiteLLM governance",
5
5
  "backstage": {
6
6
  "role": "backend-plugin",