@appport/authorization 1.0.0

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/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # @appport/authorization
2
+
3
+ The capability authorization model.
4
+
5
+ Authorization in AppPort operates on capabilities, never on transports. A
6
+ capability declares the permissions it requires; an authorizer decides whether
7
+ the caller holds them.
8
+
9
+ ```ts
10
+ import { permissionAuthorizer, combineAuthorizers, authorizerFrom } from "@appport/authorization";
11
+
12
+ const authorizer = combineAuthorizers([
13
+ permissionAuthorizer(),
14
+ authorizerFrom("owner", ({ session, input }) => isOwner(session, input))
15
+ ]);
16
+ ```
17
+
18
+ - `permissionAuthorizer()` — the session's permissions must cover the
19
+ capability's. Wildcards (`documents.*`, `*`) are supported.
20
+ - `authorizerFrom(name, fn)` — resource-level policy.
21
+ - `combineAuthorizers([...])` — every authorizer must allow; first denial wins.
22
+ - `allowAllAuthorizer()` — local runtimes and tests only.
23
+
24
+ `UNAUTHORIZED` and `FORBIDDEN` are distinguished deliberately: a client needs to
25
+ tell "sign in" from "you cannot do this".
26
+
27
+ Nothing here infers trust from the carrier. Desktop IPC is not identity, and
28
+ neither is HTTPS.
@@ -0,0 +1,94 @@
1
+ /**
2
+ * `@appport/authorization` — the capability authorization model (§34, §37, §38).
3
+ *
4
+ * Authorization in AppPort operates on capabilities, never on transports.
5
+ * A capability declares the permissions it requires; an {@link Authorizer}
6
+ * decides whether the current principal holds them. Nothing here infers trust
7
+ * from the transport: desktop IPC is not privileged, and HTTPS is not identity.
8
+ */
9
+ import { AppPortError, type CapabilityRef, type Principal, type Session } from "@appport/protocol";
10
+ export type Permission = string;
11
+ /**
12
+ * Matches a permission against a granted permission, supporting `*` wildcards
13
+ * at segment granularity: `documents.*` grants `documents.write`, and the bare
14
+ * `*` grants everything.
15
+ */
16
+ export declare function permissionMatches(granted: Permission, required: Permission): boolean;
17
+ export declare function grantsPermission(granted: Iterable<Permission>, required: Permission): boolean;
18
+ /**
19
+ * The authorization view handed to capability handlers (§10).
20
+ *
21
+ * Handlers use it for resource-level checks that the declarative capability
22
+ * permissions cannot express ("may this principal write *this* document").
23
+ */
24
+ export interface AuthorizationContext {
25
+ readonly session?: Session;
26
+ readonly principal?: Principal;
27
+ /** Permissions effectively granted to the caller. */
28
+ readonly permissions: readonly Permission[];
29
+ has(permission: Permission): boolean;
30
+ hasAll(permissions: readonly Permission[]): boolean;
31
+ /** Throws `FORBIDDEN` (or `UNAUTHORIZED` when anonymous) if not granted. */
32
+ require(permission: Permission): void;
33
+ }
34
+ export declare function createAuthorizationContext(options: {
35
+ session?: Session;
36
+ principal?: Principal;
37
+ permissions?: readonly Permission[];
38
+ }): AuthorizationContext;
39
+ export interface AuthorizationRequest {
40
+ capability: CapabilityRef;
41
+ /** Permissions declared by the capability version. */
42
+ required: readonly Permission[];
43
+ session?: Session;
44
+ principal?: Principal;
45
+ /** Validated capability input, so policies can make resource-aware decisions. */
46
+ input: unknown;
47
+ /** Transport kind, for auditing only — never for granting trust (§37, §38). */
48
+ transport?: string;
49
+ }
50
+ export type AuthorizationDecision = {
51
+ allowed: true; /** Permissions to expose on the handler context. */
52
+ permissions?: readonly Permission[];
53
+ } | {
54
+ allowed: false;
55
+ code: "UNAUTHORIZED" | "FORBIDDEN";
56
+ reason?: string;
57
+ };
58
+ export interface Authorizer {
59
+ readonly name: string;
60
+ authorize(request: AuthorizationRequest): AuthorizationDecision | Promise<AuthorizationDecision>;
61
+ }
62
+ export declare const ALLOW: AuthorizationDecision;
63
+ export declare function deny(reason?: string, code?: "UNAUTHORIZED" | "FORBIDDEN"): AuthorizationDecision;
64
+ /**
65
+ * The default authorizer: the session's permission set must cover every
66
+ * permission the capability declares.
67
+ *
68
+ * A capability that declares no permissions is public. A capability that
69
+ * declares permissions with no session present fails `UNAUTHORIZED`, so clients
70
+ * can distinguish "log in" from "not allowed".
71
+ */
72
+ export declare function permissionAuthorizer(options?: {
73
+ /** Permissions granted to every caller, authenticated or not. */
74
+ publicPermissions?: readonly Permission[];
75
+ /** Resolves additional permissions for a principal. */
76
+ resolvePermissions?: (request: AuthorizationRequest) => readonly Permission[] | Promise<readonly Permission[]>;
77
+ }): Authorizer;
78
+ /**
79
+ * Allows everything. Appropriate for local single-user runtimes and tests, and
80
+ * never appropriate for a networked deployment.
81
+ */
82
+ export declare function allowAllAuthorizer(): Authorizer;
83
+ /** Wraps a plain predicate as an authorizer. */
84
+ export declare function authorizerFrom(name: string, fn: (request: AuthorizationRequest) => boolean | AuthorizationDecision | Promise<boolean | AuthorizationDecision>): Authorizer;
85
+ /**
86
+ * Runs authorizers in order; every authorizer must allow. The first denial
87
+ * wins, so put the cheapest check first.
88
+ */
89
+ export declare function combineAuthorizers(authorizers: readonly Authorizer[]): Authorizer;
90
+ /** Converts a denial into the corresponding protocol error. */
91
+ export declare function decisionToError(decision: Extract<AuthorizationDecision, {
92
+ allowed: false;
93
+ }>): AppPortError;
94
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAU,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE3G,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAKpF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAK7F;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC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AAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,cAAc,GAAG,WAAyB,GAAG,qBAAqB,CAI7G;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE;IACP,iEAAiE;IACjE,iBAAiB,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAC1C,uDAAuD;IACvD,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;CAC3G,GACL,UAAU,CAqBZ;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,CAE/C;AAED,gDAAgD;AAChD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,GAAG,qBAAqB,GAAG,OAAO,CAAC,OAAO,GAAG,qBAAqB,CAAC,GAChH,UAAU,CAWZ;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,CAajF;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,qBAAqB,EAAE;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,GAAG,YAAY,CAI1G"}
package/dist/index.js ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * `@appport/authorization` — the capability authorization model (§34, §37, §38).
3
+ *
4
+ * Authorization in AppPort operates on capabilities, never on transports.
5
+ * A capability declares the permissions it requires; an {@link Authorizer}
6
+ * decides whether the current principal holds them. Nothing here infers trust
7
+ * from the transport: desktop IPC is not privileged, and HTTPS is not identity.
8
+ */
9
+ import { AppPortError, errors } from "@appport/protocol";
10
+ /**
11
+ * Matches a permission against a granted permission, supporting `*` wildcards
12
+ * at segment granularity: `documents.*` grants `documents.write`, and the bare
13
+ * `*` grants everything.
14
+ */
15
+ export function permissionMatches(granted, required) {
16
+ if (granted === "*" || granted === required)
17
+ return true;
18
+ if (!granted.endsWith(".*"))
19
+ return false;
20
+ const prefix = granted.slice(0, -1); // keep the trailing dot
21
+ return required.startsWith(prefix);
22
+ }
23
+ export function grantsPermission(granted, required) {
24
+ for (const permission of granted) {
25
+ if (permissionMatches(permission, required))
26
+ return true;
27
+ }
28
+ return false;
29
+ }
30
+ export function createAuthorizationContext(options) {
31
+ const permissions = options.permissions ?? options.session?.permissions ?? [];
32
+ const principal = options.principal ?? options.session?.principal;
33
+ const context = {
34
+ ...(options.session ? { session: options.session } : {}),
35
+ ...(principal ? { principal } : {}),
36
+ permissions,
37
+ has: (permission) => grantsPermission(permissions, permission),
38
+ hasAll: (required) => required.every((permission) => grantsPermission(permissions, permission)),
39
+ require: (permission) => {
40
+ if (grantsPermission(permissions, permission))
41
+ return;
42
+ if (!principal)
43
+ throw errors.unauthorized();
44
+ throw errors.forbidden(`Missing permission: ${permission}`, { required: [permission] });
45
+ }
46
+ };
47
+ return context;
48
+ }
49
+ export const ALLOW = { allowed: true };
50
+ export function deny(reason, code = "FORBIDDEN") {
51
+ return code === "UNAUTHORIZED"
52
+ ? { allowed: false, code, ...(reason ? { reason } : {}) }
53
+ : { allowed: false, code, ...(reason ? { reason } : {}) };
54
+ }
55
+ /**
56
+ * The default authorizer: the session's permission set must cover every
57
+ * permission the capability declares.
58
+ *
59
+ * A capability that declares no permissions is public. A capability that
60
+ * declares permissions with no session present fails `UNAUTHORIZED`, so clients
61
+ * can distinguish "log in" from "not allowed".
62
+ */
63
+ export function permissionAuthorizer(options = {}) {
64
+ return {
65
+ name: "permission",
66
+ async authorize(request) {
67
+ const granted = [
68
+ ...(options.publicPermissions ?? []),
69
+ ...(request.session?.permissions ?? []),
70
+ ...(options.resolvePermissions ? await options.resolvePermissions(request) : [])
71
+ ];
72
+ if (request.required.length === 0)
73
+ return { allowed: true, permissions: granted };
74
+ const missing = request.required.filter((permission) => !grantsPermission(granted, permission));
75
+ if (missing.length === 0)
76
+ return { allowed: true, permissions: granted };
77
+ const principal = request.principal ?? request.session?.principal;
78
+ if (!principal) {
79
+ return { allowed: false, code: "UNAUTHORIZED", reason: "Authentication is required" };
80
+ }
81
+ return { allowed: false, code: "FORBIDDEN", reason: `Missing permission: ${missing.join(", ")}` };
82
+ }
83
+ };
84
+ }
85
+ /**
86
+ * Allows everything. Appropriate for local single-user runtimes and tests, and
87
+ * never appropriate for a networked deployment.
88
+ */
89
+ export function allowAllAuthorizer() {
90
+ return { name: "allow-all", authorize: () => ({ allowed: true, permissions: ["*"] }) };
91
+ }
92
+ /** Wraps a plain predicate as an authorizer. */
93
+ export function authorizerFrom(name, fn) {
94
+ return {
95
+ name,
96
+ async authorize(request) {
97
+ const result = await fn(request);
98
+ if (typeof result === "boolean") {
99
+ return result ? { allowed: true } : { allowed: false, code: "FORBIDDEN" };
100
+ }
101
+ return result;
102
+ }
103
+ };
104
+ }
105
+ /**
106
+ * Runs authorizers in order; every authorizer must allow. The first denial
107
+ * wins, so put the cheapest check first.
108
+ */
109
+ export function combineAuthorizers(authorizers) {
110
+ return {
111
+ name: `combined(${authorizers.map((a) => a.name).join(",")})`,
112
+ async authorize(request) {
113
+ let permissions;
114
+ for (const authorizer of authorizers) {
115
+ const decision = await authorizer.authorize(request);
116
+ if (!decision.allowed)
117
+ return decision;
118
+ if (decision.permissions)
119
+ permissions = decision.permissions;
120
+ }
121
+ return permissions ? { allowed: true, permissions } : { allowed: true };
122
+ }
123
+ };
124
+ }
125
+ /** Converts a denial into the corresponding protocol error. */
126
+ export function decisionToError(decision) {
127
+ return decision.code === "UNAUTHORIZED"
128
+ ? errors.unauthorized(decision.reason ?? "Authentication is required")
129
+ : errors.forbidden(decision.reason ?? "Capability is not authorized");
130
+ }
131
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;A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C,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,IAAI,4BAA4B,CAAC;QACtE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,8BAA8B,CAAC,CAAC;AAC1E,CAAC"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@appport/authorization",
3
+ "version": "1.0.0",
4
+ "description": "Capability authorization model for AppPort.",
5
+ "license": "Apache-2.0",
6
+ "repository": { "type": "git", "url": "git+https://github.com/rkendel1/appport.git", "directory": "packages/authorization" },
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -b",
22
+ "clean": "tsc -b --clean"
23
+ },
24
+ "dependencies": {
25
+ "@appport/protocol": "1.0.0"
26
+ },
27
+ "publishConfig": { "access": "public" }
28
+ }