@trops/dash-core 0.1.494 → 0.1.495
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.esm.js +60 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +60 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -49192,6 +49192,7 @@ var WidgetGrantRow = function WidgetGrantRow(_ref6) {
|
|
|
49192
49192
|
}), allServerNames.map(function (serverName) {
|
|
49193
49193
|
var decl = declaredServers[serverName] || {};
|
|
49194
49194
|
var grant = grantedServers[serverName];
|
|
49195
|
+
var allStale = isServerEntirelyStale(decl, grant);
|
|
49195
49196
|
return /*#__PURE__*/jsxs("div", {
|
|
49196
49197
|
className: "flex flex-col space-y-2 border-t border-gray-800 pt-2",
|
|
49197
49198
|
children: [/*#__PURE__*/jsxs("div", {
|
|
@@ -49208,6 +49209,9 @@ var WidgetGrantRow = function WidgetGrantRow(_ref6) {
|
|
|
49208
49209
|
return onRevokeServer(serverName);
|
|
49209
49210
|
}
|
|
49210
49211
|
})]
|
|
49212
|
+
}), allStale && /*#__PURE__*/jsx("div", {
|
|
49213
|
+
className: "text-xs text-amber-400 bg-amber-900 bg-opacity-20 border border-amber-700 rounded px-2 py-1.5",
|
|
49214
|
+
children: "All grants on this server are no longer in the manifest \u2014 the widget likely no longer uses this server. Consider revoking."
|
|
49211
49215
|
}), /*#__PURE__*/jsx(PermsList, {
|
|
49212
49216
|
label: "Tools",
|
|
49213
49217
|
declaredItems: decl.tools || [],
|
|
@@ -49241,17 +49245,44 @@ var PermsList = function PermsList(_ref7) {
|
|
|
49241
49245
|
}), all.map(function (item) {
|
|
49242
49246
|
var isGranted = grantedSet.has(item);
|
|
49243
49247
|
var isDeclared = declaredSet.has(item);
|
|
49248
|
+
var isStale = isGranted && !isDeclared;
|
|
49244
49249
|
return /*#__PURE__*/jsxs("span", {
|
|
49245
|
-
className: "text-xs font-mono break-all ".concat(
|
|
49246
|
-
children: [item,
|
|
49247
|
-
className: "ml-2
|
|
49248
|
-
children: "(no longer
|
|
49250
|
+
className: "text-xs font-mono break-all ".concat(isStale ? "text-amber-400" : isGranted ? "opacity-100" : "opacity-50 line-through"),
|
|
49251
|
+
children: [item, isStale && /*#__PURE__*/jsx("span", {
|
|
49252
|
+
className: "ml-2 not-italic font-sans normal-case tracking-normal text-amber-400",
|
|
49253
|
+
children: "(stale \u2014 widget no longer requests this; consider revoking)"
|
|
49249
49254
|
})]
|
|
49250
49255
|
}, item);
|
|
49251
49256
|
})]
|
|
49252
49257
|
});
|
|
49253
49258
|
};
|
|
49254
49259
|
|
|
49260
|
+
/**
|
|
49261
|
+
* True when the granted entry has at least one item AND every granted
|
|
49262
|
+
* item is missing from the current declared block (i.e. all of this
|
|
49263
|
+
* server's grants are unused by the current manifest). Used to surface
|
|
49264
|
+
* a "this whole server's grant looks unused" suggestion at the row level.
|
|
49265
|
+
*/
|
|
49266
|
+
function isServerEntirelyStale(decl, grant) {
|
|
49267
|
+
if (!grant) return false;
|
|
49268
|
+
var declTools = new Set(decl.tools || []);
|
|
49269
|
+
var declRead = new Set(decl.readPaths || []);
|
|
49270
|
+
var declWrite = new Set(decl.writePaths || []);
|
|
49271
|
+
var grantedTools = grant.tools || [];
|
|
49272
|
+
var grantedRead = grant.readPaths || [];
|
|
49273
|
+
var grantedWrite = grant.writePaths || [];
|
|
49274
|
+
var total = grantedTools.length + grantedRead.length + grantedWrite.length;
|
|
49275
|
+
if (total === 0) return false;
|
|
49276
|
+
var stale = grantedTools.every(function (t) {
|
|
49277
|
+
return !declTools.has(t);
|
|
49278
|
+
}) && grantedRead.every(function (p) {
|
|
49279
|
+
return !declRead.has(p);
|
|
49280
|
+
}) && grantedWrite.every(function (p) {
|
|
49281
|
+
return !declWrite.has(p);
|
|
49282
|
+
});
|
|
49283
|
+
return stale;
|
|
49284
|
+
}
|
|
49285
|
+
|
|
49255
49286
|
/**
|
|
49256
49287
|
* Renders a small badge showing how the user got to this grant. Helps
|
|
49257
49288
|
* the user audit grants that were approved against a scanner guess
|
|
@@ -49355,6 +49386,31 @@ var EXAMPLE_FIXTURES = [{
|
|
|
49355
49386
|
}
|
|
49356
49387
|
}
|
|
49357
49388
|
}
|
|
49389
|
+
}, {
|
|
49390
|
+
caption: "Stale grant — the widget upgraded and dropped readPaths from its manifest, but the user's grant is still present.",
|
|
49391
|
+
widgetId: "@example/upgraded-widget",
|
|
49392
|
+
hasManifest: true,
|
|
49393
|
+
grantOrigin: "declared",
|
|
49394
|
+
declared: {
|
|
49395
|
+
// Manifest now declares only the tool, no paths.
|
|
49396
|
+
servers: {
|
|
49397
|
+
filesystem: {
|
|
49398
|
+
tools: ["read_file"],
|
|
49399
|
+
readPaths: [],
|
|
49400
|
+
writePaths: []
|
|
49401
|
+
}
|
|
49402
|
+
}
|
|
49403
|
+
},
|
|
49404
|
+
granted: {
|
|
49405
|
+
grantOrigin: "declared",
|
|
49406
|
+
servers: {
|
|
49407
|
+
filesystem: {
|
|
49408
|
+
tools: ["read_file"],
|
|
49409
|
+
readPaths: ["~/Documents/old-notes"],
|
|
49410
|
+
writePaths: []
|
|
49411
|
+
}
|
|
49412
|
+
}
|
|
49413
|
+
}
|
|
49358
49414
|
}];
|
|
49359
49415
|
var noop = function noop() {};
|
|
49360
49416
|
|