thumbgate 1.37.3 → 1.39.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/.agents/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
- package/.agents/skills/bolt-forge-opt-in-not-clone/SKILL.md +72 -0
- package/.agents/skills/decisive-step-evaluator/SKILL.md +47 -0
- package/.agents/skills/fiddler-control-plane-honesty/SKILL.md +61 -0
- package/.agents/skills/halo-trace-optimize-not-clone/SKILL.md +60 -0
- package/.agents/skills/harness-evolution-ceiling/SKILL.md +52 -0
- package/.agents/skills/infoq-architect-honesty-not-clone/SKILL.md +37 -0
- package/.agents/skills/meko-datapack-honesty-not-clone/SKILL.md +45 -0
- package/.agents/skills/mintlify-knowledge-honesty-not-clone/SKILL.md +49 -0
- package/.agents/skills/model-distress-governance/SKILL.md +56 -0
- package/.agents/skills/omp-coordination-honesty-not-clone/SKILL.md +94 -0
- package/.agents/skills/saas-moat-honesty-not-clone/SKILL.md +22 -0
- package/.agents/skills/salt-code-policy-honesty-not-clone/SKILL.md +76 -0
- package/.agents/skills/siren-mcp-governance/SKILL.md +50 -0
- package/.agents/skills/vs-coverage-gap-not-clone/SKILL.md +69 -0
- package/.agents/skills/wisdom-context-artifact-not-clone/SKILL.md +67 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/mcp/server-card.json +1 -1
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/forge/forge.yaml +3 -3
- package/adapters/future-agi/.mcp.json +1 -1
- package/adapters/future-agi/config.toml +1 -1
- package/adapters/future-agi/opencode.json +1 -1
- package/adapters/herdr/herdr-plugin.toml +2 -2
- package/adapters/hotdata/hotdata-vector-store.js +575 -0
- package/adapters/mcp/server-stdio.js +1 -1
- package/adapters/opencode/opencode.json +1 -1
- package/adapters/strands/STRANDS.md +107 -0
- package/adapters/strands/strands-box-diode.js +344 -0
- package/adapters/strands/strands-decider-adapter.js +445 -0
- package/adapters/strands/strands-middleware.js +192 -0
- package/adapters/tailscale/.mcp.json +15 -0
- package/adapters/tailscale/TAILSCALE.md +117 -0
- package/adapters/tailscale/config.toml +16 -0
- package/bin/cli.js +602 -21
- package/config/gate-templates.json +109 -0
- package/config/gates/default.json +13 -0
- package/config/schemas/task-outcome-receipt.schema.json +12 -0
- package/package.json +150 -21
- package/public/blog/2026-09-28-pretool-secret-deny.html +83 -0
- package/public/blog/2026-10-01-aws-strands-harness-token-firewall.html +77 -0
- package/public/blog/2026-10-01-model-distress-relief-seeking-firewall.html +71 -0
- package/public/blog/2026-10-02-salt-code-honest-steal-40-guardrails.html +106 -0
- package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +119 -0
- package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +141 -0
- package/public/connectors.html +329 -0
- package/public/enterprise-governance.html +311 -0
- package/public/gaming-playbook.html +732 -0
- package/public/index.html +77 -51
- package/public/install.html +7 -7
- package/public/learn.html +14 -0
- package/public/numbers.html +2 -2
- package/public/onboarding.html +794 -0
- package/public/operator-framework.html +385 -0
- package/public/pricing.html +14 -10
- package/scripts/activesaddler-curriculum-doctor.js +357 -0
- package/scripts/agent-context-artifact.js +325 -0
- package/scripts/agent-egress-policy.js +2 -2
- package/scripts/agent-operations-planner.js +1 -1
- package/scripts/agent-outcome-eval.js +1 -1
- package/scripts/agent-reliability-client.js +148 -0
- package/scripts/apple-minions-idle-compute-steal.js +428 -0
- package/scripts/autoresearch-runner.js +20 -1
- package/scripts/billing.js +0 -1
- package/scripts/cli-demo.js +505 -1
- package/scripts/cli-schema.js +36 -0
- package/scripts/colab-compute-honesty.js +93 -0
- package/scripts/corporate-email-isolation-diode.js +299 -0
- package/scripts/coverage-gap.js +396 -0
- package/scripts/dashboard-chat.js +3 -3
- package/scripts/dashboard.js +2 -2
- package/scripts/decisive-step-doctor.js +256 -0
- package/scripts/decisive-step-evaluator.js +390 -0
- package/scripts/entitlement.js +18 -7
- package/scripts/experiment-tracker.js +5 -3
- package/scripts/feedback-loop.js +26 -3
- package/scripts/fiddler-control-plane-honesty.js +303 -0
- package/scripts/financial-control-plane.js +10 -2
- package/scripts/gates-engine.js +3 -1
- package/scripts/github-license-compliance-diode.js +378 -0
- package/scripts/halo-trace-optimizer.js +631 -0
- package/scripts/harness-ceiling-doctor.js +326 -0
- package/scripts/hf-papers.js +1 -1
- package/scripts/human-escalation.js +7 -1
- package/scripts/hybrid-feedback-context.js +53 -7
- package/scripts/infoq-architect-honesty.js +362 -0
- package/scripts/lesson-graph.js +785 -0
- package/scripts/lesson-inference.js +1 -1
- package/scripts/lesson-retrieval.js +26 -18
- package/scripts/license.js +122 -21
- package/scripts/llm-behavior-monitor.js +1 -1
- package/scripts/llm-obs-honesty.js +52 -0
- package/scripts/local-model-profile.js +11 -7
- package/scripts/mailer/resend-mailer.js +6 -3
- package/scripts/mcp-transport-strategy.js +1 -1
- package/scripts/meko-datapack-honesty.js +414 -0
- package/scripts/migrate-lesson-graph.js +442 -0
- package/scripts/mintlify-knowledge-honesty.js +647 -0
- package/scripts/model-distress-detector.js +207 -0
- package/scripts/model-distress-doctor.js +368 -0
- package/scripts/multi-harness-invariants.js +305 -0
- package/scripts/omp-coordination-honesty.js +488 -0
- package/scripts/pro-local-dashboard.js +20 -3
- package/scripts/prompt-eval.js +1 -1
- package/scripts/prove-herdr-adapter.js +367 -3
- package/scripts/rag-embedding-identity.js +1 -1
- package/scripts/rrsi-regularizer.js +531 -0
- package/scripts/saas-moat-honesty.js +443 -0
- package/scripts/salt-code-policy-honesty.js +1204 -0
- package/scripts/secret-redaction.js +58 -0
- package/scripts/session-export-gate.js +368 -0
- package/scripts/siren-mcp-governance.js +539 -0
- package/scripts/strands-box-doctor.js +130 -0
- package/scripts/strands-harness-doctor.js +390 -0
- package/scripts/stripe-revenue-catalog-audit.js +12 -0
- package/scripts/stripe-revenue-catalog.js +40 -0
- package/scripts/switchyard-router.js +153 -0
- package/scripts/tailscale-p2p-doctor.js +252 -0
- package/scripts/task-outcomes.js +148 -3
- package/scripts/thumbgate-board-loop.js +4 -2
- package/scripts/thumbgate-daily-discoveries-publish.js +86 -38
- package/scripts/triage-savings-calculator.js +181 -0
- package/scripts/vector-store.js +41 -2
- package/scripts/vulnerability-pre-action-diode.js +319 -0
- package/scripts/windbg-evidence-diagnostics.js +241 -0
- package/scripts/workflow-intake-queue.js +1 -1
- package/scripts/workspace-agent-routines.js +534 -6
- package/scripts/workspace-evolver.js +143 -13
- package/server.json +2 -2
- package/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
- package/skills/siren-mcp-governance/SKILL.md +50 -0
- package/src/api/server.js +191 -5
- package/src/mcp-writeguard.js +1 -1
- package/src/session-interactivity.js +284 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Strands Box & Dogwood Policy Diode — AWS Strands Box Format Steal
|
|
5
|
+
*
|
|
6
|
+
* Implements OS containment + contextual Dogwood policy enforcement:
|
|
7
|
+
* - State-aware event history across tools (fs:read, fs:write, fs:delete, http:request, mcp:call)
|
|
8
|
+
* - Exfiltration diode & taint tracking (block outbound network after sensitive file read)
|
|
9
|
+
* - Credential injection gateway (agent sees placeholder token; gateway attaches secret on egress)
|
|
10
|
+
* - Sliding-window rate limiters (e.g. max 3 external alerts / 10 min)
|
|
11
|
+
* - Sub-1ms local CPU execution
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const crypto = require('node:crypto');
|
|
15
|
+
const { performance } = require('node:perf_hooks');
|
|
16
|
+
|
|
17
|
+
const EVENT_FS_READ = 'fs:read';
|
|
18
|
+
const EVENT_FS_WRITE = 'fs:write';
|
|
19
|
+
const EVENT_FS_DELETE = 'fs:delete';
|
|
20
|
+
const EVENT_HTTP_REQUEST = 'http:request';
|
|
21
|
+
const EVENT_MCP_CALL = 'mcp:call';
|
|
22
|
+
const EVENT_SHELL_EXEC = 'shell:exec';
|
|
23
|
+
|
|
24
|
+
const DEFAULT_SENSITIVE_PATTERNS = [
|
|
25
|
+
/\.env(?:\..+)?$/,
|
|
26
|
+
/credentials(?:\.json|\.txt)?$/i,
|
|
27
|
+
/id_rsa|id_ed25519/,
|
|
28
|
+
/token|secret|password|customer[-_]data/i
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates an isolated Strands Box governance session.
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} opts
|
|
35
|
+
* @param {string} [opts.id]
|
|
36
|
+
* @param {string} opts.name
|
|
37
|
+
* @param {string} opts.workspace
|
|
38
|
+
* @param {Array<RegExp|string>} [opts.sensitivePatterns]
|
|
39
|
+
* @param {Array<Object>} [opts.credentialRoutes]
|
|
40
|
+
* @param {Object} [opts.rateLimits]
|
|
41
|
+
* @returns {Object} Box session instance
|
|
42
|
+
*/
|
|
43
|
+
function createBoxSession(opts = {}) {
|
|
44
|
+
const sessionId = opts.id || `box_${Date.now()}_${crypto.randomBytes(4).toString('hex')}`;
|
|
45
|
+
const name = opts.name || 'default-box';
|
|
46
|
+
const workspace = opts.workspace || process.cwd();
|
|
47
|
+
const sensitivePatterns = opts.sensitivePatterns || DEFAULT_SENSITIVE_PATTERNS;
|
|
48
|
+
const credentialRoutes = opts.credentialRoutes || [];
|
|
49
|
+
const rateLimits = opts.rateLimits || {};
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
id: sessionId,
|
|
53
|
+
name,
|
|
54
|
+
workspace,
|
|
55
|
+
sensitivePatterns,
|
|
56
|
+
credentialRoutes,
|
|
57
|
+
rateLimits,
|
|
58
|
+
history: [],
|
|
59
|
+
taintedSources: new Set(),
|
|
60
|
+
isTainted: false,
|
|
61
|
+
rateCounters: new Map() // key -> array of timestamps
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Decomposes a shell command into concrete Dogwood events.
|
|
67
|
+
*
|
|
68
|
+
* @param {string} command - Shell command string
|
|
69
|
+
* @returns {Array<{type: string, target: string, operation: string}>}
|
|
70
|
+
*/
|
|
71
|
+
function decomposeCommand(command = '') {
|
|
72
|
+
let trimmed = String(command).trim();
|
|
73
|
+
const events = [];
|
|
74
|
+
|
|
75
|
+
// Strip common execution wrappers (sudo, nohup, env prefixes)
|
|
76
|
+
trimmed = trimmed.replace(/^(?:sudo\s+|nohup\s+|env(?:\s+[a-zA-Z_][a-zA-Z0-9_]*=[^\s]+)*\s+)+/i, '');
|
|
77
|
+
|
|
78
|
+
// Strip absolute path from command name (e.g. /bin/rm -> rm, /usr/bin/cat -> cat)
|
|
79
|
+
trimmed = trimmed.replace(/^\/(?:usr\/)?(?:bin|sbin)\/([a-zA-Z0-9_-]+)/, '$1');
|
|
80
|
+
|
|
81
|
+
// Match destructive deletes: rm -rf path, rm path
|
|
82
|
+
const rmMatch = trimmed.match(/^rm\s+(?:-[a-zA-Z]+\s+)*(.+)$/);
|
|
83
|
+
if (rmMatch) {
|
|
84
|
+
const targets = rmMatch[1].split(/\s+/).filter(Boolean);
|
|
85
|
+
for (const t of targets) {
|
|
86
|
+
events.push({ type: EVENT_FS_DELETE, target: t, operation: 'delete' });
|
|
87
|
+
}
|
|
88
|
+
return events;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Match common file readers: cat, head, tail, less, more, base64, cp
|
|
92
|
+
const readMatch = trimmed.match(/^(?:cat|head|tail|less|more|base64|cp)\s+(?:-[a-zA-Z0-9]+\s+)*(.+)$/);
|
|
93
|
+
if (readMatch) {
|
|
94
|
+
const targets = readMatch[1].split(/\s+/).filter(Boolean);
|
|
95
|
+
for (const t of targets) {
|
|
96
|
+
events.push({ type: EVENT_FS_READ, target: t, operation: 'read' });
|
|
97
|
+
}
|
|
98
|
+
return events;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Match network egress: curl, wget, fetch
|
|
102
|
+
const curlMatch = trimmed.match(/^(?:curl|wget)\s+(?:-[a-zA-Z0-9-]+\s+)*(https?:\/\/[^\s'"]+)/i);
|
|
103
|
+
if (curlMatch) {
|
|
104
|
+
events.push({ type: EVENT_HTTP_REQUEST, target: curlMatch[1], operation: 'network_egress' });
|
|
105
|
+
return events;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Generic execution
|
|
109
|
+
events.push({ type: EVENT_SHELL_EXEC, target: trimmed, operation: 'shell_exec' });
|
|
110
|
+
return events;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Checks sliding window rate limit for an action key.
|
|
115
|
+
*
|
|
116
|
+
* @param {Object} session
|
|
117
|
+
* @param {string} actionKey
|
|
118
|
+
* @param {number} maxCount
|
|
119
|
+
* @param {number} windowSeconds
|
|
120
|
+
* @returns {boolean} True if within limit, false if exceeded
|
|
121
|
+
*/
|
|
122
|
+
function checkRateLimit(session, actionKey, maxCount, windowSeconds) {
|
|
123
|
+
const now = Date.now();
|
|
124
|
+
const windowMs = windowSeconds * 1000;
|
|
125
|
+
let timestamps = session.rateCounters.get(actionKey) || [];
|
|
126
|
+
|
|
127
|
+
// Filter timestamps within current sliding window
|
|
128
|
+
timestamps = timestamps.filter(ts => (now - ts) <= windowMs);
|
|
129
|
+
session.rateCounters.set(actionKey, timestamps);
|
|
130
|
+
|
|
131
|
+
if (timestamps.length >= maxCount) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
timestamps.push(now);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Evaluates an operation through Strands Box & Dogwood policies.
|
|
141
|
+
*
|
|
142
|
+
* @param {Object} session - The box session created by createBoxSession
|
|
143
|
+
* @param {Object} action - Action descriptor
|
|
144
|
+
* @param {string} action.type - Event type (fs:read, fs:write, fs:delete, http:request, mcp:call, shell:exec)
|
|
145
|
+
* @param {string} action.target - Path, URL, or identifier
|
|
146
|
+
* @param {Object} [action.params] - Parameters or request headers
|
|
147
|
+
* @returns {Object} Evaluation verdict
|
|
148
|
+
*/
|
|
149
|
+
function evaluateBoxAction(session, action = {}) {
|
|
150
|
+
const start = performance.now();
|
|
151
|
+
const type = action.type || 'unknown';
|
|
152
|
+
const target = String(action.target || '').trim();
|
|
153
|
+
const params = action.params || {};
|
|
154
|
+
|
|
155
|
+
// 1. Compound Command Decomposition
|
|
156
|
+
if (type === EVENT_SHELL_EXEC) {
|
|
157
|
+
const subEvents = decomposeCommand(target);
|
|
158
|
+
for (const sub of subEvents) {
|
|
159
|
+
if (sub.type !== EVENT_SHELL_EXEC) {
|
|
160
|
+
const subVerdict = evaluateBoxAction(session, {
|
|
161
|
+
type: sub.type,
|
|
162
|
+
target: sub.target,
|
|
163
|
+
params
|
|
164
|
+
});
|
|
165
|
+
if (!subVerdict.allowed) {
|
|
166
|
+
return subVerdict;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 2. Sensitive File Access & Taint Propagation (fs:read)
|
|
173
|
+
if (type === EVENT_FS_READ) {
|
|
174
|
+
for (const pattern of session.sensitivePatterns) {
|
|
175
|
+
const regex = pattern instanceof RegExp ? pattern : new RegExp(pattern, 'i');
|
|
176
|
+
if (regex.test(target)) {
|
|
177
|
+
session.isTainted = true;
|
|
178
|
+
session.taintedSources.add(target);
|
|
179
|
+
session.history.push({
|
|
180
|
+
type,
|
|
181
|
+
target,
|
|
182
|
+
timestamp: Date.now(),
|
|
183
|
+
verdict: 'ALLOW_WITH_TAINT',
|
|
184
|
+
tainted: true
|
|
185
|
+
});
|
|
186
|
+
const elapsed = performance.now() - start;
|
|
187
|
+
return {
|
|
188
|
+
allowed: true,
|
|
189
|
+
decision: 'ALLOW',
|
|
190
|
+
reason: 'SENSITIVE_DATA_READ_TAINT_PROPAGATED',
|
|
191
|
+
tainted: true,
|
|
192
|
+
taintedSources: Array.from(session.taintedSources),
|
|
193
|
+
latencyMs: Number(elapsed.toFixed(3))
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 3. Destructive Deletion Guard (fs:delete)
|
|
200
|
+
if (type === EVENT_FS_DELETE) {
|
|
201
|
+
const isRootOrSystem = /^\/(?:etc|var|usr|bin|boot|System|Library|Users)(?:\/|$)/i.test(target) || target === '/';
|
|
202
|
+
const isParentEscaped = target.includes('..') && !target.startsWith(session.workspace);
|
|
203
|
+
if (isRootOrSystem || isParentEscaped) {
|
|
204
|
+
const elapsed = performance.now() - start;
|
|
205
|
+
return {
|
|
206
|
+
allowed: false,
|
|
207
|
+
decision: 'BLOCK',
|
|
208
|
+
reason: 'CRITICAL_DELETION_CONTAINMENT_BREACH',
|
|
209
|
+
target,
|
|
210
|
+
latencyMs: Number(elapsed.toFixed(3))
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// 4. Exfiltration Prevention & Network Egress Diode (http:request)
|
|
216
|
+
if (type === EVENT_HTTP_REQUEST) {
|
|
217
|
+
// If session holds tainted sensitive data, block untrusted egress
|
|
218
|
+
if (session.isTainted) {
|
|
219
|
+
const allowlistedHosts = ['127.0.0.1', 'localhost', 'api.thumbgate.ai'];
|
|
220
|
+
let isAllowlisted = false;
|
|
221
|
+
try {
|
|
222
|
+
const urlObj = new URL(target.startsWith('http') ? target : `http://${target}`);
|
|
223
|
+
isAllowlisted = allowlistedHosts.some(h => urlObj.hostname === h || urlObj.hostname.endsWith(`.${h}`));
|
|
224
|
+
} catch {
|
|
225
|
+
isAllowlisted = false;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!isAllowlisted) {
|
|
229
|
+
const elapsed = performance.now() - start;
|
|
230
|
+
return {
|
|
231
|
+
allowed: false,
|
|
232
|
+
decision: 'BLOCK',
|
|
233
|
+
reason: 'EXFILTRATION_DIODE_TRIGGERED',
|
|
234
|
+
detail: 'Outbound request blocked because session contains tainted sensitive file reads',
|
|
235
|
+
taintedSources: Array.from(session.taintedSources),
|
|
236
|
+
target,
|
|
237
|
+
latencyMs: Number(elapsed.toFixed(3))
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Rate limiting for external requests
|
|
243
|
+
const rateKey = session.rateLimits[target] ? target
|
|
244
|
+
: session.rateLimits['http:request'] ? 'http:request'
|
|
245
|
+
: session.rateLimits['default'] ? 'default' : null;
|
|
246
|
+
const rateLimitConfig = rateKey ? session.rateLimits[rateKey] : null;
|
|
247
|
+
if (rateLimitConfig) {
|
|
248
|
+
const withinLimit = checkRateLimit(
|
|
249
|
+
session,
|
|
250
|
+
`http:${rateKey}`,
|
|
251
|
+
rateLimitConfig.maxCount,
|
|
252
|
+
rateLimitConfig.windowSeconds
|
|
253
|
+
);
|
|
254
|
+
if (!withinLimit) {
|
|
255
|
+
const elapsed = performance.now() - start;
|
|
256
|
+
return {
|
|
257
|
+
allowed: false,
|
|
258
|
+
decision: 'BLOCK',
|
|
259
|
+
reason: 'RATE_LIMIT_EXCEEDED',
|
|
260
|
+
detail: `Exceeded ${rateLimitConfig.maxCount} requests per ${rateLimitConfig.windowSeconds}s`,
|
|
261
|
+
target,
|
|
262
|
+
latencyMs: Number(elapsed.toFixed(3))
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// 5. Credential Injection Diode (Zero-Secret-Egress)
|
|
268
|
+
let transformedParams = { ...params };
|
|
269
|
+
let injectedAuth = false;
|
|
270
|
+
|
|
271
|
+
for (const route of session.credentialRoutes) {
|
|
272
|
+
let host = '';
|
|
273
|
+
try {
|
|
274
|
+
host = new URL(target.startsWith('http') ? target : `https://${target}`).hostname;
|
|
275
|
+
} catch {
|
|
276
|
+
host = '';
|
|
277
|
+
}
|
|
278
|
+
if (host === route.match || target.startsWith(route.match)) {
|
|
279
|
+
// Strip dummy placeholder token if present
|
|
280
|
+
if (transformedParams.headers) {
|
|
281
|
+
const headers = { ...transformedParams.headers };
|
|
282
|
+
if (headers.Authorization && headers.Authorization.includes('placeholder')) {
|
|
283
|
+
headers.Authorization = route.inject;
|
|
284
|
+
injectedAuth = true;
|
|
285
|
+
} else if (route.header && route.inject) {
|
|
286
|
+
headers[route.header] = route.inject;
|
|
287
|
+
injectedAuth = true;
|
|
288
|
+
}
|
|
289
|
+
transformedParams.headers = headers;
|
|
290
|
+
} else if (route.header && route.inject) {
|
|
291
|
+
transformedParams.headers = { [route.header]: route.inject };
|
|
292
|
+
injectedAuth = true;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
session.history.push({
|
|
298
|
+
type,
|
|
299
|
+
target,
|
|
300
|
+
timestamp: Date.now(),
|
|
301
|
+
verdict: 'ALLOW',
|
|
302
|
+
credentialInjected: injectedAuth
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
const elapsed = performance.now() - start;
|
|
306
|
+
return {
|
|
307
|
+
allowed: true,
|
|
308
|
+
decision: 'ALLOW',
|
|
309
|
+
reason: 'EGRESS_POLICY_PERMITTED',
|
|
310
|
+
injectedAuth,
|
|
311
|
+
transformedParams: injectedAuth ? transformedParams : undefined,
|
|
312
|
+
latencyMs: Number(elapsed.toFixed(3))
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 6. Default allow for conforming operations within workspace
|
|
317
|
+
session.history.push({
|
|
318
|
+
type,
|
|
319
|
+
target,
|
|
320
|
+
timestamp: Date.now(),
|
|
321
|
+
verdict: 'ALLOW'
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
const elapsed = performance.now() - start;
|
|
325
|
+
return {
|
|
326
|
+
allowed: true,
|
|
327
|
+
decision: 'ALLOW',
|
|
328
|
+
reason: 'ACTION_PERMITTED_IN_BOX',
|
|
329
|
+
latencyMs: Number(elapsed.toFixed(3))
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
module.exports = {
|
|
334
|
+
createBoxSession,
|
|
335
|
+
decomposeCommand,
|
|
336
|
+
checkRateLimit,
|
|
337
|
+
evaluateBoxAction,
|
|
338
|
+
EVENT_FS_READ,
|
|
339
|
+
EVENT_FS_WRITE,
|
|
340
|
+
EVENT_FS_DELETE,
|
|
341
|
+
EVENT_HTTP_REQUEST,
|
|
342
|
+
EVENT_MCP_CALL,
|
|
343
|
+
EVENT_SHELL_EXEC
|
|
344
|
+
};
|