@kitsy/cnos 1.8.4 → 1.9.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.
@@ -1857,7 +1857,7 @@ function getNamespaceDefinition(manifest, namespaceOrKey) {
1857
1857
  const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
1858
1858
  return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
1859
1859
  }
1860
- function ensureProjectionAllowed(manifest, key, target) {
1860
+ function ensureProjectionAllowed(manifest, key, target, options = {}) {
1861
1861
  const namespace = getNamespaceNameForKey(key);
1862
1862
  const definition = getNamespaceDefinition(manifest, namespace);
1863
1863
  if (definition.kind !== "data") {
@@ -1866,6 +1866,9 @@ function ensureProjectionAllowed(manifest, key, target) {
1866
1866
  );
1867
1867
  }
1868
1868
  if (definition.sensitive) {
1869
+ if (target === "env" && namespace === "secret" && options.allowSecretForEnv) {
1870
+ return;
1871
+ }
1869
1872
  throw new CnosSecurityError(
1870
1873
  `Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
1871
1874
  );
@@ -3279,7 +3282,7 @@ function normalizeEnvValue(value) {
3279
3282
  return JSON.stringify(value);
3280
3283
  }
3281
3284
  function toEnv(graph, manifest, options = {}, helpers = {}) {
3282
- const includeSecrets = options.includeSecrets ?? true;
3285
+ const includeSecrets = options.includeSecrets ?? false;
3283
3286
  const output = {};
3284
3287
  const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
3285
3288
  ([left], [right]) => left.localeCompare(right)
@@ -3290,19 +3293,24 @@ function toEnv(graph, manifest, options = {}, helpers = {}) {
3290
3293
  continue;
3291
3294
  }
3292
3295
  const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
3293
- if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3294
- continue;
3295
- }
3296
- if (entry.namespace === "secret" && !includeSecrets) {
3296
+ const isSecretNamespace = entry.namespace === "secret";
3297
+ if (namespaceDefinition.kind !== "data") {
3297
3298
  continue;
3298
3299
  }
3299
- if (isSecretReference(entry.value)) {
3300
+ if (isSecretNamespace) {
3301
+ if (!includeSecrets) {
3302
+ continue;
3303
+ }
3304
+ } else if (!namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3300
3305
  continue;
3301
3306
  }
3302
3307
  const value = helpers.read ? helpers.read(logicalKey) : entry.value;
3303
3308
  if (value === void 0) {
3304
3309
  continue;
3305
3310
  }
3311
+ if (isSecretReference(value) || !isSecretNamespace && isSecretReference(entry.value)) {
3312
+ continue;
3313
+ }
3306
3314
  output[envVar] = normalizeEnvValue(value);
3307
3315
  }
3308
3316
  return output;
@@ -3712,7 +3720,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3712
3720
  // package.json
3713
3721
  var package_default = {
3714
3722
  name: "@kitsy/cnos",
3715
- version: "1.8.4",
3723
+ version: "1.9.1",
3716
3724
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3717
3725
  type: "module",
3718
3726
  main: "./dist/index.cjs",
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  createCnos
3
- } from "../chunk-O2KTQ6PB.js";
4
- import "../chunk-JQLV4OQU.js";
5
- import "../chunk-4AAA2RHV.js";
6
- import "../chunk-UMVFSHP2.js";
7
- import "../chunk-N5DX5QEB.js";
8
- import "../chunk-36AR262B.js";
9
- import "../chunk-EJT2VJTM.js";
3
+ } from "../chunk-MYG6EPUX.js";
4
+ import "../chunk-LURQ4LAK.js";
5
+ import "../chunk-A2WG3ZKW.js";
6
+ import "../chunk-L7JVECPE.js";
7
+ import "../chunk-6QQPHDUI.js";
8
+ import "../chunk-7JZO6XN3.js";
9
+ import "../chunk-2JBA2LXU.js";
10
10
  import {
11
11
  CnosManifestError,
12
12
  createSecretVaultProvider,
13
13
  isSecretReference
14
- } from "../chunk-ZH5QZQ7C.js";
14
+ } from "../chunk-7KVM5PUW.js";
15
15
 
16
16
  // src/build/index.ts
17
17
  async function resolveBrowserData(options = {}) {
@@ -2,7 +2,7 @@ import {
2
2
  envVarToLogicalKey,
3
3
  resolveWorkspaceScopedPath,
4
4
  toPortablePath
5
- } from "./chunk-ZH5QZQ7C.js";
5
+ } from "./chunk-7KVM5PUW.js";
6
6
 
7
7
  // ../../plugins/dotenv/src/index.ts
8
8
  import { readFile } from "fs/promises";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  applySchemaRules
3
- } from "./chunk-ZH5QZQ7C.js";
3
+ } from "./chunk-7KVM5PUW.js";
4
4
 
5
5
  // ../../plugins/basic-schema/src/index.ts
6
6
  function createBasicSchemaPlugin() {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  joinConfigPath
3
- } from "./chunk-ZH5QZQ7C.js";
3
+ } from "./chunk-7KVM5PUW.js";
4
4
 
5
5
  // ../../plugins/cli-args/src/index.ts
6
6
  var CLI_ARGS_PLUGIN_ID = "@kitsy/cnos/plugins/cli-args";
@@ -1705,7 +1705,7 @@ function getNamespaceDefinition(manifest, namespaceOrKey) {
1705
1705
  const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
1706
1706
  return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
1707
1707
  }
1708
- function ensureProjectionAllowed(manifest, key, target) {
1708
+ function ensureProjectionAllowed(manifest, key, target, options = {}) {
1709
1709
  const namespace = getNamespaceNameForKey(key);
1710
1710
  const definition = getNamespaceDefinition(manifest, namespace);
1711
1711
  if (definition.kind !== "data") {
@@ -1714,6 +1714,9 @@ function ensureProjectionAllowed(manifest, key, target) {
1714
1714
  );
1715
1715
  }
1716
1716
  if (definition.sensitive) {
1717
+ if (target === "env" && namespace === "secret" && options.allowSecretForEnv) {
1718
+ return;
1719
+ }
1717
1720
  throw new CnosSecurityError(
1718
1721
  `Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
1719
1722
  );
@@ -2505,7 +2508,7 @@ function normalizeEnvValue(value) {
2505
2508
  return JSON.stringify(value);
2506
2509
  }
2507
2510
  function toEnv(graph, manifest, options = {}, helpers = {}) {
2508
- const includeSecrets = options.includeSecrets ?? true;
2511
+ const includeSecrets = options.includeSecrets ?? false;
2509
2512
  const output = {};
2510
2513
  const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
2511
2514
  ([left], [right]) => left.localeCompare(right)
@@ -2516,19 +2519,24 @@ function toEnv(graph, manifest, options = {}, helpers = {}) {
2516
2519
  continue;
2517
2520
  }
2518
2521
  const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
2519
- if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
2520
- continue;
2521
- }
2522
- if (entry.namespace === "secret" && !includeSecrets) {
2522
+ const isSecretNamespace = entry.namespace === "secret";
2523
+ if (namespaceDefinition.kind !== "data") {
2523
2524
  continue;
2524
2525
  }
2525
- if (isSecretReference(entry.value)) {
2526
+ if (isSecretNamespace) {
2527
+ if (!includeSecrets) {
2528
+ continue;
2529
+ }
2530
+ } else if (!namespaceDefinition.shareable || namespaceDefinition.sensitive) {
2526
2531
  continue;
2527
2532
  }
2528
2533
  const value = helpers.read ? helpers.read(logicalKey) : entry.value;
2529
2534
  if (value === void 0) {
2530
2535
  continue;
2531
2536
  }
2537
+ if (isSecretReference(value) || !isSecretNamespace && isSecretReference(entry.value)) {
2538
+ continue;
2539
+ }
2532
2540
  output[envVar] = normalizeEnvValue(value);
2533
2541
  }
2534
2542
  return output;
@@ -4,7 +4,7 @@ import {
4
4
  isSecretReference,
5
5
  parseYaml,
6
6
  toPortablePath
7
- } from "./chunk-ZH5QZQ7C.js";
7
+ } from "./chunk-7KVM5PUW.js";
8
8
 
9
9
  // ../../plugins/filesystem/src/helpers.ts
10
10
  import { readdir } from "fs/promises";
@@ -3,7 +3,7 @@ import {
3
3
  graphRequiresSecretHydration,
4
4
  readRuntimeGraphFromEnv,
5
5
  readServerProjectionFromEnv
6
- } from "./chunk-DL5G3QSZ.js";
6
+ } from "./chunk-NVFACB64.js";
7
7
  import {
8
8
  createCnos,
9
9
  getBootstrappedSecretHydrationRequired,
@@ -12,7 +12,7 @@ import {
12
12
  setBootstrappedSecretHydrationRequired,
13
13
  setSingletonReady,
14
14
  setSingletonRuntime
15
- } from "./chunk-O2KTQ6PB.js";
15
+ } from "./chunk-MYG6EPUX.js";
16
16
  import {
17
17
  createDefaultRuntimeProviders,
18
18
  createDerivedRuntimeSupport,
@@ -28,7 +28,7 @@ import {
28
28
  toLogicalKey,
29
29
  toNamespaceObject,
30
30
  toPublicEnv
31
- } from "./chunk-ZH5QZQ7C.js";
31
+ } from "./chunk-7KVM5PUW.js";
32
32
 
33
33
  // src/runtime/index.ts
34
34
  import { existsSync, readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  envVarToLogicalKey
3
- } from "./chunk-ZH5QZQ7C.js";
3
+ } from "./chunk-7KVM5PUW.js";
4
4
 
5
5
  // ../../plugins/process-env/src/index.ts
6
6
  var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toEnv,
3
3
  toPublicEnv
4
- } from "./chunk-ZH5QZQ7C.js";
4
+ } from "./chunk-7KVM5PUW.js";
5
5
 
6
6
  // ../../plugins/env-export/src/index.ts
7
7
  function createEnvExportPlugin() {
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  createEnvExportPlugin,
3
3
  createPublicEnvExportPlugin
4
- } from "./chunk-JQLV4OQU.js";
4
+ } from "./chunk-LURQ4LAK.js";
5
5
  import {
6
6
  createFilesystemSecretsPlugin,
7
7
  createFilesystemValuesPlugin
8
- } from "./chunk-4AAA2RHV.js";
8
+ } from "./chunk-A2WG3ZKW.js";
9
9
  import {
10
10
  createProcessEnvPlugin
11
- } from "./chunk-UMVFSHP2.js";
11
+ } from "./chunk-L7JVECPE.js";
12
12
  import {
13
13
  createBasicSchemaPlugin
14
- } from "./chunk-N5DX5QEB.js";
14
+ } from "./chunk-6QQPHDUI.js";
15
15
  import {
16
16
  createCliArgsPlugin
17
- } from "./chunk-36AR262B.js";
17
+ } from "./chunk-7JZO6XN3.js";
18
18
  import {
19
19
  createDotenvPlugin
20
- } from "./chunk-EJT2VJTM.js";
20
+ } from "./chunk-2JBA2LXU.js";
21
21
  import {
22
22
  createCnos,
23
23
  createProvenanceInspector
24
- } from "./chunk-ZH5QZQ7C.js";
24
+ } from "./chunk-7KVM5PUW.js";
25
25
 
26
26
  // src/defaultPlugins.ts
27
27
  function defaultPlugins() {
@@ -68,7 +68,7 @@ function setBootstrappedSecretHydrationRequired(value) {
68
68
  // package.json
69
69
  var package_default = {
70
70
  name: "@kitsy/cnos",
71
- version: "1.8.4",
71
+ version: "1.9.1",
72
72
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
73
73
  type: "module",
74
74
  main: "./dist/index.cjs",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSecretReference
3
- } from "./chunk-ZH5QZQ7C.js";
3
+ } from "./chunk-7KVM5PUW.js";
4
4
 
5
5
  // src/runtime/bootstrap.ts
6
6
  import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
@@ -1859,7 +1859,7 @@ function getNamespaceDefinition(manifest, namespaceOrKey) {
1859
1859
  const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
1860
1860
  return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
1861
1861
  }
1862
- function ensureProjectionAllowed(manifest, key, target) {
1862
+ function ensureProjectionAllowed(manifest, key, target, options = {}) {
1863
1863
  const namespace = getNamespaceNameForKey(key);
1864
1864
  const definition = getNamespaceDefinition(manifest, namespace);
1865
1865
  if (definition.kind !== "data") {
@@ -1868,6 +1868,9 @@ function ensureProjectionAllowed(manifest, key, target) {
1868
1868
  );
1869
1869
  }
1870
1870
  if (definition.sensitive) {
1871
+ if (target === "env" && namespace === "secret" && options.allowSecretForEnv) {
1872
+ return;
1873
+ }
1871
1874
  throw new CnosSecurityError(
1872
1875
  `Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
1873
1876
  );
@@ -3281,7 +3284,7 @@ function normalizeEnvValue(value) {
3281
3284
  return JSON.stringify(value);
3282
3285
  }
3283
3286
  function toEnv(graph, manifest, options = {}, helpers = {}) {
3284
- const includeSecrets = options.includeSecrets ?? true;
3287
+ const includeSecrets = options.includeSecrets ?? false;
3285
3288
  const output = {};
3286
3289
  const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
3287
3290
  ([left], [right]) => left.localeCompare(right)
@@ -3292,19 +3295,24 @@ function toEnv(graph, manifest, options = {}, helpers = {}) {
3292
3295
  continue;
3293
3296
  }
3294
3297
  const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
3295
- if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3296
- continue;
3297
- }
3298
- if (entry.namespace === "secret" && !includeSecrets) {
3298
+ const isSecretNamespace = entry.namespace === "secret";
3299
+ if (namespaceDefinition.kind !== "data") {
3299
3300
  continue;
3300
3301
  }
3301
- if (isSecretReference(entry.value)) {
3302
+ if (isSecretNamespace) {
3303
+ if (!includeSecrets) {
3304
+ continue;
3305
+ }
3306
+ } else if (!namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3302
3307
  continue;
3303
3308
  }
3304
3309
  const value = helpers.read ? helpers.read(logicalKey) : entry.value;
3305
3310
  if (value === void 0) {
3306
3311
  continue;
3307
3312
  }
3313
+ if (isSecretReference(value) || !isSecretNamespace && isSecretReference(entry.value)) {
3314
+ continue;
3315
+ }
3308
3316
  output[envVar] = normalizeEnvValue(value);
3309
3317
  }
3310
3318
  return output;
@@ -3756,7 +3764,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3756
3764
  // package.json
3757
3765
  var package_default = {
3758
3766
  name: "@kitsy/cnos",
3759
- version: "1.8.4",
3767
+ version: "1.9.1",
3760
3768
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3761
3769
  type: "module",
3762
3770
  main: "./dist/index.cjs",
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  createCnos,
3
3
  defaultPlugins
4
- } from "../chunk-O2KTQ6PB.js";
5
- import "../chunk-JQLV4OQU.js";
6
- import "../chunk-4AAA2RHV.js";
7
- import "../chunk-UMVFSHP2.js";
8
- import "../chunk-N5DX5QEB.js";
9
- import "../chunk-36AR262B.js";
10
- import "../chunk-EJT2VJTM.js";
4
+ } from "../chunk-MYG6EPUX.js";
5
+ import "../chunk-LURQ4LAK.js";
6
+ import "../chunk-A2WG3ZKW.js";
7
+ import "../chunk-L7JVECPE.js";
8
+ import "../chunk-6QQPHDUI.js";
9
+ import "../chunk-7JZO6XN3.js";
10
+ import "../chunk-2JBA2LXU.js";
11
11
  import {
12
12
  planDump,
13
13
  toEnv,
14
14
  toPublicEnv,
15
15
  writeDump
16
- } from "../chunk-ZH5QZQ7C.js";
16
+ } from "../chunk-7KVM5PUW.js";
17
17
  export {
18
18
  createCnos,
19
19
  defaultPlugins,
package/dist/index.cjs CHANGED
@@ -1859,7 +1859,7 @@ function getNamespaceDefinition(manifest, namespaceOrKey) {
1859
1859
  const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
1860
1860
  return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
1861
1861
  }
1862
- function ensureProjectionAllowed(manifest, key, target) {
1862
+ function ensureProjectionAllowed(manifest, key, target, options = {}) {
1863
1863
  const namespace = getNamespaceNameForKey(key);
1864
1864
  const definition = getNamespaceDefinition(manifest, namespace);
1865
1865
  if (definition.kind !== "data") {
@@ -1868,6 +1868,9 @@ function ensureProjectionAllowed(manifest, key, target) {
1868
1868
  );
1869
1869
  }
1870
1870
  if (definition.sensitive) {
1871
+ if (target === "env" && namespace === "secret" && options.allowSecretForEnv) {
1872
+ return;
1873
+ }
1871
1874
  throw new CnosSecurityError(
1872
1875
  `Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
1873
1876
  );
@@ -3281,7 +3284,7 @@ function normalizeEnvValue(value) {
3281
3284
  return JSON.stringify(value);
3282
3285
  }
3283
3286
  function toEnv(graph, manifest, options = {}, helpers = {}) {
3284
- const includeSecrets = options.includeSecrets ?? true;
3287
+ const includeSecrets = options.includeSecrets ?? false;
3285
3288
  const output = {};
3286
3289
  const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
3287
3290
  ([left], [right]) => left.localeCompare(right)
@@ -3292,19 +3295,24 @@ function toEnv(graph, manifest, options = {}, helpers = {}) {
3292
3295
  continue;
3293
3296
  }
3294
3297
  const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
3295
- if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3296
- continue;
3297
- }
3298
- if (entry.namespace === "secret" && !includeSecrets) {
3298
+ const isSecretNamespace = entry.namespace === "secret";
3299
+ if (namespaceDefinition.kind !== "data") {
3299
3300
  continue;
3300
3301
  }
3301
- if (isSecretReference(entry.value)) {
3302
+ if (isSecretNamespace) {
3303
+ if (!includeSecrets) {
3304
+ continue;
3305
+ }
3306
+ } else if (!namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3302
3307
  continue;
3303
3308
  }
3304
3309
  const value = helpers.read ? helpers.read(logicalKey) : entry.value;
3305
3310
  if (value === void 0) {
3306
3311
  continue;
3307
3312
  }
3313
+ if (isSecretReference(value) || !isSecretNamespace && isSecretReference(entry.value)) {
3314
+ continue;
3315
+ }
3308
3316
  output[envVar] = normalizeEnvValue(value);
3309
3317
  }
3310
3318
  return output;
@@ -3714,7 +3722,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3714
3722
  // package.json
3715
3723
  var package_default = {
3716
3724
  name: "@kitsy/cnos",
3717
- version: "1.8.4",
3725
+ version: "1.9.1",
3718
3726
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3719
3727
  type: "module",
3720
3728
  main: "./dist/index.cjs",
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  runtime_default
3
- } from "./chunk-LDFKY65G.js";
4
- import "./chunk-DL5G3QSZ.js";
5
- import "./chunk-O2KTQ6PB.js";
6
- import "./chunk-JQLV4OQU.js";
7
- import "./chunk-4AAA2RHV.js";
8
- import "./chunk-UMVFSHP2.js";
9
- import "./chunk-N5DX5QEB.js";
10
- import "./chunk-36AR262B.js";
11
- import "./chunk-EJT2VJTM.js";
12
- import "./chunk-ZH5QZQ7C.js";
3
+ } from "./chunk-L6ZMJPA6.js";
4
+ import "./chunk-NVFACB64.js";
5
+ import "./chunk-MYG6EPUX.js";
6
+ import "./chunk-LURQ4LAK.js";
7
+ import "./chunk-A2WG3ZKW.js";
8
+ import "./chunk-L7JVECPE.js";
9
+ import "./chunk-6QQPHDUI.js";
10
+ import "./chunk-7JZO6XN3.js";
11
+ import "./chunk-2JBA2LXU.js";
12
+ import "./chunk-7KVM5PUW.js";
13
13
  export {
14
14
  runtime_default as cnos,
15
15
  runtime_default as default
package/dist/internal.cjs CHANGED
@@ -1391,7 +1391,7 @@ function getNamespaceDefinition(manifest, namespaceOrKey) {
1391
1391
  const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
1392
1392
  return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
1393
1393
  }
1394
- function ensureProjectionAllowed(manifest, key, target) {
1394
+ function ensureProjectionAllowed(manifest, key, target, options = {}) {
1395
1395
  const namespace = getNamespaceNameForKey(key);
1396
1396
  const definition = getNamespaceDefinition(manifest, namespace);
1397
1397
  if (definition.kind !== "data") {
@@ -1400,6 +1400,9 @@ function ensureProjectionAllowed(manifest, key, target) {
1400
1400
  );
1401
1401
  }
1402
1402
  if (definition.sensitive) {
1403
+ if (target === "env" && namespace === "secret" && options.allowSecretForEnv) {
1404
+ return;
1405
+ }
1403
1406
  throw new CnosSecurityError(
1404
1407
  `Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
1405
1408
  );
@@ -24,8 +24,11 @@ declare function writeKeychain(entry: string, value: string): Promise<void>;
24
24
  declare function loadManifest(options?: LoadManifestOptions): Promise<LoadedManifest>;
25
25
 
26
26
  type ProjectionTarget = 'public' | 'env';
27
+ interface ProjectionPolicyOptions {
28
+ allowSecretForEnv?: boolean;
29
+ }
27
30
  declare function getNamespaceDefinition(manifest: NormalizedManifest, namespaceOrKey: string): NamespaceDefinition;
28
- declare function ensureProjectionAllowed(manifest: NormalizedManifest, key: LogicalKey, target: ProjectionTarget): void;
31
+ declare function ensureProjectionAllowed(manifest: NormalizedManifest, key: LogicalKey, target: ProjectionTarget, options?: ProjectionPolicyOptions): void;
29
32
 
30
33
  declare function resolveVaultAuth(vaultId: string, definition: VaultDefinition, processEnv?: Record<string, string | undefined>): Promise<VaultAuthConfig>;
31
34
 
@@ -24,8 +24,11 @@ declare function writeKeychain(entry: string, value: string): Promise<void>;
24
24
  declare function loadManifest(options?: LoadManifestOptions): Promise<LoadedManifest>;
25
25
 
26
26
  type ProjectionTarget = 'public' | 'env';
27
+ interface ProjectionPolicyOptions {
28
+ allowSecretForEnv?: boolean;
29
+ }
27
30
  declare function getNamespaceDefinition(manifest: NormalizedManifest, namespaceOrKey: string): NamespaceDefinition;
28
- declare function ensureProjectionAllowed(manifest: NormalizedManifest, key: LogicalKey, target: ProjectionTarget): void;
31
+ declare function ensureProjectionAllowed(manifest: NormalizedManifest, key: LogicalKey, target: ProjectionTarget, options?: ProjectionPolicyOptions): void;
29
32
 
30
33
  declare function resolveVaultAuth(vaultId: string, definition: VaultDefinition, processEnv?: Record<string, string | undefined>): Promise<VaultAuthConfig>;
31
34
 
package/dist/internal.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  serializeRuntimeGraph,
12
12
  serializeSecretPayload,
13
13
  serializeServerProjection
14
- } from "./chunk-DL5G3QSZ.js";
14
+ } from "./chunk-NVFACB64.js";
15
15
  import {
16
16
  CnosAuthenticationError,
17
17
  CnosSecurityError,
@@ -64,7 +64,7 @@ import {
64
64
  writeLocalSecret,
65
65
  writeRemoteRootCacheMetadata,
66
66
  writeVaultSessionKey
67
- } from "./chunk-ZH5QZQ7C.js";
67
+ } from "./chunk-7KVM5PUW.js";
68
68
 
69
69
  // src/codegen/generateTypes.ts
70
70
  function toPascalCase(value) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createBasicSchemaPlugin
3
- } from "../chunk-N5DX5QEB.js";
4
- import "../chunk-ZH5QZQ7C.js";
3
+ } from "../chunk-6QQPHDUI.js";
4
+ import "../chunk-7KVM5PUW.js";
5
5
  export {
6
6
  createBasicSchemaPlugin
7
7
  };
@@ -2,8 +2,8 @@ import {
2
2
  cliArgEntriesFromArgs,
3
3
  createCliArgsPlugin,
4
4
  parseCliArgs
5
- } from "../chunk-36AR262B.js";
6
- import "../chunk-ZH5QZQ7C.js";
5
+ } from "../chunk-7JZO6XN3.js";
6
+ import "../chunk-7KVM5PUW.js";
7
7
  export {
8
8
  cliArgEntriesFromArgs,
9
9
  createCliArgsPlugin,
@@ -2,8 +2,8 @@ import {
2
2
  createDotenvPlugin,
3
3
  dotenvEntriesFromObject,
4
4
  parseDotenv
5
- } from "../chunk-EJT2VJTM.js";
6
- import "../chunk-ZH5QZQ7C.js";
5
+ } from "../chunk-2JBA2LXU.js";
6
+ import "../chunk-7KVM5PUW.js";
7
7
  export {
8
8
  createDotenvPlugin,
9
9
  dotenvEntriesFromObject,
@@ -174,7 +174,7 @@ function normalizeEnvValue(value) {
174
174
  return JSON.stringify(value);
175
175
  }
176
176
  function toEnv(graph, manifest, options = {}, helpers = {}) {
177
- const includeSecrets = options.includeSecrets ?? true;
177
+ const includeSecrets = options.includeSecrets ?? false;
178
178
  const output = {};
179
179
  const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
180
180
  ([left], [right]) => left.localeCompare(right)
@@ -185,19 +185,24 @@ function toEnv(graph, manifest, options = {}, helpers = {}) {
185
185
  continue;
186
186
  }
187
187
  const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
188
- if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
188
+ const isSecretNamespace = entry.namespace === "secret";
189
+ if (namespaceDefinition.kind !== "data") {
189
190
  continue;
190
191
  }
191
- if (entry.namespace === "secret" && !includeSecrets) {
192
- continue;
193
- }
194
- if (isSecretReference(entry.value)) {
192
+ if (isSecretNamespace) {
193
+ if (!includeSecrets) {
194
+ continue;
195
+ }
196
+ } else if (!namespaceDefinition.shareable || namespaceDefinition.sensitive) {
195
197
  continue;
196
198
  }
197
199
  const value = helpers.read ? helpers.read(logicalKey) : entry.value;
198
200
  if (value === void 0) {
199
201
  continue;
200
202
  }
203
+ if (isSecretReference(value) || !isSecretNamespace && isSecretReference(entry.value)) {
204
+ continue;
205
+ }
201
206
  output[envVar] = normalizeEnvValue(value);
202
207
  }
203
208
  return output;
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createEnvExportPlugin,
3
3
  createPublicEnvExportPlugin
4
- } from "../chunk-JQLV4OQU.js";
4
+ } from "../chunk-LURQ4LAK.js";
5
5
  import {
6
6
  toEnv,
7
7
  toPublicEnv
8
- } from "../chunk-ZH5QZQ7C.js";
8
+ } from "../chunk-7KVM5PUW.js";
9
9
  export {
10
10
  createEnvExportPlugin,
11
11
  createPublicEnvExportPlugin,
@@ -5,8 +5,8 @@ import {
5
5
  filesystemSecretsReader,
6
6
  filesystemValuesReader,
7
7
  yamlObjectToEntries
8
- } from "../chunk-4AAA2RHV.js";
9
- import "../chunk-ZH5QZQ7C.js";
8
+ } from "../chunk-A2WG3ZKW.js";
9
+ import "../chunk-7KVM5PUW.js";
10
10
  export {
11
11
  collectFilesystemLayerFiles,
12
12
  createFilesystemSecretsPlugin,
@@ -2,8 +2,8 @@ import {
2
2
  createProcessEnvPlugin,
3
3
  processEnvEntriesFromObject,
4
4
  processNamespaceEntriesFromContext
5
- } from "../chunk-UMVFSHP2.js";
6
- import "../chunk-ZH5QZQ7C.js";
5
+ } from "../chunk-L7JVECPE.js";
6
+ import "../chunk-7KVM5PUW.js";
7
7
  export {
8
8
  createProcessEnvPlugin,
9
9
  processEnvEntriesFromObject,
@@ -1856,7 +1856,7 @@ function getNamespaceDefinition(manifest, namespaceOrKey) {
1856
1856
  const namespace = namespaceOrKey.includes(".") ? getNamespaceNameForKey(namespaceOrKey) : namespaceOrKey;
1857
1857
  return manifest.namespaces[namespace] ?? DEFAULT_DATA_NAMESPACE;
1858
1858
  }
1859
- function ensureProjectionAllowed(manifest, key, target) {
1859
+ function ensureProjectionAllowed(manifest, key, target, options = {}) {
1860
1860
  const namespace = getNamespaceNameForKey(key);
1861
1861
  const definition = getNamespaceDefinition(manifest, namespace);
1862
1862
  if (definition.kind !== "data") {
@@ -1865,6 +1865,9 @@ function ensureProjectionAllowed(manifest, key, target) {
1865
1865
  );
1866
1866
  }
1867
1867
  if (definition.sensitive) {
1868
+ if (target === "env" && namespace === "secret" && options.allowSecretForEnv) {
1869
+ return;
1870
+ }
1868
1871
  throw new CnosSecurityError(
1869
1872
  `Cannot promote ${key} to ${target} because namespace "${namespace}" is sensitive.`
1870
1873
  );
@@ -3278,7 +3281,7 @@ function normalizeEnvValue(value) {
3278
3281
  return JSON.stringify(value);
3279
3282
  }
3280
3283
  function toEnv(graph, manifest, options = {}, helpers = {}) {
3281
- const includeSecrets = options.includeSecrets ?? true;
3284
+ const includeSecrets = options.includeSecrets ?? false;
3282
3285
  const output = {};
3283
3286
  const mappedEntries = Object.entries(manifest.envMapping.explicit).sort(
3284
3287
  ([left], [right]) => left.localeCompare(right)
@@ -3289,19 +3292,24 @@ function toEnv(graph, manifest, options = {}, helpers = {}) {
3289
3292
  continue;
3290
3293
  }
3291
3294
  const namespaceDefinition = getNamespaceDefinition(manifest, entry.namespace);
3292
- if (namespaceDefinition.kind !== "data" || !namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3293
- continue;
3294
- }
3295
- if (entry.namespace === "secret" && !includeSecrets) {
3295
+ const isSecretNamespace = entry.namespace === "secret";
3296
+ if (namespaceDefinition.kind !== "data") {
3296
3297
  continue;
3297
3298
  }
3298
- if (isSecretReference(entry.value)) {
3299
+ if (isSecretNamespace) {
3300
+ if (!includeSecrets) {
3301
+ continue;
3302
+ }
3303
+ } else if (!namespaceDefinition.shareable || namespaceDefinition.sensitive) {
3299
3304
  continue;
3300
3305
  }
3301
3306
  const value = helpers.read ? helpers.read(logicalKey) : entry.value;
3302
3307
  if (value === void 0) {
3303
3308
  continue;
3304
3309
  }
3310
+ if (isSecretReference(value) || !isSecretNamespace && isSecretReference(entry.value)) {
3311
+ continue;
3312
+ }
3305
3313
  output[envVar] = normalizeEnvValue(value);
3306
3314
  }
3307
3315
  return output;
@@ -3711,7 +3719,7 @@ function envVarToLogicalKey(envVar, config = {}) {
3711
3719
  // package.json
3712
3720
  var package_default = {
3713
3721
  name: "@kitsy/cnos",
3714
- version: "1.8.4",
3722
+ version: "1.9.1",
3715
3723
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
3716
3724
  type: "module",
3717
3725
  main: "./dist/index.cjs",
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  runtime_default
3
- } from "../chunk-LDFKY65G.js";
4
- import "../chunk-DL5G3QSZ.js";
5
- import "../chunk-O2KTQ6PB.js";
6
- import "../chunk-JQLV4OQU.js";
7
- import "../chunk-4AAA2RHV.js";
8
- import "../chunk-UMVFSHP2.js";
9
- import "../chunk-N5DX5QEB.js";
10
- import "../chunk-36AR262B.js";
11
- import "../chunk-EJT2VJTM.js";
12
- import "../chunk-ZH5QZQ7C.js";
3
+ } from "../chunk-L6ZMJPA6.js";
4
+ import "../chunk-NVFACB64.js";
5
+ import "../chunk-MYG6EPUX.js";
6
+ import "../chunk-LURQ4LAK.js";
7
+ import "../chunk-A2WG3ZKW.js";
8
+ import "../chunk-L7JVECPE.js";
9
+ import "../chunk-6QQPHDUI.js";
10
+ import "../chunk-7JZO6XN3.js";
11
+ import "../chunk-2JBA2LXU.js";
12
+ import "../chunk-7KVM5PUW.js";
13
13
  export {
14
14
  runtime_default as default
15
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitsy/cnos",
3
- "version": "1.8.4",
3
+ "version": "1.9.1",
4
4
  "description": "Batteries-included CNOS runtime package wired with the official plugins.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",