shieldcortex 2.13.2 → 2.14.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.
Files changed (117) hide show
  1. package/README.md +174 -2
  2. package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
  3. package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
  4. package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
  5. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
  6. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
  7. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  10. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  11. package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  12. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
  13. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +1 -1
  14. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  15. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  16. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  17. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  18. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  19. package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
  21. package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +1 -1
  22. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  23. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +1 -1
  24. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
  25. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +1 -1
  26. package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  27. package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
  28. package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
  29. package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
  30. package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
  31. package/dist/cli/iron-dome.d.ts +16 -0
  32. package/dist/cli/iron-dome.d.ts.map +1 -0
  33. package/dist/cli/iron-dome.js +219 -0
  34. package/dist/cli/iron-dome.js.map +1 -0
  35. package/dist/cloud/quarantine-sync.d.ts +1 -1
  36. package/dist/cloud/quarantine-sync.d.ts.map +1 -1
  37. package/dist/cloud/quarantine-sync.js +18 -2
  38. package/dist/cloud/quarantine-sync.js.map +1 -1
  39. package/dist/cloud/sync-queue.d.ts +18 -0
  40. package/dist/cloud/sync-queue.d.ts.map +1 -1
  41. package/dist/cloud/sync-queue.js +48 -4
  42. package/dist/cloud/sync-queue.js.map +1 -1
  43. package/dist/cloud/sync.d.ts +1 -1
  44. package/dist/cloud/sync.js +1 -1
  45. package/dist/defence/index.d.ts +2 -0
  46. package/dist/defence/index.d.ts.map +1 -1
  47. package/dist/defence/index.js +2 -0
  48. package/dist/defence/index.js.map +1 -1
  49. package/dist/defence/iron-dome/__tests__/action-gate.test.d.ts +5 -0
  50. package/dist/defence/iron-dome/__tests__/action-gate.test.d.ts.map +1 -0
  51. package/dist/defence/iron-dome/__tests__/action-gate.test.js +71 -0
  52. package/dist/defence/iron-dome/__tests__/action-gate.test.js.map +1 -0
  53. package/dist/defence/iron-dome/__tests__/gateway.test.d.ts +5 -0
  54. package/dist/defence/iron-dome/__tests__/gateway.test.d.ts.map +1 -0
  55. package/dist/defence/iron-dome/__tests__/gateway.test.js +60 -0
  56. package/dist/defence/iron-dome/__tests__/gateway.test.js.map +1 -0
  57. package/dist/defence/iron-dome/__tests__/injection-scanner.test.d.ts +7 -0
  58. package/dist/defence/iron-dome/__tests__/injection-scanner.test.d.ts.map +1 -0
  59. package/dist/defence/iron-dome/__tests__/injection-scanner.test.js +230 -0
  60. package/dist/defence/iron-dome/__tests__/injection-scanner.test.js.map +1 -0
  61. package/dist/defence/iron-dome/__tests__/pii-guard.test.d.ts +5 -0
  62. package/dist/defence/iron-dome/__tests__/pii-guard.test.d.ts.map +1 -0
  63. package/dist/defence/iron-dome/__tests__/pii-guard.test.js +130 -0
  64. package/dist/defence/iron-dome/__tests__/pii-guard.test.js.map +1 -0
  65. package/dist/defence/iron-dome/action-gate.d.ts +19 -0
  66. package/dist/defence/iron-dome/action-gate.d.ts.map +1 -0
  67. package/dist/defence/iron-dome/action-gate.js +92 -0
  68. package/dist/defence/iron-dome/action-gate.js.map +1 -0
  69. package/dist/defence/iron-dome/audit.d.ts +20 -0
  70. package/dist/defence/iron-dome/audit.d.ts.map +1 -0
  71. package/dist/defence/iron-dome/audit.js +34 -0
  72. package/dist/defence/iron-dome/audit.js.map +1 -0
  73. package/dist/defence/iron-dome/config.d.ts +28 -0
  74. package/dist/defence/iron-dome/config.d.ts.map +1 -0
  75. package/dist/defence/iron-dome/config.js +116 -0
  76. package/dist/defence/iron-dome/config.js.map +1 -0
  77. package/dist/defence/iron-dome/gateway.d.ts +24 -0
  78. package/dist/defence/iron-dome/gateway.d.ts.map +1 -0
  79. package/dist/defence/iron-dome/gateway.js +49 -0
  80. package/dist/defence/iron-dome/gateway.js.map +1 -0
  81. package/dist/defence/iron-dome/index.d.ts +40 -0
  82. package/dist/defence/iron-dome/index.d.ts.map +1 -0
  83. package/dist/defence/iron-dome/index.js +125 -0
  84. package/dist/defence/iron-dome/index.js.map +1 -0
  85. package/dist/defence/iron-dome/injection-scanner.d.ts +28 -0
  86. package/dist/defence/iron-dome/injection-scanner.d.ts.map +1 -0
  87. package/dist/defence/iron-dome/injection-scanner.js +117 -0
  88. package/dist/defence/iron-dome/injection-scanner.js.map +1 -0
  89. package/dist/defence/iron-dome/kill-switch.d.ts +16 -0
  90. package/dist/defence/iron-dome/kill-switch.d.ts.map +1 -0
  91. package/dist/defence/iron-dome/kill-switch.js +30 -0
  92. package/dist/defence/iron-dome/kill-switch.js.map +1 -0
  93. package/dist/defence/iron-dome/pii-guard.d.ts +22 -0
  94. package/dist/defence/iron-dome/pii-guard.d.ts.map +1 -0
  95. package/dist/defence/iron-dome/pii-guard.js +84 -0
  96. package/dist/defence/iron-dome/pii-guard.js.map +1 -0
  97. package/dist/embeddings/generator.d.ts.map +1 -1
  98. package/dist/embeddings/generator.js +28 -2
  99. package/dist/embeddings/generator.js.map +1 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +6 -0
  102. package/dist/index.js.map +1 -1
  103. package/dist/lib.d.ts +2 -0
  104. package/dist/lib.d.ts.map +1 -1
  105. package/dist/lib.js +2 -0
  106. package/dist/lib.js.map +1 -1
  107. package/dist/memory/store.d.ts.map +1 -1
  108. package/dist/memory/store.js +11 -1
  109. package/dist/memory/store.js.map +1 -1
  110. package/dist/server.d.ts.map +1 -1
  111. package/dist/server.js +93 -0
  112. package/dist/server.js.map +1 -1
  113. package/dist/tools/context.d.ts +1 -1
  114. package/package.json +2 -2
  115. /package/dashboard/.next/standalone/dashboard/.next/static/{hK5vjDheb2ytBlhBFJqor → V3kmn6wNste9-mE3bPDSl}/_buildManifest.js +0 -0
  116. /package/dashboard/.next/standalone/dashboard/.next/static/{hK5vjDheb2ytBlhBFJqor → V3kmn6wNste9-mE3bPDSl}/_clientMiddlewareManifest.json +0 -0
  117. /package/dashboard/.next/standalone/dashboard/.next/static/{hK5vjDheb2ytBlhBFJqor → V3kmn6wNste9-mE3bPDSl}/_ssgManifest.js +0 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Iron Dome — Audit Logging
3
+ *
4
+ * Uses the existing ShieldCortex audit system to log Iron Dome events.
5
+ */
6
+ import { logAudit } from '../audit/logger.js';
7
+ /**
8
+ * Log an Iron Dome event to the defence audit table.
9
+ * Fire-and-forget safe: errors are caught and logged, never thrown.
10
+ */
11
+ export function logIronDomeAudit(event) {
12
+ try {
13
+ logAudit({
14
+ memory_id: null,
15
+ project: null,
16
+ timestamp: new Date().toISOString(),
17
+ source_type: event.source?.type ?? 'cli',
18
+ source_identifier: event.source?.identifier ?? 'iron-dome',
19
+ trust_score: 0,
20
+ sensitivity_level: 'PUBLIC',
21
+ firewall_result: event.allowed ? 'ALLOW' : 'BLOCK',
22
+ anomaly_score: 0,
23
+ threat_indicators: '[]',
24
+ blocked_patterns: '[]',
25
+ reason: `[iron-dome:${event.action}] ${event.reason}`,
26
+ fragmentation_score: null,
27
+ pipeline_duration_ms: null,
28
+ });
29
+ }
30
+ catch (err) {
31
+ console.error('[iron-dome] Failed to log audit event:', err);
32
+ }
33
+ }
34
+ //# sourceMappingURL=audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../src/defence/iron-dome/audit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAW9C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAyB;IACxD,IAAI,CAAC;QACH,QAAQ,CAAC;YACP,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,IAAI,KAAK;YACxC,iBAAiB,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,IAAI,WAAW;YAC1D,WAAW,EAAE,CAAC;YACd,iBAAiB,EAAE,QAAQ;YAC3B,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;YAClD,aAAa,EAAE,CAAC;YAChB,iBAAiB,EAAE,IAAI;YACvB,gBAAgB,EAAE,IAAI;YACtB,MAAM,EAAE,cAAc,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;YACrD,mBAAmB,EAAE,IAAI;YACzB,oBAAoB,EAAE,IAAI;SAC3B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,GAAG,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Iron Dome — Configuration types and defaults
3
+ *
4
+ * Defines the IronDomeConfig interface and pre-built profiles
5
+ * for different security postures.
6
+ */
7
+ export interface IronDomePiiRules {
8
+ neverOutput: string[];
9
+ aggregatesOnly: string[];
10
+ }
11
+ export interface IronDomeSubAgentRestrictions {
12
+ blockedOperations: string[];
13
+ sanitiseContext: boolean;
14
+ }
15
+ export type IronDomeProfile = 'school' | 'enterprise' | 'personal' | 'paranoid';
16
+ export interface IronDomeConfig {
17
+ enabled: boolean;
18
+ trustedChannels: string[];
19
+ killPhrase: string;
20
+ requireApproval: string[];
21
+ autoApprove: string[];
22
+ piiRules: IronDomePiiRules;
23
+ subAgentRestrictions: IronDomeSubAgentRestrictions;
24
+ profile?: IronDomeProfile;
25
+ }
26
+ export declare const DEFAULT_IRON_DOME_CONFIG: IronDomeConfig;
27
+ export declare const IRON_DOME_PROFILES: Record<IronDomeProfile, Omit<IronDomeConfig, 'enabled'>>;
28
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/defence/iron-dome/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC;AAEhF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,oBAAoB,EAAE,4BAA4B,CAAC;IACnD,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAID,eAAO,MAAM,wBAAwB,EAAE,cActC,CAAC;AAIF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CA8FvF,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Iron Dome — Configuration types and defaults
3
+ *
4
+ * Defines the IronDomeConfig interface and pre-built profiles
5
+ * for different security postures.
6
+ */
7
+ // ── Default Configuration ──
8
+ export const DEFAULT_IRON_DOME_CONFIG = {
9
+ enabled: false,
10
+ trustedChannels: ['terminal', 'cli'],
11
+ killPhrase: 'full stop',
12
+ requireApproval: ['send_email', 'delete_file', 'api_call', 'purchase', 'transfer_funds'],
13
+ autoApprove: ['read_file', 'search', 'calculate', 'format'],
14
+ piiRules: {
15
+ neverOutput: [],
16
+ aggregatesOnly: [],
17
+ },
18
+ subAgentRestrictions: {
19
+ blockedOperations: [],
20
+ sanitiseContext: false,
21
+ },
22
+ };
23
+ // ── Pre-built Profiles ──
24
+ export const IRON_DOME_PROFILES = {
25
+ school: {
26
+ trustedChannels: ['terminal', 'cli'],
27
+ killPhrase: 'full stop',
28
+ requireApproval: [
29
+ 'send_email', 'delete_file', 'api_call', 'export_data',
30
+ 'share_data', 'modify_records', 'create_report',
31
+ ],
32
+ autoApprove: ['read_file', 'search', 'calculate', 'format'],
33
+ piiRules: {
34
+ neverOutput: [
35
+ 'pupil_name', 'student_name', 'date_of_birth', 'address',
36
+ 'parent_name', 'guardian_name', 'medical_info', 'sen_status',
37
+ 'fsm_status', 'ethnicity', 'religion', 'national_insurance',
38
+ ],
39
+ aggregatesOnly: [
40
+ 'attendance', 'grades', 'behaviour_points', 'exclusions',
41
+ ],
42
+ },
43
+ subAgentRestrictions: {
44
+ blockedOperations: ['export_pupil_data', 'bulk_email', 'modify_safeguarding'],
45
+ sanitiseContext: true,
46
+ },
47
+ profile: 'school',
48
+ },
49
+ enterprise: {
50
+ trustedChannels: ['terminal', 'cli', 'slack'],
51
+ killPhrase: 'full stop',
52
+ requireApproval: [
53
+ 'send_email', 'delete_file', 'api_call', 'purchase',
54
+ 'transfer_funds', 'modify_permissions', 'deploy', 'export_data',
55
+ ],
56
+ autoApprove: ['read_file', 'search', 'calculate', 'format', 'lint', 'test'],
57
+ piiRules: {
58
+ neverOutput: [
59
+ 'credit_card', 'bank_account', 'ssn', 'tax_id',
60
+ 'salary', 'compensation',
61
+ ],
62
+ aggregatesOnly: [
63
+ 'revenue', 'expenses', 'headcount',
64
+ ],
65
+ },
66
+ subAgentRestrictions: {
67
+ blockedOperations: ['export_financial_data', 'modify_payroll'],
68
+ sanitiseContext: true,
69
+ },
70
+ profile: 'enterprise',
71
+ },
72
+ personal: {
73
+ trustedChannels: ['terminal', 'cli', 'telegram', 'email'],
74
+ killPhrase: 'full stop',
75
+ requireApproval: [
76
+ 'send_email', 'purchase', 'transfer_funds', 'delete_file',
77
+ ],
78
+ autoApprove: [
79
+ 'read_file', 'search', 'calculate', 'format',
80
+ 'api_call', 'create_file',
81
+ ],
82
+ piiRules: {
83
+ neverOutput: ['password', 'credit_card', 'bank_account'],
84
+ aggregatesOnly: [],
85
+ },
86
+ subAgentRestrictions: {
87
+ blockedOperations: [],
88
+ sanitiseContext: false,
89
+ },
90
+ profile: 'personal',
91
+ },
92
+ paranoid: {
93
+ trustedChannels: ['terminal'],
94
+ killPhrase: 'full stop',
95
+ requireApproval: [
96
+ 'send_email', 'delete_file', 'api_call', 'purchase',
97
+ 'transfer_funds', 'create_file', 'modify_file', 'deploy',
98
+ 'export_data', 'share_data', 'modify_permissions',
99
+ 'install_package', 'run_script', 'network_request',
100
+ ],
101
+ autoApprove: ['search', 'calculate', 'format'],
102
+ piiRules: {
103
+ neverOutput: [
104
+ 'password', 'credit_card', 'bank_account', 'ssn', 'tax_id',
105
+ 'date_of_birth', 'address', 'phone_number', 'email_address',
106
+ ],
107
+ aggregatesOnly: ['salary', 'revenue', 'expenses'],
108
+ },
109
+ subAgentRestrictions: {
110
+ blockedOperations: ['export_data', 'network_request', 'install_package'],
111
+ sanitiseContext: true,
112
+ },
113
+ profile: 'paranoid',
114
+ },
115
+ };
116
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/defence/iron-dome/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,8BAA8B;AAE9B,MAAM,CAAC,MAAM,wBAAwB,GAAmB;IACtD,OAAO,EAAE,KAAK;IACd,eAAe,EAAE,CAAC,UAAU,EAAE,KAAK,CAAC;IACpC,UAAU,EAAE,WAAW;IACvB,eAAe,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,CAAC;IACxF,WAAW,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC;IAC3D,QAAQ,EAAE;QACR,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;gBAC1D,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe;aAC5D;YACD,cAAc,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC;SAClD;QACD,oBAAoB,EAAE;YACpB,iBAAiB,EAAE,CAAC,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,CAAC;YACxE,eAAe,EAAE,IAAI;SACtB;QACD,OAAO,EAAE,UAAU;KACpB;CACF,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Iron Dome — Instruction Gateway
3
+ *
4
+ * Validates whether an instruction channel is trusted before
5
+ * allowing commands through. Builds on existing trust scoring concepts.
6
+ */
7
+ import type { IronDomeConfig } from './config.js';
8
+ import type { DefenceSource } from '../types.js';
9
+ export interface GatewayResult {
10
+ allowed: boolean;
11
+ channel: string;
12
+ reason: string;
13
+ trustLevel: 'trusted' | 'untrusted' | 'blocked';
14
+ }
15
+ /**
16
+ * Check if a channel is trusted according to Iron Dome configuration.
17
+ */
18
+ export declare function isChannelTrusted(channel: string, config: IronDomeConfig): boolean;
19
+ /**
20
+ * Validate an instruction through the gateway.
21
+ * Returns whether the instruction should be processed.
22
+ */
23
+ export declare function validateGateway(channel: string, instruction: string, config: IronDomeConfig, source?: DefenceSource): GatewayResult;
24
+ //# sourceMappingURL=gateway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../../src/defence/iron-dome/gateway.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;CACjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,cAAc,GACrB,OAAO,CAGT;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,aAAa,GACrB,aAAa,CAgCf"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Iron Dome — Instruction Gateway
3
+ *
4
+ * Validates whether an instruction channel is trusted before
5
+ * allowing commands through. Builds on existing trust scoring concepts.
6
+ */
7
+ import { logIronDomeAudit } from './audit.js';
8
+ /**
9
+ * Check if a channel is trusted according to Iron Dome configuration.
10
+ */
11
+ export function isChannelTrusted(channel, config) {
12
+ if (!config.enabled)
13
+ return true;
14
+ return config.trustedChannels.includes(channel.toLowerCase());
15
+ }
16
+ /**
17
+ * Validate an instruction through the gateway.
18
+ * Returns whether the instruction should be processed.
19
+ */
20
+ export function validateGateway(channel, instruction, config, source) {
21
+ if (!config.enabled) {
22
+ return {
23
+ allowed: true,
24
+ channel,
25
+ reason: 'Iron Dome is not active',
26
+ trustLevel: 'trusted',
27
+ };
28
+ }
29
+ const normChannel = channel.toLowerCase();
30
+ const trusted = config.trustedChannels.includes(normChannel);
31
+ const result = {
32
+ allowed: trusted,
33
+ channel: normChannel,
34
+ reason: trusted
35
+ ? `Channel "${normChannel}" is trusted`
36
+ : `Channel "${normChannel}" is not in trusted channels list`,
37
+ trustLevel: trusted ? 'trusted' : 'untrusted',
38
+ };
39
+ // Log the gateway check
40
+ logIronDomeAudit({
41
+ action: 'gateway_check',
42
+ channel: normChannel,
43
+ allowed: result.allowed,
44
+ reason: result.reason,
45
+ source,
46
+ });
47
+ return result;
48
+ }
49
+ //# sourceMappingURL=gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gateway.js","sourceRoot":"","sources":["../../../src/defence/iron-dome/gateway.ts"],"names":[],"mappings":"AAAA;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BEHAVIOUR (instruction gating, action approval, injection scanning)
5
+ * while the existing defence layer protects agent MEMORY.
6
+ *
7
+ * Main exports for the Iron Dome module.
8
+ */
9
+ import type { IronDomeConfig, IronDomeProfile } from './config.js';
10
+ export { DEFAULT_IRON_DOME_CONFIG, IRON_DOME_PROFILES } from './config.js';
11
+ export type { IronDomeConfig, IronDomeProfile, IronDomePiiRules, IronDomeSubAgentRestrictions } from './config.js';
12
+ export { scanForInjection } from './injection-scanner.js';
13
+ export type { InjectionScanResult, InjectionDetection, InjectionSeverity, InjectionCategory } from './injection-scanner.js';
14
+ export { isChannelTrusted, validateGateway } from './gateway.js';
15
+ export type { GatewayResult } from './gateway.js';
16
+ export { isActionAllowed } from './action-gate.js';
17
+ export type { ActionGateResult, ActionDecision } from './action-gate.js';
18
+ export { checkPII } from './pii-guard.js';
19
+ export type { PiiCheckResult, PiiViolation } from './pii-guard.js';
20
+ export { handleKillPhrase } from './kill-switch.js';
21
+ export type { KillSwitchResult } from './kill-switch.js';
22
+ export { logIronDomeAudit } from './audit.js';
23
+ export type { IronDomeAuditEvent } from './audit.js';
24
+ /**
25
+ * Activate Iron Dome with an optional profile.
26
+ */
27
+ export declare function activateIronDome(profile?: IronDomeProfile): IronDomeConfig;
28
+ /**
29
+ * Deactivate Iron Dome.
30
+ */
31
+ export declare function deactivateIronDome(): void;
32
+ /**
33
+ * Get the current Iron Dome status and configuration.
34
+ */
35
+ export declare function getIronDomeStatus(): {
36
+ enabled: boolean;
37
+ config: IronDomeConfig;
38
+ profile?: IronDomeProfile;
39
+ };
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/defence/iron-dome/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAMnE,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEnH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE5H,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA4DrD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,cAAc,CAyB1E;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CASzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B,CAOA"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Iron Dome — Behaviour Protection Layer
3
+ *
4
+ * Protects agent BEHAVIOUR (instruction gating, action approval, injection scanning)
5
+ * while the existing defence layer protects agent MEMORY.
6
+ *
7
+ * Main exports for the Iron Dome module.
8
+ */
9
+ import { getDatabase } from '../../database/init.js';
10
+ import { DEFAULT_IRON_DOME_CONFIG, IRON_DOME_PROFILES } from './config.js';
11
+ import { logIronDomeAudit } from './audit.js';
12
+ // ── Re-exports ──
13
+ export { DEFAULT_IRON_DOME_CONFIG, IRON_DOME_PROFILES } from './config.js';
14
+ export { scanForInjection } from './injection-scanner.js';
15
+ export { isChannelTrusted, validateGateway } from './gateway.js';
16
+ export { isActionAllowed } from './action-gate.js';
17
+ export { checkPII } from './pii-guard.js';
18
+ export { handleKillPhrase } from './kill-switch.js';
19
+ export { logIronDomeAudit } from './audit.js';
20
+ // ── Iron Dome State Management ──
21
+ // In-memory config (persisted to SQLite iron_dome_config table)
22
+ let activeConfig = { ...DEFAULT_IRON_DOME_CONFIG };
23
+ /**
24
+ * Ensure the iron_dome_config table exists.
25
+ */
26
+ function ensureTable() {
27
+ try {
28
+ const db = getDatabase();
29
+ db.exec(`
30
+ CREATE TABLE IF NOT EXISTS iron_dome_config (
31
+ key TEXT PRIMARY KEY,
32
+ value TEXT NOT NULL,
33
+ updated_at TEXT NOT NULL DEFAULT (datetime('now'))
34
+ )
35
+ `);
36
+ }
37
+ catch {
38
+ // Database may not be initialised yet — config stays in memory
39
+ }
40
+ }
41
+ /**
42
+ * Load Iron Dome configuration from the database.
43
+ */
44
+ function loadConfig() {
45
+ try {
46
+ ensureTable();
47
+ const db = getDatabase();
48
+ const row = db.prepare('SELECT value FROM iron_dome_config WHERE key = ?').get('config');
49
+ if (row) {
50
+ activeConfig = JSON.parse(row.value);
51
+ return activeConfig;
52
+ }
53
+ }
54
+ catch {
55
+ // Fall through to default
56
+ }
57
+ return activeConfig;
58
+ }
59
+ /**
60
+ * Save Iron Dome configuration to the database.
61
+ */
62
+ function saveConfig(config) {
63
+ try {
64
+ ensureTable();
65
+ const db = getDatabase();
66
+ db.prepare(`
67
+ INSERT INTO iron_dome_config (key, value, updated_at)
68
+ VALUES ('config', ?, datetime('now'))
69
+ ON CONFLICT(key) DO UPDATE SET value = excluded.value, updated_at = excluded.updated_at
70
+ `).run(JSON.stringify(config));
71
+ }
72
+ catch (err) {
73
+ console.error('[iron-dome] Failed to save config:', err);
74
+ }
75
+ }
76
+ /**
77
+ * Activate Iron Dome with an optional profile.
78
+ */
79
+ export function activateIronDome(profile) {
80
+ let config;
81
+ if (profile && IRON_DOME_PROFILES[profile]) {
82
+ config = {
83
+ ...IRON_DOME_PROFILES[profile],
84
+ enabled: true,
85
+ };
86
+ }
87
+ else {
88
+ config = {
89
+ ...DEFAULT_IRON_DOME_CONFIG,
90
+ enabled: true,
91
+ };
92
+ }
93
+ activeConfig = config;
94
+ saveConfig(config);
95
+ logIronDomeAudit({
96
+ action: 'activate',
97
+ allowed: true,
98
+ reason: profile ? `Activated with profile: ${profile}` : 'Activated with default config',
99
+ });
100
+ return config;
101
+ }
102
+ /**
103
+ * Deactivate Iron Dome.
104
+ */
105
+ export function deactivateIronDome() {
106
+ activeConfig = { ...DEFAULT_IRON_DOME_CONFIG, enabled: false };
107
+ saveConfig(activeConfig);
108
+ logIronDomeAudit({
109
+ action: 'deactivate',
110
+ allowed: true,
111
+ reason: 'Iron Dome deactivated',
112
+ });
113
+ }
114
+ /**
115
+ * Get the current Iron Dome status and configuration.
116
+ */
117
+ export function getIronDomeStatus() {
118
+ const config = loadConfig();
119
+ return {
120
+ enabled: config.enabled,
121
+ config,
122
+ profile: config.profile,
123
+ };
124
+ }
125
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/defence/iron-dome/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,mBAA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AAC;IAC5B,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM;QACN,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Iron Dome — Prompt Injection Scanner
3
+ *
4
+ * Port of ~/clawd/skills/iron-dome/scripts/scan.py to TypeScript.
5
+ * Detects prompt injection patterns in text content from untrusted sources
6
+ * (emails, form submissions, API responses, web pages).
7
+ */
8
+ export type InjectionSeverity = 'low' | 'medium' | 'high' | 'critical';
9
+ export type InjectionCategory = 'fake_system_message' | 'authority_claim' | 'urgency_secrecy' | 'credential_extraction' | 'instruction_injection' | 'encoding_trick' | 'role_manipulation' | 'context_escape';
10
+ export interface InjectionDetection {
11
+ category: InjectionCategory;
12
+ severity: InjectionSeverity;
13
+ pattern: string;
14
+ match: string;
15
+ description: string;
16
+ }
17
+ export interface InjectionScanResult {
18
+ clean: boolean;
19
+ riskLevel: 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
20
+ detections: InjectionDetection[];
21
+ textLength: number;
22
+ summary: string;
23
+ }
24
+ /**
25
+ * Scan text for prompt injection patterns.
26
+ */
27
+ export declare function scanForInjection(text: string): InjectionScanResult;
28
+ //# sourceMappingURL=injection-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injection-scanner.d.ts","sourceRoot":"","sources":["../../../src/defence/iron-dome/injection-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAEvE,MAAM,MAAM,iBAAiB,GACzB,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,uBAAuB,GACvB,uBAAuB,GACvB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,CAAC;AAErB,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IAC3D,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAkQD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAkElE"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Iron Dome — Prompt Injection Scanner
3
+ *
4
+ * Port of ~/clawd/skills/iron-dome/scripts/scan.py to TypeScript.
5
+ * Detects prompt injection patterns in text content from untrusted sources
6
+ * (emails, form submissions, API responses, web pages).
7
+ */
8
+ const PATTERNS = [];
9
+ function pattern(category, severity, name, description, regex) {
10
+ PATTERNS.push({ category, severity, name, description, regex });
11
+ }
12
+ // ── Fake system / admin messages ──
13
+ pattern('fake_system_message', 'critical', 'system_prompt_override', 'Attempts to override or replace the system prompt', /(?:new|updated?|revised?|override|replace)\s+(?:system\s+)?(?:prompt|instructions?|rules?|directives?)\s*[:=]/gi);
14
+ pattern('fake_system_message', 'critical', 'system_message_tag', 'Fake system message markers embedded in content', /(?:\[\/?\s*system\s*\]|<\/?\s*system\s*>|<<\s*system\s*>>|---\s*system\s*---|SYSTEM\s*(?:MESSAGE|PROMPT|NOTE|INSTRUCTION)\s*:)/gi);
15
+ pattern('fake_system_message', 'high', 'ignore_previous', 'Instruction to ignore or forget previous context', /(?:ignore|forget|disregard|override|discard|drop|reset)\s+(?:all\s+)?(?:previous|prior|above|earlier|existing|old|original)\s+(?:instructions?|rules?|context|prompts?|directives?|constraints?|guidelines?)/gi);
16
+ pattern('fake_system_message', 'high', 'new_instructions', 'Claims to provide new operating instructions', /(?:from\s+now\s+on|starting\s+now|henceforth|going\s+forward)\s*[,:]?\s*(?:you\s+(?:must|should|will|are|need)|your\s+(?:new|updated?))/gi);
17
+ pattern('fake_system_message', 'high', 'end_of_prompt', 'Fake end-of-prompt markers to inject new context', /(?:---\s*END\s+OF\s+(?:SYSTEM\s+)?(?:PROMPT|INSTRUCTIONS?)|END_INSTRUCTIONS?|<\/instructions?>|={3,}\s*(?:END|STOP))/gi);
18
+ pattern('fake_system_message', 'medium', 'developer_mode', 'Claims to enable special modes or bypass restrictions', /(?:developer|debug|admin|maintenance|test|god|sudo|root|unrestricted|jailbreak)\s*mode\s*(?:enabled|activated|on|engaged)/gi);
19
+ // ── Authority claims ──
20
+ pattern('authority_claim', 'high', 'identity_claim', 'Claims to be an admin, owner, developer, or authority figure', /(?:I\s+am|this\s+is|speaking\s+as|writing\s+as|signed|regards)\s*[,:]?\s*(?:the\s+)?(?:admin(?:istrator)?|owner|developer|creator|operator|manager|ceo|cto|boss|supervisor|root\s+user|system\s+admin)/gi);
21
+ pattern('authority_claim', 'high', 'as_the_authority', 'Uses "as the [role]" to claim authority', /as\s+the\s+(?:admin(?:istrator)?|owner|developer|creator|operator|system\s+(?:admin|operator)|lead|manager|supervisor|principal|head)/gi);
22
+ pattern('authority_claim', 'medium', 'authorised_claim', 'Claims authorisation for an action', /(?:I(?:'m|\s+am)\s+)?(?:author[iy][sz]ed?|permitted|allowed|granted\s+(?:access|permission))\s+(?:to|by|for|from)/gi);
23
+ pattern('authority_claim', 'medium', 'michael_impersonation', 'Claims to be Michael or the user', /(?:(?:this\s+is|I\s+am|it'?s|from)\s+Michael|Michael\s+(?:says?|wants?|told|asked|instructed|requests?|needs?)\s+(?:you\s+)?to)/gi);
24
+ // ── Urgency + secrecy combinations ──
25
+ pattern('urgency_secrecy', 'high', 'urgency_secrecy_combo', 'Combines urgency with secrecy — classic social engineering', /(?:(?:urgent(?:ly)?|immediate(?:ly)?|right\s+now|asap|time[- ]sensitive|critical(?:ly)?|emergency)[\s\S]{0,100}(?:don'?t\s+(?:tell|mention|inform|alert|notify|share)|keep\s+(?:this\s+)?(?:secret|quiet|private|between\s+us|confidential)|do\s*n(?:ot|'t)\s+(?:log|record|audit|report)))|(?:(?:don'?t\s+(?:tell|mention|inform|alert|notify|share)|keep\s+(?:this\s+)?(?:secret|quiet|private|between\s+us|confidential))[\s\S]{0,100}(?:urgent(?:ly)?|immediate(?:ly)?|right\s+now|asap|time[- ]sensitive|critical(?:ly)?|emergency))/gi);
26
+ pattern('urgency_secrecy', 'medium', 'secrecy_instruction', 'Instructions to hide actions or avoid logging', /(?:don'?t|do\s+not|never|avoid)\s+(?:tell|mention|inform|alert|notify|share\s+with|report\s+to|log|record|audit|let\s+(?:anyone|(?:the\s+)?(?:admin|owner|user|michael))\s+know)/gi);
27
+ pattern('urgency_secrecy', 'medium', 'bypass_approval', 'Attempts to skip approval or verification steps', /(?:skip|bypass|ignore|disable|turn\s+off|override|circumvent|avoid)\s+(?:the\s+)?(?:approv(?:al|e)|verif(?:y|ication)|confirm(?:ation)?|review|check|auth(?:entication|orisation)?|gate|filter|scan|iron\s*dome|security)/gi);
28
+ // ── Credential / secret extraction ──
29
+ pattern('credential_extraction', 'critical', 'credential_request', 'Requests passwords, keys, tokens, or secrets', /(?:(?:send|give|share|show|reveal|output|print|display|paste|tell|provide)\s+(?:me\s+)?(?:the\s+)?(?:password|api[- ]?key|secret[- ]?key|token|private[- ]?key|credentials?|auth[- ]?(?:token|key|secret)|ssh[- ]?key|access[- ]?key|master[- ]?key|encryption[- ]?key|certificate|\.env|secret))/gi);
30
+ pattern('credential_extraction', 'critical', 'exfiltration_attempt', 'Attempts to send data to external destinations', /(?:(?:send|forward|post|upload|transmit|exfiltrate|copy|transfer)\s+(?:(?:all|the|this|that|those|your)\s+)?(?:data|info(?:rmation)?|content|email|message|file|log|credential|secret|key|token|password|config)\s+to\s+(?:https?:\/\/|(?:my|this|the)\s+(?:server|endpoint|api|email|address|url)))/gi);
31
+ pattern('credential_extraction', 'high', 'env_file_access', 'Attempts to read sensitive config files', /(?:(?:read|cat|show|display|print|output|open|access|get)\s+(?:the\s+)?(?:\.env|\.ssh|credentials?\.(?:json|yml|yaml|xml|ini|conf)|secret|private\.key|auth\.json|token\.json|config.*(?:password|secret|key)))/gi);
32
+ // ── Instruction injection in data fields ──
33
+ pattern('instruction_injection', 'high', 'instruction_in_data', 'Imperative instructions embedded in what should be data', /(?:^|\n)\s*(?:IMPORTANT|NOTE|INSTRUCTION|ACTION\s*REQUIRED|TASK|TODO|EXECUTE|PERFORM|RUN)\s*:\s*(?:you\s+(?:must|should|need\s+to|have\s+to)|please\s+(?:do|run|execute|send|delete|modify|change))/gi);
34
+ pattern('instruction_injection', 'high', 'ai_directive', 'Directives addressed to the AI/assistant/agent', /(?:dear\s+(?:ai|assistant|agent|bot|model|llm|gpt|claude|jarvis)|(?:hey|hi|hello)\s+(?:ai|assistant|agent|bot|model))\s*[,:]?\s*(?:please|you\s+(?:must|should|need)|I\s+(?:need|want)\s+you\s+to)/gi);
35
+ pattern('instruction_injection', 'medium', 'hidden_instruction', 'Instructions disguised with special formatting or whitespace', /(?:\[INST\]|\[\/INST\]|<\|(?:im_start|im_end|system|user|assistant)\|>|###\s*(?:System|Instruction|Human|Assistant)\s*:)/gi);
36
+ pattern('instruction_injection', 'medium', 'email_injection', 'Email body containing commands for the processing agent', /(?:when\s+(?:you|the\s+(?:ai|agent|assistant|bot))\s+(?:read|process|receive|see|get)\s+this|if\s+(?:an?\s+)?(?:ai|agent|assistant|bot)\s+(?:is\s+)?(?:reading|processing|scanning)\s+this)/gi);
37
+ // ── Encoding / obfuscation tricks ──
38
+ pattern('encoding_trick', 'medium', 'base64_instruction', 'Base64-encoded content that may hide instructions', /(?:decode|execute|run|follow|process)\s+(?:this\s+)?(?:base64|encoded|b64)\s*:\s*[A-Za-z0-9+/]{20,}={0,2}/gi);
39
+ pattern('encoding_trick', 'medium', 'unicode_obfuscation', 'Zero-width or special unicode characters used for obfuscation', /[\u200b\u200c\u200d\u200e\u200f\u2060\u2061\u2062\u2063\u2064\ufeff]{2,}/g);
40
+ pattern('encoding_trick', 'low', 'rot13_instruction', 'ROT13-encoded instructions', /(?:rot13|decode|decipher)\s*:\s*[a-zA-Z\s]{10,}/gi);
41
+ // ── Role manipulation ──
42
+ pattern('role_manipulation', 'high', 'roleplay_injection', 'Attempts to get the agent to adopt a different role', /(?:you\s+are\s+(?:now|no\s+longer)\s+(?:a|an|the)\s+|pretend\s+(?:you(?:'re|\s+are)\s+|to\s+be\s+)|act\s+as\s+(?:if\s+you(?:'re|\s+are)\s+)?(?:a|an|the)\s+|roleplay\s+as|your\s+new\s+(?:role|identity|persona)\s+is)/gi);
43
+ pattern('role_manipulation', 'high', 'constraint_removal', 'Attempts to remove safety constraints or rules', /(?:you\s+(?:don'?t|do\s+not)\s+(?:have|need)\s+(?:any\s+)?(?:rules?|constraints?|restrictions?|limitations?|guidelines?|boundaries?))|(?:(?:remove|disable|turn\s+off|drop|ignore)\s+(?:all\s+)?(?:your\s+)?(?:safety|security|content)?\s*(?:rules?|filters?|constraints?|restrictions?|limitations?|guidelines?|guardrails?|boundaries?))/gi);
44
+ // ── Context escape ──
45
+ pattern('context_escape', 'high', 'conversation_reset', 'Attempts to reset the conversation or start a new context', /(?:(?:new|fresh|clean)\s+conversation|conversation\s+(?:reset|restart)|start(?:ing)?\s+(?:over|fresh|new\s+(?:session|conversation))|clear\s+(?:context|history|memory|conversation))/gi);
46
+ pattern('context_escape', 'medium', 'output_format_hijack', 'Attempts to control the output format for injection', /(?:respond\s+(?:only\s+)?with|your\s+(?:only\s+)?(?:response|output|reply)\s+(?:should|must|will)\s+be|output\s+(?:exactly|only|nothing\s+(?:but|except))|say\s+(?:only|exactly|nothing\s+(?:but|except)))\s+/gi);
47
+ // ── Scanner ──
48
+ /**
49
+ * Scan text for prompt injection patterns.
50
+ */
51
+ export function scanForInjection(text) {
52
+ const detections = [];
53
+ for (const pat of PATTERNS) {
54
+ // Reset lastIndex for global regexes
55
+ pat.regex.lastIndex = 0;
56
+ let match;
57
+ while ((match = pat.regex.exec(text)) !== null) {
58
+ detections.push({
59
+ category: pat.category,
60
+ severity: pat.severity,
61
+ pattern: pat.name,
62
+ match: match[0].trim().slice(0, 200),
63
+ description: pat.description,
64
+ });
65
+ }
66
+ }
67
+ // Deduplicate: same category + pattern + overlapping matched text
68
+ const seen = new Set();
69
+ const unique = [];
70
+ for (const d of detections) {
71
+ const key = `${d.category}:${d.pattern}:${d.match.slice(0, 80)}`;
72
+ if (!seen.has(key)) {
73
+ seen.add(key);
74
+ unique.push(d);
75
+ }
76
+ }
77
+ // Determine overall risk level
78
+ let riskLevel = 'NONE';
79
+ if (unique.length > 0) {
80
+ const severities = unique.map(d => d.severity);
81
+ if (severities.includes('critical')) {
82
+ riskLevel = 'CRITICAL';
83
+ }
84
+ else if (severities.includes('high')) {
85
+ riskLevel = 'HIGH';
86
+ }
87
+ else if (severities.includes('medium')) {
88
+ riskLevel = 'MEDIUM';
89
+ }
90
+ else {
91
+ riskLevel = 'LOW';
92
+ }
93
+ }
94
+ // Build summary
95
+ let summary;
96
+ if (unique.length === 0) {
97
+ summary = 'No prompt injection patterns detected.';
98
+ }
99
+ else {
100
+ const cats = {};
101
+ for (const d of unique) {
102
+ cats[d.category] = (cats[d.category] ?? 0) + 1;
103
+ }
104
+ const parts = Object.entries(cats)
105
+ .sort(([a], [b]) => a.localeCompare(b))
106
+ .map(([k, v]) => `${v}x ${k}`);
107
+ summary = `${unique.length} detection(s): ${parts.join(', ')}`;
108
+ }
109
+ return {
110
+ clean: unique.length === 0,
111
+ riskLevel,
112
+ detections: unique,
113
+ textLength: text.length,
114
+ summary,
115
+ };
116
+ }
117
+ //# sourceMappingURL=injection-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injection-scanner.js","sourceRoot":"","sources":["../../../src/defence/iron-dome/injection-scan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C,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACjD,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;aAC/B,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjC,OAAO,GAAG,GAAG,MAAM,CAAC,MAAM,kBAAkB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACjE,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,SAAS;QACT,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,IAAI,CAAC,MAAM;QACvB,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Iron Dome — Kill Switch
3
+ *
4
+ * Handles kill phrase detection. When the kill phrase is detected
5
+ * in input, Iron Dome immediately halts all processing.
6
+ */
7
+ import type { IronDomeConfig } from './config.js';
8
+ export interface KillSwitchResult {
9
+ triggered: boolean;
10
+ phrase: string;
11
+ }
12
+ /**
13
+ * Check if the input contains the kill phrase.
14
+ */
15
+ export declare function handleKillPhrase(input: string, config: IronDomeConfig): KillSwitchResult;
16
+ //# sourceMappingURL=kill-switch.d.ts.map