agentshield-sdk 7.2.1 → 7.4.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/CHANGELOG.md +125 -1
- package/README.md +68 -7
- package/bin/agent-shield.js +19 -0
- package/package.json +10 -3
- package/src/agent-protocol.js +4 -0
- package/src/allowlist.js +605 -603
- package/src/attack-genome.js +536 -0
- package/src/attack-replay.js +246 -0
- package/src/audit-streaming.js +486 -469
- package/src/audit.js +619 -0
- package/src/behavior-profiling.js +299 -289
- package/src/behavioral-dna.js +757 -0
- package/src/canary.js +273 -271
- package/src/compliance-authority.js +803 -0
- package/src/compliance.js +619 -617
- package/src/confidence-tuning.js +328 -324
- package/src/context-scoring.js +362 -360
- package/src/cost-optimizer.js +1024 -1024
- package/src/detector-core.js +186 -0
- package/src/distributed.js +7 -2
- package/src/embedding.js +310 -307
- package/src/errors.js +9 -0
- package/src/evolution-simulator.js +650 -0
- package/src/flight-recorder.js +379 -0
- package/src/herd-immunity.js +521 -0
- package/src/honeypot.js +332 -328
- package/src/index.js +6 -5
- package/src/integrations.js +1 -2
- package/src/intent-firewall.js +775 -0
- package/src/llm-redteam.js +678 -670
- package/src/main.js +139 -0
- package/src/mcp-security-runtime.js +6 -5
- package/src/middleware.js +11 -5
- package/src/model-fingerprint.js +1059 -1042
- package/src/multi-agent-trust.js +459 -453
- package/src/multi-agent.js +1 -1
- package/src/normalizer.js +734 -0
- package/src/pii.js +8 -1
- package/src/policy-dsl.js +775 -775
- package/src/presets.js +409 -409
- package/src/production.js +22 -9
- package/src/real-attack-datasets.js +246 -0
- package/src/redteam.js +475 -475
- package/src/report-generator.js +640 -0
- package/src/response-handler.js +436 -429
- package/src/scanners.js +358 -357
- package/src/self-healing.js +368 -363
- package/src/semantic.js +339 -339
- package/src/shield-score.js +250 -250
- package/src/soc-dashboard.js +394 -0
- package/src/sso-saml.js +8 -4
- package/src/supply-chain.js +667 -0
- package/src/testing.js +24 -2
- package/src/threat-intel-federation.js +343 -0
- package/src/tool-guard.js +412 -412
- package/src/watermark.js +242 -235
- package/src/worker-scanner.js +608 -601
package/src/pii.js
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* - Content Policies: Block agents from generating certain content categories.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
const { createShieldError } = require('./errors');
|
|
12
|
+
|
|
11
13
|
// =========================================================================
|
|
12
14
|
// PII PATTERNS
|
|
13
15
|
// =========================================================================
|
|
@@ -196,6 +198,7 @@ class DLPEngine {
|
|
|
196
198
|
this.rules = options.rules || [];
|
|
197
199
|
this.onViolation = options.onViolation || null;
|
|
198
200
|
this.violations = [];
|
|
201
|
+
this._maxViolations = options.maxViolations || 1000;
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
/**
|
|
@@ -215,7 +218,8 @@ class DLPEngine {
|
|
|
215
218
|
try {
|
|
216
219
|
pattern = new RegExp(rule.pattern, 'gi');
|
|
217
220
|
} catch (err) {
|
|
218
|
-
|
|
221
|
+
const shieldErr = createShieldError('AS-CFG-005', { pattern: rule.pattern, reason: err.message });
|
|
222
|
+
console.error(`[Agent Shield] ${shieldErr.message}`);
|
|
219
223
|
return this;
|
|
220
224
|
}
|
|
221
225
|
} else {
|
|
@@ -262,6 +266,9 @@ class DLPEngine {
|
|
|
262
266
|
violations.push(violation);
|
|
263
267
|
this.violations.push(violation);
|
|
264
268
|
}
|
|
269
|
+
if (this.violations.length > this._maxViolations) {
|
|
270
|
+
this.violations = this.violations.slice(-this._maxViolations);
|
|
271
|
+
}
|
|
265
272
|
|
|
266
273
|
if (rule.action === 'redact') {
|
|
267
274
|
if (rule.pattern.global) rule.pattern.lastIndex = 0;
|