@naylence/runtime 0.4.8 → 0.4.10
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/browser/index.cjs +23 -118
- package/dist/browser/index.mjs +24 -118
- package/dist/cjs/naylence/fame/node/factory-commons.js +2 -3
- package/dist/cjs/naylence/fame/security/auth/policy/authorization-policy-definition.js +1 -1
- package/dist/cjs/naylence/fame/security/auth/policy/basic-authorization-policy.js +18 -59
- package/dist/cjs/naylence/fame/security/index.js +1 -2
- package/dist/cjs/naylence/fame/security/node-security-profile-factory.js +1 -52
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/node/factory-commons.js +2 -3
- package/dist/esm/naylence/fame/security/auth/policy/authorization-policy-definition.js +1 -1
- package/dist/esm/naylence/fame/security/auth/policy/basic-authorization-policy.js +18 -59
- package/dist/esm/naylence/fame/security/index.js +1 -1
- package/dist/esm/naylence/fame/security/node-security-profile-factory.js +0 -51
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +23 -118
- package/dist/node/index.mjs +24 -118
- package/dist/node/node.cjs +23 -118
- package/dist/node/node.mjs +24 -118
- package/dist/types/naylence/fame/security/auth/policy/authorization-policy-definition.d.ts +5 -1
- package/dist/types/naylence/fame/security/auth/policy/basic-authorization-policy.d.ts +0 -6
- package/dist/types/naylence/fame/security/index.d.ts +1 -1
- package/dist/types/naylence/fame/security/node-security-profile-factory.d.ts +0 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENV_VAR_JWKS_URL = exports.ENV_VAR_JWT_AUDIENCE = exports.ENV_VAR_JWT_ALGORITHM = exports.ENV_VAR_JWT_TRUSTED_ISSUER = exports.CREDENTIAL_PROVIDER_FACTORY_BASE_TYPE = exports.EdDSAEnvelopeSigner = exports.encodeUtf8 = exports.immutableHeaders = exports.frameDigest = exports.decodeBase64Url = exports.canonicalJson = exports.SigningConfigClass = exports.SECURITY_MANAGER_FACTORY_BASE_TYPE = exports.SECURITY_POLICY_FACTORY_BASE_TYPE = exports.KEY_STORE_FACTORY_BASE_TYPE = exports.ATTACHMENT_KEY_VALIDATOR_FACTORY_BASE_TYPE = exports.KEY_MANAGER_FACTORY_BASE_TYPE = exports.SecureChannelManagerFactory = exports.SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE = exports.ENCRYPTION_MANAGER_FACTORY_BASE_TYPE = exports.NoopTrustStoreProvider = exports.TrustStoreProviderFactory = exports.TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE = exports.CertificateManagerFactory = exports.CERTIFICATE_MANAGER_FACTORY_BASE_TYPE = exports.TokenProviderFactory = exports.TOKEN_PROVIDER_FACTORY_BASE_TYPE = exports.TokenVerifierFactory = exports.TOKEN_VERIFIER_FACTORY_BASE_TYPE = exports.TokenIssuerFactory = exports.TOKEN_ISSUER_FACTORY_BASE_TYPE = exports.AuthInjectionStrategyFactory = exports.AUTH_INJECTION_STRATEGY_FACTORY_BASE_TYPE = exports.AUTH_PROFILE_ENV_VAR_HMAC_SECRET = exports.AUTH_PROFILE_ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE = exports.AUTH_PROFILE_ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER = exports.AUTH_PROFILE_ENV_VAR_TRUSTED_CLIENT_SCOPE = exports.AUTH_PROFILE_ENV_VAR_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY = exports.AUTH_PROFILE_ENV_VAR_JWKS_URL = exports.AUTH_PROFILE_ENV_VAR_JWT_AUDIENCE = exports.AUTH_PROFILE_ENV_VAR_JWT_ALGORITHM = exports.AUTH_PROFILE_ENV_VAR_JWT_TRUSTED_ISSUER = exports.AUTH_PROFILE_NAME_NOOP = exports.AUTH_PROFILE_NAME_OAUTH2_CALLBACK = exports.AUTH_PROFILE_NAME_OAUTH2_GATED = exports.AUTH_PROFILE_NAME_OAUTH2 = exports.AUTH_PROFILE_NAME_DEFAULT = exports.AuthorizationProfileFactory = exports.AuthorizerFactory = exports.AUTHORIZER_FACTORY_BASE_TYPE = void 0;
|
|
4
|
-
exports.PROFILE_NAME_OPEN = exports.PROFILE_NAME_GATED_CALLBACK = exports.PROFILE_NAME_GATED = exports.PROFILE_NAME_OVERLAY_CALLBACK = exports.PROFILE_NAME_OVERLAY = exports.
|
|
4
|
+
exports.PROFILE_NAME_OPEN = exports.PROFILE_NAME_GATED_CALLBACK = exports.PROFILE_NAME_GATED = exports.PROFILE_NAME_OVERLAY_CALLBACK = exports.PROFILE_NAME_OVERLAY = exports.ENV_VAR_AUTHORIZATION_PROFILE = exports.ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE = exports.ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER = exports.ENV_VAR_HMAC_SECRET = exports.ENV_VAR_DEFAULT_ENCRYPTION_LEVEL = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
tslib_1.__exportStar(require("./auth/authorizer.js"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./auth/auth-identity.js"), exports);
|
|
@@ -130,7 +130,6 @@ Object.defineProperty(exports, "ENV_VAR_HMAC_SECRET", { enumerable: true, get: f
|
|
|
130
130
|
Object.defineProperty(exports, "ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER", { enumerable: true, get: function () { return node_security_profile_factory_js_1.ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER; } });
|
|
131
131
|
Object.defineProperty(exports, "ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE", { enumerable: true, get: function () { return node_security_profile_factory_js_1.ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE; } });
|
|
132
132
|
Object.defineProperty(exports, "ENV_VAR_AUTHORIZATION_PROFILE", { enumerable: true, get: function () { return node_security_profile_factory_js_1.ENV_VAR_AUTHORIZATION_PROFILE; } });
|
|
133
|
-
Object.defineProperty(exports, "PROFILE_NAME_STRICT_OVERLAY", { enumerable: true, get: function () { return node_security_profile_factory_js_1.PROFILE_NAME_STRICT_OVERLAY; } });
|
|
134
133
|
Object.defineProperty(exports, "PROFILE_NAME_OVERLAY", { enumerable: true, get: function () { return node_security_profile_factory_js_1.PROFILE_NAME_OVERLAY; } });
|
|
135
134
|
Object.defineProperty(exports, "PROFILE_NAME_OVERLAY_CALLBACK", { enumerable: true, get: function () { return node_security_profile_factory_js_1.PROFILE_NAME_OVERLAY_CALLBACK; } });
|
|
136
135
|
Object.defineProperty(exports, "PROFILE_NAME_GATED", { enumerable: true, get: function () { return node_security_profile_factory_js_1.PROFILE_NAME_GATED; } });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeSecurityProfileFactory = exports.FACTORY_META = exports.PROFILE_NAME_OPEN = exports.PROFILE_NAME_GATED_CALLBACK = exports.PROFILE_NAME_GATED = exports.PROFILE_NAME_OVERLAY_CALLBACK = exports.PROFILE_NAME_OVERLAY = exports.
|
|
3
|
+
exports.NodeSecurityProfileFactory = exports.FACTORY_META = exports.PROFILE_NAME_OPEN = exports.PROFILE_NAME_GATED_CALLBACK = exports.PROFILE_NAME_GATED = exports.PROFILE_NAME_OVERLAY_CALLBACK = exports.PROFILE_NAME_OVERLAY = exports.ENV_VAR_AUTHORIZATION_PROFILE = exports.ENV_VAR_TRUSTED_CLIENT_SCOPE = exports.ENV_VAR_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY = exports.ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE = exports.ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER = exports.ENV_VAR_HMAC_SECRET = exports.ENV_VAR_DEFAULT_ENCRYPTION_LEVEL = exports.ENV_VAR_JWKS_URL = exports.ENV_VAR_JWT_AUDIENCE = exports.ENV_VAR_JWT_ALGORITHM = exports.ENV_VAR_JWT_TRUSTED_ISSUER = void 0;
|
|
4
4
|
const factory_1 = require("@naylence/factory");
|
|
5
5
|
const security_manager_factory_js_1 = require("./security-manager-factory.js");
|
|
6
6
|
const logging_js_1 = require("../util/logging.js");
|
|
@@ -17,61 +17,11 @@ exports.ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE = 'FAME_JWT_REVERSE_AUTH_AUDIENCE';
|
|
|
17
17
|
exports.ENV_VAR_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY = 'FAME_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY';
|
|
18
18
|
exports.ENV_VAR_TRUSTED_CLIENT_SCOPE = 'FAME_TRUSTED_CLIENT_SCOPE';
|
|
19
19
|
exports.ENV_VAR_AUTHORIZATION_PROFILE = 'FAME_AUTHORIZATION_PROFILE';
|
|
20
|
-
exports.PROFILE_NAME_STRICT_OVERLAY = 'strict-overlay';
|
|
21
20
|
exports.PROFILE_NAME_OVERLAY = 'overlay';
|
|
22
21
|
exports.PROFILE_NAME_OVERLAY_CALLBACK = 'overlay-callback';
|
|
23
22
|
exports.PROFILE_NAME_GATED = 'gated';
|
|
24
23
|
exports.PROFILE_NAME_GATED_CALLBACK = 'gated-callback';
|
|
25
24
|
exports.PROFILE_NAME_OPEN = 'open';
|
|
26
|
-
const STRICT_OVERLAY_PROFILE = {
|
|
27
|
-
type: 'DefaultSecurityManager',
|
|
28
|
-
security_policy: {
|
|
29
|
-
type: 'DefaultSecurityPolicy',
|
|
30
|
-
signing: {
|
|
31
|
-
signing_material: 'x509-chain',
|
|
32
|
-
require_cert_sid_match: true,
|
|
33
|
-
inbound: {
|
|
34
|
-
signature_policy: 'required',
|
|
35
|
-
unsigned_violation_action: 'nack',
|
|
36
|
-
invalid_signature_action: 'nack',
|
|
37
|
-
},
|
|
38
|
-
response: {
|
|
39
|
-
mirror_request_signing: true,
|
|
40
|
-
always_sign_responses: false,
|
|
41
|
-
sign_error_responses: true,
|
|
42
|
-
},
|
|
43
|
-
outbound: {
|
|
44
|
-
default_signing: true,
|
|
45
|
-
sign_sensitive_operations: true,
|
|
46
|
-
sign_if_recipient_expects: true,
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
encryption: {
|
|
50
|
-
inbound: {
|
|
51
|
-
allow_plaintext: true,
|
|
52
|
-
allow_channel: true,
|
|
53
|
-
allow_sealed: true,
|
|
54
|
-
plaintext_violation_action: 'nack',
|
|
55
|
-
channel_violation_action: 'nack',
|
|
56
|
-
sealed_violation_action: 'nack',
|
|
57
|
-
},
|
|
58
|
-
response: {
|
|
59
|
-
mirror_request_level: true,
|
|
60
|
-
minimum_response_level: 'plaintext',
|
|
61
|
-
escalate_sealed_responses: false,
|
|
62
|
-
},
|
|
63
|
-
outbound: {
|
|
64
|
-
default_level: factory_1.Expressions.env(exports.ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, 'channel'),
|
|
65
|
-
escalate_if_peer_supports: false,
|
|
66
|
-
prefer_sealed_for_sensitive: false,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
authorizer: {
|
|
71
|
-
type: 'AuthorizationProfile',
|
|
72
|
-
profile: factory_1.Expressions.env(exports.ENV_VAR_AUTHORIZATION_PROFILE, 'jwt'),
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
25
|
const OVERLAY_PROFILE = {
|
|
76
26
|
type: 'DefaultSecurityManager',
|
|
77
27
|
security_policy: {
|
|
@@ -274,7 +224,6 @@ const OPEN_PROFILE = {
|
|
|
274
224
|
};
|
|
275
225
|
(0, profile_registry_js_1.registerProfile)(security_manager_factory_js_1.SECURITY_MANAGER_FACTORY_BASE_TYPE, exports.PROFILE_NAME_OVERLAY, OVERLAY_PROFILE, { source: 'node-security-profile-factory' });
|
|
276
226
|
(0, profile_registry_js_1.registerProfile)(security_manager_factory_js_1.SECURITY_MANAGER_FACTORY_BASE_TYPE, exports.PROFILE_NAME_OVERLAY_CALLBACK, OVERLAY_CALLBACK_PROFILE, { source: 'node-security-profile-factory' });
|
|
277
|
-
(0, profile_registry_js_1.registerProfile)(security_manager_factory_js_1.SECURITY_MANAGER_FACTORY_BASE_TYPE, exports.PROFILE_NAME_STRICT_OVERLAY, STRICT_OVERLAY_PROFILE, { source: 'node-security-profile-factory' });
|
|
278
227
|
(0, profile_registry_js_1.registerProfile)(security_manager_factory_js_1.SECURITY_MANAGER_FACTORY_BASE_TYPE, exports.PROFILE_NAME_GATED, GATED_PROFILE, { source: 'node-security-profile-factory' });
|
|
279
228
|
(0, profile_registry_js_1.registerProfile)(security_manager_factory_js_1.SECURITY_MANAGER_FACTORY_BASE_TYPE, exports.PROFILE_NAME_GATED_CALLBACK, GATED_CALLBACK_PROFILE, { source: 'node-security-profile-factory' });
|
|
280
229
|
(0, profile_registry_js_1.registerProfile)(security_manager_factory_js_1.SECURITY_MANAGER_FACTORY_BASE_TYPE, exports.PROFILE_NAME_OPEN, OPEN_PROFILE, { source: 'node-security-profile-factory' });
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated during build - do not edit manually
|
|
3
|
-
// Generated from package.json version: 0.4.
|
|
3
|
+
// Generated from package.json version: 0.4.10
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.VERSION = void 0;
|
|
6
6
|
/**
|
|
7
7
|
* The package version, injected at build time.
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
exports.VERSION = '0.4.
|
|
10
|
+
exports.VERSION = '0.4.10';
|
|
@@ -460,9 +460,8 @@ function requiresCryptoProvider(config) {
|
|
|
460
460
|
const profile = record.profile;
|
|
461
461
|
if (typeof profile === 'string') {
|
|
462
462
|
const profileLower = profile.toLowerCase();
|
|
463
|
-
// Overlay variants require crypto provider for envelope signing
|
|
464
|
-
if (profileLower.includes('overlay')
|
|
465
|
-
profileLower === 'strict-overlay') {
|
|
463
|
+
// Overlay variants (including strict-overlay) require crypto provider for envelope signing
|
|
464
|
+
if (profileLower.includes('overlay')) {
|
|
466
465
|
return true;
|
|
467
466
|
}
|
|
468
467
|
}
|
|
@@ -93,11 +93,6 @@ export class BasicAuthorizationPolicy {
|
|
|
93
93
|
const resolvedActionNormalized = this.normalizeActionToken(resolvedAction) ?? resolvedAction;
|
|
94
94
|
const address = extractAddress(envelope);
|
|
95
95
|
const grantedScopes = extractGrantedScopes(context);
|
|
96
|
-
const rawFrameType = envelope.frame
|
|
97
|
-
?.type;
|
|
98
|
-
const frameTypeNormalized = typeof rawFrameType === 'string' && rawFrameType.trim().length > 0
|
|
99
|
-
? rawFrameType.trim().toLowerCase()
|
|
100
|
-
: '';
|
|
101
96
|
// Extract and normalize origin type for rule matching
|
|
102
97
|
const rawOriginType = context?.originType;
|
|
103
98
|
const originTypeNormalized = typeof rawOriginType === 'string'
|
|
@@ -115,22 +110,16 @@ export class BasicAuthorizationPolicy {
|
|
|
115
110
|
step.expression = 'when clause (skipped by basic policy)';
|
|
116
111
|
step.result = false;
|
|
117
112
|
evaluationTrace.push(step);
|
|
113
|
+
logger.debug('rule_skipped_when_clause', { ruleId: rule.id });
|
|
118
114
|
continue;
|
|
119
115
|
}
|
|
120
|
-
//
|
|
121
|
-
if (rule.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
if (!rule.frameTypes.has(frameTypeNormalized)) {
|
|
129
|
-
step.expression = `frame_type: ${rawFrameType ?? 'unknown'} not in rule set`;
|
|
130
|
-
step.result = false;
|
|
131
|
-
evaluationTrace.push(step);
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
116
|
+
// Skip rules with 'frame_type' clause (reserved for advanced-security package)
|
|
117
|
+
if (rule.hasFrameTypeClause) {
|
|
118
|
+
step.expression = 'frame_type clause (skipped by basic policy)';
|
|
119
|
+
step.result = false;
|
|
120
|
+
evaluationTrace.push(step);
|
|
121
|
+
logger.debug('rule_skipped_frame_type_clause', { ruleId: rule.id });
|
|
122
|
+
continue;
|
|
134
123
|
}
|
|
135
124
|
// Check origin type match (early gate for efficiency)
|
|
136
125
|
if (rule.originTypes) {
|
|
@@ -245,8 +234,14 @@ export class BasicAuthorizationPolicy {
|
|
|
245
234
|
const actions = this.compileActions(rule.action, id);
|
|
246
235
|
// Compile address patterns (glob-only, no regex)
|
|
247
236
|
const addressPatterns = this.compileAddress(rule.address, id);
|
|
248
|
-
//
|
|
249
|
-
const
|
|
237
|
+
// Check for frame_type clause (reserved for advanced-security)
|
|
238
|
+
const hasFrameTypeClause = rule.frame_type !== undefined;
|
|
239
|
+
if (hasFrameTypeClause && warnOnUnknown) {
|
|
240
|
+
logger.warning('reserved_field_frame_type_will_be_skipped', {
|
|
241
|
+
ruleId: id,
|
|
242
|
+
message: `Rule "${id}" uses reserved field "frame_type" which is only supported in advanced-security package. This rule will be skipped during evaluation.`,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
250
245
|
// Compile origin type gating
|
|
251
246
|
const originTypes = this.compileOriginTypes(rule.origin_type, id);
|
|
252
247
|
// Compile scope matcher (glob-only, no regex)
|
|
@@ -273,11 +268,12 @@ export class BasicAuthorizationPolicy {
|
|
|
273
268
|
description: rule.description,
|
|
274
269
|
effect: rule.effect,
|
|
275
270
|
actions,
|
|
276
|
-
frameTypes,
|
|
271
|
+
frameTypes: undefined, // No longer used; reserved for advanced-security
|
|
277
272
|
originTypes,
|
|
278
273
|
addressPatterns,
|
|
279
274
|
scopeMatcher,
|
|
280
275
|
hasWhenClause: typeof rule.when === 'string' && rule.when.length > 0,
|
|
276
|
+
hasFrameTypeClause,
|
|
281
277
|
};
|
|
282
278
|
}
|
|
283
279
|
/**
|
|
@@ -367,43 +363,6 @@ export class BasicAuthorizationPolicy {
|
|
|
367
363
|
}
|
|
368
364
|
return patterns;
|
|
369
365
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Compiles frame_type field into a Set of normalized frame types.
|
|
372
|
-
* Supports single string or array of strings (implicit any-of).
|
|
373
|
-
* Returns undefined if not specified (no frame type gating).
|
|
374
|
-
*/
|
|
375
|
-
compileFrameTypes(frameType, ruleId) {
|
|
376
|
-
if (frameType === undefined) {
|
|
377
|
-
return undefined;
|
|
378
|
-
}
|
|
379
|
-
// Handle single frame type
|
|
380
|
-
if (typeof frameType === 'string') {
|
|
381
|
-
const normalized = frameType.trim().toLowerCase();
|
|
382
|
-
if (!normalized) {
|
|
383
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": value must not be empty`);
|
|
384
|
-
}
|
|
385
|
-
return new Set([normalized]);
|
|
386
|
-
}
|
|
387
|
-
// Handle array of frame types
|
|
388
|
-
if (!Array.isArray(frameType)) {
|
|
389
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": must be a string or array of strings`);
|
|
390
|
-
}
|
|
391
|
-
if (frameType.length === 0) {
|
|
392
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": array must not be empty`);
|
|
393
|
-
}
|
|
394
|
-
const frameTypes = new Set();
|
|
395
|
-
for (const ft of frameType) {
|
|
396
|
-
if (typeof ft !== 'string') {
|
|
397
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": all values must be strings`);
|
|
398
|
-
}
|
|
399
|
-
const normalized = ft.trim().toLowerCase();
|
|
400
|
-
if (!normalized) {
|
|
401
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": values must not be empty`);
|
|
402
|
-
}
|
|
403
|
-
frameTypes.add(normalized);
|
|
404
|
-
}
|
|
405
|
-
return frameTypes;
|
|
406
|
-
}
|
|
407
366
|
/**
|
|
408
367
|
* Compiles origin_type field into a Set of normalized origin types.
|
|
409
368
|
* Supports single string or array of strings (implicit any-of).
|
|
@@ -69,4 +69,4 @@ export * from './credential/browser-auto-key-credential-provider.js';
|
|
|
69
69
|
export * from './credential/browser-wrapped-key-credential-provider.js';
|
|
70
70
|
export * from './credential/session-key-credential-provider.js';
|
|
71
71
|
export * from './credential/dev-fixed-key-credential-provider.js';
|
|
72
|
-
export { ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWKS_URL, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_AUTHORIZATION_PROFILE,
|
|
72
|
+
export { ENV_VAR_JWT_TRUSTED_ISSUER, ENV_VAR_JWT_ALGORITHM, ENV_VAR_JWT_AUDIENCE, ENV_VAR_JWKS_URL, ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, ENV_VAR_HMAC_SECRET, ENV_VAR_JWT_REVERSE_AUTH_TRUSTED_ISSUER, ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE, ENV_VAR_AUTHORIZATION_PROFILE, PROFILE_NAME_OVERLAY, PROFILE_NAME_OVERLAY_CALLBACK, PROFILE_NAME_GATED, PROFILE_NAME_GATED_CALLBACK, PROFILE_NAME_OPEN, } from './node-security-profile-factory.js';
|
|
@@ -14,61 +14,11 @@ export const ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE = 'FAME_JWT_REVERSE_AUTH_AUDIENCE
|
|
|
14
14
|
export const ENV_VAR_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY = 'FAME_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY';
|
|
15
15
|
export const ENV_VAR_TRUSTED_CLIENT_SCOPE = 'FAME_TRUSTED_CLIENT_SCOPE';
|
|
16
16
|
export const ENV_VAR_AUTHORIZATION_PROFILE = 'FAME_AUTHORIZATION_PROFILE';
|
|
17
|
-
export const PROFILE_NAME_STRICT_OVERLAY = 'strict-overlay';
|
|
18
17
|
export const PROFILE_NAME_OVERLAY = 'overlay';
|
|
19
18
|
export const PROFILE_NAME_OVERLAY_CALLBACK = 'overlay-callback';
|
|
20
19
|
export const PROFILE_NAME_GATED = 'gated';
|
|
21
20
|
export const PROFILE_NAME_GATED_CALLBACK = 'gated-callback';
|
|
22
21
|
export const PROFILE_NAME_OPEN = 'open';
|
|
23
|
-
const STRICT_OVERLAY_PROFILE = {
|
|
24
|
-
type: 'DefaultSecurityManager',
|
|
25
|
-
security_policy: {
|
|
26
|
-
type: 'DefaultSecurityPolicy',
|
|
27
|
-
signing: {
|
|
28
|
-
signing_material: 'x509-chain',
|
|
29
|
-
require_cert_sid_match: true,
|
|
30
|
-
inbound: {
|
|
31
|
-
signature_policy: 'required',
|
|
32
|
-
unsigned_violation_action: 'nack',
|
|
33
|
-
invalid_signature_action: 'nack',
|
|
34
|
-
},
|
|
35
|
-
response: {
|
|
36
|
-
mirror_request_signing: true,
|
|
37
|
-
always_sign_responses: false,
|
|
38
|
-
sign_error_responses: true,
|
|
39
|
-
},
|
|
40
|
-
outbound: {
|
|
41
|
-
default_signing: true,
|
|
42
|
-
sign_sensitive_operations: true,
|
|
43
|
-
sign_if_recipient_expects: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
encryption: {
|
|
47
|
-
inbound: {
|
|
48
|
-
allow_plaintext: true,
|
|
49
|
-
allow_channel: true,
|
|
50
|
-
allow_sealed: true,
|
|
51
|
-
plaintext_violation_action: 'nack',
|
|
52
|
-
channel_violation_action: 'nack',
|
|
53
|
-
sealed_violation_action: 'nack',
|
|
54
|
-
},
|
|
55
|
-
response: {
|
|
56
|
-
mirror_request_level: true,
|
|
57
|
-
minimum_response_level: 'plaintext',
|
|
58
|
-
escalate_sealed_responses: false,
|
|
59
|
-
},
|
|
60
|
-
outbound: {
|
|
61
|
-
default_level: Expressions.env(ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, 'channel'),
|
|
62
|
-
escalate_if_peer_supports: false,
|
|
63
|
-
prefer_sealed_for_sensitive: false,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
authorizer: {
|
|
68
|
-
type: 'AuthorizationProfile',
|
|
69
|
-
profile: Expressions.env(ENV_VAR_AUTHORIZATION_PROFILE, 'jwt'),
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
22
|
const OVERLAY_PROFILE = {
|
|
73
23
|
type: 'DefaultSecurityManager',
|
|
74
24
|
security_policy: {
|
|
@@ -271,7 +221,6 @@ const OPEN_PROFILE = {
|
|
|
271
221
|
};
|
|
272
222
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_OVERLAY, OVERLAY_PROFILE, { source: 'node-security-profile-factory' });
|
|
273
223
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_OVERLAY_CALLBACK, OVERLAY_CALLBACK_PROFILE, { source: 'node-security-profile-factory' });
|
|
274
|
-
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_STRICT_OVERLAY, STRICT_OVERLAY_PROFILE, { source: 'node-security-profile-factory' });
|
|
275
224
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_GATED, GATED_PROFILE, { source: 'node-security-profile-factory' });
|
|
276
225
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_GATED_CALLBACK, GATED_CALLBACK_PROFILE, { source: 'node-security-profile-factory' });
|
|
277
226
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_OPEN, OPEN_PROFILE, { source: 'node-security-profile-factory' });
|
package/dist/esm/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// This file is auto-generated during build - do not edit manually
|
|
2
|
-
// Generated from package.json version: 0.4.
|
|
2
|
+
// Generated from package.json version: 0.4.10
|
|
3
3
|
/**
|
|
4
4
|
* The package version, injected at build time.
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.4.
|
|
7
|
+
export const VERSION = '0.4.10';
|
package/dist/node/index.cjs
CHANGED
|
@@ -14,12 +14,12 @@ var fastify = require('fastify');
|
|
|
14
14
|
var websocketPlugin = require('@fastify/websocket');
|
|
15
15
|
|
|
16
16
|
// This file is auto-generated during build - do not edit manually
|
|
17
|
-
// Generated from package.json version: 0.4.
|
|
17
|
+
// Generated from package.json version: 0.4.10
|
|
18
18
|
/**
|
|
19
19
|
* The package version, injected at build time.
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
|
-
const VERSION = '0.4.
|
|
22
|
+
const VERSION = '0.4.10';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Fame protocol specific error classes with WebSocket close codes and proper inheritance.
|
|
@@ -13681,9 +13681,8 @@ function requiresCryptoProvider(config) {
|
|
|
13681
13681
|
const profile = record.profile;
|
|
13682
13682
|
if (typeof profile === 'string') {
|
|
13683
13683
|
const profileLower = profile.toLowerCase();
|
|
13684
|
-
// Overlay variants require crypto provider for envelope signing
|
|
13685
|
-
if (profileLower.includes('overlay')
|
|
13686
|
-
profileLower === 'strict-overlay') {
|
|
13684
|
+
// Overlay variants (including strict-overlay) require crypto provider for envelope signing
|
|
13685
|
+
if (profileLower.includes('overlay')) {
|
|
13687
13686
|
return true;
|
|
13688
13687
|
}
|
|
13689
13688
|
}
|
|
@@ -22124,7 +22123,7 @@ const KNOWN_RULE_FIELDS = new Set([
|
|
|
22124
22123
|
'effect',
|
|
22125
22124
|
'action',
|
|
22126
22125
|
'address',
|
|
22127
|
-
'frame_type',
|
|
22126
|
+
'frame_type', // Reserved for advanced-security
|
|
22128
22127
|
'origin_type',
|
|
22129
22128
|
'scope',
|
|
22130
22129
|
'when', // Reserved for advanced-security
|
|
@@ -22647,11 +22646,6 @@ class BasicAuthorizationPolicy {
|
|
|
22647
22646
|
const resolvedActionNormalized = this.normalizeActionToken(resolvedAction) ?? resolvedAction;
|
|
22648
22647
|
const address = extractAddress(envelope);
|
|
22649
22648
|
const grantedScopes = extractGrantedScopes(context);
|
|
22650
|
-
const rawFrameType = envelope.frame
|
|
22651
|
-
?.type;
|
|
22652
|
-
const frameTypeNormalized = typeof rawFrameType === 'string' && rawFrameType.trim().length > 0
|
|
22653
|
-
? rawFrameType.trim().toLowerCase()
|
|
22654
|
-
: '';
|
|
22655
22649
|
// Extract and normalize origin type for rule matching
|
|
22656
22650
|
const rawOriginType = context?.originType;
|
|
22657
22651
|
const originTypeNormalized = typeof rawOriginType === 'string'
|
|
@@ -22669,22 +22663,16 @@ class BasicAuthorizationPolicy {
|
|
|
22669
22663
|
step.expression = 'when clause (skipped by basic policy)';
|
|
22670
22664
|
step.result = false;
|
|
22671
22665
|
evaluationTrace.push(step);
|
|
22666
|
+
logger$J.debug('rule_skipped_when_clause', { ruleId: rule.id });
|
|
22672
22667
|
continue;
|
|
22673
22668
|
}
|
|
22674
|
-
//
|
|
22675
|
-
if (rule.
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
}
|
|
22682
|
-
if (!rule.frameTypes.has(frameTypeNormalized)) {
|
|
22683
|
-
step.expression = `frame_type: ${rawFrameType ?? 'unknown'} not in rule set`;
|
|
22684
|
-
step.result = false;
|
|
22685
|
-
evaluationTrace.push(step);
|
|
22686
|
-
continue;
|
|
22687
|
-
}
|
|
22669
|
+
// Skip rules with 'frame_type' clause (reserved for advanced-security package)
|
|
22670
|
+
if (rule.hasFrameTypeClause) {
|
|
22671
|
+
step.expression = 'frame_type clause (skipped by basic policy)';
|
|
22672
|
+
step.result = false;
|
|
22673
|
+
evaluationTrace.push(step);
|
|
22674
|
+
logger$J.debug('rule_skipped_frame_type_clause', { ruleId: rule.id });
|
|
22675
|
+
continue;
|
|
22688
22676
|
}
|
|
22689
22677
|
// Check origin type match (early gate for efficiency)
|
|
22690
22678
|
if (rule.originTypes) {
|
|
@@ -22799,8 +22787,14 @@ class BasicAuthorizationPolicy {
|
|
|
22799
22787
|
const actions = this.compileActions(rule.action, id);
|
|
22800
22788
|
// Compile address patterns (glob-only, no regex)
|
|
22801
22789
|
const addressPatterns = this.compileAddress(rule.address, id);
|
|
22802
|
-
//
|
|
22803
|
-
const
|
|
22790
|
+
// Check for frame_type clause (reserved for advanced-security)
|
|
22791
|
+
const hasFrameTypeClause = rule.frame_type !== undefined;
|
|
22792
|
+
if (hasFrameTypeClause && warnOnUnknown) {
|
|
22793
|
+
logger$J.warning('reserved_field_frame_type_will_be_skipped', {
|
|
22794
|
+
ruleId: id,
|
|
22795
|
+
message: `Rule "${id}" uses reserved field "frame_type" which is only supported in advanced-security package. This rule will be skipped during evaluation.`,
|
|
22796
|
+
});
|
|
22797
|
+
}
|
|
22804
22798
|
// Compile origin type gating
|
|
22805
22799
|
const originTypes = this.compileOriginTypes(rule.origin_type, id);
|
|
22806
22800
|
// Compile scope matcher (glob-only, no regex)
|
|
@@ -22827,11 +22821,12 @@ class BasicAuthorizationPolicy {
|
|
|
22827
22821
|
description: rule.description,
|
|
22828
22822
|
effect: rule.effect,
|
|
22829
22823
|
actions,
|
|
22830
|
-
frameTypes,
|
|
22824
|
+
frameTypes: undefined, // No longer used; reserved for advanced-security
|
|
22831
22825
|
originTypes,
|
|
22832
22826
|
addressPatterns,
|
|
22833
22827
|
scopeMatcher,
|
|
22834
22828
|
hasWhenClause: typeof rule.when === 'string' && rule.when.length > 0,
|
|
22829
|
+
hasFrameTypeClause,
|
|
22835
22830
|
};
|
|
22836
22831
|
}
|
|
22837
22832
|
/**
|
|
@@ -22921,43 +22916,6 @@ class BasicAuthorizationPolicy {
|
|
|
22921
22916
|
}
|
|
22922
22917
|
return patterns;
|
|
22923
22918
|
}
|
|
22924
|
-
/**
|
|
22925
|
-
* Compiles frame_type field into a Set of normalized frame types.
|
|
22926
|
-
* Supports single string or array of strings (implicit any-of).
|
|
22927
|
-
* Returns undefined if not specified (no frame type gating).
|
|
22928
|
-
*/
|
|
22929
|
-
compileFrameTypes(frameType, ruleId) {
|
|
22930
|
-
if (frameType === undefined) {
|
|
22931
|
-
return undefined;
|
|
22932
|
-
}
|
|
22933
|
-
// Handle single frame type
|
|
22934
|
-
if (typeof frameType === 'string') {
|
|
22935
|
-
const normalized = frameType.trim().toLowerCase();
|
|
22936
|
-
if (!normalized) {
|
|
22937
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": value must not be empty`);
|
|
22938
|
-
}
|
|
22939
|
-
return new Set([normalized]);
|
|
22940
|
-
}
|
|
22941
|
-
// Handle array of frame types
|
|
22942
|
-
if (!Array.isArray(frameType)) {
|
|
22943
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": must be a string or array of strings`);
|
|
22944
|
-
}
|
|
22945
|
-
if (frameType.length === 0) {
|
|
22946
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": array must not be empty`);
|
|
22947
|
-
}
|
|
22948
|
-
const frameTypes = new Set();
|
|
22949
|
-
for (const ft of frameType) {
|
|
22950
|
-
if (typeof ft !== 'string') {
|
|
22951
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": all values must be strings`);
|
|
22952
|
-
}
|
|
22953
|
-
const normalized = ft.trim().toLowerCase();
|
|
22954
|
-
if (!normalized) {
|
|
22955
|
-
throw new Error(`Invalid frame_type in rule "${ruleId}": values must not be empty`);
|
|
22956
|
-
}
|
|
22957
|
-
frameTypes.add(normalized);
|
|
22958
|
-
}
|
|
22959
|
-
return frameTypes;
|
|
22960
|
-
}
|
|
22961
22919
|
/**
|
|
22962
22920
|
* Compiles origin_type field into a Set of normalized origin types.
|
|
22963
22921
|
* Supports single string or array of strings (implicit any-of).
|
|
@@ -29611,61 +29569,11 @@ const ENV_VAR_JWT_REVERSE_AUTH_AUDIENCE = 'FAME_JWT_REVERSE_AUTH_AUDIENCE';
|
|
|
29611
29569
|
const ENV_VAR_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY = 'FAME_ENFORCE_TOKEN_SUBJECT_NODE_IDENTITY';
|
|
29612
29570
|
const ENV_VAR_TRUSTED_CLIENT_SCOPE = 'FAME_TRUSTED_CLIENT_SCOPE';
|
|
29613
29571
|
const ENV_VAR_AUTHORIZATION_PROFILE = 'FAME_AUTHORIZATION_PROFILE';
|
|
29614
|
-
const PROFILE_NAME_STRICT_OVERLAY = 'strict-overlay';
|
|
29615
29572
|
const PROFILE_NAME_OVERLAY = 'overlay';
|
|
29616
29573
|
const PROFILE_NAME_OVERLAY_CALLBACK = 'overlay-callback';
|
|
29617
29574
|
const PROFILE_NAME_GATED = 'gated';
|
|
29618
29575
|
const PROFILE_NAME_GATED_CALLBACK = 'gated-callback';
|
|
29619
29576
|
const PROFILE_NAME_OPEN$1 = 'open';
|
|
29620
|
-
const STRICT_OVERLAY_PROFILE = {
|
|
29621
|
-
type: 'DefaultSecurityManager',
|
|
29622
|
-
security_policy: {
|
|
29623
|
-
type: 'DefaultSecurityPolicy',
|
|
29624
|
-
signing: {
|
|
29625
|
-
signing_material: 'x509-chain',
|
|
29626
|
-
require_cert_sid_match: true,
|
|
29627
|
-
inbound: {
|
|
29628
|
-
signature_policy: 'required',
|
|
29629
|
-
unsigned_violation_action: 'nack',
|
|
29630
|
-
invalid_signature_action: 'nack',
|
|
29631
|
-
},
|
|
29632
|
-
response: {
|
|
29633
|
-
mirror_request_signing: true,
|
|
29634
|
-
always_sign_responses: false,
|
|
29635
|
-
sign_error_responses: true,
|
|
29636
|
-
},
|
|
29637
|
-
outbound: {
|
|
29638
|
-
default_signing: true,
|
|
29639
|
-
sign_sensitive_operations: true,
|
|
29640
|
-
sign_if_recipient_expects: true,
|
|
29641
|
-
},
|
|
29642
|
-
},
|
|
29643
|
-
encryption: {
|
|
29644
|
-
inbound: {
|
|
29645
|
-
allow_plaintext: true,
|
|
29646
|
-
allow_channel: true,
|
|
29647
|
-
allow_sealed: true,
|
|
29648
|
-
plaintext_violation_action: 'nack',
|
|
29649
|
-
channel_violation_action: 'nack',
|
|
29650
|
-
sealed_violation_action: 'nack',
|
|
29651
|
-
},
|
|
29652
|
-
response: {
|
|
29653
|
-
mirror_request_level: true,
|
|
29654
|
-
minimum_response_level: 'plaintext',
|
|
29655
|
-
escalate_sealed_responses: false,
|
|
29656
|
-
},
|
|
29657
|
-
outbound: {
|
|
29658
|
-
default_level: factory.Expressions.env(ENV_VAR_DEFAULT_ENCRYPTION_LEVEL, 'channel'),
|
|
29659
|
-
escalate_if_peer_supports: false,
|
|
29660
|
-
prefer_sealed_for_sensitive: false,
|
|
29661
|
-
},
|
|
29662
|
-
},
|
|
29663
|
-
},
|
|
29664
|
-
authorizer: {
|
|
29665
|
-
type: 'AuthorizationProfile',
|
|
29666
|
-
profile: factory.Expressions.env(ENV_VAR_AUTHORIZATION_PROFILE, 'jwt'),
|
|
29667
|
-
},
|
|
29668
|
-
};
|
|
29669
29577
|
const OVERLAY_PROFILE = {
|
|
29670
29578
|
type: 'DefaultSecurityManager',
|
|
29671
29579
|
security_policy: {
|
|
@@ -29868,7 +29776,6 @@ const OPEN_PROFILE$1 = {
|
|
|
29868
29776
|
};
|
|
29869
29777
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_OVERLAY, OVERLAY_PROFILE, { source: 'node-security-profile-factory' });
|
|
29870
29778
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_OVERLAY_CALLBACK, OVERLAY_CALLBACK_PROFILE, { source: 'node-security-profile-factory' });
|
|
29871
|
-
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_STRICT_OVERLAY, STRICT_OVERLAY_PROFILE, { source: 'node-security-profile-factory' });
|
|
29872
29779
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_GATED, GATED_PROFILE, { source: 'node-security-profile-factory' });
|
|
29873
29780
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_GATED_CALLBACK, GATED_CALLBACK_PROFILE, { source: 'node-security-profile-factory' });
|
|
29874
29781
|
registerProfile(SECURITY_MANAGER_FACTORY_BASE_TYPE, PROFILE_NAME_OPEN$1, OPEN_PROFILE$1, { source: 'node-security-profile-factory' });
|
|
@@ -30005,7 +29912,6 @@ var nodeSecurityProfileFactory = /*#__PURE__*/Object.freeze({
|
|
|
30005
29912
|
PROFILE_NAME_OPEN: PROFILE_NAME_OPEN$1,
|
|
30006
29913
|
PROFILE_NAME_OVERLAY: PROFILE_NAME_OVERLAY,
|
|
30007
29914
|
PROFILE_NAME_OVERLAY_CALLBACK: PROFILE_NAME_OVERLAY_CALLBACK,
|
|
30008
|
-
PROFILE_NAME_STRICT_OVERLAY: PROFILE_NAME_STRICT_OVERLAY,
|
|
30009
29915
|
default: NodeSecurityProfileFactory
|
|
30010
29916
|
});
|
|
30011
29917
|
|
|
@@ -43886,7 +43792,6 @@ exports.PROFILE_NAME_GATED_CALLBACK = PROFILE_NAME_GATED_CALLBACK;
|
|
|
43886
43792
|
exports.PROFILE_NAME_OPEN = PROFILE_NAME_OPEN$1;
|
|
43887
43793
|
exports.PROFILE_NAME_OVERLAY = PROFILE_NAME_OVERLAY;
|
|
43888
43794
|
exports.PROFILE_NAME_OVERLAY_CALLBACK = PROFILE_NAME_OVERLAY_CALLBACK;
|
|
43889
|
-
exports.PROFILE_NAME_STRICT_OVERLAY = PROFILE_NAME_STRICT_OVERLAY;
|
|
43890
43795
|
exports.PromptCredentialProvider = PromptCredentialProvider;
|
|
43891
43796
|
exports.REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE = REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE;
|
|
43892
43797
|
exports.REQUIRED_FIELDS_BY_KTY = REQUIRED_FIELDS_BY_KTY;
|