pepr 2.0.2 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/build/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwFpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAoF/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/build/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyFpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAqF/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildAndDeploy.d.ts","sourceRoot":"","sources":["../../../src/cli/deploy/buildAndDeploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAKjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BvF;AACD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAQtF"}
1
+ {"version":3,"file":"buildAndDeploy.d.ts","sourceRoot":"","sources":["../../../src/cli/deploy/buildAndDeploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAKjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvF;AACD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAQtF"}
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CA+G/C"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAoH/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,MAAM,CAAC,OAAO,cAAc,OAAO,CAoElC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,MAAM,CAAC,OAAO,cAAc,OAAO,CA+DlC"}
@@ -0,0 +1,3 @@
1
+ export declare const ADMIN_RBAC_WARNING: string;
2
+ export declare function warnIfAdminRbac(rbacMode?: string): void;
3
+ //# sourceMappingURL=rbacModeWarning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbacModeWarning.d.ts","sourceRoot":"","sources":["../../src/cli/rbacModeWarning.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB,QAGiC,CAAC;AAEjE,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAIvD"}
package/dist/cli.js CHANGED
@@ -9676,7 +9676,7 @@ var packageJSON = {
9676
9676
  "!src/fixtures/**",
9677
9677
  "!dist/**/*.test.d.ts*"
9678
9678
  ],
9679
- version: "2.0.2",
9679
+ version: "2.0.3",
9680
9680
  main: "dist/lib.js",
9681
9681
  types: "dist/lib.d.ts",
9682
9682
  scripts: {
@@ -10083,6 +10083,16 @@ function handleModuleBuildError(e) {
10083
10083
 
10084
10084
  // src/cli/build/index.ts
10085
10085
  var import_path5 = require("path");
10086
+
10087
+ // src/cli/rbacModeWarning.ts
10088
+ var ADMIN_RBAC_WARNING = "Admin RBAC mode grants broad cluster-wide permissions. It is intended for demo/POC purposes only and should NOT be used in production. Use scoped RBAC mode for production workloads. See https://docs.pepr.dev/user-guide/rbac/ for more details.";
10089
+ function warnIfAdminRbac(rbacMode) {
10090
+ if (rbacMode !== "scoped") {
10091
+ logger_default.warn(ADMIN_RBAC_WARNING);
10092
+ }
10093
+ }
10094
+
10095
+ // src/cli/build/index.ts
10086
10096
  async function generateDeploymentAssets(buildResult, opts, outputDir) {
10087
10097
  const { cfg, path: path4 } = buildResult;
10088
10098
  const image = assignImage({
@@ -10186,6 +10196,7 @@ function build_default(program2) {
10186
10196
  logger_default.info(`Module built successfully at ${path4}`);
10187
10197
  return;
10188
10198
  }
10199
+ warnIfAdminRbac(determineRbacMode(opts, buildModuleResult.cfg));
10189
10200
  await generateDeploymentAssets(buildModuleResult, opts, outputDir);
10190
10201
  });
10191
10202
  }
@@ -10477,6 +10488,7 @@ async function buildAndDeployModule(image, force) {
10477
10488
  validateNamespaces(capability, webhook);
10478
10489
  }
10479
10490
  try {
10491
+ warnIfAdminRbac(builtModule.cfg.pepr.rbacMode);
10480
10492
  await webhook.deploy(deployWebhook, force, builtModule.cfg.pepr.webhookTimeout ?? 10);
10481
10493
  validateCapabilityNames(webhook.capabilities);
10482
10494
  await namespaceDeploymentsReady();
@@ -10547,11 +10559,16 @@ function dev_default(program2) {
10547
10559
  await import_fs10.promises.writeFile("insecure-tls.key", webhook.tls.pem.key);
10548
10560
  try {
10549
10561
  let program3;
10562
+ let hasWarnedAboutAdminRbac = false;
10550
10563
  const name2 = `pepr-${cfg.pepr.uuid}`;
10551
10564
  const scheduleStore = `pepr-${cfg.pepr.uuid}-schedule`;
10552
10565
  const store = `pepr-${cfg.pepr.uuid}-store`;
10553
10566
  const runFork = async () => {
10554
10567
  logger_default.info(`Running module ${path4}`);
10568
+ if (!hasWarnedAboutAdminRbac) {
10569
+ warnIfAdminRbac(cfg.pepr.rbacMode);
10570
+ hasWarnedAboutAdminRbac = true;
10571
+ }
10555
10572
  await webhook.deploy(deployWebhook, false, 30);
10556
10573
  try {
10557
10574
  validateCapabilityNames(webhook.capabilities);
@@ -10939,9 +10956,7 @@ function init_default() {
10939
10956
  doPostInitActions(dirName);
10940
10957
  }
10941
10958
  logger_default.info(`New Pepr module created at ${dirName}`);
10942
- logger_default.warn(
10943
- `The default RBAC mode (admin) generates a ClusterRole with cluster-admin level permissions for the hello-pepr capability. This is intended for demo/POC purposes only and should NOT be used in production.See https://docs.pepr.dev/user-guide/rbac/ for more details.`
10944
- );
10959
+ warnIfAdminRbac(packageJSON2.data.pepr.rbacMode);
10945
10960
  logger_default.info(`Open VSCode or your editor of choice in ${dirName} to get started!`);
10946
10961
  } catch (error) {
10947
10962
  throw new Error(`Error creating Pepr module:`, { cause: error });
@@ -78,7 +78,7 @@ var packageJSON = {
78
78
  "!src/fixtures/**",
79
79
  "!dist/**/*.test.d.ts*"
80
80
  ],
81
- version: "2.0.2",
81
+ version: "2.0.3",
82
82
  main: "dist/lib.js",
83
83
  types: "dist/lib.d.ts",
84
84
  scripts: {
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "!src/fixtures/**",
17
17
  "!dist/**/*.test.d.ts*"
18
18
  ],
19
- "version": "2.0.2",
19
+ "version": "2.0.3",
20
20
  "main": "dist/lib.js",
21
21
  "types": "dist/lib.d.ts",
22
22
  "scripts": {
@@ -19,6 +19,7 @@ import {
19
19
  import { buildModule, BuildModuleReturn } from "./buildModule";
20
20
  import Log from "../../lib/telemetry/logger";
21
21
  import { resolve } from "path";
22
+ import { warnIfAdminRbac } from "../rbacModeWarning";
22
23
 
23
24
  interface BuildOpts {
24
25
  customName?: string;
@@ -172,6 +173,7 @@ export default function (program: Command): void {
172
173
  return;
173
174
  }
174
175
 
176
+ warnIfAdminRbac(determineRbacMode(opts, buildModuleResult.cfg));
175
177
  await generateDeploymentAssets(buildModuleResult, opts, outputDir);
176
178
  });
177
179
  }
@@ -5,6 +5,7 @@ import { namespaceDeploymentsReady } from "../../lib/deploymentChecks";
5
5
  import { namespaceComplianceValidator, validateCapabilityNames } from "../../lib/helpers";
6
6
  import { CapabilityExport } from "../../lib/types";
7
7
  import { buildModule } from "../build/buildModule";
8
+ import { warnIfAdminRbac } from "../rbacModeWarning";
8
9
 
9
10
  export async function buildAndDeployModule(image: string, force: boolean): Promise<void> {
10
11
  const builtModule = await buildModule("dist", {});
@@ -24,6 +25,7 @@ export async function buildAndDeployModule(image: string, force: boolean): Promi
24
25
  validateNamespaces(capability, webhook);
25
26
  }
26
27
  try {
28
+ warnIfAdminRbac(builtModule.cfg.pepr.rbacMode);
27
29
  await webhook.deploy(deployWebhook, force, builtModule.cfg.pepr.webhookTimeout ?? 10);
28
30
 
29
31
  // wait for capabilities to be loaded and test names
package/src/cli/dev.ts CHANGED
@@ -13,6 +13,7 @@ import { deployWebhook } from "../lib/assets/deploy";
13
13
  import { promises as fs } from "fs";
14
14
  import { validateCapabilityNames } from "../lib/helpers";
15
15
  import Log from "../lib/telemetry/logger";
16
+ import { warnIfAdminRbac } from "./rbacModeWarning";
16
17
 
17
18
  export default function (program: Command): void {
18
19
  program
@@ -56,6 +57,7 @@ export default function (program: Command): void {
56
57
 
57
58
  try {
58
59
  let program: ChildProcess;
60
+ let hasWarnedAboutAdminRbac = false;
59
61
  const name = `pepr-${cfg.pepr.uuid}`;
60
62
  const scheduleStore = `pepr-${cfg.pepr.uuid}-schedule`;
61
63
  const store = `pepr-${cfg.pepr.uuid}-store`;
@@ -65,6 +67,10 @@ export default function (program: Command): void {
65
67
  Log.info(`Running module ${path}`);
66
68
 
67
69
  // Deploy the webhook with a 30 second timeout for debugging, don't force
70
+ if (!hasWarnedAboutAdminRbac) {
71
+ warnIfAdminRbac(cfg.pepr.rbacMode);
72
+ hasWarnedAboutAdminRbac = true;
73
+ }
68
74
  await webhook.deploy(deployWebhook, false, 30);
69
75
 
70
76
  try {
@@ -14,6 +14,7 @@ import { createProjectFiles } from "./createProjectFiles";
14
14
  import { v4 as uuidv4 } from "uuid";
15
15
  import Log from "../../lib/telemetry/logger";
16
16
  import { sanitizeResourceName } from "../../sdk/sdk";
17
+ import { warnIfAdminRbac } from "../rbacModeWarning";
17
18
 
18
19
  export default function (): Command {
19
20
  let response = {} as PromptOptions;
@@ -71,12 +72,7 @@ export default function (): Command {
71
72
  }
72
73
 
73
74
  Log.info(`New Pepr module created at ${dirName}`);
74
- Log.warn(
75
- `The default RBAC mode (admin) generates a ClusterRole with cluster-admin level ` +
76
- `permissions for the hello-pepr capability. This is intended for demo/POC purposes only ` +
77
- `and should NOT be used in production.` +
78
- `See https://docs.pepr.dev/user-guide/rbac/ for more details.`,
79
- );
75
+ warnIfAdminRbac(packageJSON.data.pepr.rbacMode);
80
76
  Log.info(`Open VSCode or your editor of choice in ${dirName} to get started!`);
81
77
  } catch (error) {
82
78
  throw new Error(`Error creating Pepr module:`, { cause: error });
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
+
4
+ import Log from "../lib/telemetry/logger";
5
+
6
+ export const ADMIN_RBAC_WARNING =
7
+ "Admin RBAC mode grants broad cluster-wide permissions. It is intended for demo/POC purposes " +
8
+ "only and should NOT be used in production. Use scoped RBAC mode for production workloads. " +
9
+ "See https://docs.pepr.dev/user-guide/rbac/ for more details.";
10
+
11
+ export function warnIfAdminRbac(rbacMode?: string): void {
12
+ if (rbacMode !== "scoped") {
13
+ Log.warn(ADMIN_RBAC_WARNING);
14
+ }
15
+ }