@norskvideo/ctl-product-template-schema 0.1.77 → 0.1.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@norskvideo/ctl-product-template-schema",
3
- "version": "0.1.77",
3
+ "version": "0.1.79",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,6 +44,10 @@
44
44
  "types": "./secrets/index.d.ts",
45
45
  "default": "./secrets/index.js"
46
46
  },
47
+ "./secrets/wire": {
48
+ "types": "./secrets/wire.d.ts",
49
+ "default": "./secrets/wire.js"
50
+ },
47
51
  "./product-channels": {
48
52
  "types": "./product-channels.d.ts",
49
53
  "default": "./product-channels.js"
@@ -1,4 +1,4 @@
1
- import { type Result } from "@norskvideo/ctl-foundation";
1
+ import { type Result } from "@norskvideo/ctl-foundation/browser";
2
2
  export declare const SECRET_REFERENCE_PREFIX = "secretref:";
3
3
  /** The NodeInventory capability a worker advertises when it resolves secret
4
4
  * references, so placement can keep a job whose parameters hold one off an
@@ -8,7 +8,9 @@
8
8
  // a script) and the worker that resolves them. The provider names a resolver
9
9
  // configured on the worker; the key is that provider's business and may hold
10
10
  // colons, slashes or ciphertext.
11
- import { err, ok } from "@norskvideo/ctl-foundation";
11
+ // The browser entry: the API contract reaches this module (the resolve
12
+ // endpoint's wire schemas), and the contract is loaded by the web UIs.
13
+ import { err, ok } from "@norskvideo/ctl-foundation/browser";
12
14
  export const SECRET_REFERENCE_PREFIX = "secretref:";
13
15
  /** The NodeInventory capability a worker advertises when it resolves secret
14
16
  * references, so placement can keep a job whose parameters hold one off an
@@ -2,6 +2,7 @@ import { type SecretResolver } from "./resolver.js";
2
2
  export { isSecretReference, parseSecretReference, SECRET_PLACEHOLDER, SECRET_REFERENCE_PREFIX, type SecretReference, secretReference, } from "../secret-references.js";
3
3
  export { activeSecretsProfile, type LoadSecretProvidersOptions, loadSecretProviders, PRODUCTION_SECRETS_PROFILE, RESERVED_PROVIDER_NAMES, SECRETS_PROFILE_ENV, SecretProfileSchema, type SecretProvidersConfig, SecretProvidersConfigSchema, secretsProfileNotice, } from "./config.js";
4
4
  export { type DelegateOptions, delegateResolver } from "./delegate.js";
5
+ export { INVALID_SECRET_NAME_MESSAGE, MAX_SECRET_VALUE_BYTES, validSecretName } from "./names.js";
5
6
  export { deobfuscate, isObfuscated, OBFUSCATED_PREFIX, obfuscate } from "./obfuscation.js";
6
7
  export type { SecretProvider, SecretProviders, SecretResolutionError } from "./provider.js";
7
8
  export { type AwsSecretProviderOptions, awsSecretProvider } from "./providers/aws.js";
package/secrets/index.js CHANGED
@@ -12,6 +12,7 @@ import { SECRETS_TOKEN_ENV, SECRETS_URL_ENV } from "./wire.js";
12
12
  export { isSecretReference, parseSecretReference, SECRET_PLACEHOLDER, SECRET_REFERENCE_PREFIX, secretReference, } from "../secret-references.js";
13
13
  export { activeSecretsProfile, loadSecretProviders, PRODUCTION_SECRETS_PROFILE, RESERVED_PROVIDER_NAMES, SECRETS_PROFILE_ENV, SecretProfileSchema, SecretProvidersConfigSchema, secretsProfileNotice, } from "./config.js";
14
14
  export { delegateResolver } from "./delegate.js";
15
+ export { INVALID_SECRET_NAME_MESSAGE, MAX_SECRET_VALUE_BYTES, validSecretName } from "./names.js";
15
16
  export { deobfuscate, isObfuscated, OBFUSCATED_PREFIX, obfuscate } from "./obfuscation.js";
16
17
  export { awsSecretProvider } from "./providers/aws.js";
17
18
  export { envSecretProvider } from "./providers/env.js";
@@ -0,0 +1,6 @@
1
+ /** The largest value a `norsk` store takes. */
2
+ export declare const MAX_SECRET_VALUE_BYTES: number;
3
+ /** Path-like: `/`-separated segments, so a tenant's secrets can sit under
4
+ * `tenants/<id>/` (the tenant policy's rule), and none of them `.` or `..`. */
5
+ export declare function validSecretName(name: string): boolean;
6
+ export declare const INVALID_SECRET_NAME_MESSAGE: string;
@@ -0,0 +1,18 @@
1
+ // A `norsk` secret's name, shared by every store that holds them (norsk-ctl's
2
+ // and norsk-mgr's, RFC 0011 §3.4) so a name one accepts the other does too.
3
+ /** The largest value a `norsk` store takes. */
4
+ export const MAX_SECRET_VALUE_BYTES = 64 * 1024;
5
+ const SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
6
+ const MAX_NAME = 256;
7
+ /** The resolve route's own path segment: the guard lets that path through
8
+ * unauthenticated, so no secret may be addressed by it. */
9
+ const RESERVED_NAMES = new Set(["resolve"]);
10
+ /** Path-like: `/`-separated segments, so a tenant's secrets can sit under
11
+ * `tenants/<id>/` (the tenant policy's rule), and none of them `.` or `..`. */
12
+ export function validSecretName(name) {
13
+ if (name.length === 0 || name.length > MAX_NAME || RESERVED_NAMES.has(name))
14
+ return false;
15
+ return name.split("/").every((s) => SEGMENT.test(s) && !/^\.+$/.test(s));
16
+ }
17
+ export const INVALID_SECRET_NAME_MESSAGE = "a secret's name is one or more '/'-separated segments of letters, digits, '.', '_' and '-', " +
18
+ `each starting with a letter or digit, at most ${MAX_NAME} characters, and not 'resolve'`;