@datacules/agent-identity-store-dynamic 0.9.0 → 0.11.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 +43 -57
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="../../../assets/logo.svg" alt="Agent Identity — by Datacules LLC" width="360"/>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# `@datacules/agent-identity-store-dynamic`
|
|
2
6
|
|
|
3
|
-
Just-in-
|
|
7
|
+
JIT (Just-in-Time) credential provisioning store for the agent-identity framework. Mints short-lived secrets on demand via Vault dynamic secrets, AWS IAM Roles Anywhere, or Azure Managed Identity. Zero static secrets at rest.
|
|
4
8
|
|
|
5
9
|
## Install
|
|
6
10
|
|
|
@@ -8,74 +12,56 @@ Just-in-time credential provisioning for [`@datacules/agent-identity`](../../cor
|
|
|
8
12
|
npm install @datacules/agent-identity-store-dynamic
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
## Why JIT?
|
|
12
|
-
|
|
13
|
-
With static credential stores, long-lived secrets sit at rest — if the store is compromised, every credential in it is exposed. With JIT provisioning, there are no stored secrets: the store calls your vault on every resolution and gets back a short-lived lease. After the TTL (15–60 minutes) the upstream system revokes the secret automatically. The blast radius of any store compromise collapses to a single active session at most.
|
|
14
|
-
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
-
### Vault dynamic secrets
|
|
18
|
-
|
|
19
17
|
```typescript
|
|
20
|
-
import { DynamicCredentialStore
|
|
21
|
-
import { createRouterFromStore }
|
|
18
|
+
import { DynamicCredentialStore } from '@datacules/agent-identity-store-dynamic';
|
|
19
|
+
import { createRouterFromStore } from '@datacules/agent-identity';
|
|
22
20
|
|
|
21
|
+
// Vault dynamic secrets
|
|
23
22
|
const store = new DynamicCredentialStore({
|
|
24
|
-
provisioner:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ttl: '30m',
|
|
30
|
-
}),
|
|
23
|
+
provisioner: 'vault-dynamic',
|
|
24
|
+
vaultAddr: process.env.VAULT_ADDR!,
|
|
25
|
+
vaultToken: process.env.VAULT_TOKEN!,
|
|
26
|
+
roleName: 'agent-identity-db-role',
|
|
27
|
+
ttl: '1h',
|
|
31
28
|
});
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
import { DynamicCredentialStore, AwsRolesAnywhereProvisioner } from '@datacules/agent-identity-store-dynamic';
|
|
30
|
+
// AWS IAM Roles Anywhere
|
|
31
|
+
const store = new DynamicCredentialStore({
|
|
32
|
+
provisioner: 'aws-iam-roles-anywhere',
|
|
33
|
+
profileArn: 'arn:aws:rolesanywhere:us-east-1:...',
|
|
34
|
+
roleArn: 'arn:aws:iam::...:role/AgentIdentityRole',
|
|
35
|
+
trustAnchorArn: 'arn:aws:rolesanywhere:us-east-1:...',
|
|
36
|
+
certificatePath: '/run/spire/svid.pem',
|
|
37
|
+
privateKeyPath: '/run/spire/svid-key.pem',
|
|
38
|
+
});
|
|
43
39
|
|
|
40
|
+
// Azure Managed Identity
|
|
44
41
|
const store = new DynamicCredentialStore({
|
|
45
|
-
provisioner:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
trustAnchorArn: 'arn:aws:rolesanywhere:us-east-1:...',
|
|
49
|
-
region: 'us-east-1',
|
|
50
|
-
durationSeconds: 3600,
|
|
51
|
-
}),
|
|
42
|
+
provisioner: 'azure-managed-identity',
|
|
43
|
+
resource: 'https://management.azure.com/',
|
|
44
|
+
clientId: process.env.AZURE_CLIENT_ID, // optional for user-assigned MI
|
|
52
45
|
});
|
|
46
|
+
|
|
47
|
+
const router = createRouterFromStore(store, rules, logger);
|
|
53
48
|
```
|
|
54
49
|
|
|
55
|
-
|
|
50
|
+
## How it works
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
secret,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async revoke(leaseId: string): Promise<void> {
|
|
74
|
-
await myVault.revoke(leaseId);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
```
|
|
52
|
+
1. On the first `findByRef(ref)` call for a slot, the provisioner mints a new secret (DB password, IAM session token, etc.) from the backend.
|
|
53
|
+
2. The minted credential is cached in-memory until 60 seconds before its TTL expires.
|
|
54
|
+
3. On expiry, the next `findByRef()` call provisions a fresh secret automatically.
|
|
55
|
+
4. A full store compromise reveals only the cached in-flight secrets — no long-lived secrets exist anywhere.
|
|
56
|
+
|
|
57
|
+
## TTL considerations
|
|
58
|
+
|
|
59
|
+
| Provisioner | Typical TTL | Backend revocation |
|
|
60
|
+
|-------------|-------------|--------------------|
|
|
61
|
+
| Vault dynamic secrets | 1 h (configurable) | Vault lease revocation API |
|
|
62
|
+
| AWS IAM Roles Anywhere | 1 h (max 12 h) | IAM session revocation |
|
|
63
|
+
| Azure Managed Identity | 24 h | Azure AD token revocation |
|
|
78
64
|
|
|
79
|
-
|
|
65
|
+
---
|
|
80
66
|
|
|
81
|
-
|
|
67
|
+
Part of the [agent-identity monorepo](https://github.com/hvrcharon1/agent-identity) by [Datacules LLC](https://datacules.com).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datacules/agent-identity-store-dynamic",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Just-in-time credential provisioning store for @datacules/agent-identity — mints short-lived secrets on demand via Vault dynamic secrets or AWS IAM Roles Anywhere",
|
|
6
6
|
"author": "Datacules LLC",
|