@atlasauth/pca-authzen 0.1.0 → 0.2.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/LICENSE +21 -0
- package/README.md +68 -0
- package/package.json +28 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Atlas Authorization
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @atlasauth/pca-authzen
|
|
2
|
+
|
|
3
|
+
Proof-Carrying Authority (PCA) behind the OpenID AuthZEN Authorization API. It gives you a Policy Decision Point (PDP) so any AuthZEN-speaking Policy Enforcement Point (an API gateway, a service mesh sidecar, an MCP host) can ask "can this subject do this action on this resource?" and get a boolean decision backed by the PCA verifier and policy engine.
|
|
4
|
+
|
|
5
|
+
- If the request `context` carries a signed PCActn (key `pca_action`), the PDP verifies it and then runs the deterministic policy decision.
|
|
6
|
+
- Otherwise it evaluates the declared policy statically (exact admission via `@atlasauth/pca-analyzer`).
|
|
7
|
+
- Everything fails closed: an unresolved policy, a malformed or foreign PCActn, a verifier rejection, a policy denial or a thrown error all return `decision: false`.
|
|
8
|
+
|
|
9
|
+
It exposes Access Evaluation, Access Evaluations (batch), the COAZ profile for MCP tool authorization, and an approval-required reference (AARP style) when a step-up cosign is needed.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npm i @atlasauth/pca-authzen @atlasauth/pca @atlasauth/pca-analyzer
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { agent, generateKeyPair } from '@atlasauth/pca';
|
|
21
|
+
import { authzenPdp, authzenHandler, PCA_ACTION_KEY, isApprovalRequired } from '@atlasauth/pca-authzen';
|
|
22
|
+
|
|
23
|
+
const a = agent({
|
|
24
|
+
principal: generateKeyPair(),
|
|
25
|
+
goal: 'reconcile october refunds',
|
|
26
|
+
permissions: { stripe: ['refund'] },
|
|
27
|
+
limits: { refund: '$500' },
|
|
28
|
+
aud: 'rs_demo',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const pdp = authzenPdp({
|
|
32
|
+
audience: 'rs_demo',
|
|
33
|
+
// Look up the authority for each request. Return null to deny.
|
|
34
|
+
resolve: () => ({ grant: a.grant, chain: a.chain, policy: a.policy, budget: a.budget }),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const { encoded } = a.act('stripe.refund', 'charge:ch_1', { amount: 42, currency: 'usd' });
|
|
38
|
+
|
|
39
|
+
const resp = await pdp.evaluate({
|
|
40
|
+
subject: { type: 'agent', id: 'a1' },
|
|
41
|
+
action: { name: 'stripe.refund', properties: { amount: 42, currency: 'usd' } },
|
|
42
|
+
resource: { type: 'charge', id: 'ch_1' },
|
|
43
|
+
context: { [PCA_ACTION_KEY]: encoded },
|
|
44
|
+
});
|
|
45
|
+
// resp.decision is a boolean; isApprovalRequired(resp) is true for a pending step-up
|
|
46
|
+
|
|
47
|
+
// Framework-agnostic HTTP handler for the standard AuthZEN paths:
|
|
48
|
+
const handle = authzenHandler(pdp); // handle({ path: '/access/v1/evaluation', body }) -> { status, body }
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The signed PCActn must match the requested action, resource and parameters, otherwise the decision is false. If you omit `audience` and the PCActn carries an `aud`, the PDP fails closed.
|
|
52
|
+
|
|
53
|
+
## API
|
|
54
|
+
|
|
55
|
+
- `authzenPdp(config)` returns `{ evaluate, evaluations, evaluateTool }`
|
|
56
|
+
- `authzenHandler(pdp)`, with path constants `EVALUATION_PATH`, `EVALUATIONS_PATH`, `COAZ_TOOL_PATH`
|
|
57
|
+
- `approvalOf`, `isApprovalRequired`, `PCA_ACTION_KEY`, `PCA_APPROVAL_KEY`
|
|
58
|
+
- Request guards (`isAccessEvaluationRequest`, ...) and `defaultToAction` (override per request with `toAction`)
|
|
59
|
+
|
|
60
|
+
## Status
|
|
61
|
+
|
|
62
|
+
The PDP is only as strong as the `resolve` callback you provide: it decides against the grant, policy and budget you hand it, and it keeps no state of its own. Cryptography in the underlying PCA packages is unaudited.
|
|
63
|
+
|
|
64
|
+
Source and issues: https://github.com/Atlas-Authorization/pca
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT - see LICENSE
|
package/package.json
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasauth/pca-authzen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "AuthZEN PDP for PCA: expose the PCA verifier/policy engine behind the OpenID AuthZEN Authorization API (subject/action/resource/context) with the COAZ MCP-tool and AARP approval profiles, so any AuthZEN PEP can use PCA as its decision point.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"authzen",
|
|
7
|
+
"pdp",
|
|
8
|
+
"openid",
|
|
9
|
+
"authorization api",
|
|
10
|
+
"agent authorization",
|
|
11
|
+
"proof-carrying authority",
|
|
12
|
+
"pca",
|
|
13
|
+
"ai agents"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"homepage": "https://github.com/Atlas-Authorization/pca#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/Atlas-Authorization/pca/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/Atlas-Authorization/pca.git",
|
|
23
|
+
"directory": "packages/pca-authzen"
|
|
24
|
+
},
|
|
5
25
|
"main": "./dist/index.js",
|
|
6
26
|
"types": "./dist/index.d.ts",
|
|
7
27
|
"exports": {
|
|
@@ -12,8 +32,8 @@
|
|
|
12
32
|
"./package.json": "./package.json"
|
|
13
33
|
},
|
|
14
34
|
"dependencies": {
|
|
15
|
-
"@atlasauth/pca": "0.
|
|
16
|
-
"@atlasauth/pca-analyzer": "0.
|
|
35
|
+
"@atlasauth/pca": "0.2.0",
|
|
36
|
+
"@atlasauth/pca-analyzer": "0.2.0"
|
|
17
37
|
},
|
|
18
38
|
"devDependencies": {
|
|
19
39
|
"typescript": "^5.6.3",
|
|
@@ -21,8 +41,12 @@
|
|
|
21
41
|
},
|
|
22
42
|
"files": [
|
|
23
43
|
"dist",
|
|
24
|
-
"README.md"
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE"
|
|
25
46
|
],
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=20"
|
|
49
|
+
},
|
|
26
50
|
"publishConfig": {
|
|
27
51
|
"access": "public"
|
|
28
52
|
},
|