@cdot65/prisma-airs-cli 4.1.0 → 4.1.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.
Files changed (2) hide show
  1. package/dist/cli/index.js +22 -13
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -3604,6 +3604,16 @@ function registerScopedReads(root, name, description, select, options = {}) {
3604
3604
  return group;
3605
3605
  }
3606
3606
  var knownValues = (values) => values.join(", ");
3607
+ function redactApiKeyMaterial(value) {
3608
+ if (Array.isArray(value)) return value.map(redactApiKeyMaterial);
3609
+ if (value === null || typeof value !== "object") return value;
3610
+ return Object.fromEntries(
3611
+ Object.entries(value).map(([key, entry]) => [
3612
+ key,
3613
+ key === "key" ? "***" : redactApiKeyMaterial(entry)
3614
+ ])
3615
+ );
3616
+ }
3607
3617
  function parseNamedDate(value, flag) {
3608
3618
  try {
3609
3619
  return parseDateOption(value);
@@ -3666,23 +3676,22 @@ function registerApiKeys(root) {
3666
3676
  for (const kind of ["service", "user"]) {
3667
3677
  const group = showHelpOnEmpty(apiKeys.command(kind).description(`Manage ${kind} API keys`));
3668
3678
  const list = addReadOutput(
3669
- group.command("list").description(`List ${kind} API keys in a workspace (data plane)`).requiredOption("--workspace <uuid>", "Workspace UUID")
3679
+ group.command("list").description(`List ${kind} API keys in a workspace (data plane)`).requiredOption("--workspace <uuid>", "Workspace UUID").option("--reveal-sensitive", "Show API key material")
3670
3680
  );
3671
3681
  list.action(
3672
- (opts) => runList(
3673
- list,
3674
- opts,
3675
- `${kind} API keys`,
3676
- (client) => kind === "service" ? client.apiKeys.listService({ workspaceId: opts.workspace }) : client.apiKeys.listUser({ workspaceId: opts.workspace })
3677
- )
3682
+ (opts) => runList(list, opts, `${kind} API keys`, async (client) => {
3683
+ const result = await (kind === "service" ? client.apiKeys.listService({ workspaceId: opts.workspace }) : client.apiKeys.listUser({ workspaceId: opts.workspace }));
3684
+ return opts.revealSensitive ? result : redactApiKeyMaterial(result);
3685
+ })
3686
+ );
3687
+ const get = addReadOutput(
3688
+ group.command("get <id>").description(`Get one ${kind} API key`).option("--reveal-sensitive", "Show API key material")
3678
3689
  );
3679
- const get = addReadOutput(group.command("get <id>").description(`Get one ${kind} API key`));
3680
3690
  get.action(
3681
- (id, opts) => runDetail(
3682
- get,
3683
- opts,
3684
- (client) => kind === "service" ? client.apiKeys.getService(id) : client.apiKeys.getUser(id)
3685
- )
3691
+ (id, opts) => runDetail(get, opts, async (client) => {
3692
+ const result = await (kind === "service" ? client.apiKeys.getService(id) : client.apiKeys.getUser(id));
3693
+ return opts.revealSensitive ? result : redactApiKeyMaterial(result);
3694
+ })
3686
3695
  );
3687
3696
  const createFields = [
3688
3697
  { option: "alertEmails", path: "alert_emails", parse: parseCsvOption },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cdot65/prisma-airs-cli",
3
3
  "packageManager": "pnpm@10.6.5",
4
- "version": "4.1.0",
4
+ "version": "4.1.1",
5
5
  "description": "CLI and library for Palo Alto Prisma AIRS — guardrail refinement, AI red teaming, model security scanning, profile audits",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",