@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
|
@@ -4,11 +4,81 @@
|
|
|
4
4
|
* Null handling semantics:
|
|
5
5
|
* - Scope predicate builtins (has_scope, has_any_scope, has_all_scopes)
|
|
6
6
|
* return `false` when passed `null` for required args.
|
|
7
|
+
* - Security predicate builtins (is_signed, is_encrypted, is_encrypted_at_least)
|
|
8
|
+
* return `false` when the envelope lacks the required security posture.
|
|
7
9
|
* - Wrong non-null types still raise BuiltinError to surface real bugs.
|
|
8
10
|
*/
|
|
9
11
|
import { type FunctionRegistry } from "../../../expr/index.js";
|
|
12
|
+
/**
|
|
13
|
+
* Encryption level type for normalized security posture.
|
|
14
|
+
*/
|
|
15
|
+
export type EncryptionLevel = "plaintext" | "channel" | "sealed" | "unknown";
|
|
16
|
+
/**
|
|
17
|
+
* Normalizes an encryption algorithm string to an EncryptionLevel.
|
|
18
|
+
*
|
|
19
|
+
* Mapping rules:
|
|
20
|
+
* - null/undefined => "plaintext" (no encryption present)
|
|
21
|
+
* - alg contains "-channel" => "channel" (e.g., "chacha20-poly1305-channel")
|
|
22
|
+
* - alg contains "-sealed" => "sealed" (explicit sealed marker)
|
|
23
|
+
* - alg matches ECDH-ES pattern with AEAD cipher => "sealed" (e.g., "ECDH-ES+A256GCM")
|
|
24
|
+
* - otherwise => "unknown"
|
|
25
|
+
*
|
|
26
|
+
* Currently supported algorithms:
|
|
27
|
+
* - Channel: "chacha20-poly1305-channel"
|
|
28
|
+
* - Sealed: "ECDH-ES+A256GCM"
|
|
29
|
+
*
|
|
30
|
+
* This helper is centralized to ensure consistent mapping across TS and Python.
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeEncryptionLevelFromAlg(alg: string | null | undefined): EncryptionLevel;
|
|
33
|
+
/**
|
|
34
|
+
* Security metadata bindings exposed to expressions.
|
|
35
|
+
* This is the shape of the `envelope.sec` binding.
|
|
36
|
+
*/
|
|
37
|
+
export interface SecurityBindings {
|
|
38
|
+
sig: {
|
|
39
|
+
present: boolean;
|
|
40
|
+
kid: string | null;
|
|
41
|
+
};
|
|
42
|
+
enc: {
|
|
43
|
+
present: boolean;
|
|
44
|
+
alg: string | null;
|
|
45
|
+
kid: string | null;
|
|
46
|
+
level: EncryptionLevel;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates security bindings from an envelope's sec header.
|
|
51
|
+
* Exposes only metadata, never raw values like sig.val or enc.val.
|
|
52
|
+
*/
|
|
53
|
+
export declare function createSecurityBindings(sec: {
|
|
54
|
+
sig?: {
|
|
55
|
+
kid?: string;
|
|
56
|
+
};
|
|
57
|
+
enc?: {
|
|
58
|
+
alg?: string;
|
|
59
|
+
kid?: string;
|
|
60
|
+
};
|
|
61
|
+
} | undefined): SecurityBindings;
|
|
62
|
+
/**
|
|
63
|
+
* Options for creating an auth function registry.
|
|
64
|
+
*/
|
|
65
|
+
export interface AuthFunctionRegistryOptions {
|
|
66
|
+
/**
|
|
67
|
+
* Granted scopes for scope checking builtins.
|
|
68
|
+
*/
|
|
69
|
+
grantedScopes?: readonly string[];
|
|
70
|
+
/**
|
|
71
|
+
* Security bindings for security posture builtins.
|
|
72
|
+
* If not provided, is_signed returns false and encryption_level returns "plaintext".
|
|
73
|
+
*/
|
|
74
|
+
securityBindings?: SecurityBindings;
|
|
75
|
+
}
|
|
10
76
|
/**
|
|
11
77
|
* Creates a function registry with auth helpers installed.
|
|
78
|
+
*
|
|
79
|
+
* This registry extends the base builtins with:
|
|
80
|
+
* - Scope builtins: has_scope, has_any_scope, has_all_scopes
|
|
81
|
+
* - Security builtins: is_signed, encryption_level, is_encrypted, is_encrypted_at_least
|
|
12
82
|
*/
|
|
13
|
-
export declare function createAuthFunctionRegistry(
|
|
83
|
+
export declare function createAuthFunctionRegistry(grantedScopesOrOptions?: readonly string[] | AuthFunctionRegistryOptions): FunctionRegistry;
|
|
14
84
|
//# sourceMappingURL=expr-builtins.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expr-builtins.d.ts","sourceRoot":"","sources":["../../../../../../../src/naylence/fame/security/auth/policy/expr-builtins.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"expr-builtins.d.ts","sourceRoot":"","sources":["../../../../../../../src/naylence/fame/security/auth/policy/expr-builtins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAGhC;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAqB7E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,+BAA+B,CAC7C,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC7B,eAAe,CAyBjB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE;QACH,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,CAAC;IACF,GAAG,EAAE;QACH,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,KAAK,EAAE,eAAe,CAAC;KACxB,CAAC;CACH;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE;IAAE,GAAG,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,GAAG,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAAG,SAAS,GAChF,gBAAgB,CAkBlB;AASD;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAElC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,sBAAsB,GAAE,SAAS,MAAM,EAAE,GAAG,2BAAgC,GAC3E,gBAAgB,CAiKlB"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
|
-
export { createAuthFunctionRegistry } from "./expr-builtins.js";
|
|
9
|
+
export { createAuthFunctionRegistry, createSecurityBindings, normalizeEncryptionLevelFromAlg, type AuthFunctionRegistryOptions, type EncryptionLevel, type SecurityBindings, } from "./expr-builtins.js";
|
|
10
10
|
export { AdvancedAuthorizationPolicy, type AdvancedAuthorizationPolicyOptions, } from "./advanced-authorization-policy.js";
|
|
11
11
|
export { AdvancedAuthorizationPolicyFactory, FACTORY_META as ADVANCED_AUTHORIZATION_POLICY_FACTORY_META, type AdvancedAuthorizationPolicyConfig, } from "./advanced-authorization-policy-factory.js";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/naylence/fame/security/auth/policy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/naylence/fame/security/auth/policy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,+BAA+B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EACL,kCAAkC,EAClC,YAAY,IAAI,0CAA0C,EAC1D,KAAK,iCAAiC,GACvC,MAAM,4CAA4C,CAAC"}
|
package/dist/types/version.d.ts
CHANGED
package/package.json
CHANGED