@datacules/agent-identity-anomaly 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 +40 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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-anomaly`
|
|
2
6
|
|
|
3
7
|
Behavioral baseline and anomaly detection for [`@datacules/agent-identity`](../../core). Wraps your audit pipeline with zero routing config changes — each agent builds a rolling baseline and deviations trigger `credential.anomaly` audit events.
|
|
@@ -11,26 +15,29 @@ npm install @datacules/agent-identity-anomaly
|
|
|
11
15
|
## Usage
|
|
12
16
|
|
|
13
17
|
```typescript
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
import { withAnomalyDetection } from '@datacules/agent-identity-anomaly';
|
|
19
|
+
import { createRouter } from '@datacules/agent-identity';
|
|
20
|
+
|
|
21
|
+
const router = withAnomalyDetection(
|
|
22
|
+
createRouter(credentials, rules, auditLogger),
|
|
23
|
+
{
|
|
24
|
+
policies: [
|
|
25
|
+
{ severity: 'low', action: 'warn' }, // emit credential.anomaly audit event
|
|
26
|
+
{ severity: 'medium', action: 'throttle' }, // rate-limit to 10% of normal
|
|
27
|
+
{ severity: 'high', action: 'block' }, // return null — deny the resolution
|
|
28
|
+
],
|
|
29
|
+
onAnomaly: (event) => {
|
|
30
|
+
alertingService.send(
|
|
31
|
+
`Anomaly: ${event.signal} (${event.severity}) for agent ${event.userId}`
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
// Use router exactly as before — anomaly detection is transparent
|
|
38
|
+
const resolved = await router.resolveAsync(ctx);
|
|
32
39
|
if (!resolved) {
|
|
33
|
-
//
|
|
40
|
+
// null means either no rule matched OR anomaly policy was 'block'
|
|
34
41
|
}
|
|
35
42
|
```
|
|
36
43
|
|
|
@@ -38,7 +45,7 @@ if (!resolved) {
|
|
|
38
45
|
|
|
39
46
|
| Signal | Severity | Description |
|
|
40
47
|
|--------|----------|-------------|
|
|
41
|
-
| `rate_spike` | high | Call rate
|
|
48
|
+
| `rate_spike` | high | Call rate 3× the hourly EWMA |
|
|
42
49
|
| `new_credential_type` | medium | Credential kind never seen before |
|
|
43
50
|
| `new_action_type` | medium | Action (`read`/`write`/etc.) never seen before |
|
|
44
51
|
| `new_resource_kind` | medium | Resource kind (`shared`/`personal`) never seen before |
|
|
@@ -47,7 +54,7 @@ if (!resolved) {
|
|
|
47
54
|
|
|
48
55
|
## Audit event format
|
|
49
56
|
|
|
50
|
-
Every anomaly emits a `credential.anomaly` audit entry
|
|
57
|
+
Every anomaly emits a `credential.anomaly` audit entry:
|
|
51
58
|
|
|
52
59
|
```json
|
|
53
60
|
{
|
|
@@ -59,3 +66,15 @@ Every anomaly emits a `credential.anomaly` audit entry with additional fields:
|
|
|
59
66
|
"userId": "agent-orders"
|
|
60
67
|
}
|
|
61
68
|
```
|
|
69
|
+
|
|
70
|
+
## Response policies
|
|
71
|
+
|
|
72
|
+
| Action | Behaviour |
|
|
73
|
+
|--------|-----------|
|
|
74
|
+
| `warn` | Emit `credential.anomaly` audit event; return credential normally |
|
|
75
|
+
| `throttle` | Emit event; allow only 10% of requests through (random sampling) |
|
|
76
|
+
| `block` | Emit event; return `null` so the caller must abort or escalate to human review |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
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-anomaly",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Anomaly detection and behavioral baseline for @datacules/agent-identity — statistical detection of unusual credential usage patterns",
|
|
6
6
|
"author": "Datacules LLC",
|