@orygn/opa-mcp 0.3.0 → 0.5.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 (157) hide show
  1. package/CHANGELOG.md +396 -3
  2. package/README.md +132 -98
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +8 -3
  5. package/dist/cli.js.map +1 -1
  6. package/dist/config.d.ts +15 -3
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +74 -14
  9. package/dist/config.js.map +1 -1
  10. package/dist/constants.d.ts +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/lib/bundle-signatures.d.ts +23 -0
  13. package/dist/lib/bundle-signatures.d.ts.map +1 -0
  14. package/dist/lib/bundle-signatures.js +152 -0
  15. package/dist/lib/bundle-signatures.js.map +1 -0
  16. package/dist/lib/child-env.d.ts +41 -0
  17. package/dist/lib/child-env.d.ts.map +1 -0
  18. package/dist/lib/child-env.js +176 -0
  19. package/dist/lib/child-env.js.map +1 -0
  20. package/dist/lib/conftest-cli.d.ts +25 -10
  21. package/dist/lib/conftest-cli.d.ts.map +1 -1
  22. package/dist/lib/conftest-cli.js +153 -33
  23. package/dist/lib/conftest-cli.js.map +1 -1
  24. package/dist/lib/install-id.d.ts.map +1 -1
  25. package/dist/lib/install-id.js +18 -3
  26. package/dist/lib/install-id.js.map +1 -1
  27. package/dist/lib/json-stream.d.ts +26 -0
  28. package/dist/lib/json-stream.d.ts.map +1 -0
  29. package/dist/lib/json-stream.js +69 -0
  30. package/dist/lib/json-stream.js.map +1 -0
  31. package/dist/lib/opa-cli.d.ts +64 -16
  32. package/dist/lib/opa-cli.d.ts.map +1 -1
  33. package/dist/lib/opa-cli.js +99 -28
  34. package/dist/lib/opa-cli.js.map +1 -1
  35. package/dist/lib/opa-paths.d.ts +24 -0
  36. package/dist/lib/opa-paths.d.ts.map +1 -0
  37. package/dist/lib/opa-paths.js +97 -0
  38. package/dist/lib/opa-paths.js.map +1 -0
  39. package/dist/lib/regal-cli.d.ts +16 -1
  40. package/dist/lib/regal-cli.d.ts.map +1 -1
  41. package/dist/lib/regal-cli.js +41 -6
  42. package/dist/lib/regal-cli.js.map +1 -1
  43. package/dist/lib/rego-ast-walker.d.ts.map +1 -1
  44. package/dist/lib/rego-ast-walker.js +141 -17
  45. package/dist/lib/rego-ast-walker.js.map +1 -1
  46. package/dist/lib/rego-counterexample.d.ts +1 -1
  47. package/dist/lib/rego-counterexample.d.ts.map +1 -1
  48. package/dist/lib/rego-counterexample.js +23 -5
  49. package/dist/lib/rego-counterexample.js.map +1 -1
  50. package/dist/lib/rego-ir.d.ts +32 -2
  51. package/dist/lib/rego-ir.d.ts.map +1 -1
  52. package/dist/lib/rego-smt-encoder.d.ts +53 -5
  53. package/dist/lib/rego-smt-encoder.d.ts.map +1 -1
  54. package/dist/lib/rego-smt-encoder.js +192 -26
  55. package/dist/lib/rego-smt-encoder.js.map +1 -1
  56. package/dist/lib/rego-type-inferencer.d.ts +1 -1
  57. package/dist/lib/rego-type-inferencer.d.ts.map +1 -1
  58. package/dist/lib/rego-type-inferencer.js +3 -3
  59. package/dist/lib/rego-type-inferencer.js.map +1 -1
  60. package/dist/lib/rego-verify-engine.d.ts.map +1 -1
  61. package/dist/lib/rego-verify-engine.js +109 -77
  62. package/dist/lib/rego-verify-engine.js.map +1 -1
  63. package/dist/lib/rego-z3.d.ts +10 -0
  64. package/dist/lib/rego-z3.d.ts.map +1 -1
  65. package/dist/lib/rego-z3.js +38 -0
  66. package/dist/lib/rego-z3.js.map +1 -1
  67. package/dist/lib/security.d.ts +8 -0
  68. package/dist/lib/security.d.ts.map +1 -1
  69. package/dist/lib/security.js +130 -54
  70. package/dist/lib/security.js.map +1 -1
  71. package/dist/lib/subprocess.d.ts +36 -3
  72. package/dist/lib/subprocess.d.ts.map +1 -1
  73. package/dist/lib/subprocess.js +121 -20
  74. package/dist/lib/subprocess.js.map +1 -1
  75. package/dist/lib/tool-helpers.d.ts.map +1 -1
  76. package/dist/lib/tool-helpers.js +10 -0
  77. package/dist/lib/tool-helpers.js.map +1 -1
  78. package/dist/resources/patterns.d.ts +1 -1
  79. package/dist/resources/patterns.d.ts.map +1 -1
  80. package/dist/resources/patterns.js +40 -12
  81. package/dist/resources/patterns.js.map +1 -1
  82. package/dist/server.d.ts.map +1 -1
  83. package/dist/server.js +10 -2
  84. package/dist/server.js.map +1 -1
  85. package/dist/tools/authoring/check-schema.js +1 -1
  86. package/dist/tools/authoring/check-schema.js.map +1 -1
  87. package/dist/tools/bundles/build.d.ts.map +1 -1
  88. package/dist/tools/bundles/build.js +12 -4
  89. package/dist/tools/bundles/build.js.map +1 -1
  90. package/dist/tools/bundles/sign.d.ts +9 -2
  91. package/dist/tools/bundles/sign.d.ts.map +1 -1
  92. package/dist/tools/bundles/sign.js +145 -19
  93. package/dist/tools/bundles/sign.js.map +1 -1
  94. package/dist/tools/bundles/verify.d.ts +1 -1
  95. package/dist/tools/bundles/verify.d.ts.map +1 -1
  96. package/dist/tools/bundles/verify.js +58 -19
  97. package/dist/tools/bundles/verify.js.map +1 -1
  98. package/dist/tools/conftest/pull.d.ts.map +1 -1
  99. package/dist/tools/conftest/pull.js +24 -10
  100. package/dist/tools/conftest/pull.js.map +1 -1
  101. package/dist/tools/conftest/push.d.ts.map +1 -1
  102. package/dist/tools/conftest/push.js +17 -7
  103. package/dist/tools/conftest/push.js.map +1 -1
  104. package/dist/tools/conftest/test.d.ts +10 -6
  105. package/dist/tools/conftest/test.d.ts.map +1 -1
  106. package/dist/tools/conftest/test.js +47 -24
  107. package/dist/tools/conftest/test.js.map +1 -1
  108. package/dist/tools/conftest/verify.d.ts +10 -6
  109. package/dist/tools/conftest/verify.d.ts.map +1 -1
  110. package/dist/tools/conftest/verify.js +30 -18
  111. package/dist/tools/conftest/verify.js.map +1 -1
  112. package/dist/tools/evaluation/bench.d.ts +16 -0
  113. package/dist/tools/evaluation/bench.d.ts.map +1 -1
  114. package/dist/tools/evaluation/bench.js +30 -5
  115. package/dist/tools/evaluation/bench.js.map +1 -1
  116. package/dist/tools/evaluation/exec.d.ts +16 -0
  117. package/dist/tools/evaluation/exec.d.ts.map +1 -1
  118. package/dist/tools/evaluation/exec.js +35 -2
  119. package/dist/tools/evaluation/exec.js.map +1 -1
  120. package/dist/tools/evaluation/test-multiroot.d.ts +4 -0
  121. package/dist/tools/evaluation/test-multiroot.d.ts.map +1 -1
  122. package/dist/tools/evaluation/test-multiroot.js +21 -14
  123. package/dist/tools/evaluation/test-multiroot.js.map +1 -1
  124. package/dist/tools/evaluation/test.d.ts +45 -0
  125. package/dist/tools/evaluation/test.d.ts.map +1 -1
  126. package/dist/tools/evaluation/test.js +146 -27
  127. package/dist/tools/evaluation/test.js.map +1 -1
  128. package/dist/tools/helpers/coverage-gaps.d.ts +11 -3
  129. package/dist/tools/helpers/coverage-gaps.d.ts.map +1 -1
  130. package/dist/tools/helpers/coverage-gaps.js +4 -3
  131. package/dist/tools/helpers/coverage-gaps.js.map +1 -1
  132. package/dist/tools/helpers/explain-undefined.d.ts +9 -3
  133. package/dist/tools/helpers/explain-undefined.d.ts.map +1 -1
  134. package/dist/tools/helpers/explain-undefined.js +83 -51
  135. package/dist/tools/helpers/explain-undefined.js.map +1 -1
  136. package/dist/tools/helpers/verify.d.ts.map +1 -1
  137. package/dist/tools/helpers/verify.js +5 -1
  138. package/dist/tools/helpers/verify.js.map +1 -1
  139. package/dist/tools/server-management/_shared.d.ts +15 -4
  140. package/dist/tools/server-management/_shared.d.ts.map +1 -1
  141. package/dist/tools/server-management/_shared.js +73 -12
  142. package/dist/tools/server-management/_shared.js.map +1 -1
  143. package/dist/tools/server-management/data.d.ts.map +1 -1
  144. package/dist/tools/server-management/data.js +88 -23
  145. package/dist/tools/server-management/data.js.map +1 -1
  146. package/dist/tools/server-management/decisions.d.ts.map +1 -1
  147. package/dist/tools/server-management/decisions.js +16 -3
  148. package/dist/tools/server-management/decisions.js.map +1 -1
  149. package/dist/tools/server-management/policies.d.ts.map +1 -1
  150. package/dist/tools/server-management/policies.js +44 -7
  151. package/dist/tools/server-management/policies.js.map +1 -1
  152. package/dist/tools/server-management/status.d.ts.map +1 -1
  153. package/dist/tools/server-management/status.js +80 -13
  154. package/dist/tools/server-management/status.js.map +1 -1
  155. package/dist/types.d.ts +10 -1
  156. package/dist/types.d.ts.map +1 -1
  157. package/package.json +2 -1
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Per-stream capture ceiling.
3
+ *
4
+ * Two independent reasons this has to exist. A `Buffer` can hold far more than
5
+ * a string can, so `Buffer.concat(...).toString('utf8')` throws once the capture
6
+ * passes V8's max string length (536,870,888 bytes on Node 24) -- and it throws
7
+ * inside an async 'close' handler, where nothing upstream can catch it. And well
8
+ * before that limit the pipeline copies the payload several times over (chunks,
9
+ * string, parsed object, sanitized clone), so a large capture costs multiples of
10
+ * its own size in resident memory.
11
+ *
12
+ * 32 MiB sits far above what any of the wrapped commands produce in normal use
13
+ * and far below the point where either problem bites. Override with
14
+ * OPA_MCP_MAX_SUBPROCESS_BYTES.
15
+ */
16
+ export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
1
17
  export interface SpawnOptions {
2
18
  /** Argument vector passed directly to the binary. */
3
19
  args: string[];
@@ -7,10 +23,21 @@ export interface SpawnOptions {
7
23
  cwd?: string;
8
24
  /** Hard timeout in milliseconds. */
9
25
  timeoutMs: number;
10
- /** Extra environment variables to merge into process.env. */
26
+ /**
27
+ * Extra environment variables for the child, merged over the minimal base
28
+ * environment. The child never inherits the server's own `process.env`: a
29
+ * policy can read its interpreter's environment through `opa.runtime().env`,
30
+ * so anything passed here is readable by evaluated Rego. Pass secrets only
31
+ * when the command genuinely needs them.
32
+ */
11
33
  env?: Record<string, string>;
12
34
  /** External cancellation signal from the MCP client. */
13
35
  signal?: AbortSignal;
36
+ /**
37
+ * Maximum bytes to capture from stdout and from stderr, each counted
38
+ * separately. On overflow the stream is clamped and the child is killed.
39
+ */
40
+ maxOutputBytes?: number;
14
41
  }
15
42
  export interface SpawnResult {
16
43
  exitCode: number | null;
@@ -21,10 +48,16 @@ export interface SpawnResult {
21
48
  aborted: boolean;
22
49
  /** Time spent in milliseconds. */
23
50
  durationMs: number;
51
+ /**
52
+ * True when either stream hit `maxOutputBytes` and the child was killed.
53
+ * Optional so the many hand-built SpawnResult fixtures in the test suite stay
54
+ * valid; absent means "not truncated".
55
+ */
56
+ outputTruncated?: boolean;
24
57
  }
25
58
  /**
26
- * Run a binary and return its captured output. Never throws -- failures
27
- * are reflected in `exitCode` / `timedOut`.
59
+ * Run a binary and return its captured output. Never throws -- failures are
60
+ * reflected in `exitCode` / `timedOut` / `outputTruncated`.
28
61
  */
29
62
  export declare function runBinary(binary: string, opts: SpawnOptions): Promise<SpawnResult>;
30
63
  //# sourceMappingURL=subprocess.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subprocess.d.ts","sourceRoot":"","sources":["../../src/lib/subprocess.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,wDAAwD;IACxD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA0FxF"}
1
+ {"version":3,"file":"subprocess.d.ts","sourceRoot":"","sources":["../../src/lib/subprocess.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,wBAAwB,QAAmB,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,wDAAwD;IACxD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,mEAAmE;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AA6CD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAmIxF"}
@@ -1,15 +1,73 @@
1
1
  /**
2
- * Subprocess wrapper used by `opa-cli.ts` and `regal-cli.ts`.
2
+ * Subprocess wrapper used by `opa-cli.ts`, `regal-cli.ts` and `conftest-cli.ts`.
3
3
  *
4
4
  * - Uses argv arrays only (never shell strings) -- prevents injection.
5
5
  * - Hard timeout per invocation, defaulting to config.subprocessTimeoutMs.
6
- * - Captures stdout / stderr / exit code separately.
6
+ * - Captures stdout / stderr / exit code separately, each capped in bytes.
7
+ * - Passes a minimal environment to the child, never the server's own.
7
8
  * - Optional stdin payload for piping source code.
8
9
  */
9
10
  import { spawn } from 'node:child_process';
11
+ import { buildChildEnv } from './child-env.js';
10
12
  /**
11
- * Run a binary and return its captured output. Never throws -- failures
12
- * are reflected in `exitCode` / `timedOut`.
13
+ * Per-stream capture ceiling.
14
+ *
15
+ * Two independent reasons this has to exist. A `Buffer` can hold far more than
16
+ * a string can, so `Buffer.concat(...).toString('utf8')` throws once the capture
17
+ * passes V8's max string length (536,870,888 bytes on Node 24) -- and it throws
18
+ * inside an async 'close' handler, where nothing upstream can catch it. And well
19
+ * before that limit the pipeline copies the payload several times over (chunks,
20
+ * string, parsed object, sanitized clone), so a large capture costs multiples of
21
+ * its own size in resident memory.
22
+ *
23
+ * 32 MiB sits far above what any of the wrapped commands produce in normal use
24
+ * and far below the point where either problem bites. Override with
25
+ * OPA_MCP_MAX_SUBPROCESS_BYTES.
26
+ */
27
+ export const DEFAULT_MAX_OUTPUT_BYTES = 32 * 1024 * 1024;
28
+ /** Accumulates a stream's chunks up to a byte ceiling. */
29
+ class CappedBuffer {
30
+ limit;
31
+ chunks = [];
32
+ bytes = 0;
33
+ overflowed = false;
34
+ constructor(limit) {
35
+ this.limit = limit;
36
+ }
37
+ /** Returns true when this chunk pushed the stream past its limit. */
38
+ push(chunk) {
39
+ if (this.overflowed)
40
+ return false;
41
+ const remaining = this.limit - this.bytes;
42
+ // `<=` so output that lands exactly on the limit and then ends is a
43
+ // complete capture, not a truncated one. If more follows, the next chunk
44
+ // finds `remaining === 0` and overflows there instead.
45
+ if (chunk.length <= remaining) {
46
+ this.chunks.push(chunk);
47
+ this.bytes += chunk.length;
48
+ return false;
49
+ }
50
+ // The whole payload can arrive as a single chunk -- `opa eval --format json`
51
+ // marshals its result in memory and writes it in one burst at exit -- so the
52
+ // offending chunk has to be clamped here. A running total that only rejects
53
+ // the *next* chunk would never get a turn.
54
+ if (remaining > 0) {
55
+ this.chunks.push(chunk.subarray(0, remaining));
56
+ this.bytes += remaining;
57
+ }
58
+ this.overflowed = true;
59
+ return true;
60
+ }
61
+ get didOverflow() {
62
+ return this.overflowed;
63
+ }
64
+ toString() {
65
+ return Buffer.concat(this.chunks, this.bytes).toString('utf8');
66
+ }
67
+ }
68
+ /**
69
+ * Run a binary and return its captured output. Never throws -- failures are
70
+ * reflected in `exitCode` / `timedOut` / `outputTruncated`.
13
71
  */
14
72
  export async function runBinary(binary, opts) {
15
73
  const start = Date.now();
@@ -21,19 +79,22 @@ export async function runBinary(binary, opts) {
21
79
  timedOut: false,
22
80
  aborted: true,
23
81
  durationMs: 0,
82
+ outputTruncated: false,
24
83
  };
25
84
  }
26
85
  return await new Promise((resolvePromise) => {
27
86
  const child = spawn(binary, opts.args, {
28
87
  cwd: opts.cwd,
29
- env: opts.env ? { ...process.env, ...opts.env } : process.env,
88
+ env: buildChildEnv(opts.env),
30
89
  shell: false,
31
90
  windowsHide: true,
32
91
  });
33
- const stdoutChunks = [];
34
- const stderrChunks = [];
92
+ const limit = opts.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
93
+ const stdout = new CappedBuffer(limit);
94
+ const stderr = new CappedBuffer(limit);
35
95
  let timedOut = false;
36
96
  let aborted = false;
97
+ let settled = false;
37
98
  let killTimer;
38
99
  const killChild = () => {
39
100
  child.kill('SIGTERM');
@@ -57,29 +118,69 @@ export async function runBinary(binary, opts) {
57
118
  if (killTimer)
58
119
  clearTimeout(killTimer);
59
120
  };
60
- child.stdout?.on('data', (chunk) => stdoutChunks.push(chunk));
61
- child.stderr?.on('data', (chunk) => stderrChunks.push(chunk));
62
- child.on('error', (e) => {
121
+ /**
122
+ * Resolve at most once. 'error' and 'close' can both fire -- killing a child
123
+ * mid-write is the ordinary way to reach that -- and a second resolve would
124
+ * silently discard whichever result came second.
125
+ */
126
+ const settle = (result) => {
127
+ if (settled)
128
+ return;
129
+ settled = true;
63
130
  clearTimers();
64
- resolvePromise({
131
+ resolvePromise(result);
132
+ };
133
+ child.stdout?.on('data', (chunk) => {
134
+ if (stdout.push(chunk))
135
+ killChild();
136
+ });
137
+ child.stderr?.on('data', (chunk) => {
138
+ if (stderr.push(chunk))
139
+ killChild();
140
+ });
141
+ // Killing a child mid-write can surface an EPIPE on the pipe. Without a
142
+ // listener that is an unhandled 'error' event, which would take the whole
143
+ // server down -- the exact failure mode this cap exists to prevent.
144
+ child.stdout?.on('error', () => undefined);
145
+ child.stderr?.on('error', () => undefined);
146
+ child.stdin?.on('error', () => undefined);
147
+ child.on('error', (e) => {
148
+ settle({
65
149
  exitCode: null,
66
150
  stdout: '',
67
151
  stderr: e.message,
68
152
  timedOut: false,
69
153
  aborted,
70
154
  durationMs: Date.now() - start,
155
+ outputTruncated: false,
71
156
  });
72
157
  });
73
158
  child.on('close', (code) => {
74
- clearTimers();
75
- resolvePromise({
76
- exitCode: code,
77
- stdout: Buffer.concat(stdoutChunks).toString('utf8'),
78
- stderr: Buffer.concat(stderrChunks).toString('utf8'),
79
- timedOut,
80
- aborted,
81
- durationMs: Date.now() - start,
82
- });
159
+ // Decoding runs here, in an async callback whose throw would escape every
160
+ // try/catch upstream and reach the process as an uncaughtException. The
161
+ // byte cap is what makes that unreachable; this is the belt to its braces.
162
+ try {
163
+ settle({
164
+ exitCode: code,
165
+ stdout: stdout.toString(),
166
+ stderr: stderr.toString(),
167
+ timedOut,
168
+ aborted,
169
+ durationMs: Date.now() - start,
170
+ outputTruncated: stdout.didOverflow || stderr.didOverflow,
171
+ });
172
+ }
173
+ catch (e) {
174
+ settle({
175
+ exitCode: null,
176
+ stdout: '',
177
+ stderr: e instanceof Error ? e.message : 'failed to decode subprocess output',
178
+ timedOut,
179
+ aborted,
180
+ durationMs: Date.now() - start,
181
+ outputTruncated: true,
182
+ });
183
+ }
83
184
  });
84
185
  if (opts.stdin !== undefined) {
85
186
  child.stdin?.write(opts.stdin);
@@ -1 +1 @@
1
- {"version":3,"file":"subprocess.js","sourceRoot":"","sources":["../../src/lib/subprocess.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA4B3C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAc,EAAE,IAAkB;IAChE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,IAAI,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;QACzB,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,CAAC;SACd,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,IAAI,OAAO,CAAc,CAAC,cAAc,EAAE,EAAE;QACvD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE;YACrC,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG;YAC7D,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QAEH,MAAM,YAAY,GAAa,EAAE,CAAC;QAClC,MAAM,YAAY,GAAa,EAAE,CAAC;QAClC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,IAAI,SAAoD,CAAC;QAEzD,MAAM,SAAS,GAAG,GAAS,EAAE;YAC3B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACt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AE,OAAO,CAAA;CAAO,GACpC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAA;CAAE,CAU9E;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,EACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,aAAa,CAAC,CAgBxB"}
@@ -70,6 +70,16 @@ export function mapSubprocessFailure(result, binary) {
70
70
  details: { durationMs: result.durationMs },
71
71
  });
72
72
  }
73
+ // Like the timeout above, an over-size process is killed and so also reports a
74
+ // null exit code. Check it before the null-code branch, or a policy that
75
+ // simply produced too much output is reported as a missing binary and sends
76
+ // the user hunting for an install problem that does not exist.
77
+ if (result.outputTruncated) {
78
+ return err('OUTPUT_TOO_LARGE', `${binary} produced more output than the capture limit (OPA_MCP_MAX_SUBPROCESS_BYTES) allows, and was stopped.`, {
79
+ hint: 'Narrow the query, or drop `--explain full` in favour of a shallower explanation. Trace output grows with the square of the data iterated, so a comprehension over a large collection produces hundreds of megabytes from a small policy.',
80
+ details: { durationMs: result.durationMs },
81
+ });
82
+ }
73
83
  if (result.exitCode === null) {
74
84
  const code = binary === 'opa'
75
85
  ? 'OPA_BINARY_NOT_FOUND'
@@ -1 +1 @@
1
- {"version":3,"file":"tool-helpers.js","sourceRoot":"","sources":["../../src/lib/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,mDAAmD,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CA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;QAC7E,4EAA4E;QAC5E,qEAAqE;QACrE,mEAAmE;QACnE,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE;YACnC,OAAO;YACP,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;SAChD,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC9D,OAAO,cAAc,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC7F,CAAC;AACH,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * - A test
6
6
  * - Common pitfalls
7
7
  */
8
- export declare const PATTERNS = "# Rego pattern library\n\nCommon Rego patterns with working examples, tests, and pitfalls. Each\npattern is self-contained -- copy, adapt, and ship.\n\n---\n\n## 1. Role-based access control (RBAC)\n\n**When to use:** the simplest authorization model. Every user has one\nor more roles; each role grants a set of actions on a set of\nresources. Sufficient for ~80% of internal applications.\n\n```rego\npackage rbac\n\nimport rego.v1\n\ndefault allow := false\n\n# Permissions table -- extend as roles evolve.\npermissions := {\n \"admin\": {\"read\", \"write\", \"delete\", \"manage_users\"},\n \"editor\": {\"read\", \"write\"},\n \"viewer\": {\"read\"},\n}\n\nallow if {\n some role in input.user.roles\n input.action in permissions[role]\n}\n\n# Why was it denied? -- useful for audit logs.\ndeny_reasons contains reason if {\n not allow\n input.user\n reason := sprintf(\n \"user %q has roles %v, none grant %q\",\n [input.user.id, input.user.roles, input.action],\n )\n}\n\ndeny_reasons contains \"anonymous request\" if {\n not allow\n not input.user\n}\n```\n\n**Test:**\n\n```rego\npackage rbac_test\n\nimport rego.v1\nimport data.rbac\n\ntest_admin_can_delete if {\n rbac.allow with input as {\n \"user\": {\"id\": \"alice\", \"roles\": [\"admin\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_viewer_cannot_delete if {\n not rbac.allow with input as {\n \"user\": {\"id\": \"bob\", \"roles\": [\"viewer\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_anonymous_denied if {\n not rbac.allow with input as {\"action\": \"read\"}\n reasons := rbac.deny_reasons with input as {\"action\": \"read\"}\n \"anonymous request\" in reasons\n}\n```\n\n**Pitfalls:**\n- The `permissions` table grows unbounded. Move to data files\n (`data.permissions`) once you have more than ~20 roles.\n- Roles overlap with groups in real auth systems; map at the boundary\n rather than carrying both.\n\n---\n\n## 2. Attribute-based access control (ABAC)\n\n**When to use:** when \"who\" alone isn't enough -- decisions also depend\non resource attributes (ownership, tenant, sensitivity) and context\n(time of day, source IP).\n\n```rego\npackage abac\n\nimport rego.v1\n\ndefault allow := false\n\n# A user can read any resource they own.\nallow if {\n input.action == \"read\"\n input.resource.owner_id == input.user.id\n}\n\n# A user can read shared resources at their organization.\nallow if {\n input.action == \"read\"\n input.resource.shared\n input.resource.org_id == input.user.org_id\n}\n\n# Admins can do anything within their organization.\nallow if {\n \"admin\" in input.user.roles\n input.resource.org_id == input.user.org_id\n}\n\n# Don't show \"secret\" resources to anyone outside the owner's\n# organization, even admins.\nallow := false if {\n input.resource.classification == \"secret\"\n input.resource.org_id != input.user.org_id\n}\n```\n\n**Test:**\n\n```rego\npackage abac_test\n\nimport rego.v1\nimport data.abac\n\ntest_owner_reads_own if {\n abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\"},\n \"resource\": {\"owner_id\": \"u1\", \"org_id\": \"o1\"},\n }\n}\n\ntest_admin_blocked_from_secret_in_other_org if {\n not abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\", \"roles\": [\"admin\"]},\n \"resource\": {\n \"owner_id\": \"u2\",\n \"org_id\": \"o2\",\n \"classification\": \"secret\",\n },\n }\n}\n```\n\n**Pitfalls:**\n- Multiple `allow` rules combine with logical OR. Use explicit\n `allow := false if ...` to *override* an allow.\n- Don't compute attributes inside the policy; compute them at the\n boundary and pass via `input`.\n\n---\n\n## 3. Kubernetes admission control\n\n**When to use:** validate or mutate Kubernetes resources at admission\ntime. Run as a Gatekeeper, OPA-as-a-webhook, or Kyverno-equivalent\npolicy layer.\n\n```rego\npackage k8s.admission\n\nimport rego.v1\n\n# Reject pods without resource limits.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n container := input.request.object.spec.containers[_]\n not container.resources.limits.memory\n msg := sprintf(\n \"Pod %q container %q is missing resources.limits.memory\",\n [input.request.object.metadata.name, container.name],\n )\n}\n\n# Reject privileged containers in production.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n input.request.namespace != \"kube-system\"\n container := input.request.object.spec.containers[_]\n container.securityContext.privileged == true\n msg := sprintf(\n \"privileged containers are not allowed: %q in %q\",\n [container.name, input.request.object.metadata.name],\n )\n}\n```\n\n**Pitfalls:**\n- Use `input.request.object` for the resource being admitted; the\n envelope shape comes from Kubernetes, not your control.\n- For mutations, return a JSON Patch via the `patch` field. Test\n patches with the actual admission webhook in dry-run mode before\n enforcing.\n- Iteration order is undefined; never rely on `containers[0]` to mean\n anything specific.\n\n---\n\n## 4. Infrastructure-as-Code gates (Terraform)\n\n**When to use:** validate Terraform plans before apply. Catch overly\npermissive IAM, public S3 buckets, missing encryption.\n\n```rego\npackage terraform\n\nimport rego.v1\n\n# Reject S3 buckets without server-side encryption.\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_s3_bucket\"\n after := resource.change.after\n not after.server_side_encryption_configuration\n msg := sprintf(\n \"S3 bucket %q has no server-side encryption configured\",\n [resource.address],\n )\n}\n\n# Reject IAM policies with action \"*\" on resource \"*\".\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_iam_policy\"\n policy := json.unmarshal(resource.change.after.policy)\n statement := policy.Statement[_]\n statement.Effect == \"Allow\"\n \"*\" in statement.Action\n statement.Resource == \"*\"\n msg := sprintf(\"IAM policy %q grants Allow * on *\", [resource.address])\n}\n```\n\n**Pitfalls:**\n- Terraform plan JSON is verbose and version-specific. Pin the\n `terraform plan -json` schema you target.\n- `resource_changes[_].change.after` may be `null` for destroys --\n guard against it.\n- For wide-radius changes, use `opa exec --decision` against a plan\n file in CI, not the live API.\n\n---\n\n## 5. API authorization (HTTP request gating)\n\n**When to use:** at the API gateway / reverse proxy layer, validate\neach request against the caller's identity and the requested\nendpoint.\n\n```rego\npackage api.authz\n\nimport rego.v1\n\ndefault allow := false\n\n# Public endpoints -- no auth required.\npublic_endpoints := {\n {\"method\": \"GET\", \"path\": [\"health\"]},\n {\"method\": \"GET\", \"path\": [\"version\"]},\n}\n\nallow if {\n some endpoint in public_endpoints\n matches_endpoint(endpoint)\n}\n\n# Authenticated reads on resources the user has access to.\nallow if {\n input.method == \"GET\"\n input.user\n user_can_read(input.user, input.path)\n}\n\n# Authenticated writes only with specific scopes.\nallow if {\n input.method in {\"POST\", \"PUT\", \"PATCH\", \"DELETE\"}\n input.user\n \"write\" in input.user.scopes\n user_can_write(input.user, input.path)\n}\n\nmatches_endpoint(spec) if {\n spec.method == input.method\n spec.path == input.path\n}\n\nuser_can_read(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n\nuser_can_write(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n```\n\n**Pitfalls:**\n- `input.path` is typically an array (`[\"users\", \"alice\"]`), not a\n string. Build it consistently at the gateway.\n- Path-prefix matching is easy; full pattern matching is not. For\n parameterized routes, decode at the gateway and pass structured\n fields.\n\n---\n\n## 6. Rate limiting (with sliding window data)\n\n**When to use:** allow N requests per principal per window. Lightweight\nlimit enforcement; for high throughput, push to a dedicated rate\nlimiter.\n\n```rego\npackage rate\n\nimport rego.v1\n\n# Configuration: 100 requests per principal per 60-second window.\nlimit := 100\nwindow_seconds := 60\n\n# input.now is a unix timestamp in nanoseconds.\n# data.requests[principal] is an array of nanosecond timestamps.\n\ncurrent_window := requests if {\n requests := [t | some t in data.requests[input.principal]; t > input.now - window_seconds * 1000000000]\n}\n\n# Do not name this rule `count`: it would shadow the built-in of the same\n# name, and the call below would resolve to the rule instead.\nrequest_count := count(current_window)\n\nallow if request_count < limit\n\ndeny_reason := sprintf(\n \"rate limit exceeded: %d requests in last %d seconds (limit %d)\",\n [request_count, window_seconds, limit],\n) if not allow\n```\n\n**Pitfalls:**\n- `data.requests` grows unbounded unless the writer prunes outside the\n window. Schedule prune on every write.\n- This pattern is *advisory* -- under load, two concurrent decisions\n can both see `count == limit - 1` and both allow. For strict\n limits, use a Lua/Redis token bucket at the gateway and have OPA\n validate the token, not count requests.\n\n---\n\n## Where these patterns came from\n\nEach is distilled from production policy code. The full Rego files,\ntests, and policy data fixtures live in this server's GitHub\nrepository under `tests/fixtures/policies/`.\n\nFor more patterns, see:\n\n- OPA Playground: https://play.openpolicyagent.org/\n- Awesome OPA: https://github.com/anderseknert/awesome-opa\n- Styra DAS pattern library: https://docs.styra.com/das/policies\n";
8
+ export declare const PATTERNS = "# Rego pattern library\n\nCommon Rego patterns with working examples, tests, and pitfalls. Each\npattern is self-contained -- copy, adapt, and ship.\n\n---\n\n## 1. Role-based access control (RBAC)\n\n**When to use:** the simplest authorization model. Every user has one\nor more roles; each role grants a set of actions on a set of\nresources. Sufficient for ~80% of internal applications.\n\n```rego\npackage rbac\n\nimport rego.v1\n\ndefault allow := false\n\n# Permissions table -- extend as roles evolve.\npermissions := {\n \"admin\": {\"read\", \"write\", \"delete\", \"manage_users\"},\n \"editor\": {\"read\", \"write\"},\n \"viewer\": {\"read\"},\n}\n\nallow if {\n some role in input.user.roles\n input.action in permissions[role]\n}\n\n# Why was it denied? -- useful for audit logs.\ndeny_reasons contains reason if {\n not allow\n input.user\n reason := sprintf(\n \"user %q has roles %v, none grant %q\",\n [input.user.id, input.user.roles, input.action],\n )\n}\n\ndeny_reasons contains \"anonymous request\" if {\n not allow\n not input.user\n}\n```\n\n**Test:**\n\n```rego\npackage rbac_test\n\nimport rego.v1\nimport data.rbac\n\ntest_admin_can_delete if {\n rbac.allow with input as {\n \"user\": {\"id\": \"alice\", \"roles\": [\"admin\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_viewer_cannot_delete if {\n not rbac.allow with input as {\n \"user\": {\"id\": \"bob\", \"roles\": [\"viewer\"]},\n \"action\": \"delete\",\n }\n}\n\ntest_anonymous_denied if {\n not rbac.allow with input as {\"action\": \"read\"}\n reasons := rbac.deny_reasons with input as {\"action\": \"read\"}\n \"anonymous request\" in reasons\n}\n```\n\n**Pitfalls:**\n- The `permissions` table grows unbounded. Move to data files\n (`data.permissions`) once you have more than ~20 roles.\n- Roles overlap with groups in real auth systems; map at the boundary\n rather than carrying both.\n\n---\n\n## 2. Attribute-based access control (ABAC)\n\n**When to use:** when \"who\" alone isn't enough -- decisions also depend\non resource attributes (ownership, tenant, sensitivity) and context\n(time of day, source IP).\n\n```rego\npackage abac\n\nimport rego.v1\n\ndefault allow := false\n\n# Don't show \"secret\" resources to anyone outside the owner's\n# organization, even admins.\n#\n# Written as a guard the permissive rules consult. A second rule\n# assigning `allow := false` is a conflict in Rego, not an override:\n# both rules produce a value for the same document and evaluation\n# fails with eval_conflict_error. Deny wins by being a precondition,\n# not by being written last.\nhidden_from_other_org if {\n input.resource.classification == \"secret\"\n input.resource.org_id != input.user.org_id\n}\n\n# A user can read any resource they own.\nallow if {\n input.action == \"read\"\n input.resource.owner_id == input.user.id\n not hidden_from_other_org\n}\n\n# A user can read shared resources at their organization.\nallow if {\n input.action == \"read\"\n input.resource.shared\n input.resource.org_id == input.user.org_id\n not hidden_from_other_org\n}\n\n# Admins can do anything within their organization.\nallow if {\n \"admin\" in input.user.roles\n input.resource.org_id == input.user.org_id\n not hidden_from_other_org\n}\n```\n\n**Test:**\n\n```rego\npackage abac_test\n\nimport rego.v1\nimport data.abac\n\ntest_owner_reads_own if {\n abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\"},\n \"resource\": {\"owner_id\": \"u1\", \"org_id\": \"o1\"},\n }\n}\n\ntest_admin_blocked_from_secret_in_other_org if {\n not abac.allow with input as {\n \"action\": \"read\",\n \"user\": {\"id\": \"u1\", \"org_id\": \"o1\", \"roles\": [\"admin\"]},\n \"resource\": {\n \"owner_id\": \"u2\",\n \"org_id\": \"o2\",\n \"classification\": \"secret\",\n },\n }\n}\n```\n\n**Pitfalls:**\n- Multiple `allow` rules combine with logical OR. A later rule\n cannot override an earlier one by assigning a different value:\n two rules producing different values for the same document is an\n `eval_conflict_error` and evaluation fails. Express a denial as a\n condition the permissive rules must pass, as `hidden_from_other_org`\n does above.\n- Don't compute attributes inside the policy; compute them at the\n boundary and pass via `input`.\n\n---\n\n## 3. Kubernetes admission control\n\n**When to use:** validate or mutate Kubernetes resources at admission\ntime. Run as a Gatekeeper, OPA-as-a-webhook, or Kyverno-equivalent\npolicy layer.\n\n```rego\npackage k8s.admission\n\nimport rego.v1\n\n# Reject pods without resource limits.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n container := input.request.object.spec.containers[_]\n not container.resources.limits.memory\n msg := sprintf(\n \"Pod %q container %q is missing resources.limits.memory\",\n [input.request.object.metadata.name, container.name],\n )\n}\n\n# Reject privileged containers in production.\ndeny contains msg if {\n input.request.kind.kind == \"Pod\"\n input.request.namespace != \"kube-system\"\n container := input.request.object.spec.containers[_]\n container.securityContext.privileged == true\n msg := sprintf(\n \"privileged containers are not allowed: %q in %q\",\n [container.name, input.request.object.metadata.name],\n )\n}\n```\n\n**Pitfalls:**\n- Use `input.request.object` for the resource being admitted; the\n envelope shape comes from Kubernetes, not your control.\n- For mutations, return a JSON Patch via the `patch` field. Test\n patches with the actual admission webhook in dry-run mode before\n enforcing.\n- Iteration order is undefined; never rely on `containers[0]` to mean\n anything specific.\n\n---\n\n## 4. Infrastructure-as-Code gates (Terraform)\n\n**When to use:** validate Terraform plans before apply. Catch overly\npermissive IAM, public S3 buckets, missing encryption.\n\n```rego\npackage terraform\n\nimport rego.v1\n\n# Reject S3 buckets without server-side encryption.\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_s3_bucket\"\n after := resource.change.after\n not after.server_side_encryption_configuration\n msg := sprintf(\n \"S3 bucket %q has no server-side encryption configured\",\n [resource.address],\n )\n}\n\n# Reject IAM policies with action \"*\" on resource \"*\".\n#\n# AWS accepts either a bare string or an array for Statement, Action\n# and Resource, so each is widened to a set before the wildcard test.\n# Testing the array form alone lets the most common admin policy of\n# all, {\"Action\": \"*\", \"Resource\": \"*\"}, through untouched.\nto_set(v) := {v} if is_string(v)\n\nto_set(v) := {x | some x in v} if is_array(v)\n\nstatements(policy) := to_set(policy.Statement) if is_array(policy.Statement)\n\nstatements(policy) := {policy.Statement} if is_object(policy.Statement)\n\ndeny contains msg if {\n resource := input.resource_changes[_]\n resource.type == \"aws_iam_policy\"\n policy := json.unmarshal(resource.change.after.policy)\n some statement in statements(policy)\n statement.Effect == \"Allow\"\n \"*\" in to_set(statement.Action)\n \"*\" in to_set(statement.Resource)\n msg := sprintf(\"IAM policy %q grants Allow * on *\", [resource.address])\n}\n```\n\n**Pitfalls:**\n- Terraform plan JSON is verbose and version-specific. Pin the\n `terraform plan -json` schema you target.\n- `resource_changes[_].change.after` may be `null` for destroys --\n guard against it.\n- IAM policy documents are string-or-array in several places. Match\n both, or a policy that grants everything slips through.\n- For wide-radius changes, use `opa exec --decision` against a plan\n file in CI, not the live API.\n\n---\n\n## 5. API authorization (HTTP request gating)\n\n**When to use:** at the API gateway / reverse proxy layer, validate\neach request against the caller's identity and the requested\nendpoint.\n\n```rego\npackage api.authz\n\nimport rego.v1\n\ndefault allow := false\n\n# Public endpoints -- no auth required.\npublic_endpoints := {\n {\"method\": \"GET\", \"path\": [\"health\"]},\n {\"method\": \"GET\", \"path\": [\"version\"]},\n}\n\nallow if {\n some endpoint in public_endpoints\n matches_endpoint(endpoint)\n}\n\n# Authenticated reads on resources the user has access to.\nallow if {\n input.method == \"GET\"\n input.user\n user_can_read(input.user, input.path)\n}\n\n# Authenticated writes only with specific scopes.\nallow if {\n input.method in {\"POST\", \"PUT\", \"PATCH\", \"DELETE\"}\n input.user\n \"write\" in input.user.scopes\n user_can_write(input.user, input.path)\n}\n\nmatches_endpoint(spec) if {\n spec.method == input.method\n spec.path == input.path\n}\n\nuser_can_read(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n\nuser_can_write(user, path) if {\n path[0] == \"users\"\n user.id == path[1]\n}\n```\n\n**Pitfalls:**\n- `input.path` is typically an array (`[\"users\", \"alice\"]`), not a\n string. Build it consistently at the gateway.\n- Path-prefix matching is easy; full pattern matching is not. For\n parameterized routes, decode at the gateway and pass structured\n fields.\n\n---\n\n## 6. Rate limiting (with sliding window data)\n\n**When to use:** allow N requests per principal per window. Lightweight\nlimit enforcement; for high throughput, push to a dedicated rate\nlimiter.\n\n```rego\npackage rate\n\nimport rego.v1\n\n# Configuration: 100 requests per principal per 60-second window.\nlimit := 100\nwindow_seconds := 60\n\n# input.now is a unix timestamp in nanoseconds.\n# data.requests[principal] is an array of nanosecond timestamps.\n\ncurrent_window := requests if {\n requests := [t | some t in data.requests[input.principal]; t > input.now - window_seconds * 1000000000]\n}\n\n# Do not name this rule `count`: it would shadow the built-in of the same\n# name, and the call below would resolve to the rule instead.\nrequest_count := count(current_window)\n\nallow if request_count < limit\n\ndeny_reason := sprintf(\n \"rate limit exceeded: %d requests in last %d seconds (limit %d)\",\n [request_count, window_seconds, limit],\n) if not allow\n```\n\n**Pitfalls:**\n- `data.requests` grows unbounded unless the writer prunes outside the\n window. Schedule prune on every write.\n- This pattern is *advisory* -- under load, two concurrent decisions\n can both see `count == limit - 1` and both allow. For strict\n limits, use a Lua/Redis token bucket at the gateway and have OPA\n validate the token, not count requests.\n\n---\n\n## Where these patterns came from\n\nEach is distilled from production policy code. The full Rego files,\ntests, and policy data fixtures live in this server's GitHub\nrepository under `tests/fixtures/policies/`.\n\nFor more patterns, see:\n\n- OPA Playground: https://play.openpolicyagent.org/\n- Awesome OPA: https://github.com/anderseknert/awesome-opa\n- Styra DAS pattern library: https://docs.styra.com/das/policies\n";
9
9
  //# sourceMappingURL=patterns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/resources/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,wwTAoXpB,CAAC"}
1
+ {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/resources/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,2iWAgZpB,CAAC"}
@@ -103,10 +103,24 @@ import rego.v1
103
103
 
104
104
  default allow := false
105
105
 
106
+ # Don't show "secret" resources to anyone outside the owner's
107
+ # organization, even admins.
108
+ #
109
+ # Written as a guard the permissive rules consult. A second rule
110
+ # assigning \`allow := false\` is a conflict in Rego, not an override:
111
+ # both rules produce a value for the same document and evaluation
112
+ # fails with eval_conflict_error. Deny wins by being a precondition,
113
+ # not by being written last.
114
+ hidden_from_other_org if {
115
+ input.resource.classification == "secret"
116
+ input.resource.org_id != input.user.org_id
117
+ }
118
+
106
119
  # A user can read any resource they own.
107
120
  allow if {
108
121
  input.action == "read"
109
122
  input.resource.owner_id == input.user.id
123
+ not hidden_from_other_org
110
124
  }
111
125
 
112
126
  # A user can read shared resources at their organization.
@@ -114,19 +128,14 @@ allow if {
114
128
  input.action == "read"
115
129
  input.resource.shared
116
130
  input.resource.org_id == input.user.org_id
131
+ not hidden_from_other_org
117
132
  }
118
133
 
119
134
  # Admins can do anything within their organization.
120
135
  allow if {
121
136
  "admin" in input.user.roles
122
137
  input.resource.org_id == input.user.org_id
123
- }
124
-
125
- # Don't show "secret" resources to anyone outside the owner's
126
- # organization, even admins.
127
- allow := false if {
128
- input.resource.classification == "secret"
129
- input.resource.org_id != input.user.org_id
138
+ not hidden_from_other_org
130
139
  }
131
140
  \`\`\`
132
141
 
@@ -160,8 +169,12 @@ test_admin_blocked_from_secret_in_other_org if {
160
169
  \`\`\`
161
170
 
162
171
  **Pitfalls:**
163
- - Multiple \`allow\` rules combine with logical OR. Use explicit
164
- \`allow := false if ...\` to *override* an allow.
172
+ - Multiple \`allow\` rules combine with logical OR. A later rule
173
+ cannot override an earlier one by assigning a different value:
174
+ two rules producing different values for the same document is an
175
+ \`eval_conflict_error\` and evaluation fails. Express a denial as a
176
+ condition the permissive rules must pass, as \`hidden_from_other_org\`
177
+ does above.
165
178
  - Don't compute attributes inside the policy; compute them at the
166
179
  boundary and pass via \`input\`.
167
180
 
@@ -236,14 +249,27 @@ deny contains msg if {
236
249
  }
237
250
 
238
251
  # Reject IAM policies with action "*" on resource "*".
252
+ #
253
+ # AWS accepts either a bare string or an array for Statement, Action
254
+ # and Resource, so each is widened to a set before the wildcard test.
255
+ # Testing the array form alone lets the most common admin policy of
256
+ # all, {"Action": "*", "Resource": "*"}, through untouched.
257
+ to_set(v) := {v} if is_string(v)
258
+
259
+ to_set(v) := {x | some x in v} if is_array(v)
260
+
261
+ statements(policy) := to_set(policy.Statement) if is_array(policy.Statement)
262
+
263
+ statements(policy) := {policy.Statement} if is_object(policy.Statement)
264
+
239
265
  deny contains msg if {
240
266
  resource := input.resource_changes[_]
241
267
  resource.type == "aws_iam_policy"
242
268
  policy := json.unmarshal(resource.change.after.policy)
243
- statement := policy.Statement[_]
269
+ some statement in statements(policy)
244
270
  statement.Effect == "Allow"
245
- "*" in statement.Action
246
- statement.Resource == "*"
271
+ "*" in to_set(statement.Action)
272
+ "*" in to_set(statement.Resource)
247
273
  msg := sprintf("IAM policy %q grants Allow * on *", [resource.address])
248
274
  }
249
275
  \`\`\`
@@ -253,6 +279,8 @@ deny contains msg if {
253
279
  \`terraform plan -json\` schema you target.
254
280
  - \`resource_changes[_].change.after\` may be \`null\` for destroys --
255
281
  guard against it.
282
+ - IAM policy documents are string-or-array in several places. Match
283
+ both, or a policy that grants everything slips through.
256
284
  - For wide-radius changes, use \`opa exec --decision\` against a plan
257
285
  file in CI, not the live API.
258
286
 
@@ -1 +1 @@
1
- {"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/resources/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoXvB,CAAC"}
1
+ {"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/resources/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgZvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAI/E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAU7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAiBvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAuBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CvE;AAED;;;;;;;GAOG;AACH,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAuBpE"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAI/E,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAU7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;AAiBvC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAuBrD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0CvE;AAED;;;;;;;GAOG;AACH,wBAAsB,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAuBpE"}
package/dist/server.js CHANGED
@@ -8,7 +8,8 @@
8
8
  * IMPORTANT: never write to stdout from anywhere in this process --
9
9
  * stdout is the MCP protocol channel. Use `logger` (file) or stderr.
10
10
  */
11
- import { pathToFileURL } from 'node:url';
11
+ import { realpathSync } from 'node:fs';
12
+ import { fileURLToPath } from 'node:url';
12
13
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
14
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
15
  import { formatHelp, formatStartupBanner, formatVersion, parseCliArgs } from './cli.js';
@@ -144,9 +145,16 @@ function isEntryPoint() {
144
145
  if (!argv1)
145
146
  return false;
146
147
  try {
147
- return import.meta.url === pathToFileURL(argv1).href;
148
+ // Compare real paths. Node resolves symlinks for the module's own URL but
149
+ // leaves process.argv[1] as it was invoked, so a server reached through a
150
+ // link saw two different strings and started nothing: no --version, no
151
+ // --help, and no transport, which a client sees as a process that exits
152
+ // immediately. npm's bin entry is a symlink on macOS and Linux, and
153
+ // installing globally or running through npx goes through it.
154
+ return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(argv1);
148
155
  }
149
156
  catch {
157
+ // A path that cannot be resolved is not this module.
150
158
  return false;
151
159
  }
152
160
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAGjF,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExF,OA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,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -32,7 +32,7 @@ const RegoCheckSchemaInput = {
32
32
  .optional()
33
33
  .describe('Filesystem paths to policy files or directories to validate. Each path must be inside an allowed root (OPA_MCP_ALLOWED_PATHS). Mutually exclusive with `source`.'),
34
34
  inlineSchema: z
35
- .record(z.unknown())
35
+ .record(z.string(), z.unknown())
36
36
  .optional()
37
37
  .describe('JSON Schema (draft-07) object describing the expected shape of the `input` document. Mutually exclusive with `schemaPath`. Accepts the `schema` field from `rego_infer_input_schema` output directly.'),
38
38
  schemaPath: z
@@ -1 +1 @@
1
- {"version":3,"file":"check-schema.js","sourceRoot":"","sources":["../../../src/tools/authoring/check-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EA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.d.ts","sourceRoot":"","sources":["../../../src/tools/bundles/build.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAwE9C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAqG9E"}