@neurosec/sentry 1.0.20 → 1.1.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 (176) hide show
  1. package/README.md +4 -0
  2. package/dist/api-auth.d.ts +31 -0
  3. package/dist/api-auth.d.ts.map +1 -0
  4. package/dist/api-auth.js +105 -0
  5. package/dist/api-auth.js.map +1 -0
  6. package/dist/api-auth.test.d.ts +2 -0
  7. package/dist/api-auth.test.d.ts.map +1 -0
  8. package/dist/api-auth.test.js +89 -0
  9. package/dist/api-auth.test.js.map +1 -0
  10. package/dist/api.d.ts +8 -7
  11. package/dist/api.d.ts.map +1 -1
  12. package/dist/api.js +141 -134
  13. package/dist/api.js.map +1 -1
  14. package/dist/cli.d.ts +1 -1
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +107 -14
  17. package/dist/cli.js.map +1 -1
  18. package/dist/cli.test.d.ts +2 -0
  19. package/dist/cli.test.d.ts.map +1 -0
  20. package/dist/cli.test.js +68 -0
  21. package/dist/cli.test.js.map +1 -0
  22. package/dist/config.d.ts +30 -0
  23. package/dist/config.d.ts.map +1 -1
  24. package/dist/config.js +50 -1
  25. package/dist/config.js.map +1 -1
  26. package/dist/discovery-win.d.ts +4 -0
  27. package/dist/discovery-win.d.ts.map +1 -0
  28. package/dist/discovery-win.js +153 -0
  29. package/dist/discovery-win.js.map +1 -0
  30. package/dist/discovery.d.ts.map +1 -1
  31. package/dist/discovery.js +23 -97
  32. package/dist/discovery.js.map +1 -1
  33. package/dist/discovery.test.js +18 -109
  34. package/dist/discovery.test.js.map +1 -1
  35. package/dist/enforcement/file-monitor.d.ts +9 -0
  36. package/dist/enforcement/file-monitor.d.ts.map +1 -1
  37. package/dist/enforcement/file-monitor.js +9 -2
  38. package/dist/enforcement/file-monitor.js.map +1 -1
  39. package/dist/enforcement/network-monitor.d.ts.map +1 -1
  40. package/dist/enforcement/network-monitor.js +350 -9
  41. package/dist/enforcement/network-monitor.js.map +1 -1
  42. package/dist/enforcement/network-monitor.test.d.ts +2 -0
  43. package/dist/enforcement/network-monitor.test.d.ts.map +1 -0
  44. package/dist/enforcement/network-monitor.test.js +52 -0
  45. package/dist/enforcement/network-monitor.test.js.map +1 -0
  46. package/dist/enforcement/policy-executor.d.ts +24 -1
  47. package/dist/enforcement/policy-executor.d.ts.map +1 -1
  48. package/dist/enforcement/policy-executor.js +213 -69
  49. package/dist/enforcement/policy-executor.js.map +1 -1
  50. package/dist/enforcement/policy-executor.test.d.ts +2 -0
  51. package/dist/enforcement/policy-executor.test.d.ts.map +1 -0
  52. package/dist/enforcement/policy-executor.test.js +46 -0
  53. package/dist/enforcement/policy-executor.test.js.map +1 -0
  54. package/dist/enforcement/target-validator.d.ts +37 -0
  55. package/dist/enforcement/target-validator.d.ts.map +1 -0
  56. package/dist/enforcement/target-validator.js +0 -0
  57. package/dist/enforcement/target-validator.js.map +1 -0
  58. package/dist/enforcement/target-validator.test.d.ts +2 -0
  59. package/dist/enforcement/target-validator.test.d.ts.map +1 -0
  60. package/dist/enforcement/target-validator.test.js +103 -0
  61. package/dist/enforcement/target-validator.test.js.map +1 -0
  62. package/dist/http-client.d.ts +35 -0
  63. package/dist/http-client.d.ts.map +1 -0
  64. package/dist/http-client.js +168 -0
  65. package/dist/http-client.js.map +1 -0
  66. package/dist/http-client.test.d.ts +2 -0
  67. package/dist/http-client.test.d.ts.map +1 -0
  68. package/dist/http-client.test.js +172 -0
  69. package/dist/http-client.test.js.map +1 -0
  70. package/dist/index.js +190 -114
  71. package/dist/index.js.map +1 -1
  72. package/dist/launcher.d.ts +33 -0
  73. package/dist/launcher.d.ts.map +1 -0
  74. package/dist/launcher.js +425 -0
  75. package/dist/launcher.js.map +1 -0
  76. package/dist/launcher.test.d.ts +2 -0
  77. package/dist/launcher.test.d.ts.map +1 -0
  78. package/dist/launcher.test.js +109 -0
  79. package/dist/launcher.test.js.map +1 -0
  80. package/dist/proxy/cert-manager.d.ts +24 -0
  81. package/dist/proxy/cert-manager.d.ts.map +1 -0
  82. package/dist/proxy/cert-manager.js +117 -0
  83. package/dist/proxy/cert-manager.js.map +1 -0
  84. package/dist/proxy/cert-manager.test.d.ts +2 -0
  85. package/dist/proxy/cert-manager.test.d.ts.map +1 -0
  86. package/dist/proxy/cert-manager.test.js +70 -0
  87. package/dist/proxy/cert-manager.test.js.map +1 -0
  88. package/dist/proxy/index.d.ts +61 -0
  89. package/dist/proxy/index.d.ts.map +1 -0
  90. package/dist/proxy/index.js +74 -0
  91. package/dist/proxy/index.js.map +1 -0
  92. package/dist/proxy/policy-enforcer.d.ts +30 -0
  93. package/dist/proxy/policy-enforcer.d.ts.map +1 -0
  94. package/dist/proxy/policy-enforcer.js +143 -0
  95. package/dist/proxy/policy-enforcer.js.map +1 -0
  96. package/dist/proxy/proxy-server.d.ts +42 -0
  97. package/dist/proxy/proxy-server.d.ts.map +1 -0
  98. package/dist/proxy/proxy-server.js +652 -0
  99. package/dist/proxy/proxy-server.js.map +1 -0
  100. package/dist/proxy/redaction-engine.d.ts +4 -0
  101. package/dist/proxy/redaction-engine.d.ts.map +1 -0
  102. package/dist/proxy/redaction-engine.js +50 -0
  103. package/dist/proxy/redaction-engine.js.map +1 -0
  104. package/dist/proxy/response-redaction.test.d.ts +2 -0
  105. package/dist/proxy/response-redaction.test.d.ts.map +1 -0
  106. package/dist/proxy/response-redaction.test.js +125 -0
  107. package/dist/proxy/response-redaction.test.js.map +1 -0
  108. package/dist/proxy/threat-engine.d.ts +22 -0
  109. package/dist/proxy/threat-engine.d.ts.map +1 -0
  110. package/dist/proxy/threat-engine.js +291 -0
  111. package/dist/proxy/threat-engine.js.map +1 -0
  112. package/dist/proxy/threat-engine.test.d.ts +2 -0
  113. package/dist/proxy/threat-engine.test.d.ts.map +1 -0
  114. package/dist/proxy/threat-engine.test.js +27 -0
  115. package/dist/proxy/threat-engine.test.js.map +1 -0
  116. package/dist/redirect/env-injector.d.ts +72 -0
  117. package/dist/redirect/env-injector.d.ts.map +1 -0
  118. package/dist/redirect/env-injector.js +177 -0
  119. package/dist/redirect/env-injector.js.map +1 -0
  120. package/dist/redirect/env-injector.test.d.ts +2 -0
  121. package/dist/redirect/env-injector.test.d.ts.map +1 -0
  122. package/dist/redirect/env-injector.test.js +91 -0
  123. package/dist/redirect/env-injector.test.js.map +1 -0
  124. package/dist/redirect/index.d.ts +3 -0
  125. package/dist/redirect/index.d.ts.map +1 -0
  126. package/dist/redirect/index.js +8 -0
  127. package/dist/redirect/index.js.map +1 -0
  128. package/dist/redirect/platform-redirect.d.ts +42 -0
  129. package/dist/redirect/platform-redirect.d.ts.map +1 -0
  130. package/dist/redirect/platform-redirect.js +229 -0
  131. package/dist/redirect/platform-redirect.js.map +1 -0
  132. package/dist/redirect/platform-redirect.test.d.ts +2 -0
  133. package/dist/redirect/platform-redirect.test.d.ts.map +1 -0
  134. package/dist/redirect/platform-redirect.test.js +76 -0
  135. package/dist/redirect/platform-redirect.test.js.map +1 -0
  136. package/dist/sandbox/index.d.ts +23 -2
  137. package/dist/sandbox/index.d.ts.map +1 -1
  138. package/dist/sandbox/index.js +24 -7
  139. package/dist/sandbox/index.js.map +1 -1
  140. package/dist/sandbox/linux-sandbox.d.ts +13 -2
  141. package/dist/sandbox/linux-sandbox.d.ts.map +1 -1
  142. package/dist/sandbox/linux-sandbox.js +61 -27
  143. package/dist/sandbox/linux-sandbox.js.map +1 -1
  144. package/dist/sandbox/macos-sandbox.d.ts +15 -4
  145. package/dist/sandbox/macos-sandbox.d.ts.map +1 -1
  146. package/dist/sandbox/macos-sandbox.js +36 -18
  147. package/dist/sandbox/macos-sandbox.js.map +1 -1
  148. package/dist/sandbox/sandbox-result.test.d.ts +2 -0
  149. package/dist/sandbox/sandbox-result.test.d.ts.map +1 -0
  150. package/dist/sandbox/sandbox-result.test.js +87 -0
  151. package/dist/sandbox/sandbox-result.test.js.map +1 -0
  152. package/dist/sandbox/windows-sandbox.d.ts +34 -0
  153. package/dist/sandbox/windows-sandbox.d.ts.map +1 -0
  154. package/dist/sandbox/windows-sandbox.js +161 -0
  155. package/dist/sandbox/windows-sandbox.js.map +1 -0
  156. package/dist/setup.d.ts.map +1 -1
  157. package/dist/setup.js +33 -43
  158. package/dist/setup.js.map +1 -1
  159. package/dist/skill-authz/skill-evaluator.d.ts +30 -0
  160. package/dist/skill-authz/skill-evaluator.d.ts.map +1 -1
  161. package/dist/skill-authz/skill-evaluator.js +161 -30
  162. package/dist/skill-authz/skill-evaluator.js.map +1 -1
  163. package/dist/skill-authz/skill-evaluator.test.d.ts +2 -0
  164. package/dist/skill-authz/skill-evaluator.test.d.ts.map +1 -0
  165. package/dist/skill-authz/skill-evaluator.test.js +127 -0
  166. package/dist/skill-authz/skill-evaluator.test.js.map +1 -0
  167. package/dist/telemetry.d.ts +2 -8
  168. package/dist/telemetry.d.ts.map +1 -1
  169. package/dist/telemetry.js +17 -147
  170. package/dist/telemetry.js.map +1 -1
  171. package/dist/types.d.ts +48 -105
  172. package/dist/types.d.ts.map +1 -1
  173. package/dist/types.js +34 -1
  174. package/dist/types.js.map +1 -1
  175. package/package.json +7 -3
  176. package/scripts/install-sentry-windows.ps1 +217 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neurosec/sentry",
3
- "version": "1.0.20",
3
+ "version": "1.1.0",
4
4
  "description": "NeuroShield Sentry — host-level agent protection daemon. Detects and blocks malicious AI agent actions at the OS level.",
5
5
  "keywords": [
6
6
  "ai-security",
@@ -28,7 +28,8 @@
28
28
  },
29
29
  "os": [
30
30
  "linux",
31
- "darwin"
31
+ "darwin",
32
+ "win32"
32
33
  ],
33
34
  "preferGlobal": true,
34
35
  "bin": {
@@ -50,7 +51,10 @@
50
51
  "lint": "eslint src --ext .ts",
51
52
  "test": "vitest run",
52
53
  "prepack": "npm run build && node scripts/prepack.js",
53
- "postinstall": "node scripts/postinstall.js"
54
+ "postinstall": "node scripts/postinstall.js",
55
+ "install-service:linux": "sudo bash scripts/install-sentry.sh",
56
+ "install-service:macos": "sudo bash scripts/install-sentry-macos.sh",
57
+ "install-service:win": "powershell -ExecutionPolicy Bypass -File scripts/install-sentry-windows.ps1"
54
58
  },
55
59
  "dependencies": {
56
60
  "yaml": "^2.3.4",
@@ -0,0 +1,217 @@
1
+ # NeuroShield Sentry Daemon — Windows Installation Script
2
+ # Run as Administrator: powershell -ExecutionPolicy Bypass -File install-sentry-windows.ps1
3
+ param(
4
+ [string]$Mode = "monitor",
5
+ [string]$NeurosecUrl = "https://api.neurosec.ai",
6
+ [string]$OrgId = "",
7
+ [string]$Token = ""
8
+ )
9
+
10
+ $ErrorActionPreference = "Stop"
11
+ $SentryVersion = "1.0.0"
12
+ $InstallDir = "$env:ProgramFiles\NeuroShield\Sentry"
13
+ $ConfigDir = "$env:ProgramData\NeuroShield\Sentry"
14
+ $StateDir = "$env:ProgramData\NeuroShield\Sentry\state"
15
+ $LogDir = "$env:ProgramData\NeuroShield\Sentry\logs"
16
+ $BinPath = "$InstallDir\bin\neuroshield-sentryd.cmd"
17
+ $ConfigPath = "$ConfigDir\sentry.yaml"
18
+ $ServiceName = "NeuroShieldSentry"
19
+
20
+ Write-Host "============================================" -ForegroundColor Cyan
21
+ Write-Host " NeuroShield Sentry v$SentryVersion Installer (Windows)" -ForegroundColor Cyan
22
+ Write-Host " Mode: $Mode" -ForegroundColor Cyan
23
+ Write-Host "============================================" -ForegroundColor Cyan
24
+
25
+ # Check if running as admin
26
+ $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
27
+ if (-not $isAdmin) {
28
+ Write-Host "ERROR: This script must be run as Administrator" -ForegroundColor Red
29
+ exit 1
30
+ }
31
+
32
+ # Check Node.js
33
+ try {
34
+ $nodeVersion = node --version
35
+ Write-Host "Node.js found: $nodeVersion" -ForegroundColor Green
36
+ } catch {
37
+ Write-Host "ERROR: Node.js is required (>= 20)" -ForegroundColor Red
38
+ exit 1
39
+ }
40
+
41
+ # Create directories
42
+ Write-Host "Creating directories..." -ForegroundColor Yellow
43
+ New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
44
+ New-Item -ItemType Directory -Force -Path $ConfigDir | Out-Null
45
+ New-Item -ItemType Directory -Force -Path $StateDir | Out-Null
46
+ New-Item -ItemType Directory -Force -Path $LogDir | Out-Null
47
+
48
+ # Copy sentry package files
49
+ $scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
50
+ $projectDir = Resolve-Path "$scriptPath\..\..\.."
51
+ $sentryPackage = "$projectDir\packages\sentry"
52
+
53
+ if (Test-Path "$sentryPackage\package.json") {
54
+ Write-Host "Building sentry daemon from source..." -ForegroundColor Yellow
55
+
56
+ # Copy dist
57
+ if (Test-Path "$sentryPackage\dist") {
58
+ Copy-Item -Path "$sentryPackage\dist\*" -Destination "$InstallDir" -Recurse -Force
59
+ }
60
+
61
+ # Copy node_modules
62
+ if (Test-Path "$sentryPackage\node_modules") {
63
+ Copy-Item -Path "$sentryPackage\node_modules\*" -Destination "$InstallDir\node_modules" -Recurse -Force
64
+ }
65
+
66
+ Copy-Item -Path "$sentryPackage\package.json" -Destination "$InstallDir" -Force
67
+ }
68
+
69
+ # Create wrapper script
70
+ $wrapperContent = @"
71
+ @echo off
72
+ node "%~dp0..\dist\index.js" %*
73
+ "@
74
+ [System.IO.File]::WriteAllText($BinPath, $wrapperContent)
75
+
76
+ # Generate default config
77
+ if (-not (Test-Path $ConfigPath)) {
78
+ Write-Host "Generating default config..." -ForegroundColor Yellow
79
+
80
+ $hostId = "$env:COMPUTERNAME-sentry"
81
+
82
+ $configContent = @"
83
+ # NeuroShield Sentry Daemon Configuration (Windows)
84
+ sentry:
85
+ host_id: "$hostId"
86
+ version: "$SentryVersion"
87
+ health_port: 9190
88
+ api_port: 9191
89
+ state_dir: "$StateDir"
90
+ pid_file_path: "$StateDir\sentry.pid"
91
+
92
+ neurosec:
93
+ endpoint: "$NeurosecUrl"
94
+ org_id: "$OrgId"
95
+ token_path: "$ConfigDir\sentry.token"
96
+ tls_cert: "$ConfigDir\cert.pem"
97
+ tls_key: "$ConfigDir\key.pem"
98
+ sync_interval_ms: 30000
99
+ heartbeat_interval_ms: 300000
100
+
101
+ enforcement:
102
+ mode: "$Mode"
103
+ sandbox_enabled: false
104
+ syscall_filter_enabled: false
105
+ network_filter_enabled: true
106
+ filesystem_filter_enabled: false
107
+
108
+ sandbox_defaults:
109
+ cpu_max: "0.5"
110
+ memory_max: "512MB"
111
+ pid_max: 100
112
+
113
+ network:
114
+ allow_hosts:
115
+ - "api.openai.com:443"
116
+ - "api.anthropic.com:443"
117
+ - "api.neurosec.ai:443"
118
+ block_hosts:
119
+ - "*.pastebin.com"
120
+ - "*.ngrok.io"
121
+ - "*.requestbin.net"
122
+ - "*.webhook.site"
123
+ allow_private: false
124
+ dns_monitor_enabled: false
125
+
126
+ proxy:
127
+ enabled: true
128
+ port: 9081
129
+ bind_address: "127.0.0.1"
130
+ upstream_timeout_ms: 120000
131
+ max_buffer_size_mb: 10
132
+ intercept_https: false
133
+
134
+ redirect:
135
+ enabled: true
136
+ strategy: "env-inject"
137
+ preserve_original_key: true
138
+ inject_on_discover: true
139
+
140
+ skill_authz:
141
+ enabled: true
142
+ allow_unknown: false
143
+ require_approval:
144
+ - "shell_exec"
145
+ - "bash"
146
+ - "terminal"
147
+ - "run_command"
148
+
149
+ audit:
150
+ log_path: "$LogDir\sentry.log"
151
+ retention_days: 90
152
+ max_size_mb: 500
153
+
154
+ discovery:
155
+ interval_ms: 30000
156
+ source_paths:
157
+ - "C:\Users"
158
+ - "C:\Projects"
159
+ - "C:\Workspace"
160
+ "@
161
+ [System.IO.File]::WriteAllText($ConfigPath, $configContent)
162
+ Write-Host " Config written to $ConfigPath" -ForegroundColor Green
163
+ }
164
+
165
+ # Create empty token file
166
+ $tokenPath = "$ConfigDir\sentry.token"
167
+ if (-not (Test-Path $tokenPath)) {
168
+ if ($Token) {
169
+ [System.IO.File]::WriteAllText($tokenPath, $Token)
170
+ } else {
171
+ New-Item -ItemType File -Force -Path $tokenPath | Out-Null
172
+ }
173
+ }
174
+
175
+ # Install Windows service using NSSM or sc.exe
176
+ Write-Host "Installing Windows service..." -ForegroundColor Yellow
177
+
178
+ # Check if NSSM is available
179
+ $nssmPath = Get-Command "nssm" -ErrorAction SilentlyContinue
180
+
181
+ if ($nssmPath) {
182
+ # Use NSSM for service management
183
+ nssm install $ServiceName "node.exe" "$InstallDir\dist\index.js" "$ConfigPath"
184
+ nssm set $ServiceName AppDirectory "$InstallDir"
185
+ nssm set $ServiceName DisplayName "NeuroShield Sentry Daemon"
186
+ nssm set $ServiceName Description "Host-level AI agent protection daemon. Detects, sandboxes, and enforces policies on AI agent processes."
187
+ nssm set $ServiceName Start SERVICE_AUTO_START
188
+ nssm set $ServiceName AppStdout "$LogDir\sentry-stdout.log"
189
+ nssm set $ServiceName AppStderr "$LogDir\sentry-stderr.log"
190
+ nssm set $ServiceName AppEnvironmentExtra "NODE_ENV=production SENTRY_CONFIG_PATH=$ConfigPath LOG_LEVEL=info"
191
+ nssm start $ServiceName
192
+ } else {
193
+ # Use sc.exe for basic service creation
194
+ $binaryPath = "node.exe `"$InstallDir\dist\index.js`" `"$ConfigPath`""
195
+ sc.exe create $ServiceName binPath= $binaryPath start= auto
196
+ sc.exe description $ServiceName "Host-level AI agent protection daemon"
197
+ sc.exe failure $ServiceName reset= 86400 actions= restart/5000/restart/10000/restart/30000
198
+ sc.exe start $ServiceName
199
+ }
200
+
201
+ Write-Host ""
202
+ Write-Host "============================================" -ForegroundColor Cyan
203
+ Write-Host " Installation Complete!" -ForegroundColor Cyan
204
+ Write-Host "============================================" -ForegroundColor Cyan
205
+ Write-Host ""
206
+ Write-Host " Next steps:"
207
+ Write-Host " 1. Edit $ConfigPath with your NeuroSec org ID"
208
+ Write-Host " 2. Set your sentry token: echo 'your-token' > $ConfigDir\sentry.token"
209
+ Write-Host " 3. Service '$ServiceName' should be running"
210
+ Write-Host " 4. Check status: sc query $ServiceName"
211
+ Write-Host " 5. View logs: Get-Content $LogDir\sentry-stdout.log -Tail 50"
212
+ Write-Host " 6. Local API: curl http://127.0.0.1:9191/api/v1/status"
213
+ Write-Host ""
214
+ Write-Host " To uninstall:"
215
+ Write-Host " nssm stop $ServiceName"
216
+ Write-Host " nssm remove $ServiceName confirm"
217
+ Write-Host " Remove-Item -Recurse -Force '$InstallDir'"