@integsec/agentic-pentest-proxy 0.2.9 → 0.3.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 (44) hide show
  1. package/README.md +2 -0
  2. package/cloudflare/package-lock.json +1553 -0
  3. package/cloudflare/package.json +15 -0
  4. package/cloudflare/src/worker.mjs +126 -0
  5. package/cloudflare/wrangler.jsonc +26 -0
  6. package/dist/bin/integsec-agentic-pentest-bridge.d.ts +3 -0
  7. package/dist/bin/integsec-agentic-pentest-bridge.d.ts.map +1 -0
  8. package/dist/bin/integsec-agentic-pentest-bridge.js +23 -0
  9. package/dist/bin/integsec-agentic-pentest-bridge.js.map +1 -0
  10. package/dist/bin/integsec-agentic-pentest-gateway.d.ts +3 -0
  11. package/dist/bin/integsec-agentic-pentest-gateway.d.ts.map +1 -0
  12. package/dist/bin/integsec-agentic-pentest-gateway.js +42 -0
  13. package/dist/bin/integsec-agentic-pentest-gateway.js.map +1 -0
  14. package/dist/bin/integsec-agentic-pentest-proxy.js +6 -0
  15. package/dist/bin/integsec-agentic-pentest-proxy.js.map +1 -1
  16. package/dist/src/config.js +1 -1
  17. package/dist/src/gateway/admin.html +21 -0
  18. package/dist/src/gateway/admin.js +78 -0
  19. package/dist/src/gateway/auth.d.ts +18 -0
  20. package/dist/src/gateway/auth.d.ts.map +1 -0
  21. package/dist/src/gateway/auth.js +112 -0
  22. package/dist/src/gateway/auth.js.map +1 -0
  23. package/dist/src/gateway/runtime.d.ts +20 -0
  24. package/dist/src/gateway/runtime.d.ts.map +1 -0
  25. package/dist/src/gateway/runtime.js +167 -0
  26. package/dist/src/gateway/runtime.js.map +1 -0
  27. package/dist/src/gateway/server.d.ts +27 -0
  28. package/dist/src/gateway/server.d.ts.map +1 -0
  29. package/dist/src/gateway/server.js +232 -0
  30. package/dist/src/gateway/server.js.map +1 -0
  31. package/dist/src/gateway/state.d.ts +64 -0
  32. package/dist/src/gateway/state.d.ts.map +1 -0
  33. package/dist/src/gateway/state.js +126 -0
  34. package/dist/src/gateway/state.js.map +1 -0
  35. package/dist/src/index.d.ts +1 -1
  36. package/dist/src/index.js +1 -1
  37. package/dist/src/proxy.d.ts +4 -3
  38. package/dist/src/proxy.d.ts.map +1 -1
  39. package/dist/src/proxy.js +22 -9
  40. package/dist/src/proxy.js.map +1 -1
  41. package/dist/src/types.d.ts +2 -0
  42. package/dist/src/types.d.ts.map +1 -1
  43. package/docs/managed-gateway.md +90 -0
  44. package/package.json +11 -3
@@ -0,0 +1,126 @@
1
+ import { readFileSync, writeFileSync, renameSync, mkdirSync, existsSync } from "node:fs";
2
+ import { dirname } from "node:path";
3
+ import { randomUUID } from "node:crypto";
4
+ import { z } from "zod";
5
+ import { ScopeManifestSchema } from "../manifest-schema.js";
6
+ import { validateCidr, validateDomain } from "../builder/smart-validator.js";
7
+ const UpstreamSchema = z.object({
8
+ id: z.string().uuid(),
9
+ name: z.string().regex(/^[a-z][a-z0-9_-]{0,31}$/),
10
+ enabled: z.boolean(),
11
+ transport: z.enum(["stdio", "http", "sse"]),
12
+ command: z.string().min(1).optional(),
13
+ args: z.array(z.string()).default([]),
14
+ url: z.string().url().optional(),
15
+ }).superRefine((value, ctx) => {
16
+ if (value.transport === "stdio" && !value.command)
17
+ ctx.addIssue({ code: "custom", message: "stdio requires a command" });
18
+ if (value.transport !== "stdio" && !value.url)
19
+ ctx.addIssue({ code: "custom", message: "HTTP/SSE requires a URL" });
20
+ });
21
+ const ScopeRecordSchema = z.object({
22
+ id: z.string().uuid(),
23
+ manifest: ScopeManifestSchema,
24
+ profile: z.enum(["isolated", "restricted", "connected"]),
25
+ allowedHosts: z.array(z.string().min(1)).default([]),
26
+ updatedAt: z.string().datetime(),
27
+ }).superRefine((scope, ctx) => {
28
+ const manifest = scope.manifest;
29
+ if (Date.parse(manifest.engagement_window.end) <= Date.parse(manifest.engagement_window.start)) {
30
+ ctx.addIssue({ code: "custom", message: "Scope end must follow start" });
31
+ }
32
+ for (const range of manifest.authorized_targets.ip_ranges) {
33
+ for (const message of validateCidr(range).filter((item) => item.level === "error"))
34
+ ctx.addIssue({ code: "custom", message: message.message });
35
+ }
36
+ for (const domain of manifest.authorized_targets.domains) {
37
+ for (const message of validateDomain(domain).filter((item) => item.level === "error"))
38
+ ctx.addIssue({ code: "custom", message: message.message });
39
+ }
40
+ for (const value of manifest.authorized_targets.urls) {
41
+ try {
42
+ if (!["http:", "https:"].includes(new URL(value).protocol))
43
+ throw new Error();
44
+ }
45
+ catch {
46
+ ctx.addIssue({ code: "custom", message: `Invalid authorized URL: ${value}` });
47
+ }
48
+ }
49
+ for (const host of scope.allowedHosts) {
50
+ try {
51
+ const parsed = new URL(`http://${host}`);
52
+ if (parsed.hostname !== host || parsed.port || parsed.pathname !== "/")
53
+ throw new Error();
54
+ }
55
+ catch {
56
+ ctx.addIssue({ code: "custom", message: `Allowed host must be a hostname or IP without scheme or port: ${host}` });
57
+ }
58
+ }
59
+ });
60
+ const StateSchema = z.object({
61
+ version: z.literal(1),
62
+ upstreams: z.array(UpstreamSchema).max(32),
63
+ scopes: z.array(ScopeRecordSchema).max(100),
64
+ activeScopeId: z.string().uuid().nullable(),
65
+ }).superRefine((state, ctx) => {
66
+ if (state.activeScopeId && !state.scopes.some((scope) => scope.id === state.activeScopeId)) {
67
+ ctx.addIssue({ code: "custom", message: "Active scope does not exist" });
68
+ }
69
+ if (new Set(state.upstreams.map((item) => item.name)).size !== state.upstreams.length) {
70
+ ctx.addIssue({ code: "custom", message: "Upstream names must be unique" });
71
+ }
72
+ });
73
+ export class GatewayStore {
74
+ file;
75
+ state;
76
+ constructor(file) {
77
+ this.file = file;
78
+ this.state = existsSync(file)
79
+ ? StateSchema.parse(JSON.parse(readFileSync(file, "utf8")))
80
+ : { version: 1, upstreams: [], scopes: [], activeScopeId: null };
81
+ }
82
+ snapshot() { return structuredClone(this.state); }
83
+ update(mutator) {
84
+ const draft = this.snapshot();
85
+ mutator(draft);
86
+ return this.replace(draft);
87
+ }
88
+ replace(input) {
89
+ const next = StateSchema.parse(input);
90
+ mkdirSync(dirname(this.file), { recursive: true });
91
+ const temp = `${this.file}.${randomUUID()}.tmp`;
92
+ writeFileSync(temp, `${JSON.stringify(next, null, 2)}\n`, { encoding: "utf8", mode: 0o600, flag: "wx" });
93
+ renameSync(temp, this.file);
94
+ this.state = next;
95
+ return this.snapshot();
96
+ }
97
+ }
98
+ export function parseUpstream(input) {
99
+ return UpstreamSchema.parse({ ...input, id: randomUUID() });
100
+ }
101
+ export function parseScope(input, id = randomUUID()) {
102
+ return ScopeRecordSchema.parse({ ...input, id, updatedAt: new Date().toISOString() });
103
+ }
104
+ export function activeScope(state) {
105
+ return state.scopes.find((item) => item.id === state.activeScopeId);
106
+ }
107
+ export function permitsUpstream(scope, upstream) {
108
+ if (!upstream.enabled)
109
+ return false;
110
+ if (upstream.transport === "stdio")
111
+ return true;
112
+ let url;
113
+ try {
114
+ url = new URL(upstream.url);
115
+ }
116
+ catch {
117
+ return false;
118
+ }
119
+ if (scope.profile === "connected")
120
+ return url.protocol === "https:" || url.protocol === "http:";
121
+ if (scope.profile === "isolated") {
122
+ return url.protocol === "http:" && ["127.0.0.1", "[::1]", "localhost"].includes(url.hostname);
123
+ }
124
+ return scope.allowedHosts.includes(url.hostname) && (url.protocol === "https:" || url.protocol === "http:");
125
+ }
126
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sourceRoot":"","sources":["../../../src/gateway/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;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AAE,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAkB,EAAE,QAAkB;IACpE,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,QAAQ,CAAC,SAAS,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IAChD,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QAAC,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAI,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,KAAK,WAAW;QAAE,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC;IAChG,IAAI,KAAK,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAChG,CAAC;IACD,OAAO,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;AAC9G,CAAC"}
@@ -4,5 +4,5 @@ export { loadManifest } from "./manifest.js";
4
4
  export { loadConfig } from "./config.js";
5
5
  export { AuditLogger } from "./audit/index.js";
6
6
  export type { ScopeManifest, AuditEntry, ValidationResult, Decision } from "./types.js";
7
- export declare const VERSION = "0.2.6";
7
+ export declare const VERSION = "0.3.0";
8
8
  //# sourceMappingURL=index.d.ts.map
package/dist/src/index.js CHANGED
@@ -3,5 +3,5 @@ export { ScopeValidator } from "./validator.js";
3
3
  export { loadManifest } from "./manifest.js";
4
4
  export { loadConfig } from "./config.js";
5
5
  export { AuditLogger } from "./audit/index.js";
6
- export const VERSION = "0.2.6";
6
+ export const VERSION = "0.3.0";
7
7
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { ScopeManifest } from "./types.js";
1
+ import type { ScopeManifest, AuditEntry } from "./types.js";
2
2
  import { AuditLogger } from "./audit/index.js";
3
3
  import type { ProxyConfig } from "./config.js";
4
4
  export interface HandleResult {
@@ -8,6 +8,7 @@ export interface HandleResult {
8
8
  response?: unknown;
9
9
  }
10
10
  export declare class ScopeEnforcementProxy {
11
+ private readonly requiredAuditSink?;
11
12
  private validator;
12
13
  private auditLogger;
13
14
  private manifest;
@@ -15,9 +16,9 @@ export declare class ScopeEnforcementProxy {
15
16
  private serverName;
16
17
  setServerName(name: string): void;
17
18
  getServerName(): string | undefined;
18
- constructor(manifest: ScopeManifest, config: ProxyConfig);
19
+ constructor(manifest: ScopeManifest, config: ProxyConfig, requiredAuditSink?: ((entry: AuditEntry) => Promise<void>) | undefined);
19
20
  getAuditLogger(): AuditLogger;
20
- handleMessage(message: unknown): Promise<HandleResult>;
21
+ handleMessage(message: unknown, actor?: string): Promise<HandleResult>;
21
22
  /**
22
23
  * Build a JSON-RPC parse-error response for input the proxy could not parse.
23
24
  * Unparseable input is never forwarded: a more lenient upstream parser could
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgC,MAAM,YAAY,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAA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,OAAO,CAAC,UAAU,CAAqB;IAEvC,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IACjC,aAAa,IAAI,MAAM,GAAG,SAAS;gBAEvB,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAmB,iBAAiB,CAAC,GAAE,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,aAAA;IAWnI,cAAc,IAAI,WAAW;IAEvB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAoB5E;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,IAAI,OAAO;YAYtB,WAAW;IA2BzB;;;OAGG;YACW,aAAa;CAmE5B"}
package/dist/src/proxy.js CHANGED
@@ -5,6 +5,7 @@ import { DnsResolver } from "./dns-resolver.js";
5
5
  import { TechniqueChecker, loadTechniqueMappings } from "./technique-checker.js";
6
6
  const SCOPE_VIOLATION_CODE = -32001;
7
7
  export class ScopeEnforcementProxy {
8
+ requiredAuditSink;
8
9
  validator;
9
10
  auditLogger;
10
11
  manifest;
@@ -12,7 +13,8 @@ export class ScopeEnforcementProxy {
12
13
  serverName;
13
14
  setServerName(name) { this.serverName = name; }
14
15
  getServerName() { return this.serverName; }
15
- constructor(manifest, config) {
16
+ constructor(manifest, config, requiredAuditSink) {
17
+ this.requiredAuditSink = requiredAuditSink;
16
18
  this.manifest = manifest;
17
19
  this.config = config;
18
20
  const dnsResolver = new DnsResolver(config.dnsCacheTtl);
@@ -21,18 +23,18 @@ export class ScopeEnforcementProxy {
21
23
  this.auditLogger = new AuditLogger(config.auditLogPath);
22
24
  }
23
25
  getAuditLogger() { return this.auditLogger; }
24
- async handleMessage(message) {
26
+ async handleMessage(message, actor) {
25
27
  // JSON-RPC batch: every tools/call inside must pass. If any element is
26
28
  // blocked the whole batch is rejected so that the agent gets exactly one
27
29
  // response array and nothing out of scope reaches the upstream.
28
30
  if (Array.isArray(message)) {
29
- return this.handleBatch(message);
31
+ return this.handleBatch(message, actor);
30
32
  }
31
33
  // Only intercept tools/call requests
32
34
  if (!isToolCallRequest(message)) {
33
35
  return { forward: true };
34
36
  }
35
- const { decision, error } = await this.checkToolCall(message);
37
+ const { decision, error } = await this.checkToolCall(message, actor);
36
38
  if (decision.startsWith("BLOCKED")) {
37
39
  return { forward: false, response: errorResponse(message.id, error) };
38
40
  }
@@ -53,12 +55,12 @@ export class ScopeEnforcementProxy {
53
55
  // ---------------------------------------------------------------------------
54
56
  // Internals
55
57
  // ---------------------------------------------------------------------------
56
- async handleBatch(batch) {
58
+ async handleBatch(batch, actor) {
57
59
  const toolCalls = batch.filter(isToolCallRequest);
58
60
  if (toolCalls.length === 0) {
59
61
  return { forward: true };
60
62
  }
61
- const checks = await Promise.all(toolCalls.map(async (call) => ({ call, ...(await this.checkToolCall(call)) })));
63
+ const checks = await Promise.all(toolCalls.map(async (call) => ({ call, ...(await this.checkToolCall(call, actor)) })));
62
64
  const blocked = checks.filter((c) => c.decision.startsWith("BLOCKED"));
63
65
  if (blocked.length === 0) {
64
66
  return { forward: true };
@@ -79,7 +81,7 @@ export class ScopeEnforcementProxy {
79
81
  * Validate one tools/call request and write its audit entry. Never throws:
80
82
  * any internal error becomes BLOCKED_INTERNAL_ERROR (fail closed).
81
83
  */
82
- async checkToolCall(message) {
84
+ async checkToolCall(message, actor) {
83
85
  const params = isObject(message.params) ? message.params : {};
84
86
  const toolName = params.name;
85
87
  const rawArgs = params.arguments;
@@ -113,7 +115,18 @@ export class ScopeEnforcementProxy {
113
115
  duration_ms: result.durationMs,
114
116
  proxy_version: this.config.proxyVersion,
115
117
  server_name: this.serverName,
118
+ actor,
116
119
  };
120
+ if (this.requiredAuditSink) {
121
+ try {
122
+ await this.requiredAuditSink(entry);
123
+ }
124
+ catch (err) {
125
+ entry.decision = "BLOCKED_INTERNAL_ERROR";
126
+ entry.decision_reason = "Required durable audit storage is unavailable; tool call blocked.";
127
+ console.error("[gateway] Required audit sink failed:", err);
128
+ }
129
+ }
117
130
  // Write the local audit entry before the call is forwarded so decisions
118
131
  // survive an abrupt kill. Logging failures never block the decision.
119
132
  try {
@@ -124,8 +137,8 @@ export class ScopeEnforcementProxy {
124
137
  console.error(`[integsec-agentic-pentest-proxy] Failed to log audit entry: ${err instanceof Error ? err.message : String(err)}`);
125
138
  }
126
139
  return {
127
- decision: result.decision,
128
- error: `SCOPE_VIOLATION: ${result.reason} Decision: ${result.decision}.`,
140
+ decision: entry.decision,
141
+ error: `SCOPE_VIOLATION: ${entry.decision_reason} Decision: ${entry.decision}.`,
129
142
  };
130
143
  }
131
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAUjF,MAAM,oBAAoB,GAAG,CAAC,KAAK,CAAC;AAEpC,MAAM,OAAO,qBAAqB;IACxB,SAAS,CAAiB;IAC1B,WAAW,CAAc;IACzB,QAAQ,CAAgB;IACxB,MAAM,CAAc;IACpB,UAAU,CAAqB;IAEvC,aAAa,CAAC,IAAY,IAAU,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC;IAC7D,aAAa,KAAyB,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAE/D,YAAY,QAAuB,EAAE,MAAmB;QACtD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,M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KAAK,YAAY,CAAC;AACtD,CAAC;AAED,+EAA+E;AAC/E,SAAS,SAAS,CAAC,GAAY;IAC7B,OAAO,QAAQ,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,IAAI,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC;AACpG,CAAC;AAED,SAAS,aAAa,CAAC,EAAW,EAAE,OAAe;IACjD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,EAAE,IAAI,IAAI;QACd,KAAK,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE;KAC/C,CAAC;AACJ,CAAC"}
@@ -22,6 +22,8 @@ export interface AuditEntry {
22
22
  duration_ms: number;
23
23
  proxy_version: string;
24
24
  server_name?: string;
25
+ /** Verified remote identity subject, when a gateway authenticated the caller. */
26
+ actor?: string;
25
27
  }
26
28
  export interface ScopeManifest {
27
29
  engagement_id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,yBAAyB,GACzB,sBAAsB,GACtB,wBAAwB,GACxB,mBAAmB,GACnB,oBAAoB,GACpB,uBAAuB,GACvB,yBAAyB,GACzB,+BAA+B,GAC/B,wBAAwB,GACxB,mBAAmB,CAAC;AAExB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EA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,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH"}
@@ -0,0 +1,90 @@
1
+ # Managed MCP gateway
2
+
3
+ The gateway combines several MCP servers behind one `/mcp` endpoint. Its browser page at `/admin` lets an administrator add, disable, or remove servers and save engagement scopes as drafts before activating one. Every `tools/call` passes through the existing scope validator and local JSONL audit log. Tool names are prefixed with the configured server name, such as `burp__scan`.
4
+
5
+ This is a new mode. The original per-tool stdio, SSE, and HTTP proxy commands remain available.
6
+
7
+ ## Start on a tester laptop
8
+
9
+ Install Node.js 22 or newer and the package. Generate an admin token locally; keep it out of chat, tickets, and repository files.
10
+
11
+ ```powershell
12
+ npm install -g @integsec/agentic-pentest-proxy
13
+ $env:GATEWAY_ADMIN_TOKEN = node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('hex'))"
14
+ integsec-agentic-pentest-gateway
15
+ ```
16
+
17
+ Open `http://127.0.0.1:9091/admin`, enter the token, and add an MCP server. For a Burp MCP listener, choose **SSE** and enter its actual local URL, such as `http://127.0.0.1:9876/sse`. For a process-based tool, choose **Local process**, then enter its executable and arguments. Use a short server name such as `burp`.
18
+
19
+ Fill the scope editor with engagement targets, exclusions, techniques, and dates. Save a draft, review the values, then select **Activate**. The active scope is immutable; loading and saving it creates a new draft. Only one scope is active per gateway instance. Set `GATEWAY_STATE_PATH` to choose another state file, and `AUDIT_LOG_PATH` for the audit directory. Back up both locations.
20
+
21
+ The gateway binds to loopback by default. Other local software can reach its MCP endpoint; the admin API requires the separate token. Use an OS firewall or isolated container for stronger local separation.
22
+
23
+ ## Connect MCP clients
24
+
25
+ | Client | Laptop Burp path | Hosted team path |
26
+ | --- | --- | --- |
27
+ | Claude Desktop | Add the local stdio bridge below. | Team owner adds `https://agentic-proxy.pentestprepper.com/mcp` as a custom Web connector; members sign in. |
28
+ | ChatGPT | Create a Secure MCP Tunnel to the local gateway `/mcp` URL. | Create a custom MCP plugin using the public `/mcp` URL and OAuth. |
29
+ | Open WebUI | Add `http://127.0.0.1:9091/mcp` as a native Streamable HTTP MCP server. | Use the public URL only for connected or restricted scopes. |
30
+
31
+ Claude Desktop local configuration (use the actual command location found by `where.exe integsec-agentic-pentest-bridge` if it is not on `PATH`):
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "pentest-local": {
37
+ "command": "integsec-agentic-pentest-bridge",
38
+ "args": ["http://127.0.0.1:9091/mcp"]
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ The local bridge only accepts a loopback HTTP URL. The hosted Claude Team connector runs from Anthropic infrastructure and cannot reach a tester's local Burp listener. Keep a local connector for Burp even when the team also uses the hosted connector. ChatGPT's [Secure MCP Tunnel](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels) provides the private laptop route for ChatGPT.
45
+
46
+ Claude Team owners configure custom connectors in [Organization settings → Connectors](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp). ChatGPT Business or Enterprise owners create a [custom MCP server plugin](https://developers.openai.com/api/docs/guides/custom-mcp-server) in the workspace and publish it after testing. Refresh the tool list in each client after gateway changes if the client does not refresh it automatically.
47
+
48
+ ## Execution profiles and local models
49
+
50
+ Choose a profile on each scope draft:
51
+
52
+ | Profile | Gateway MCP upstream rule | Intended model path |
53
+ | --- | --- | --- |
54
+ | Isolated | Local process or loopback HTTP/SSE only. Public MCP access is denied. | Local Ollama, vLLM, or NIM with no outbound access. |
55
+ | Restricted | Local processes and HTTP/SSE hosts on the scope's allowed-host list. | Local model with approved network exceptions. |
56
+ | Connected | Enabled MCP upstreams may use HTTP or HTTPS. | Local or cloud model under the engagement's data policy. |
57
+
58
+ The gateway controls its MCP upstream connections. It does **not** control model runtime egress or an MCP process that makes its own network connections. For an air-gapped engagement, pre-download model artifacts and apply host or container network rules to Ollama, vLLM, NVIDIA NIM, Open WebUI, and the MCP processes. Do not connect an isolated scope to the hosted gateway or a cloud model.
59
+
60
+ Use [Open WebUI's native MCP support](https://docs.openwebui.com/features/extensibility/mcp/) as the chat interface. Point its MCP connection at the local gateway and connect its model provider to one of these local OpenAI-compatible endpoints (adjust port and model name to your actual runtime):
61
+
62
+ | Runtime | Example local model API | Reference |
63
+ | --- | --- | --- |
64
+ | Ollama (Meta Llama) | `http://127.0.0.1:11434/v1` | [Ollama OpenAI compatibility](https://docs.ollama.com/api/openai-compatibility) |
65
+ | vLLM (Meta Llama or compatible NVIDIA model) | `http://127.0.0.1:8000/v1` | [vLLM tool calling](https://docs.vllm.ai/en/latest/features/tool_calling/) |
66
+ | NVIDIA NIM | `http://127.0.0.1:8000/v1` | [NIM tool calling and MCP](https://docs.nvidia.com/nim/large-language-models/latest/advanced-use-cases/tool-calling-and-mcp.html) |
67
+
68
+ Open WebUI routes model tool calls to the gateway. NIM, vLLM, and Ollama are model servers; they do not directly become MCP clients just by pointing at `/mcp`. Verify each selected model's tool-call behavior before using it in a real engagement.
69
+
70
+ ## Host the team gateway entirely on Cloudflare
71
+
72
+ The [`cloudflare/` deployment](../cloudflare/wrangler.jsonc) runs the gateway in a Cloudflare Container. Its paired Durable Object stores scope configuration and audit entries in persistent SQLite-backed storage. The container's filesystem is temporary: the Worker restores configuration when it starts, persists each admin change before returning success, and receives every audit decision before the gateway forwards a tool call. If durable audit storage is unavailable, the call is blocked. Cloudflare's [container lifecycle](https://developers.cloudflare.com/containers/faq/) and [Durable Object storage](https://developers.cloudflare.com/containers/api/container-class/) explain this split.
73
+
74
+ 1. Ensure `pentestprepper.com` is an active Cloudflare zone and the account has Workers Paid with Containers enabled. The Worker uses a [Custom Domain](https://developers.cloudflare.com/workers/configuration/routing/custom-domains/) at `agentic-proxy.pentestprepper.com`; Cloudflare creates its DNS and certificate. The hostname must not already have a conflicting DNS record.
75
+ 2. In Cloudflare Zero Trust, connect **Microsoft Entra ID** for `integsec.com`. Create a policy restricted to the pentest team. Create an Access **MCP server application** covering the entire hostname, including `/admin` and `/api`, then enable [Managed OAuth](https://developers.cloudflare.com/cloudflare-one/access-controls/applications/http-apps/managed-oauth/). Copy the Cloudflare One team domain and Application Audience (AUD) tag.
76
+ 3. Publish version `0.3.0` of the container to Docker Hub. From `cloudflare/`, run `npm ci` and authenticate Wrangler to the correct Cloudflare account. Set the five Worker secrets below with `npx wrangler secret put NAME`; enter each value in your terminal and do not commit it.
77
+ 4. Set `AUDIT_WEBHOOK_URL` to `https://agentic-pentest-gateway.YOUR_WORKERS_SUBDOMAIN.workers.dev/__internal/audit`. The Worker accepts that path only with `INTERNAL_TOKEN`; other paths on `workers.dev` are denied. `GATEWAY_ADMIN_TOKEN` and `INTERNAL_TOKEN` must be independent random strings of at least 32 characters.
78
+ 5. Run `npm run check` and `npm run deploy` from `cloudflare/`. Visit `https://agentic-proxy.pentestprepper.com/admin`, complete Entra sign-in through Access, enter the admin token, and activate a restricted or connected scope. Verify Claude and ChatGPT OAuth connection before publishing to the team.
79
+
80
+ ```text
81
+ CLOUDFLARE_TEAM_DOMAIN=https://YOUR_TEAM.cloudflareaccess.com
82
+ CLOUDFLARE_ACCESS_AUD=YOUR_ACCESS_APPLICATION_AUD
83
+ GATEWAY_ADMIN_TOKEN=YOUR_RANDOM_ADMIN_TOKEN
84
+ INTERNAL_TOKEN=YOUR_DIFFERENT_RANDOM_INTERNAL_TOKEN
85
+ AUDIT_WEBHOOK_URL=https://agentic-pentest-gateway.YOUR_WORKERS_SUBDOMAIN.workers.dev/__internal/audit
86
+ ```
87
+
88
+ The Worker passes these values to the container at startup. The gateway verifies the signed [`Cf-Access-Jwt-Assertion`](https://developers.cloudflare.com/cloudflare-one/access-controls/applications/http-apps/authorization-cookie/validating-json/) on MCP and admin API requests. The admin API also requires the separate admin token. The latest 100 durable audit entries can be retrieved at `/api/audit` with both Access sign-in and the admin token. The local TUI reads local JSONL files; it does not yet stream Cloudflare audit entries.
89
+
90
+ The hosted container cannot launch Burp on a tester laptop. Each tester runs the local gateway and connects Claude Desktop through the bridge or ChatGPT through a Secure MCP Tunnel. The isolated profile is refused on the public gateway. For a non-Cloudflare host, direct Entra token validation remains available with `GATEWAY_PUBLIC_URL`, `ENTRA_TENANT=integsec.com`, `ENTRA_AUDIENCE`, and `ENTRA_SCOPE`; client OAuth compatibility needs separate testing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integsec/agentic-pentest-proxy",
3
- "version": "0.2.9",
3
+ "version": "0.3.0",
4
4
  "description": "IntegSec Agentic Pentest MCP Proxy — enforce penetration testing engagement scope for AI agents",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,10 +12,17 @@
12
12
  "integsec-agentic-pentest-proxy": "dist/bin/integsec-agentic-pentest-proxy.js",
13
13
  "integsec-agentic-pentest-setup": "dist/bin/integsec-agentic-pentest-setup.js",
14
14
  "integsec-agentic-pentest-tui": "dist/bin/integsec-agentic-pentest-tui.js",
15
- "integsec-agentic-pentest-manifest": "dist/bin/integsec-agentic-pentest-manifest.js"
15
+ "integsec-agentic-pentest-manifest": "dist/bin/integsec-agentic-pentest-manifest.js",
16
+ "integsec-agentic-pentest-gateway": "dist/bin/integsec-agentic-pentest-gateway.js",
17
+ "integsec-agentic-pentest-bridge": "dist/bin/integsec-agentic-pentest-bridge.js"
16
18
  },
17
19
  "files": [
18
20
  "dist/",
21
+ "cloudflare/wrangler.jsonc",
22
+ "cloudflare/src/worker.mjs",
23
+ "cloudflare/package.json",
24
+ "cloudflare/package-lock.json",
25
+ "docs/managed-gateway.md",
19
26
  "examples/",
20
27
  "scripts/postinstall.cjs",
21
28
  "README.md",
@@ -24,7 +31,7 @@
24
31
  "main": "./dist/src/index.js",
25
32
  "types": "./dist/src/index.d.ts",
26
33
  "scripts": {
27
- "build": "tsc && node -e \"const fs=require('fs'),path=require('path');const src='src/builder/web/client-form.html',dst='dist/src/builder/web/client-form.html';fs.mkdirSync(path.dirname(dst),{recursive:true});fs.copyFileSync(src,dst);console.log('Copied',src,'->',dst);\"",
34
+ "build": "tsc && node scripts/copy-assets.cjs",
28
35
  "dev": "tsc --watch",
29
36
  "test": "vitest run",
30
37
  "test:watch": "vitest",
@@ -53,6 +60,7 @@
53
60
  "ink": "^5.2.1",
54
61
  "ink-spinner": "^5.0.0",
55
62
  "ipaddr.js": "^2.5.0",
63
+ "jose": "^6.2.15",
56
64
  "react": "^18.3.1",
57
65
  "zod": "^4.6.7"
58
66
  },