@naylence/advanced-security 0.4.3 → 0.4.5
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 +204 -18
- package/dist/browser/index.mjs +203 -17
- package/dist/cjs/naylence/fame/expr/builtins.js +1 -1
- package/dist/cjs/naylence/fame/expr/builtins.js.map +1 -1
- package/dist/cjs/naylence/fame/security/auth/policy/advanced-authorization-policy.js +35 -13
- package/dist/cjs/naylence/fame/security/auth/policy/advanced-authorization-policy.js.map +1 -1
- package/dist/cjs/naylence/fame/security/auth/policy/expr-builtins.js +166 -2
- package/dist/cjs/naylence/fame/security/auth/policy/expr-builtins.js.map +1 -1
- package/dist/cjs/naylence/fame/security/auth/policy/index.js +1 -1
- package/dist/cjs/naylence/fame/security/auth/policy/index.js.map +1 -1
- package/dist/cjs/version.js +2 -2
- package/dist/esm/naylence/fame/expr/builtins.js +1 -1
- package/dist/esm/naylence/fame/expr/builtins.js.map +1 -1
- package/dist/esm/naylence/fame/security/auth/policy/advanced-authorization-policy.js +35 -13
- package/dist/esm/naylence/fame/security/auth/policy/advanced-authorization-policy.js.map +1 -1
- package/dist/esm/naylence/fame/security/auth/policy/expr-builtins.js +166 -2
- package/dist/esm/naylence/fame/security/auth/policy/expr-builtins.js.map +1 -1
- package/dist/esm/naylence/fame/security/auth/policy/index.js +1 -1
- package/dist/esm/naylence/fame/security/auth/policy/index.js.map +1 -1
- package/dist/esm/version.js +2 -2
- package/dist/node/index.cjs +206 -18
- package/dist/node/index.mjs +204 -18
- package/dist/node/node.cjs +206 -18
- package/dist/node/node.mjs +204 -18
- package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy.d.ts +1 -1
- package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/auth/policy/expr-builtins.d.ts +71 -1
- package/dist/types/naylence/fame/security/auth/policy/expr-builtins.d.ts.map +1 -1
- package/dist/types/naylence/fame/security/auth/policy/index.d.ts +1 -1
- package/dist/types/naylence/fame/security/auth/policy/index.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/node/node.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var factory = require('@naylence/factory');
|
|
4
4
|
var runtime = require('@naylence/runtime');
|
|
5
|
-
var
|
|
5
|
+
var sha2 = require('@noble/hashes/sha2');
|
|
6
6
|
var core = require('@naylence/core');
|
|
7
7
|
var asn1Schema = require('@peculiar/asn1-schema');
|
|
8
8
|
var asn1X509 = require('@peculiar/asn1-x509');
|
|
@@ -575,12 +575,12 @@ async function registerAdvancedSecurityFactories(registrar = factory.Registry, o
|
|
|
575
575
|
}
|
|
576
576
|
|
|
577
577
|
// This file is auto-generated during build - do not edit manually
|
|
578
|
-
// Generated from package.json version: 0.4.
|
|
578
|
+
// Generated from package.json version: 0.4.5
|
|
579
579
|
/**
|
|
580
580
|
* The package version, injected at build time.
|
|
581
581
|
* @internal
|
|
582
582
|
*/
|
|
583
|
-
const VERSION = '0.4.
|
|
583
|
+
const VERSION = '0.4.5';
|
|
584
584
|
|
|
585
585
|
async function registerAdvancedSecurityPluginFactories(registrar = factory.Registry) {
|
|
586
586
|
await registerAdvancedSecurityFactories(registrar, { includeExtras: true });
|
|
@@ -1985,7 +1985,7 @@ const secure_hash = (args) => {
|
|
|
1985
1985
|
}
|
|
1986
1986
|
// Use generateFingerprintSync from @naylence/core
|
|
1987
1987
|
// This provides SHA-256 hashing, base62 encoding, and profanity filtering
|
|
1988
|
-
return core.generateFingerprintSync(input_str, length,
|
|
1988
|
+
return core.generateFingerprintSync(input_str, length, sha2.sha256);
|
|
1989
1989
|
};
|
|
1990
1990
|
// ============================================================
|
|
1991
1991
|
// Pattern Helpers (BSL-only)
|
|
@@ -2559,8 +2559,86 @@ function evaluateAsBoolean(ast, context) {
|
|
|
2559
2559
|
* Null handling semantics:
|
|
2560
2560
|
* - Scope predicate builtins (has_scope, has_any_scope, has_all_scopes)
|
|
2561
2561
|
* return `false` when passed `null` for required args.
|
|
2562
|
+
* - Security predicate builtins (is_signed, is_encrypted, is_encrypted_at_least)
|
|
2563
|
+
* return `false` when the envelope lacks the required security posture.
|
|
2562
2564
|
* - Wrong non-null types still raise BuiltinError to surface real bugs.
|
|
2563
2565
|
*/
|
|
2566
|
+
/**
|
|
2567
|
+
* Valid encryption levels for is_encrypted_at_least comparisons.
|
|
2568
|
+
*/
|
|
2569
|
+
const VALID_ENCRYPTION_LEVELS = [
|
|
2570
|
+
"plaintext",
|
|
2571
|
+
"channel",
|
|
2572
|
+
"sealed",
|
|
2573
|
+
];
|
|
2574
|
+
/**
|
|
2575
|
+
* Encryption level ordering for comparison.
|
|
2576
|
+
* Higher number = stronger encryption.
|
|
2577
|
+
*/
|
|
2578
|
+
const ENCRYPTION_LEVEL_ORDER = {
|
|
2579
|
+
plaintext: 0,
|
|
2580
|
+
channel: 1,
|
|
2581
|
+
sealed: 2,
|
|
2582
|
+
};
|
|
2583
|
+
/**
|
|
2584
|
+
* Normalizes an encryption algorithm string to an EncryptionLevel.
|
|
2585
|
+
*
|
|
2586
|
+
* Mapping rules:
|
|
2587
|
+
* - null/undefined => "plaintext" (no encryption present)
|
|
2588
|
+
* - alg contains "-channel" => "channel" (e.g., "chacha20-poly1305-channel")
|
|
2589
|
+
* - alg contains "-sealed" => "sealed" (explicit sealed marker)
|
|
2590
|
+
* - alg matches ECDH-ES pattern with AEAD cipher => "sealed" (e.g., "ECDH-ES+A256GCM")
|
|
2591
|
+
* - otherwise => "unknown"
|
|
2592
|
+
*
|
|
2593
|
+
* Currently supported algorithms:
|
|
2594
|
+
* - Channel: "chacha20-poly1305-channel"
|
|
2595
|
+
* - Sealed: "ECDH-ES+A256GCM"
|
|
2596
|
+
*
|
|
2597
|
+
* This helper is centralized to ensure consistent mapping across TS and Python.
|
|
2598
|
+
*/
|
|
2599
|
+
function normalizeEncryptionLevelFromAlg(alg) {
|
|
2600
|
+
if (alg === null || alg === undefined) {
|
|
2601
|
+
return "plaintext";
|
|
2602
|
+
}
|
|
2603
|
+
const algLower = alg.toLowerCase();
|
|
2604
|
+
// Check for channel encryption (e.g., "chacha20-poly1305-channel")
|
|
2605
|
+
// Must check before other patterns since channel suffix is explicit
|
|
2606
|
+
if (algLower.includes("-channel")) {
|
|
2607
|
+
return "channel";
|
|
2608
|
+
}
|
|
2609
|
+
// Check for explicit sealed marker
|
|
2610
|
+
if (algLower.includes("-sealed")) {
|
|
2611
|
+
return "sealed";
|
|
2612
|
+
}
|
|
2613
|
+
// ECDH-ES key agreement with AEAD cipher => sealed encryption
|
|
2614
|
+
// Pattern: "ECDH-ES+A256GCM", "ECDH-ES+A128GCM", etc.
|
|
2615
|
+
if (algLower.startsWith("ecdh-es") && algLower.includes("+a")) {
|
|
2616
|
+
return "sealed";
|
|
2617
|
+
}
|
|
2618
|
+
return "unknown";
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* Creates security bindings from an envelope's sec header.
|
|
2622
|
+
* Exposes only metadata, never raw values like sig.val or enc.val.
|
|
2623
|
+
*/
|
|
2624
|
+
function createSecurityBindings(sec) {
|
|
2625
|
+
const sigPresent = sec?.sig !== undefined;
|
|
2626
|
+
const encPresent = sec?.enc !== undefined;
|
|
2627
|
+
return {
|
|
2628
|
+
sig: {
|
|
2629
|
+
present: sigPresent,
|
|
2630
|
+
kid: sec?.sig?.kid ?? null,
|
|
2631
|
+
},
|
|
2632
|
+
enc: {
|
|
2633
|
+
present: encPresent,
|
|
2634
|
+
alg: sec?.enc?.alg ?? null,
|
|
2635
|
+
kid: sec?.enc?.kid ?? null,
|
|
2636
|
+
level: encPresent
|
|
2637
|
+
? normalizeEncryptionLevelFromAlg(sec?.enc?.alg ?? null)
|
|
2638
|
+
: "plaintext",
|
|
2639
|
+
},
|
|
2640
|
+
};
|
|
2641
|
+
}
|
|
2564
2642
|
/**
|
|
2565
2643
|
* Checks if a value is null.
|
|
2566
2644
|
*/
|
|
@@ -2569,9 +2647,21 @@ function isNull(value) {
|
|
|
2569
2647
|
}
|
|
2570
2648
|
/**
|
|
2571
2649
|
* Creates a function registry with auth helpers installed.
|
|
2650
|
+
*
|
|
2651
|
+
* This registry extends the base builtins with:
|
|
2652
|
+
* - Scope builtins: has_scope, has_any_scope, has_all_scopes
|
|
2653
|
+
* - Security builtins: is_signed, encryption_level, is_encrypted, is_encrypted_at_least
|
|
2572
2654
|
*/
|
|
2573
|
-
function createAuthFunctionRegistry(
|
|
2574
|
-
|
|
2655
|
+
function createAuthFunctionRegistry(grantedScopesOrOptions = []) {
|
|
2656
|
+
// Handle both old signature (array) and new signature (options object)
|
|
2657
|
+
const options = Array.isArray(grantedScopesOrOptions)
|
|
2658
|
+
? { grantedScopes: grantedScopesOrOptions }
|
|
2659
|
+
: grantedScopesOrOptions;
|
|
2660
|
+
const scopes = options.grantedScopes ?? [];
|
|
2661
|
+
const secBindings = options.securityBindings ?? {
|
|
2662
|
+
sig: { present: false, kid: null },
|
|
2663
|
+
enc: { present: false, alg: null, kid: null, level: "plaintext" },
|
|
2664
|
+
};
|
|
2575
2665
|
/**
|
|
2576
2666
|
* Checks if any granted scope matches a pattern (using glob syntax).
|
|
2577
2667
|
*/
|
|
@@ -2627,11 +2717,85 @@ function createAuthFunctionRegistry(grantedScopes = []) {
|
|
|
2627
2717
|
}
|
|
2628
2718
|
return values.every((scope) => matchesScope(scope));
|
|
2629
2719
|
};
|
|
2720
|
+
// ============================================================
|
|
2721
|
+
// Security posture builtins
|
|
2722
|
+
// ============================================================
|
|
2723
|
+
/**
|
|
2724
|
+
* is_signed() -> bool
|
|
2725
|
+
*
|
|
2726
|
+
* Returns true if the envelope has a signature present.
|
|
2727
|
+
* No arguments required.
|
|
2728
|
+
*/
|
|
2729
|
+
const is_signed = (args) => {
|
|
2730
|
+
assertArgCount(args, 0, "is_signed");
|
|
2731
|
+
return secBindings.sig.present;
|
|
2732
|
+
};
|
|
2733
|
+
/**
|
|
2734
|
+
* encryption_level() -> string
|
|
2735
|
+
*
|
|
2736
|
+
* Returns the normalized encryption level: "plaintext" | "channel" | "sealed" | "unknown"
|
|
2737
|
+
* No arguments required.
|
|
2738
|
+
*/
|
|
2739
|
+
const encryption_level = (args) => {
|
|
2740
|
+
assertArgCount(args, 0, "encryption_level");
|
|
2741
|
+
return secBindings.enc.level;
|
|
2742
|
+
};
|
|
2743
|
+
/**
|
|
2744
|
+
* is_encrypted() -> bool
|
|
2745
|
+
*
|
|
2746
|
+
* Returns true if the encryption level is not "plaintext".
|
|
2747
|
+
* This means the envelope has some form of encryption (channel, sealed, or unknown).
|
|
2748
|
+
* No arguments required.
|
|
2749
|
+
*/
|
|
2750
|
+
const is_encrypted = (args) => {
|
|
2751
|
+
assertArgCount(args, 0, "is_encrypted");
|
|
2752
|
+
return secBindings.enc.level !== "plaintext";
|
|
2753
|
+
};
|
|
2754
|
+
/**
|
|
2755
|
+
* is_encrypted_at_least(level: string) -> bool
|
|
2756
|
+
*
|
|
2757
|
+
* Returns true if the envelope's encryption level meets or exceeds the required level.
|
|
2758
|
+
*
|
|
2759
|
+
* Level ordering: plaintext < channel < sealed
|
|
2760
|
+
*
|
|
2761
|
+
* Special handling:
|
|
2762
|
+
* - "unknown" encryption level does NOT satisfy "channel" or "sealed" (conservative)
|
|
2763
|
+
* - "plaintext" is always satisfied (any envelope meets at least plaintext)
|
|
2764
|
+
* - null argument => false (predicate-style)
|
|
2765
|
+
* - invalid level string => BuiltinError
|
|
2766
|
+
*/
|
|
2767
|
+
const is_encrypted_at_least = (args) => {
|
|
2768
|
+
assertArgCount(args, 1, "is_encrypted_at_least");
|
|
2769
|
+
const requiredLevel = getArg(args, 0, "is_encrypted_at_least");
|
|
2770
|
+
// Null-tolerant: return false if level is null
|
|
2771
|
+
if (!assertStringOrNull(requiredLevel, "level", "is_encrypted_at_least")) {
|
|
2772
|
+
return false;
|
|
2773
|
+
}
|
|
2774
|
+
// Validate required level
|
|
2775
|
+
if (!VALID_ENCRYPTION_LEVELS.includes(requiredLevel)) {
|
|
2776
|
+
throw new BuiltinError("is_encrypted_at_least", `level must be one of: ${VALID_ENCRYPTION_LEVELS.join(", ")}; got "${requiredLevel}"`);
|
|
2777
|
+
}
|
|
2778
|
+
const currentLevel = secBindings.enc.level;
|
|
2779
|
+
const requiredOrder = ENCRYPTION_LEVEL_ORDER[requiredLevel] ?? 0;
|
|
2780
|
+
const currentOrder = ENCRYPTION_LEVEL_ORDER[currentLevel];
|
|
2781
|
+
// If current level is "unknown", it only satisfies "plaintext"
|
|
2782
|
+
if (currentOrder === undefined) {
|
|
2783
|
+
// "unknown" is treated as NOT meeting channel/sealed requirements
|
|
2784
|
+
return requiredOrder === 0; // Only plaintext is satisfied by unknown
|
|
2785
|
+
}
|
|
2786
|
+
return currentOrder >= requiredOrder;
|
|
2787
|
+
};
|
|
2630
2788
|
return new Map([
|
|
2631
2789
|
...BUILTIN_FUNCTIONS,
|
|
2790
|
+
// Scope builtins
|
|
2632
2791
|
["has_scope", has_scope],
|
|
2633
2792
|
["has_any_scope", has_any_scope],
|
|
2634
2793
|
["has_all_scopes", has_all_scopes],
|
|
2794
|
+
// Security posture builtins
|
|
2795
|
+
["is_signed", is_signed],
|
|
2796
|
+
["encryption_level", encryption_level],
|
|
2797
|
+
["is_encrypted", is_encrypted],
|
|
2798
|
+
["is_encrypted_at_least", is_encrypted_at_least],
|
|
2635
2799
|
]);
|
|
2636
2800
|
}
|
|
2637
2801
|
/**
|
|
@@ -2710,6 +2874,9 @@ const VALID_FRAME_TYPES = [
|
|
|
2710
2874
|
"CreditUpdate",
|
|
2711
2875
|
"KeyAnnounce",
|
|
2712
2876
|
"KeyRequest",
|
|
2877
|
+
"SecureOpen",
|
|
2878
|
+
"SecureAccept",
|
|
2879
|
+
"SecureClose",
|
|
2713
2880
|
];
|
|
2714
2881
|
/**
|
|
2715
2882
|
* Simple console logger implementation.
|
|
@@ -2771,19 +2938,33 @@ function extractClaims(context) {
|
|
|
2771
2938
|
}
|
|
2772
2939
|
/**
|
|
2773
2940
|
* Creates a safe envelope subset for expression bindings.
|
|
2941
|
+
*
|
|
2942
|
+
* Exposes:
|
|
2943
|
+
* - id, sid, traceId, corrId, flowId, to
|
|
2944
|
+
* - frame: { type }
|
|
2945
|
+
* - sec: { sig: { present, kid }, enc: { present, alg, kid, level } }
|
|
2946
|
+
*
|
|
2947
|
+
* IMPORTANT: Does NOT expose raw security values (sig.val, enc.val).
|
|
2774
2948
|
*/
|
|
2775
2949
|
function createEnvelopeBindings(envelope) {
|
|
2776
2950
|
const frame = envelope.frame;
|
|
2777
2951
|
const envelopeRecord = envelope;
|
|
2952
|
+
const sec = envelopeRecord.sec;
|
|
2953
|
+
const securityBindings = createSecurityBindings(sec);
|
|
2778
2954
|
return {
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
:
|
|
2955
|
+
bindings: {
|
|
2956
|
+
id: envelope.id ?? null,
|
|
2957
|
+
sid: envelopeRecord.sid ?? null,
|
|
2958
|
+
traceId: envelopeRecord.traceId ?? null,
|
|
2959
|
+
corrId: envelopeRecord.corrId ?? null,
|
|
2960
|
+
flowId: envelopeRecord.flowId ?? null,
|
|
2961
|
+
to: extractAddress(envelope) ?? null,
|
|
2962
|
+
frame: frame
|
|
2963
|
+
? { type: frame.type ?? null }
|
|
2964
|
+
: { type: null },
|
|
2965
|
+
sec: securityBindings,
|
|
2966
|
+
},
|
|
2967
|
+
securityBindings,
|
|
2787
2968
|
};
|
|
2788
2969
|
}
|
|
2789
2970
|
/**
|
|
@@ -2937,11 +3118,12 @@ class AdvancedAuthorizationPolicy {
|
|
|
2937
3118
|
continue;
|
|
2938
3119
|
}
|
|
2939
3120
|
if (rule.whenAst) {
|
|
2940
|
-
// Lazy initialization of expression bindings
|
|
3121
|
+
// Lazy initialization of expression bindings and security context
|
|
2941
3122
|
if (!expressionBindings) {
|
|
3123
|
+
const envelopeResult = createEnvelopeBindings(envelope);
|
|
2942
3124
|
expressionBindings = {
|
|
2943
3125
|
claims: extractClaims(context),
|
|
2944
|
-
envelope:
|
|
3126
|
+
envelope: envelopeResult.bindings,
|
|
2945
3127
|
delivery: createDeliveryBindings(context, resolvedAction),
|
|
2946
3128
|
node: createNodeBindings(node),
|
|
2947
3129
|
time: {
|
|
@@ -2949,9 +3131,13 @@ class AdvancedAuthorizationPolicy {
|
|
|
2949
3131
|
now_iso: new Date().toISOString(),
|
|
2950
3132
|
},
|
|
2951
3133
|
};
|
|
3134
|
+
// Create function registry with security bindings for security builtins
|
|
3135
|
+
functionRegistry = createAuthFunctionRegistry({
|
|
3136
|
+
grantedScopes,
|
|
3137
|
+
securityBindings: envelopeResult.securityBindings,
|
|
3138
|
+
});
|
|
2952
3139
|
}
|
|
2953
|
-
const functions = functionRegistry
|
|
2954
|
-
functionRegistry = functions;
|
|
3140
|
+
const functions = functionRegistry;
|
|
2955
3141
|
const evalContext = {
|
|
2956
3142
|
bindings: expressionBindings,
|
|
2957
3143
|
limits: this.expressionLimits,
|
|
@@ -13101,6 +13287,7 @@ exports.createAftVerifier = createAftVerifier;
|
|
|
13101
13287
|
exports.createAuthFunctionRegistry = createAuthFunctionRegistry;
|
|
13102
13288
|
exports.createEd25519Csr = createEd25519Csr;
|
|
13103
13289
|
exports.createEd25519CsrFromPem = createEd25519CsrFromPem;
|
|
13290
|
+
exports.createSecurityBindings = createSecurityBindings;
|
|
13104
13291
|
exports.createTestCA = createTestCA;
|
|
13105
13292
|
exports.evaluate = evaluate;
|
|
13106
13293
|
exports.evaluateAsBoolean = evaluateAsBoolean;
|
|
@@ -13113,6 +13300,7 @@ exports.extractSpiffeIdFromCert = extractSpiffeIdFromCert;
|
|
|
13113
13300
|
exports.formatCertificateInfo = formatCertificateInfo;
|
|
13114
13301
|
exports.getTypeName = getTypeName;
|
|
13115
13302
|
exports.isBuiltinFunction = isBuiltinFunction;
|
|
13303
|
+
exports.normalizeEncryptionLevelFromAlg = normalizeEncryptionLevelFromAlg;
|
|
13116
13304
|
exports.normalizeJsValue = normalizeJsValue;
|
|
13117
13305
|
exports.normalizeStickinessMode = normalizeStickinessMode;
|
|
13118
13306
|
exports.parse = parse;
|
package/dist/node/node.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExtensionManager, Expressions, Registry, AbstractResourceFactory, createResource, createDefaultResource } from '@naylence/factory';
|
|
2
2
|
import { getLogger, ENCRYPTION_MANAGER_FACTORY_BASE_TYPE, registerProfile, SECURITY_MANAGER_FACTORY_BASE_TYPE, KNOWN_POLICY_FIELDS, VALID_EFFECTS, compileGlobOnlyScopeRequirement, KNOWN_RULE_FIELDS, VALID_ACTIONS, compileGlobPattern, VALID_ORIGIN_TYPES, AUTHORIZATION_POLICY_FACTORY_BASE_TYPE, AuthorizationPolicyFactory, EncryptionResult, urlsafeBase64Decode, sealedDecrypt, sealedEncrypt, FIXED_PREFIX_LEN, urlsafeBase64Encode, EncryptionManagerFactory, requireCryptoSupport, SECURE_CHANNEL_MANAGER_FACTORY_BASE_TYPE, SecureChannelManagerFactory, ENVELOPE_SIGNER_FACTORY_BASE_TYPE, EnvelopeSignerFactory, SigningConfigClass, validateSigningKey, JWKValidationError, decodeBase64Url, canonicalJson, secureDigest, frameDigest, immutableHeaders, encodeUtf8, ENVELOPE_VERIFIER_FACTORY_BASE_TYPE, EnvelopeVerifierFactory, TrustStoreProviderFactory as TrustStoreProviderFactory$1, TaskSpawner, getKeyStore, DefaultKeyManager, validateJwkComplete, currentTraceId, DeliveryOriginType, KEY_MANAGER_FACTORY_BASE_TYPE, KeyManagerFactory, KeyStoreFactory, BaseNodeEventListener, LOAD_BALANCER_STICKINESS_MANAGER_FACTORY_BASE_TYPE, LoadBalancerStickinessManagerFactory, REPLICA_STICKINESS_MANAGER_FACTORY_BASE_TYPE, ReplicaStickinessManagerFactory, color, formatTimestamp, AnsiColor, jsonDumps, validateHostLogicals, HTTP_CONNECTION_GRANT_TYPE, WELCOME_SERVICE_FACTORY_BASE_TYPE, WelcomeServiceFactory, NodePlacementStrategyFactory, TransportProvisionerFactory, TokenIssuerFactory, AuthorizerFactory, AuthInjectionStrategyFactory, CERTIFICATE_MANAGER_FACTORY_BASE_TYPE, CertificateManagerFactory, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE as TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE$1, validateHostLogical } from '@naylence/runtime';
|
|
3
|
-
import { sha256 } from '@noble/hashes/
|
|
3
|
+
import { sha256 } from '@noble/hashes/sha2';
|
|
4
4
|
import { generateFingerprintSync, localDeliveryContext, createFameEnvelope, FameAddress, generateId, formatAddress, SigningMaterial, DeliveryOriginType as DeliveryOriginType$1 } from '@naylence/core';
|
|
5
5
|
import { AsnConvert, OctetString } from '@peculiar/asn1-schema';
|
|
6
6
|
import { Certificate, id_ce_subjectAltName, SubjectAlternativeName, id_ce_nameConstraints, NameConstraints, Name, RelativeDistinguishedName, AttributeTypeAndValue, AttributeValue, SubjectPublicKeyInfo, GeneralName, Extensions, Extension, Attribute, AlgorithmIdentifier, TBSCertificate, Validity, Version, BasicConstraints, id_ce_basicConstraints, KeyUsageFlags, KeyUsage, id_ce_keyUsage, SubjectKeyIdentifier, id_ce_subjectKeyIdentifier, AuthorityKeyIdentifier, KeyIdentifier, id_ce_authorityKeyIdentifier, GeneralSubtrees, GeneralSubtree, ExtendedKeyUsage, id_kp_clientAuth, id_kp_serverAuth, id_ce_extKeyUsage } from '@peculiar/asn1-x509';
|
|
@@ -573,12 +573,12 @@ async function registerAdvancedSecurityFactories(registrar = Registry, options)
|
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
// This file is auto-generated during build - do not edit manually
|
|
576
|
-
// Generated from package.json version: 0.4.
|
|
576
|
+
// Generated from package.json version: 0.4.5
|
|
577
577
|
/**
|
|
578
578
|
* The package version, injected at build time.
|
|
579
579
|
* @internal
|
|
580
580
|
*/
|
|
581
|
-
const VERSION = '0.4.
|
|
581
|
+
const VERSION = '0.4.5';
|
|
582
582
|
|
|
583
583
|
async function registerAdvancedSecurityPluginFactories(registrar = Registry) {
|
|
584
584
|
await registerAdvancedSecurityFactories(registrar, { includeExtras: true });
|
|
@@ -2557,8 +2557,86 @@ function evaluateAsBoolean(ast, context) {
|
|
|
2557
2557
|
* Null handling semantics:
|
|
2558
2558
|
* - Scope predicate builtins (has_scope, has_any_scope, has_all_scopes)
|
|
2559
2559
|
* return `false` when passed `null` for required args.
|
|
2560
|
+
* - Security predicate builtins (is_signed, is_encrypted, is_encrypted_at_least)
|
|
2561
|
+
* return `false` when the envelope lacks the required security posture.
|
|
2560
2562
|
* - Wrong non-null types still raise BuiltinError to surface real bugs.
|
|
2561
2563
|
*/
|
|
2564
|
+
/**
|
|
2565
|
+
* Valid encryption levels for is_encrypted_at_least comparisons.
|
|
2566
|
+
*/
|
|
2567
|
+
const VALID_ENCRYPTION_LEVELS = [
|
|
2568
|
+
"plaintext",
|
|
2569
|
+
"channel",
|
|
2570
|
+
"sealed",
|
|
2571
|
+
];
|
|
2572
|
+
/**
|
|
2573
|
+
* Encryption level ordering for comparison.
|
|
2574
|
+
* Higher number = stronger encryption.
|
|
2575
|
+
*/
|
|
2576
|
+
const ENCRYPTION_LEVEL_ORDER = {
|
|
2577
|
+
plaintext: 0,
|
|
2578
|
+
channel: 1,
|
|
2579
|
+
sealed: 2,
|
|
2580
|
+
};
|
|
2581
|
+
/**
|
|
2582
|
+
* Normalizes an encryption algorithm string to an EncryptionLevel.
|
|
2583
|
+
*
|
|
2584
|
+
* Mapping rules:
|
|
2585
|
+
* - null/undefined => "plaintext" (no encryption present)
|
|
2586
|
+
* - alg contains "-channel" => "channel" (e.g., "chacha20-poly1305-channel")
|
|
2587
|
+
* - alg contains "-sealed" => "sealed" (explicit sealed marker)
|
|
2588
|
+
* - alg matches ECDH-ES pattern with AEAD cipher => "sealed" (e.g., "ECDH-ES+A256GCM")
|
|
2589
|
+
* - otherwise => "unknown"
|
|
2590
|
+
*
|
|
2591
|
+
* Currently supported algorithms:
|
|
2592
|
+
* - Channel: "chacha20-poly1305-channel"
|
|
2593
|
+
* - Sealed: "ECDH-ES+A256GCM"
|
|
2594
|
+
*
|
|
2595
|
+
* This helper is centralized to ensure consistent mapping across TS and Python.
|
|
2596
|
+
*/
|
|
2597
|
+
function normalizeEncryptionLevelFromAlg(alg) {
|
|
2598
|
+
if (alg === null || alg === undefined) {
|
|
2599
|
+
return "plaintext";
|
|
2600
|
+
}
|
|
2601
|
+
const algLower = alg.toLowerCase();
|
|
2602
|
+
// Check for channel encryption (e.g., "chacha20-poly1305-channel")
|
|
2603
|
+
// Must check before other patterns since channel suffix is explicit
|
|
2604
|
+
if (algLower.includes("-channel")) {
|
|
2605
|
+
return "channel";
|
|
2606
|
+
}
|
|
2607
|
+
// Check for explicit sealed marker
|
|
2608
|
+
if (algLower.includes("-sealed")) {
|
|
2609
|
+
return "sealed";
|
|
2610
|
+
}
|
|
2611
|
+
// ECDH-ES key agreement with AEAD cipher => sealed encryption
|
|
2612
|
+
// Pattern: "ECDH-ES+A256GCM", "ECDH-ES+A128GCM", etc.
|
|
2613
|
+
if (algLower.startsWith("ecdh-es") && algLower.includes("+a")) {
|
|
2614
|
+
return "sealed";
|
|
2615
|
+
}
|
|
2616
|
+
return "unknown";
|
|
2617
|
+
}
|
|
2618
|
+
/**
|
|
2619
|
+
* Creates security bindings from an envelope's sec header.
|
|
2620
|
+
* Exposes only metadata, never raw values like sig.val or enc.val.
|
|
2621
|
+
*/
|
|
2622
|
+
function createSecurityBindings(sec) {
|
|
2623
|
+
const sigPresent = sec?.sig !== undefined;
|
|
2624
|
+
const encPresent = sec?.enc !== undefined;
|
|
2625
|
+
return {
|
|
2626
|
+
sig: {
|
|
2627
|
+
present: sigPresent,
|
|
2628
|
+
kid: sec?.sig?.kid ?? null,
|
|
2629
|
+
},
|
|
2630
|
+
enc: {
|
|
2631
|
+
present: encPresent,
|
|
2632
|
+
alg: sec?.enc?.alg ?? null,
|
|
2633
|
+
kid: sec?.enc?.kid ?? null,
|
|
2634
|
+
level: encPresent
|
|
2635
|
+
? normalizeEncryptionLevelFromAlg(sec?.enc?.alg ?? null)
|
|
2636
|
+
: "plaintext",
|
|
2637
|
+
},
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2562
2640
|
/**
|
|
2563
2641
|
* Checks if a value is null.
|
|
2564
2642
|
*/
|
|
@@ -2567,9 +2645,21 @@ function isNull(value) {
|
|
|
2567
2645
|
}
|
|
2568
2646
|
/**
|
|
2569
2647
|
* Creates a function registry with auth helpers installed.
|
|
2648
|
+
*
|
|
2649
|
+
* This registry extends the base builtins with:
|
|
2650
|
+
* - Scope builtins: has_scope, has_any_scope, has_all_scopes
|
|
2651
|
+
* - Security builtins: is_signed, encryption_level, is_encrypted, is_encrypted_at_least
|
|
2570
2652
|
*/
|
|
2571
|
-
function createAuthFunctionRegistry(
|
|
2572
|
-
|
|
2653
|
+
function createAuthFunctionRegistry(grantedScopesOrOptions = []) {
|
|
2654
|
+
// Handle both old signature (array) and new signature (options object)
|
|
2655
|
+
const options = Array.isArray(grantedScopesOrOptions)
|
|
2656
|
+
? { grantedScopes: grantedScopesOrOptions }
|
|
2657
|
+
: grantedScopesOrOptions;
|
|
2658
|
+
const scopes = options.grantedScopes ?? [];
|
|
2659
|
+
const secBindings = options.securityBindings ?? {
|
|
2660
|
+
sig: { present: false, kid: null },
|
|
2661
|
+
enc: { present: false, alg: null, kid: null, level: "plaintext" },
|
|
2662
|
+
};
|
|
2573
2663
|
/**
|
|
2574
2664
|
* Checks if any granted scope matches a pattern (using glob syntax).
|
|
2575
2665
|
*/
|
|
@@ -2625,11 +2715,85 @@ function createAuthFunctionRegistry(grantedScopes = []) {
|
|
|
2625
2715
|
}
|
|
2626
2716
|
return values.every((scope) => matchesScope(scope));
|
|
2627
2717
|
};
|
|
2718
|
+
// ============================================================
|
|
2719
|
+
// Security posture builtins
|
|
2720
|
+
// ============================================================
|
|
2721
|
+
/**
|
|
2722
|
+
* is_signed() -> bool
|
|
2723
|
+
*
|
|
2724
|
+
* Returns true if the envelope has a signature present.
|
|
2725
|
+
* No arguments required.
|
|
2726
|
+
*/
|
|
2727
|
+
const is_signed = (args) => {
|
|
2728
|
+
assertArgCount(args, 0, "is_signed");
|
|
2729
|
+
return secBindings.sig.present;
|
|
2730
|
+
};
|
|
2731
|
+
/**
|
|
2732
|
+
* encryption_level() -> string
|
|
2733
|
+
*
|
|
2734
|
+
* Returns the normalized encryption level: "plaintext" | "channel" | "sealed" | "unknown"
|
|
2735
|
+
* No arguments required.
|
|
2736
|
+
*/
|
|
2737
|
+
const encryption_level = (args) => {
|
|
2738
|
+
assertArgCount(args, 0, "encryption_level");
|
|
2739
|
+
return secBindings.enc.level;
|
|
2740
|
+
};
|
|
2741
|
+
/**
|
|
2742
|
+
* is_encrypted() -> bool
|
|
2743
|
+
*
|
|
2744
|
+
* Returns true if the encryption level is not "plaintext".
|
|
2745
|
+
* This means the envelope has some form of encryption (channel, sealed, or unknown).
|
|
2746
|
+
* No arguments required.
|
|
2747
|
+
*/
|
|
2748
|
+
const is_encrypted = (args) => {
|
|
2749
|
+
assertArgCount(args, 0, "is_encrypted");
|
|
2750
|
+
return secBindings.enc.level !== "plaintext";
|
|
2751
|
+
};
|
|
2752
|
+
/**
|
|
2753
|
+
* is_encrypted_at_least(level: string) -> bool
|
|
2754
|
+
*
|
|
2755
|
+
* Returns true if the envelope's encryption level meets or exceeds the required level.
|
|
2756
|
+
*
|
|
2757
|
+
* Level ordering: plaintext < channel < sealed
|
|
2758
|
+
*
|
|
2759
|
+
* Special handling:
|
|
2760
|
+
* - "unknown" encryption level does NOT satisfy "channel" or "sealed" (conservative)
|
|
2761
|
+
* - "plaintext" is always satisfied (any envelope meets at least plaintext)
|
|
2762
|
+
* - null argument => false (predicate-style)
|
|
2763
|
+
* - invalid level string => BuiltinError
|
|
2764
|
+
*/
|
|
2765
|
+
const is_encrypted_at_least = (args) => {
|
|
2766
|
+
assertArgCount(args, 1, "is_encrypted_at_least");
|
|
2767
|
+
const requiredLevel = getArg(args, 0, "is_encrypted_at_least");
|
|
2768
|
+
// Null-tolerant: return false if level is null
|
|
2769
|
+
if (!assertStringOrNull(requiredLevel, "level", "is_encrypted_at_least")) {
|
|
2770
|
+
return false;
|
|
2771
|
+
}
|
|
2772
|
+
// Validate required level
|
|
2773
|
+
if (!VALID_ENCRYPTION_LEVELS.includes(requiredLevel)) {
|
|
2774
|
+
throw new BuiltinError("is_encrypted_at_least", `level must be one of: ${VALID_ENCRYPTION_LEVELS.join(", ")}; got "${requiredLevel}"`);
|
|
2775
|
+
}
|
|
2776
|
+
const currentLevel = secBindings.enc.level;
|
|
2777
|
+
const requiredOrder = ENCRYPTION_LEVEL_ORDER[requiredLevel] ?? 0;
|
|
2778
|
+
const currentOrder = ENCRYPTION_LEVEL_ORDER[currentLevel];
|
|
2779
|
+
// If current level is "unknown", it only satisfies "plaintext"
|
|
2780
|
+
if (currentOrder === undefined) {
|
|
2781
|
+
// "unknown" is treated as NOT meeting channel/sealed requirements
|
|
2782
|
+
return requiredOrder === 0; // Only plaintext is satisfied by unknown
|
|
2783
|
+
}
|
|
2784
|
+
return currentOrder >= requiredOrder;
|
|
2785
|
+
};
|
|
2628
2786
|
return new Map([
|
|
2629
2787
|
...BUILTIN_FUNCTIONS,
|
|
2788
|
+
// Scope builtins
|
|
2630
2789
|
["has_scope", has_scope],
|
|
2631
2790
|
["has_any_scope", has_any_scope],
|
|
2632
2791
|
["has_all_scopes", has_all_scopes],
|
|
2792
|
+
// Security posture builtins
|
|
2793
|
+
["is_signed", is_signed],
|
|
2794
|
+
["encryption_level", encryption_level],
|
|
2795
|
+
["is_encrypted", is_encrypted],
|
|
2796
|
+
["is_encrypted_at_least", is_encrypted_at_least],
|
|
2633
2797
|
]);
|
|
2634
2798
|
}
|
|
2635
2799
|
/**
|
|
@@ -2708,6 +2872,9 @@ const VALID_FRAME_TYPES = [
|
|
|
2708
2872
|
"CreditUpdate",
|
|
2709
2873
|
"KeyAnnounce",
|
|
2710
2874
|
"KeyRequest",
|
|
2875
|
+
"SecureOpen",
|
|
2876
|
+
"SecureAccept",
|
|
2877
|
+
"SecureClose",
|
|
2711
2878
|
];
|
|
2712
2879
|
/**
|
|
2713
2880
|
* Simple console logger implementation.
|
|
@@ -2769,19 +2936,33 @@ function extractClaims(context) {
|
|
|
2769
2936
|
}
|
|
2770
2937
|
/**
|
|
2771
2938
|
* Creates a safe envelope subset for expression bindings.
|
|
2939
|
+
*
|
|
2940
|
+
* Exposes:
|
|
2941
|
+
* - id, sid, traceId, corrId, flowId, to
|
|
2942
|
+
* - frame: { type }
|
|
2943
|
+
* - sec: { sig: { present, kid }, enc: { present, alg, kid, level } }
|
|
2944
|
+
*
|
|
2945
|
+
* IMPORTANT: Does NOT expose raw security values (sig.val, enc.val).
|
|
2772
2946
|
*/
|
|
2773
2947
|
function createEnvelopeBindings(envelope) {
|
|
2774
2948
|
const frame = envelope.frame;
|
|
2775
2949
|
const envelopeRecord = envelope;
|
|
2950
|
+
const sec = envelopeRecord.sec;
|
|
2951
|
+
const securityBindings = createSecurityBindings(sec);
|
|
2776
2952
|
return {
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
:
|
|
2953
|
+
bindings: {
|
|
2954
|
+
id: envelope.id ?? null,
|
|
2955
|
+
sid: envelopeRecord.sid ?? null,
|
|
2956
|
+
traceId: envelopeRecord.traceId ?? null,
|
|
2957
|
+
corrId: envelopeRecord.corrId ?? null,
|
|
2958
|
+
flowId: envelopeRecord.flowId ?? null,
|
|
2959
|
+
to: extractAddress(envelope) ?? null,
|
|
2960
|
+
frame: frame
|
|
2961
|
+
? { type: frame.type ?? null }
|
|
2962
|
+
: { type: null },
|
|
2963
|
+
sec: securityBindings,
|
|
2964
|
+
},
|
|
2965
|
+
securityBindings,
|
|
2785
2966
|
};
|
|
2786
2967
|
}
|
|
2787
2968
|
/**
|
|
@@ -2935,11 +3116,12 @@ class AdvancedAuthorizationPolicy {
|
|
|
2935
3116
|
continue;
|
|
2936
3117
|
}
|
|
2937
3118
|
if (rule.whenAst) {
|
|
2938
|
-
// Lazy initialization of expression bindings
|
|
3119
|
+
// Lazy initialization of expression bindings and security context
|
|
2939
3120
|
if (!expressionBindings) {
|
|
3121
|
+
const envelopeResult = createEnvelopeBindings(envelope);
|
|
2940
3122
|
expressionBindings = {
|
|
2941
3123
|
claims: extractClaims(context),
|
|
2942
|
-
envelope:
|
|
3124
|
+
envelope: envelopeResult.bindings,
|
|
2943
3125
|
delivery: createDeliveryBindings(context, resolvedAction),
|
|
2944
3126
|
node: createNodeBindings(node),
|
|
2945
3127
|
time: {
|
|
@@ -2947,9 +3129,13 @@ class AdvancedAuthorizationPolicy {
|
|
|
2947
3129
|
now_iso: new Date().toISOString(),
|
|
2948
3130
|
},
|
|
2949
3131
|
};
|
|
3132
|
+
// Create function registry with security bindings for security builtins
|
|
3133
|
+
functionRegistry = createAuthFunctionRegistry({
|
|
3134
|
+
grantedScopes,
|
|
3135
|
+
securityBindings: envelopeResult.securityBindings,
|
|
3136
|
+
});
|
|
2950
3137
|
}
|
|
2951
|
-
const functions = functionRegistry
|
|
2952
|
-
functionRegistry = functions;
|
|
3138
|
+
const functions = functionRegistry;
|
|
2953
3139
|
const evalContext = {
|
|
2954
3140
|
bindings: expressionBindings,
|
|
2955
3141
|
limits: this.expressionLimits,
|
|
@@ -12996,4 +13182,4 @@ if (isNode && proc && proc.env) {
|
|
|
12996
13182
|
}
|
|
12997
13183
|
}
|
|
12998
13184
|
|
|
12999
|
-
export { FACTORY_META$f as ADVANCED_AUTHORIZATION_POLICY_FACTORY_META, FACTORY_META$a as ADVANCED_EDDSA_ENVELOPE_SIGNER_FACTORY_META, FACTORY_META$9 as ADVANCED_EDDSA_ENVELOPE_VERIFIER_FACTORY_META, FACTORY_META$5 as ADVANCED_WELCOME_FACTORY_META, AFTHelper, AFTLoadBalancerStickinessManager, AFTLoadBalancerStickinessManagerFactory, AFTReplicaStickinessManager, AFTReplicaStickinessManagerFactory, FACTORY_META$7 as AFT_LOAD_BALANCER_FACTORY_META, FACTORY_META$6 as AFT_REPLICA_FACTORY_META, AdvancedAuthorizationPolicy, AdvancedAuthorizationPolicyFactory, AdvancedEdDSAEnvelopeSignerFactory, AdvancedEdDSAEnvelopeVerifierFactory, AdvancedWelcomeService, AdvancedWelcomeServiceFactory, FACTORY_META$2 as BROWSER_TRUST_STORE_PROVIDER_FACTORY_META, BUILTIN_FUNCTIONS, BrowserTrustStoreProviderFactory, BuiltinError, CAService, CAServiceClient, CAServiceFactory, CASigningService, CA_SERVICE_FACTORY_BASE_TYPE, CertificateRequestError, CompositeEncryptionManager, CompositeEncryptionManagerFactory, FACTORY_META$4 as DEFAULT_CERTIFICATE_MANAGER_FACTORY_META, DEFAULT_EXPRESSION_LIMITS, FACTORY_META$c as DEFAULT_SECURE_CHANNEL_MANAGER_FACTORY_META, DEFAULT_STICKINESS_SECURITY_LEVEL, DefaultCAService, DefaultCAServiceFactory, DefaultCertificateManager, DefaultCertificateManagerFactory, DefaultSecureChannelManager, DefaultSecureChannelManagerFactory, ENV_FAME_CA_CERT_FILE, ENV_FAME_CA_CERT_PEM, ENV_FAME_CA_KEY_FILE, ENV_FAME_CA_KEY_PEM, ENV_FAME_INTERMEDIATE_CHAIN_FILE, ENV_FAME_INTERMEDIATE_CHAIN_PEM, ENV_FAME_SIGNING_CERT_FILE, ENV_FAME_SIGNING_CERT_PEM, ENV_FAME_SIGNING_KEY_FILE, ENV_FAME_SIGNING_KEY_PEM, FACTORY_META$3 as ENV_TRUST_STORE_PROVIDER_FACTORY_META, ENV_VAR_FAME_CA_SERVICE_URL, EdDSAEnvelopeVerifier, EnvTrustStoreProviderFactory, EvaluationError, Evaluator, ExpressionError, GRANT_PURPOSE_CA_SIGN, LOGICALS_OID, LimitExceededError, NODE_ID_OID, NoAFTSigner, NullTrustStoreProvider, PROFILE_NAME_STRICT_OVERLAY, ParseError, Parser, SID_OID, SidOnlyAFTVerifier, SignedAFTSigner, SignedOptionalAFTVerifier, StickinessMode, StrictAFTVerifier, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, Tokenizer, TokenizerError, TrustStoreProviderFactory, TypeError, UnsignedAFTSigner, VERSION, X5CKeyManager, X5CKeyManagerFactory, FACTORY_META$8 as X5C_KEY_MANAGER_FACTORY_META, __advancedSecurityPluginLoader, astToString, base64UrlDecode, base64UrlEncode, calculateAstDepth, callBuiltin, index as channelEncryption, checkArrayLength, checkAstDepth, checkAstNodeCount, checkExpressionLength, checkFunctionArgCount, checkGlobPatternLength, checkRegexPatternLength, countAstNodes, createAftHelper, createAftPayload, createAftReplicaStickinessManager, createAftSigner, createAftVerifier, createAuthFunctionRegistry, createEd25519Csr, createEd25519CsrFromPem, createTestCA, evaluate, evaluateAsBoolean, extractCertificateInfo, extractLogicalHostsFromCert, extractNodeIdFromCert, extractSidFromCert, extractSidFromSpiffeId, extractSpiffeIdFromCert, formatCertificateInfo, getTypeName, isBuiltinFunction, normalizeJsValue, normalizeStickinessMode, parse, publicKeyFromX5c, registerAdvancedSecurityFactories, index$1 as sealedEncryption, serializeAftClaims, serializeAftHeader, tokenize, utf8Decode, validateJwkX5cCertificate, verifyCertSidIntegrity };
|
|
13185
|
+
export { FACTORY_META$f as ADVANCED_AUTHORIZATION_POLICY_FACTORY_META, FACTORY_META$a as ADVANCED_EDDSA_ENVELOPE_SIGNER_FACTORY_META, FACTORY_META$9 as ADVANCED_EDDSA_ENVELOPE_VERIFIER_FACTORY_META, FACTORY_META$5 as ADVANCED_WELCOME_FACTORY_META, AFTHelper, AFTLoadBalancerStickinessManager, AFTLoadBalancerStickinessManagerFactory, AFTReplicaStickinessManager, AFTReplicaStickinessManagerFactory, FACTORY_META$7 as AFT_LOAD_BALANCER_FACTORY_META, FACTORY_META$6 as AFT_REPLICA_FACTORY_META, AdvancedAuthorizationPolicy, AdvancedAuthorizationPolicyFactory, AdvancedEdDSAEnvelopeSignerFactory, AdvancedEdDSAEnvelopeVerifierFactory, AdvancedWelcomeService, AdvancedWelcomeServiceFactory, FACTORY_META$2 as BROWSER_TRUST_STORE_PROVIDER_FACTORY_META, BUILTIN_FUNCTIONS, BrowserTrustStoreProviderFactory, BuiltinError, CAService, CAServiceClient, CAServiceFactory, CASigningService, CA_SERVICE_FACTORY_BASE_TYPE, CertificateRequestError, CompositeEncryptionManager, CompositeEncryptionManagerFactory, FACTORY_META$4 as DEFAULT_CERTIFICATE_MANAGER_FACTORY_META, DEFAULT_EXPRESSION_LIMITS, FACTORY_META$c as DEFAULT_SECURE_CHANNEL_MANAGER_FACTORY_META, DEFAULT_STICKINESS_SECURITY_LEVEL, DefaultCAService, DefaultCAServiceFactory, DefaultCertificateManager, DefaultCertificateManagerFactory, DefaultSecureChannelManager, DefaultSecureChannelManagerFactory, ENV_FAME_CA_CERT_FILE, ENV_FAME_CA_CERT_PEM, ENV_FAME_CA_KEY_FILE, ENV_FAME_CA_KEY_PEM, ENV_FAME_INTERMEDIATE_CHAIN_FILE, ENV_FAME_INTERMEDIATE_CHAIN_PEM, ENV_FAME_SIGNING_CERT_FILE, ENV_FAME_SIGNING_CERT_PEM, ENV_FAME_SIGNING_KEY_FILE, ENV_FAME_SIGNING_KEY_PEM, FACTORY_META$3 as ENV_TRUST_STORE_PROVIDER_FACTORY_META, ENV_VAR_FAME_CA_SERVICE_URL, EdDSAEnvelopeVerifier, EnvTrustStoreProviderFactory, EvaluationError, Evaluator, ExpressionError, GRANT_PURPOSE_CA_SIGN, LOGICALS_OID, LimitExceededError, NODE_ID_OID, NoAFTSigner, NullTrustStoreProvider, PROFILE_NAME_STRICT_OVERLAY, ParseError, Parser, SID_OID, SidOnlyAFTVerifier, SignedAFTSigner, SignedOptionalAFTVerifier, StickinessMode, StrictAFTVerifier, TRUST_STORE_PROVIDER_FACTORY_BASE_TYPE, Tokenizer, TokenizerError, TrustStoreProviderFactory, TypeError, UnsignedAFTSigner, VERSION, X5CKeyManager, X5CKeyManagerFactory, FACTORY_META$8 as X5C_KEY_MANAGER_FACTORY_META, __advancedSecurityPluginLoader, astToString, base64UrlDecode, base64UrlEncode, calculateAstDepth, callBuiltin, index as channelEncryption, checkArrayLength, checkAstDepth, checkAstNodeCount, checkExpressionLength, checkFunctionArgCount, checkGlobPatternLength, checkRegexPatternLength, countAstNodes, createAftHelper, createAftPayload, createAftReplicaStickinessManager, createAftSigner, createAftVerifier, createAuthFunctionRegistry, createEd25519Csr, createEd25519CsrFromPem, createSecurityBindings, createTestCA, evaluate, evaluateAsBoolean, extractCertificateInfo, extractLogicalHostsFromCert, extractNodeIdFromCert, extractSidFromCert, extractSidFromSpiffeId, extractSpiffeIdFromCert, formatCertificateInfo, getTypeName, isBuiltinFunction, normalizeEncryptionLevelFromAlg, normalizeJsValue, normalizeStickinessMode, parse, publicKeyFromX5c, registerAdvancedSecurityFactories, index$1 as sealedEncryption, serializeAftClaims, serializeAftHeader, tokenize, utf8Decode, validateJwkX5cCertificate, verifyCertSidIntegrity };
|
|
@@ -14,7 +14,7 @@ import type { AuthorizationPolicy, AuthorizationDecision, AuthorizationPolicyDef
|
|
|
14
14
|
* - Bypass authorization entirely (e.g., AddressBindAck)
|
|
15
15
|
* - Are not valid frame types in the protocol
|
|
16
16
|
*/
|
|
17
|
-
export declare const VALID_FRAME_TYPES: readonly ["Data", "DeliveryAck", "NodeAttach", "NodeHello", "NodeWelcome", "NodeAttachAck", "AddressBind", "AddressUnbind", "CapabilityAdvertise", "CapabilityWithdraw", "NodeHeartbeat", "NodeHeartbeatAck", "CreditUpdate", "KeyAnnounce", "KeyRequest"];
|
|
17
|
+
export declare const VALID_FRAME_TYPES: readonly ["Data", "DeliveryAck", "NodeAttach", "NodeHello", "NodeWelcome", "NodeAttachAck", "AddressBind", "AddressUnbind", "CapabilityAdvertise", "CapabilityWithdraw", "NodeHeartbeat", "NodeHeartbeatAck", "CreditUpdate", "KeyAnnounce", "KeyRequest", "SecureOpen", "SecureAccept", "SecureClose"];
|
|
18
18
|
import type { NodeLike } from "@naylence/runtime";
|
|
19
19
|
import type { ExpressionLimits } from "../../../expr/limits.js";
|
|
20
20
|
/**
|
package/dist/types/naylence/fame/security/auth/policy/advanced-authorization-policy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced-authorization-policy.d.ts","sourceRoot":"","sources":["../../../../../../../src/naylence/fame/security/auth/policy/advanced-authorization-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EAErB,6BAA6B,EAE7B,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAY3B;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"advanced-authorization-policy.d.ts","sourceRoot":"","sources":["../../../../../../../src/naylence/fame/security/auth/policy/advanced-authorization-policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EAErB,6BAA6B,EAE7B,UAAU,EAGX,MAAM,mBAAmB,CAAC;AAY3B;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,ySAmBpB,CAAC;AAEX,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAQlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAQhE;;GAEG;AACH,UAAU,MAAM;IACd,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC3D,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC9D;AA6KD;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD;;OAEG;IACH,gBAAgB,EAAE,6BAA6B,CAAC;IAEhD;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,qBAAa,2BAA4B,YAAW,mBAAmB;IACrE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA2B;IACzD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,EAAE,kCAAkC;IAkCvD;;OAEG;IACG,eAAe,CACnB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,mBAAmB,EAC7B,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,qBAAqB,CAAC;IAmNjC,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAuFnB,OAAO,CAAC,cAAc;IAiDtB,OAAO,CAAC,cAAc;IA+DtB,OAAO,CAAC,iBAAiB;IA6DzB,OAAO,CAAC,kBAAkB;IA6D1B,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,wBAAwB;CAcjC"}
|