mcp-rubber-duck 1.20.2 → 1.20.4
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/.github/dependabot.yml +16 -9
- package/.github/workflows/security.yml +50 -11
- package/.github/workflows/semantic-release.yml +59 -24
- package/.trivyignore +19 -16
- package/CHANGELOG.md +15 -0
- package/audit-ci.json +22 -3
- package/dist/services/function-bridge.d.ts +8 -0
- package/dist/services/function-bridge.d.ts.map +1 -1
- package/dist/services/function-bridge.js +27 -0
- package/dist/services/function-bridge.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/configuration.md +3 -2
- package/docs/mcp-bridge.md +130 -6
- package/package.json +11 -6
- package/src/services/function-bridge.ts +34 -0
- package/tests/function-bridge.test.ts +356 -0
package/.github/dependabot.yml
CHANGED
|
@@ -4,15 +4,22 @@
|
|
|
4
4
|
# repo's existing posture: it relies on GitHub's repo-level Dependabot *security*
|
|
5
5
|
# updates plus the audit-ci CI gate (audit-ci.json), not scheduled version bumps.
|
|
6
6
|
#
|
|
7
|
-
# `undici` is ignored
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# The
|
|
14
|
-
#
|
|
15
|
-
#
|
|
7
|
+
# `undici` is ignored because its resolution is fully governed by the `overrides`
|
|
8
|
+
# block in package.json (`undici@6.x` and `undici@7.x`), which Dependabot does not
|
|
9
|
+
# edit. There are three copies in the tree:
|
|
10
|
+
# node_modules/undici 6.28.0 <- @actions/http-client ^6.23.0
|
|
11
|
+
# node_modules/semantic-release/node_modules/undici 7.29.0 <- @semantic-release/github ^7.0.0
|
|
12
|
+
# node_modules/npm/node_modules/undici 6.27.0 <- bundled in the npm CLI tarball
|
|
13
|
+
# The first two are already at the head of their major lines and are raised by
|
|
14
|
+
# bumping the override floor, not by a Dependabot PR. The third is bundled inside
|
|
15
|
+
# npm's own tarball and cannot be lifted by overrides at all. So every Dependabot
|
|
16
|
+
# security-update attempt here is either a no-op or fails by construction — which
|
|
17
|
+
# is what it did historically (see the closed PRs #84 and #85).
|
|
18
|
+
#
|
|
19
|
+
# audit-ci is the real gate and tracks these independently: audit-ci.json
|
|
20
|
+
# allowlists the three bundled-npm undici advisories with re-check triggers.
|
|
21
|
+
# Remove this ignore if undici ever becomes a direct dependency, or if the
|
|
22
|
+
# overrides are dropped.
|
|
16
23
|
version: 2
|
|
17
24
|
updates:
|
|
18
25
|
- package-ecosystem: "npm"
|
|
@@ -9,22 +9,33 @@ on:
|
|
|
9
9
|
# Run weekly security scans
|
|
10
10
|
- cron: '0 6 * * 1'
|
|
11
11
|
|
|
12
|
+
# Least privilege by default; jobs opt into more only where they need it.
|
|
12
13
|
permissions:
|
|
13
14
|
contents: read
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
# Supersede in-flight runs for the same ref — these are checks, not releases.
|
|
17
|
+
concurrency:
|
|
18
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
19
|
+
cancel-in-progress: true
|
|
16
20
|
|
|
17
21
|
jobs:
|
|
18
22
|
security-scan:
|
|
19
23
|
name: 🔍 Security Scan
|
|
20
24
|
runs-on: ubuntu-latest
|
|
25
|
+
timeout-minutes: 20
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
security-events: write
|
|
21
29
|
|
|
22
30
|
steps:
|
|
23
31
|
- name: 📥 Checkout
|
|
24
|
-
uses: actions/checkout@
|
|
32
|
+
uses: actions/checkout@v7
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
25
35
|
|
|
26
36
|
- name: 🔒 Run Trivy vulnerability scanner
|
|
27
|
-
|
|
37
|
+
# Pinned to the v0.36.0 tag commit — @master is a mutable ref.
|
|
38
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
28
39
|
with:
|
|
29
40
|
scan-type: 'fs'
|
|
30
41
|
scan-ref: '.'
|
|
@@ -46,7 +57,7 @@ jobs:
|
|
|
46
57
|
|
|
47
58
|
- name: 🔒 Run Trivy on Docker image
|
|
48
59
|
if: github.event_name != 'schedule'
|
|
49
|
-
uses: aquasecurity/trivy-action@
|
|
60
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
50
61
|
with:
|
|
51
62
|
image-ref: 'security-scan-image'
|
|
52
63
|
format: 'sarif'
|
|
@@ -63,13 +74,18 @@ jobs:
|
|
|
63
74
|
dependency-check:
|
|
64
75
|
name: 📦 Dependency Check
|
|
65
76
|
runs-on: ubuntu-latest
|
|
77
|
+
timeout-minutes: 15
|
|
78
|
+
permissions:
|
|
79
|
+
contents: read
|
|
66
80
|
|
|
67
81
|
steps:
|
|
68
82
|
- name: 📥 Checkout
|
|
69
|
-
uses: actions/checkout@
|
|
83
|
+
uses: actions/checkout@v7
|
|
84
|
+
with:
|
|
85
|
+
persist-credentials: false
|
|
70
86
|
|
|
71
87
|
- name: 📦 Setup Node.js
|
|
72
|
-
uses: actions/setup-node@
|
|
88
|
+
uses: actions/setup-node@v7
|
|
73
89
|
with:
|
|
74
90
|
node-version: '22'
|
|
75
91
|
cache: 'npm'
|
|
@@ -88,15 +104,22 @@ jobs:
|
|
|
88
104
|
# audit-ci respects the allowlist in audit-ci.json — advisories with no
|
|
89
105
|
# reachable fix (bundled/unpatched transitive dev deps). Each entry carries
|
|
90
106
|
# a rationale + re-check trigger in $allowlist-rationale.
|
|
91
|
-
|
|
107
|
+
# Version-pinned so the gate itself cannot shift under us.
|
|
108
|
+
run: npx --yes audit-ci@7.1.0 --config audit-ci.json
|
|
92
109
|
|
|
93
110
|
dockerfile-lint:
|
|
94
111
|
name: 🐳 Dockerfile Lint
|
|
95
112
|
runs-on: ubuntu-latest
|
|
113
|
+
timeout-minutes: 10
|
|
114
|
+
permissions:
|
|
115
|
+
contents: read
|
|
116
|
+
security-events: write
|
|
96
117
|
|
|
97
118
|
steps:
|
|
98
119
|
- name: 📥 Checkout
|
|
99
|
-
uses: actions/checkout@
|
|
120
|
+
uses: actions/checkout@v7
|
|
121
|
+
with:
|
|
122
|
+
persist-credentials: false
|
|
100
123
|
|
|
101
124
|
- name: 🔍 Lint Dockerfile
|
|
102
125
|
uses: hadolint/hadolint-action@v3.1.0
|
|
@@ -116,13 +139,18 @@ jobs:
|
|
|
116
139
|
test:
|
|
117
140
|
name: 🧪 Test Suite
|
|
118
141
|
runs-on: ubuntu-latest
|
|
142
|
+
timeout-minutes: 20
|
|
143
|
+
permissions:
|
|
144
|
+
contents: read
|
|
119
145
|
|
|
120
146
|
steps:
|
|
121
147
|
- name: 📥 Checkout
|
|
122
|
-
uses: actions/checkout@
|
|
148
|
+
uses: actions/checkout@v7
|
|
149
|
+
with:
|
|
150
|
+
persist-credentials: false
|
|
123
151
|
|
|
124
152
|
- name: 📦 Setup Node.js
|
|
125
|
-
uses: actions/setup-node@
|
|
153
|
+
uses: actions/setup-node@v7
|
|
126
154
|
with:
|
|
127
155
|
node-version: '22'
|
|
128
156
|
cache: 'npm'
|
|
@@ -145,8 +173,11 @@ jobs:
|
|
|
145
173
|
quality-gates:
|
|
146
174
|
name: 🚀 Quality Gates
|
|
147
175
|
runs-on: ubuntu-latest
|
|
176
|
+
timeout-minutes: 5
|
|
148
177
|
needs: [security-scan, dependency-check, dockerfile-lint, test]
|
|
149
178
|
if: always()
|
|
179
|
+
permissions:
|
|
180
|
+
contents: read
|
|
150
181
|
|
|
151
182
|
steps:
|
|
152
183
|
- name: 📊 Quality Gate Summary
|
|
@@ -180,3 +211,11 @@ jobs:
|
|
|
180
211
|
|
|
181
212
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
182
213
|
echo "📋 **View detailed results in the Security tab**" >> $GITHUB_STEP_SUMMARY
|
|
214
|
+
|
|
215
|
+
- name: 🚦 Enforce quality gates
|
|
216
|
+
# Without this the job is summary-only and always green, so a red
|
|
217
|
+
# dependency check or test suite would not fail this check.
|
|
218
|
+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
|
|
219
|
+
run: |
|
|
220
|
+
echo "::error::One or more quality gates failed — see the job summary above"
|
|
221
|
+
exit 1
|
|
@@ -11,25 +11,30 @@ env:
|
|
|
11
11
|
REGISTRY: ghcr.io
|
|
12
12
|
IMAGE_NAME: ${{ github.repository }}
|
|
13
13
|
|
|
14
|
+
# Least privilege by default; jobs opt into more only where they need it.
|
|
14
15
|
permissions:
|
|
15
|
-
contents:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
id-token: write
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
# Never cancel an in-flight release; queue instead.
|
|
19
|
+
concurrency:
|
|
20
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
21
|
+
cancel-in-progress: false
|
|
22
22
|
|
|
23
23
|
jobs:
|
|
24
24
|
test:
|
|
25
25
|
name: 🧪 Test Before Release
|
|
26
26
|
runs-on: ubuntu-latest
|
|
27
|
+
timeout-minutes: 20
|
|
28
|
+
permissions:
|
|
29
|
+
contents: read
|
|
27
30
|
steps:
|
|
28
31
|
- name: 📥 Checkout
|
|
29
|
-
uses: actions/checkout@
|
|
32
|
+
uses: actions/checkout@v7
|
|
33
|
+
with:
|
|
34
|
+
persist-credentials: false
|
|
30
35
|
|
|
31
36
|
- name: 📦 Setup Node.js
|
|
32
|
-
uses: actions/setup-node@
|
|
37
|
+
uses: actions/setup-node@v7
|
|
33
38
|
with:
|
|
34
39
|
node-version: '22'
|
|
35
40
|
cache: 'npm'
|
|
@@ -52,13 +57,20 @@ jobs:
|
|
|
52
57
|
security-scan:
|
|
53
58
|
name: 🔍 Security Scan
|
|
54
59
|
runs-on: ubuntu-latest
|
|
60
|
+
timeout-minutes: 20
|
|
61
|
+
permissions:
|
|
62
|
+
contents: read
|
|
63
|
+
security-events: write
|
|
55
64
|
|
|
56
65
|
steps:
|
|
57
66
|
- name: 📥 Checkout
|
|
58
|
-
uses: actions/checkout@
|
|
67
|
+
uses: actions/checkout@v7
|
|
68
|
+
with:
|
|
69
|
+
persist-credentials: false
|
|
59
70
|
|
|
60
71
|
- name: 🔒 Run Trivy vulnerability scanner
|
|
61
|
-
|
|
72
|
+
# Pinned to the v0.36.0 tag commit — @master is a mutable ref.
|
|
73
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
62
74
|
with:
|
|
63
75
|
scan-type: 'fs'
|
|
64
76
|
scan-ref: '.'
|
|
@@ -77,7 +89,8 @@ jobs:
|
|
|
77
89
|
docker build -t security-scan-image .
|
|
78
90
|
|
|
79
91
|
- name: 🔒 Run Trivy on Docker image
|
|
80
|
-
|
|
92
|
+
# Pinned to the v0.36.0 tag commit — @master is a mutable ref.
|
|
93
|
+
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
|
|
81
94
|
with:
|
|
82
95
|
image-ref: 'security-scan-image'
|
|
83
96
|
format: 'sarif'
|
|
@@ -93,13 +106,18 @@ jobs:
|
|
|
93
106
|
dependency-check:
|
|
94
107
|
name: 📦 Dependency Check
|
|
95
108
|
runs-on: ubuntu-latest
|
|
109
|
+
timeout-minutes: 15
|
|
110
|
+
permissions:
|
|
111
|
+
contents: read
|
|
96
112
|
|
|
97
113
|
steps:
|
|
98
114
|
- name: 📥 Checkout
|
|
99
|
-
uses: actions/checkout@
|
|
115
|
+
uses: actions/checkout@v7
|
|
116
|
+
with:
|
|
117
|
+
persist-credentials: false
|
|
100
118
|
|
|
101
119
|
- name: 📦 Setup Node.js
|
|
102
|
-
uses: actions/setup-node@
|
|
120
|
+
uses: actions/setup-node@v7
|
|
103
121
|
with:
|
|
104
122
|
node-version: '22'
|
|
105
123
|
cache: 'npm'
|
|
@@ -118,15 +136,22 @@ jobs:
|
|
|
118
136
|
# audit-ci respects the allowlist in audit-ci.json — advisories with no
|
|
119
137
|
# reachable fix (bundled/unpatched transitive dev deps). Each entry carries
|
|
120
138
|
# a rationale + re-check trigger in $allowlist-rationale.
|
|
121
|
-
|
|
139
|
+
# Version-pinned so the gate itself cannot shift under us.
|
|
140
|
+
run: npx --yes audit-ci@7.1.0 --config audit-ci.json
|
|
122
141
|
|
|
123
142
|
dockerfile-lint:
|
|
124
143
|
name: 🐳 Dockerfile Lint
|
|
125
144
|
runs-on: ubuntu-latest
|
|
145
|
+
timeout-minutes: 10
|
|
146
|
+
permissions:
|
|
147
|
+
contents: read
|
|
148
|
+
security-events: write
|
|
126
149
|
|
|
127
150
|
steps:
|
|
128
151
|
- name: 📥 Checkout
|
|
129
|
-
uses: actions/checkout@
|
|
152
|
+
uses: actions/checkout@v7
|
|
153
|
+
with:
|
|
154
|
+
persist-credentials: false
|
|
130
155
|
|
|
131
156
|
- name: 🔍 Lint Dockerfile
|
|
132
157
|
uses: hadolint/hadolint-action@v3.1.0
|
|
@@ -147,19 +172,25 @@ jobs:
|
|
|
147
172
|
name: 📦 Release
|
|
148
173
|
needs: [test, security-scan, dependency-check, dockerfile-lint]
|
|
149
174
|
runs-on: ubuntu-latest
|
|
175
|
+
timeout-minutes: 30
|
|
176
|
+
permissions:
|
|
177
|
+
contents: write
|
|
178
|
+
issues: write
|
|
179
|
+
pull-requests: write
|
|
180
|
+
id-token: write
|
|
150
181
|
outputs:
|
|
151
182
|
release-version: ${{ steps.get-version.outputs.version }}
|
|
152
183
|
new-release-published: ${{ steps.check-release.outputs.released }}
|
|
153
184
|
|
|
154
185
|
steps:
|
|
155
186
|
- name: 📥 Checkout
|
|
156
|
-
uses: actions/checkout@
|
|
187
|
+
uses: actions/checkout@v7
|
|
157
188
|
with:
|
|
158
189
|
fetch-depth: 0
|
|
159
190
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
160
191
|
|
|
161
192
|
- name: 📦 Setup Node.js
|
|
162
|
-
uses: actions/setup-node@
|
|
193
|
+
uses: actions/setup-node@v7
|
|
163
194
|
with:
|
|
164
195
|
node-version: '22'
|
|
165
196
|
cache: 'npm'
|
|
@@ -245,23 +276,27 @@ jobs:
|
|
|
245
276
|
name: 🐳 Build & Push Docker Images
|
|
246
277
|
needs: release
|
|
247
278
|
runs-on: ubuntu-latest
|
|
279
|
+
timeout-minutes: 90
|
|
280
|
+
permissions:
|
|
281
|
+
contents: read
|
|
282
|
+
packages: write
|
|
248
283
|
if: needs.release.outputs.new-release-published == 'true'
|
|
249
284
|
|
|
250
285
|
steps:
|
|
251
286
|
- name: 📥 Checkout release tag
|
|
252
|
-
uses: actions/checkout@
|
|
287
|
+
uses: actions/checkout@v7
|
|
253
288
|
with:
|
|
254
289
|
ref: v${{ needs.release.outputs.release-version }}
|
|
255
290
|
fetch-depth: 0
|
|
256
291
|
|
|
257
292
|
- name: 🛠️ Set up QEMU
|
|
258
|
-
uses: docker/setup-qemu-action@
|
|
293
|
+
uses: docker/setup-qemu-action@v4
|
|
259
294
|
|
|
260
295
|
- name: 🛠️ Set up Docker Buildx
|
|
261
|
-
uses: docker/setup-buildx-action@
|
|
296
|
+
uses: docker/setup-buildx-action@v4
|
|
262
297
|
|
|
263
298
|
- name: 🔑 Login to Container Registry
|
|
264
|
-
uses: docker/login-action@
|
|
299
|
+
uses: docker/login-action@v4
|
|
265
300
|
with:
|
|
266
301
|
registry: ${{ env.REGISTRY }}
|
|
267
302
|
username: ${{ github.actor }}
|
|
@@ -269,7 +304,7 @@ jobs:
|
|
|
269
304
|
|
|
270
305
|
- name: 🏷️ Extract metadata
|
|
271
306
|
id: meta
|
|
272
|
-
uses: docker/metadata-action@
|
|
307
|
+
uses: docker/metadata-action@v6
|
|
273
308
|
with:
|
|
274
309
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
275
310
|
tags: |
|
|
@@ -284,7 +319,7 @@ jobs:
|
|
|
284
319
|
|
|
285
320
|
- name: 🐳 Build and push Docker image
|
|
286
321
|
id: build
|
|
287
|
-
uses: docker/build-push-action@
|
|
322
|
+
uses: docker/build-push-action@v7
|
|
288
323
|
with:
|
|
289
324
|
context: .
|
|
290
325
|
platforms: linux/amd64,linux/arm64
|
package/.trivyignore
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
# Trivy ignore file.
|
|
2
2
|
#
|
|
3
|
-
#
|
|
4
|
-
# (npm -> node-gyp -> undici). It reaches package-lock.json only via the
|
|
5
|
-
# dev/release-only semantic-release toolchain and is NOT in the runtime Docker
|
|
6
|
-
# image (the production stage removes the npm CLI entirely). The bundled copy
|
|
7
|
-
# cannot be lifted by package overrides.
|
|
3
|
+
# Currently empty — no suppressions are needed.
|
|
8
4
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
# This file previously suppressed four undici advisories (CVE-2026-12151,
|
|
6
|
+
# CVE-2026-9679, CVE-2026-11525, CVE-2026-6733). All four are fixed in undici
|
|
7
|
+
# 6.27.0 / 7.28.0 / 8.5.0, and every undici copy in the tree now meets that bar
|
|
8
|
+
# (node_modules/undici 6.28.0, semantic-release's 7.29.0, and npm's bundled
|
|
9
|
+
# 6.27.0), so the lines matched nothing and were removed.
|
|
10
|
+
#
|
|
11
|
+
# Their stated removal trigger was also unreachable: the comment said to drop
|
|
12
|
+
# them "once the orphaned undici 6.21.0 lock entry is gone", but no such entry
|
|
13
|
+
# has ever existed in this repo's lock. The 6.21.0 in package-lock.json is
|
|
14
|
+
# `undici-types` — a types-only package with no runtime code.
|
|
15
|
+
#
|
|
16
|
+
# Note that npm's *bundled* copies of undici, tar, brace-expansion and
|
|
17
|
+
# ip-address do still carry live advisories. Those are tracked deliberately in
|
|
18
|
+
# audit-ci.json's allowlist (with per-advisory rationale and re-check triggers)
|
|
19
|
+
# and are stripped from the runtime Docker image, which removes the npm CLI
|
|
20
|
+
# entirely (see Dockerfile). If Trivy starts reporting them against
|
|
21
|
+
# package-lock.json, mirror the audit-ci.json entries here rather than
|
|
22
|
+
# re-adding the undici CVEs above.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.20.4](https://github.com/nesquikm/mcp-rubber-duck/compare/v1.20.3...v1.20.4) (2026-08-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **mcp-bridge:** warn instead of silently ignoring a global trusted-tools "*" ([ddcb451](https://github.com/nesquikm/mcp-rubber-duck/commit/ddcb451b9b1e1c1f8991808f7e88539116fa9a86)), closes [#129](https://github.com/nesquikm/mcp-rubber-duck/issues/129)
|
|
7
|
+
|
|
8
|
+
## [1.20.3](https://github.com/nesquikm/mcp-rubber-duck/compare/v1.20.2...v1.20.3) (2026-08-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** clear every override-reachable audit-ci advisory ([6aa7a4d](https://github.com/nesquikm/mcp-rubber-duck/commit/6aa7a4d57b0911e7a94da53b7c78b4bdc50dc337))
|
|
14
|
+
* **security:** scope audit-ci allowlist to the bundled-npm paths ([ab9c654](https://github.com/nesquikm/mcp-rubber-duck/commit/ab9c654f1ba7747fde6ff8d827a06c1b987bc1b8))
|
|
15
|
+
|
|
1
16
|
## [1.20.2](https://github.com/nesquikm/mcp-rubber-duck/compare/v1.20.1...v1.20.2) (2026-07-27)
|
|
2
17
|
|
|
3
18
|
|
package/audit-ci.json
CHANGED
|
@@ -5,8 +5,27 @@
|
|
|
5
5
|
"critical": true,
|
|
6
6
|
"report-type": "summary",
|
|
7
7
|
"$allowlist-rationale": {
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"$root-cause": "Every entry below resolves to a dependency BUNDLED INSIDE THE npm CLI TARBALL (node_modules/npm/node_modules/*). npm publishes those via bundleDependencies, so `overrides` in package.json cannot reach them — verified: the undici/ip-address/brace-expansion overrides added on 2026-08-10 lifted every other copy in the tree but left npm's bundled ones untouched. The npm CLI is dev/release-only (devDependencies -> semantic-release -> @semantic-release/npm -> npm) and is stripped from the runtime Docker image. Checked on 2026-08-10 that npm 11.18.0, 11.19.0 AND 12.0.2 all bundle the SAME stale set: undici 6.27.0, tar 7.5.19, brace-expansion 5.0.7, ip-address 10.2.0, minimatch 10.2.5 — so bumping the `npm` override clears nothing today. Note @semantic-release/npm@13.1.5 declares `npm: ^11.6.2`, so a fix landing only in npm 12.x would additionally need the `npm` override raised past ^11.16.0.",
|
|
9
|
+
"$scoping": "Entries are path-scoped (`GHSA-ID|path`) rather than bare advisory IDs so a REACHABLE reintroduction of the same advisory still fails CI. This works for ip-address: the bundled copy renders as `ip-address` while the reachable one renders as `express-rate-limit>ip-address` (the path that was failing before this fix). It does NOT discriminate for undici and brace-expansion — audit-ci renders both the bundled and a hypothetical direct copy as the bare package name — so those two remain the weak spot; re-check them by hand when the tree changes. Path-scoped entries fail CLOSED: if npm audit's graph shifts, the string stops matching and CI goes red, which is the intended prompt to revisit this file.",
|
|
10
|
+
"GHSA-mh99-v99m-4gvg": "brace-expansion DoS (unbounded expansion length). Patched in 5.0.8. Only npm's bundled 5.0.7 is still affected. The previous rationale here claimed the 1.x/2.x lines had no backport — that is now STALE: 1.1.18 and 2.1.4 shipped, and the `brace-expansion@1.x`/`@2.x` overrides pin them, clearing the eslint/jest (minimatch 3) and typescript-eslint (minimatch 9) paths. Re-check when npm rebundles brace-expansion >= 5.0.9.",
|
|
11
|
+
"GHSA-rgw5-rvv9-x895": "brace-expansion DoS (unbounded intermediate arrays, bypasses the CVE-2026-14257 mitigation). Same bundled 5.0.7 as above; patched in 5.0.9. Same re-check trigger.",
|
|
12
|
+
"GHSA-mwp4-54f8-5fhr": "ip-address: leading-zero octets decoded as decimal (SSRF / trust-boundary bypass). Patched in 10.3.1. Reachable path (express-rate-limit -> ip-address) is fixed by the `ip-address` override at ^10.3.1; only npm's bundled 10.2.0 (via its vendored socks) remains. Re-check when npm rebundles ip-address >= 10.3.1.",
|
|
13
|
+
"GHSA-4xrf-jv44-h6hh": "ip-address: a CIDR suffix suppresses special-use classification (SSRF / trust-boundary bypass). Patched in 10.2.2. Same bundled-only path and re-check trigger as GHSA-mwp4-54f8-5fhr.",
|
|
14
|
+
"GHSA-22jq-vg5j-6vgg": "ip-address: IPv4-mapped/NAT64 IPv6 misclassification (SSRF / trust-boundary bypass). Patched in 10.2.1. Same bundled-only path and re-check trigger as GHSA-mwp4-54f8-5fhr.",
|
|
15
|
+
"GHSA-8xcm-r25x-g524": "undici: downstream response desynchronization via the retry interceptor. Patched in 6.28.0 / 7.29.0. The two reachable copies (@actions/http-client -> undici ^6.23.0, and @semantic-release/github -> undici ^7.0.0) are lifted by the `undici@6.x`/`@7.x` overrides; only npm's bundled 6.27.0 (via its vendored node-gyp) remains. Re-check when npm rebundles undici >= 6.28.0.",
|
|
16
|
+
"GHSA-m8rv-5g2x-5cg5": "undici: CRLF injection via a blob-like body `type` property. Patched in 6.28.0 / 7.29.0. Same bundled-only path and re-check trigger as GHSA-8xcm-r25x-g524.",
|
|
17
|
+
"GHSA-v3r7-h72x-cjcm": "undici: cookie attribute injection via unsanitized domain and unparsed setCookie fields. Patched in 6.28.0 / 7.29.0. Same bundled-only path and re-check trigger as GHSA-8xcm-r25x-g524.",
|
|
18
|
+
"GHSA-r292-9mhp-454m": "node-tar DoS (uncontrolled recursion in mapHas/filesFilter). Patched in tar 7.5.21 (latest 7.5.22); npm 12.0.2 still bundles 7.5.19. Re-check when npm rebundles tar >= 7.5.21 — and note the `npm: ^11.16.0` override caveat in $root-cause if the fix lands only in npm 12.x."
|
|
10
19
|
},
|
|
11
|
-
"allowlist": [
|
|
20
|
+
"allowlist": [
|
|
21
|
+
"GHSA-mh99-v99m-4gvg|brace-expansion",
|
|
22
|
+
"GHSA-rgw5-rvv9-x895|brace-expansion",
|
|
23
|
+
"GHSA-mwp4-54f8-5fhr|ip-address",
|
|
24
|
+
"GHSA-4xrf-jv44-h6hh|ip-address",
|
|
25
|
+
"GHSA-22jq-vg5j-6vgg|ip-address",
|
|
26
|
+
"GHSA-8xcm-r25x-g524|undici",
|
|
27
|
+
"GHSA-m8rv-5g2x-5cg5|undici",
|
|
28
|
+
"GHSA-v3r7-h72x-cjcm|undici",
|
|
29
|
+
"GHSA-r292-9mhp-454m|semantic-release>@semantic-release/npm>npm>tar"
|
|
30
|
+
]
|
|
12
31
|
}
|
|
@@ -24,6 +24,14 @@ export declare class FunctionBridge {
|
|
|
24
24
|
private approvalMode;
|
|
25
25
|
private guardrailsService?;
|
|
26
26
|
constructor(mcpManager: MCPClientManager, approvalService: ApprovalService, trustedTools?: string[], approvalMode?: 'always' | 'trusted' | 'never', trustedToolsByServer?: Record<string, string[]>, guardrailsService?: GuardrailsService);
|
|
27
|
+
/**
|
|
28
|
+
* A global trusted-tools list containing '*' trusts nothing: the global list is
|
|
29
|
+
* matched literally in handleFunctionCall, so every call still hits the approval
|
|
30
|
+
* gate. That fail-closed behaviour is deliberate — honouring a global wildcard
|
|
31
|
+
* would silently switch off every approval prompt on upgrade — but it is invisible
|
|
32
|
+
* to a user who believes they disabled the prompts, so say so loudly instead.
|
|
33
|
+
*/
|
|
34
|
+
private warnIfGlobalWildcard;
|
|
27
35
|
getFunctionDefinitions(): Promise<FunctionDefinition[]>;
|
|
28
36
|
private convertMCPToolToFunction;
|
|
29
37
|
private validateToolArguments;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-bridge.d.ts","sourceRoot":"","sources":["../../src/services/function-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAK7D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM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AAO,CAAC;IAUvE,yBAAyB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAqBrE,kBAAkB,CAChB,YAAY,EAAE,MAAM,EAAE,EACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9C,IAAI;IAeP,QAAQ,IAAI;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC5B;CAQF"}
|
|
@@ -25,6 +25,32 @@ export class FunctionBridge {
|
|
|
25
25
|
Object.entries(trustedToolsByServer).forEach(([serverName, tools]) => {
|
|
26
26
|
this.trustedToolsByServer.set(serverName, new Set(tools));
|
|
27
27
|
});
|
|
28
|
+
this.warnIfGlobalWildcard();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A global trusted-tools list containing '*' trusts nothing: the global list is
|
|
32
|
+
* matched literally in handleFunctionCall, so every call still hits the approval
|
|
33
|
+
* gate. That fail-closed behaviour is deliberate — honouring a global wildcard
|
|
34
|
+
* would silently switch off every approval prompt on upgrade — but it is invisible
|
|
35
|
+
* to a user who believes they disabled the prompts, so say so loudly instead.
|
|
36
|
+
*/
|
|
37
|
+
warnIfGlobalWildcard() {
|
|
38
|
+
// In 'never' mode nothing is gated at all, so the message would be pure noise.
|
|
39
|
+
if (this.approvalMode === 'never' || !this.trustedTools.has('*')) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// 'always' mode never consults trusted lists, so recommending a per-server list
|
|
43
|
+
// on its own would send the user to a setting that changes nothing for them.
|
|
44
|
+
const remedy = this.approvalMode === 'always'
|
|
45
|
+
? 'This mode ignores trusted tools entirely: set MCP_APPROVAL_MODE=trusted first, then ' +
|
|
46
|
+
'use MCP_TRUSTED_TOOLS_<SERVER> (mcp_bridge.trusted_tools_by_server) to trust one ' +
|
|
47
|
+
'server — or use MCP_APPROVAL_MODE=never to skip approval entirely.'
|
|
48
|
+
: 'To trust every tool of one server use MCP_TRUSTED_TOOLS_<SERVER> ' +
|
|
49
|
+
'(mcp_bridge.trusted_tools_by_server); to skip approval entirely use ' +
|
|
50
|
+
'MCP_APPROVAL_MODE=never.';
|
|
51
|
+
logger.warn("Ignoring '*' in the global trusted tools list (MCP_TRUSTED_TOOLS, config key " +
|
|
52
|
+
'mcp_bridge.trusted_tools): a global wildcard is matched literally, trusts no tool, ' +
|
|
53
|
+
`and approval is still required. ${remedy}`);
|
|
28
54
|
}
|
|
29
55
|
async getFunctionDefinitions() {
|
|
30
56
|
try {
|
|
@@ -294,6 +320,7 @@ export class FunctionBridge {
|
|
|
294
320
|
updateTrustedTools(trustedTools, trustedToolsByServer) {
|
|
295
321
|
this.trustedTools = new Set(trustedTools);
|
|
296
322
|
logger.info(`Updated global trusted tools list: ${Array.from(this.trustedTools).join(', ')}`);
|
|
323
|
+
this.warnIfGlobalWildcard();
|
|
297
324
|
if (trustedToolsByServer) {
|
|
298
325
|
this.trustedToolsByServer.clear();
|
|
299
326
|
Object.entries(trustedToolsByServer).forEach(([serverName, tools]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-bridge.js","sourceRoot":"","sources":["../../src/services/function-bridge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,GAAyB,MAAM,KAAK,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAiBpE,MAAM,OAAO,cAAc;IACjB,UAAU,CAAmB;IAC7B,eAAe,CAAkB;IACjC,YAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;IACtC,oBAAoB,GAA6B,IAAI,GAAG,EAAE,CAAC;IAC3D,GAAG,CAAU;IACb,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AAU,CAAC,mBAAmB,EAAE,CAAC,MAAM;YACzD,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;YACxC,gBAAgB,EAAE,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE;SACxD,CAAC;IACJ,CAAC;CACF"}
|
package/docs/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Detailed reference documentation for MCP Rubber Duck.
|
|
|
14
14
|
| [Tools](./tools.md) | All 15 tools with input schemas and examples |
|
|
15
15
|
| [Prompts](./prompts.md) | All 8 prompt templates with arguments and usage |
|
|
16
16
|
| [CLI Providers](./cli-providers.md) | Coding agents as ducks: presets, custom, output formats |
|
|
17
|
-
| [MCP Bridge](./mcp-bridge.md) | Connect ducks to external MCP servers |
|
|
17
|
+
| [MCP Bridge](./mcp-bridge.md) | Connect ducks to external MCP servers: approval modes, trusted tools, filesystem read-access recipe |
|
|
18
18
|
| [Guardrails](./guardrails.md) | Rate limiting, token limits, pattern blocking, PII redaction |
|
|
19
19
|
| [Docker](./docker.md) | Multi-platform deployment, Compose profiles, Raspberry Pi |
|
|
20
20
|
| [Provider Setup](./provider-setup.md) | Ollama, LM Studio, Gemini, Groq, Together AI |
|
package/docs/configuration.md
CHANGED
|
@@ -70,8 +70,9 @@ LOG_LEVEL=info
|
|
|
70
70
|
|
|
71
71
|
# MCP Bridge Settings (Optional)
|
|
72
72
|
MCP_BRIDGE_ENABLED=true # Enable ducks to access external MCP servers
|
|
73
|
-
MCP_APPROVAL_MODE=trusted # always, trusted, or never
|
|
74
|
-
MCP_APPROVAL_TIMEOUT=300 # seconds
|
|
73
|
+
MCP_APPROVAL_MODE=trusted # always (default), trusted, or never
|
|
74
|
+
MCP_APPROVAL_TIMEOUT=300 # seconds (default: 300)
|
|
75
|
+
MCP_MAX_TOOL_ROUNDS=10 # Tool-calling rounds per request, 1-50 (default: 10)
|
|
75
76
|
|
|
76
77
|
# MCP Server: Context7 Documentation (Example)
|
|
77
78
|
MCP_SERVER_CONTEXT7_TYPE=http
|
package/docs/mcp-bridge.md
CHANGED
|
@@ -31,10 +31,11 @@ MCP_TRUSTED_TOOLS_CONTEXT7="*"
|
|
|
31
31
|
|
|
32
32
|
## Approval Modes
|
|
33
33
|
|
|
34
|
-
**`always
|
|
34
|
+
**`always`** (default): Every tool call requires approval (with session-based memory)
|
|
35
35
|
- First use of a tool (with specific arguments) -> requires approval
|
|
36
36
|
- Subsequent *identical* calls (same provider + server + tool + arguments) -> automatic, until the approval TTL expires
|
|
37
37
|
- A material change in arguments, or TTL expiry -> re-prompts
|
|
38
|
+
- Trusted-tool lists are **ignored** in this mode — trust is only consulted in `trusted` mode
|
|
38
39
|
|
|
39
40
|
**`trusted`**: Only untrusted tools require approval
|
|
40
41
|
- Tools in trusted lists execute immediately
|
|
@@ -51,15 +52,35 @@ Configure trust levels per MCP server for granular security:
|
|
|
51
52
|
MCP_TRUSTED_TOOLS_CONTEXT7="*"
|
|
52
53
|
|
|
53
54
|
# Trust specific filesystem operations only
|
|
54
|
-
MCP_TRUSTED_TOOLS_FILESYSTEM="
|
|
55
|
+
MCP_TRUSTED_TOOLS_FILESYSTEM="read_text_file,list_directory"
|
|
55
56
|
|
|
56
|
-
# Trust specific
|
|
57
|
-
|
|
57
|
+
# Trust specific tools from another server — substitute that server's real
|
|
58
|
+
# tool names; they are matched exactly, so placeholders never match
|
|
59
|
+
MCP_TRUSTED_TOOLS_GITHUB="<tool_name>,<other_tool_name>"
|
|
58
60
|
|
|
59
|
-
# Global fallback for servers
|
|
60
|
-
MCP_TRUSTED_TOOLS="
|
|
61
|
+
# Global fallback, used ONLY for servers that have no MCP_TRUSTED_TOOLS_<SERVER> entry
|
|
62
|
+
MCP_TRUSTED_TOOLS="common_safe_tool"
|
|
61
63
|
```
|
|
62
64
|
|
|
65
|
+
Tool names are matched by **exact string** (`read_text_file`, not `read-file`) against
|
|
66
|
+
either the bare tool name or the `server:tool` form. A name that no connected server
|
|
67
|
+
actually exposes is inert — it silently trusts nothing. Confirm the real names with the
|
|
68
|
+
`mcp_status` tool.
|
|
69
|
+
|
|
70
|
+
Two things about the global list are easy to get wrong:
|
|
71
|
+
|
|
72
|
+
- **A per-server list replaces the global list, it does not extend it.** If
|
|
73
|
+
`MCP_TRUSTED_TOOLS_FILESYSTEM` is set, `MCP_TRUSTED_TOOLS` is never consulted for the
|
|
74
|
+
`filesystem` server. Any name you still want trusted there has to be repeated in the
|
|
75
|
+
per-server list.
|
|
76
|
+
- **`"*"` is not supported in the global list.** The wildcard is only honoured in a
|
|
77
|
+
per-server list; in `MCP_TRUSTED_TOOLS` it is treated as a literal tool name and
|
|
78
|
+
matches nothing (a warning is logged at startup if you set it, except in `never` mode
|
|
79
|
+
where nothing is gated anyway). To trust everything from one server use
|
|
80
|
+
`MCP_TRUSTED_TOOLS_<SERVER>="*"` — which requires `MCP_APPROVAL_MODE="trusted"`, since
|
|
81
|
+
the default `always` ignores trusted lists entirely; to drop approvals entirely use
|
|
82
|
+
`MCP_APPROVAL_MODE="never"`.
|
|
83
|
+
|
|
63
84
|
## MCP Server Configuration
|
|
64
85
|
|
|
65
86
|
Configure MCP servers using environment variables:
|
|
@@ -103,6 +124,109 @@ Ask: "Can you find React hooks documentation from Context7 and return only the k
|
|
|
103
124
|
Duck: *searches Context7 and returns focused, essential React hooks information*
|
|
104
125
|
```
|
|
105
126
|
|
|
127
|
+
## Example: Give Ducks Read Access to Files
|
|
128
|
+
|
|
129
|
+
Wire the official [`@modelcontextprotocol/server-filesystem`](https://www.npmjs.com/package/@modelcontextprotocol/server-filesystem)
|
|
130
|
+
through the bridge over stdio, with only its read tools on the trusted list:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Enable the bridge; anything not trusted stops for approval
|
|
134
|
+
MCP_BRIDGE_ENABLED="true"
|
|
135
|
+
MCP_APPROVAL_MODE="trusted"
|
|
136
|
+
|
|
137
|
+
# Filesystem server over stdio. ARGS is comma-split, one argv entry per element,
|
|
138
|
+
# and the trailing entries are the directories the server is allowed to touch.
|
|
139
|
+
MCP_SERVER_FILESYSTEM_TYPE="stdio"
|
|
140
|
+
MCP_SERVER_FILESYSTEM_COMMAND="npx"
|
|
141
|
+
MCP_SERVER_FILESYSTEM_ARGS="-y,@modelcontextprotocol/server-filesystem@2026.7.10,/Users/you/projects/my-app,/Users/you/notes"
|
|
142
|
+
MCP_SERVER_FILESYSTEM_ENABLED="true"
|
|
143
|
+
|
|
144
|
+
# Read-only allowlist: only these run without an approval prompt
|
|
145
|
+
MCP_TRUSTED_TOOLS_FILESYSTEM="read_text_file,read_multiple_files,list_directory,directory_tree,search_files,get_file_info,list_allowed_directories"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Now a duck can read and navigate those two directories without interrupting you:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
Ask: "Read /Users/you/projects/my-app/src/config/config.ts and summarise how env vars override the config file."
|
|
152
|
+
Duck: *calls read_text_file, returns a summary*
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The seven names above are the read-only tools of `@modelcontextprotocol/server-filesystem`
|
|
156
|
+
version `2026.7.10`; that release also ships `read_file` (deprecated in favour of
|
|
157
|
+
`read_text_file`), `read_media_file`, and `list_directory_with_sizes`, which you can add if
|
|
158
|
+
you want them. Tool names are matched exactly, so **confirm the names your installed version
|
|
159
|
+
actually exposes with the `mcp_status` tool** — it lists each connected server, its tool
|
|
160
|
+
count, and the first three tool names.
|
|
161
|
+
|
|
162
|
+
Caveats worth knowing before you paste this in:
|
|
163
|
+
|
|
164
|
+
- **`ARGS` is split on commas and each element is trimmed.** A path containing a comma
|
|
165
|
+
cannot be expressed. A *trailing* comma is worse than a typo: it produces an empty argv
|
|
166
|
+
entry, which the filesystem server resolves to the working directory of the rubber-duck
|
|
167
|
+
process and silently adds to the allowed directories. Use absolute paths, no trailing
|
|
168
|
+
comma.
|
|
169
|
+
- **`MCP_SERVER_<NAME>_ENABLED` is truthy unless it is exactly `"false"`.** `"0"`, `"no"`,
|
|
170
|
+
and an unset value all leave the server enabled.
|
|
171
|
+
- **Deleting `MCP_BRIDGE_ENABLED` does not turn the bridge off.** When the variable is
|
|
172
|
+
*set*, the bridge is enabled only if the value is exactly `"true"`; when it is *unset*,
|
|
173
|
+
the mere presence of any `MCP_SERVER_*` variable enables the bridge automatically — and
|
|
174
|
+
the recipe above defines several. To actually disable the bridge, set
|
|
175
|
+
`MCP_BRIDGE_ENABLED="false"` (or `"enabled": false` under `mcp_bridge` in `config.json`, which
|
|
176
|
+
wins over the environment) rather than removing the line.
|
|
177
|
+
- **Server names are normalised, and the trusted-tools variable must match.** The `<NAME>`
|
|
178
|
+
in `MCP_SERVER_<NAME>_*` is lowercased with underscores turned into hyphens, so
|
|
179
|
+
`MCP_SERVER_FILESYSTEM_*` registers the server as `filesystem`.
|
|
180
|
+
`MCP_TRUSTED_TOOLS_<NAME>` goes through the same normalisation, so the two must use the
|
|
181
|
+
same spelling of `<NAME>`: `MCP_SERVER_MY_FILES_*` (server `my-files`) pairs with
|
|
182
|
+
`MCP_TRUSTED_TOOLS_MY_FILES`, never with `MCP_TRUSTED_TOOLS_MYFILES`.
|
|
183
|
+
- **CLI ducks never get bridge tools.** Providers of `type: "cli"` are skipped when
|
|
184
|
+
MCP-enhanced providers are built, and calls to them fall back to a plain chat request.
|
|
185
|
+
Only HTTP/OpenAI-compatible ducks can call filesystem tools.
|
|
186
|
+
- **`npx` has to be on `PATH`, and the child gets a stripped environment.** The stdio child
|
|
187
|
+
is spawned without a shell and with only the MCP SDK's default inherited variables —
|
|
188
|
+
`HOME`, `LOGNAME`, `PATH`, `SHELL`, `TERM`, `USER` on macOS and Linux. Rubber-duck passes
|
|
189
|
+
no extra `env` and no `cwd`, so none of your other variables (API keys included) reach the
|
|
190
|
+
child, and it inherits rubber-duck's working directory. If rubber-duck is launched by a
|
|
191
|
+
GUI app with a minimal `PATH`, give the absolute path instead, e.g.
|
|
192
|
+
`MCP_SERVER_FILESYSTEM_COMMAND="/usr/local/bin/npx"`.
|
|
193
|
+
- **Pin the server version.** `npx -y` resolves to the latest release. Because trust is
|
|
194
|
+
exact-string matching, an upstream rename or removal empties your allowlist without any
|
|
195
|
+
error: the tool still exists under its new name, it just is not trusted any more, so every
|
|
196
|
+
call starts prompting (or, in `never` mode, runs unguarded). A pinned version keeps the
|
|
197
|
+
names stable until you choose to bump it.
|
|
198
|
+
|
|
199
|
+
### Caveat: trusted tools gate calls, not tool exposure
|
|
200
|
+
|
|
201
|
+
The trusted-tools list is an **approval filter, not a visibility filter**.
|
|
202
|
+
|
|
203
|
+
`getFunctionDefinitions()` in `src/services/function-bridge.ts` turns *every* tool of *every*
|
|
204
|
+
connected server into a function definition and hands the whole set to the model — there is
|
|
205
|
+
no trust filtering at that step. Trust is consulted only later, in `handleFunctionCall()`,
|
|
206
|
+
once a call has actually arrived.
|
|
207
|
+
|
|
208
|
+
So the read-only allowlist above does **not** hide `write_file`, `edit_file`, `move_file`, or
|
|
209
|
+
`create_directory` from the duck. The duck still sees them and can still decide to call one;
|
|
210
|
+
what you get is an approval prompt instead of a silent write. That prompt is the whole of the
|
|
211
|
+
protection.
|
|
212
|
+
|
|
213
|
+
Two ways to throw it away:
|
|
214
|
+
|
|
215
|
+
- `MCP_TRUSTED_TOOLS_FILESYSTEM="*"` trusts every tool from that server, writes included —
|
|
216
|
+
no prompt at all. This is the trap: the wildcard looks like a convenience and is actually
|
|
217
|
+
the entire security boundary.
|
|
218
|
+
- `MCP_APPROVAL_MODE="never"` skips approval for every server.
|
|
219
|
+
|
|
220
|
+
The bridge cannot work read-only-ness out for you either. The filesystem server has no
|
|
221
|
+
read-only flag — its arguments are just the allowed directories — and while it does annotate
|
|
222
|
+
its tools with `readOnlyHint`, the bridge's `MCPTool` type keeps only `serverName`, `name`,
|
|
223
|
+
`description`, and `inputSchema`, so annotations are discarded on the way in and cannot be
|
|
224
|
+
used for filtering.
|
|
225
|
+
|
|
226
|
+
A genuine read-only guarantee needs a server that has no write tools at all, plus OS-level
|
|
227
|
+
protection: a read-only bind mount, a dedicated user with no write permission on those paths,
|
|
228
|
+
or a container with the directory mounted `:ro`.
|
|
229
|
+
|
|
106
230
|
## Token Optimization Benefits
|
|
107
231
|
|
|
108
232
|
**Smart Token Management**: Ducks can retrieve comprehensive data from MCP servers but return only the essential information you need, saving tokens in your host LLM conversations:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-rubber-duck",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.4",
|
|
4
4
|
"description": "An MCP server that bridges to multiple OpenAI-compatible LLMs - your AI rubber duck debugging panel",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -74,16 +74,21 @@
|
|
|
74
74
|
"@hono/node-server": "Major-version override (2.x) against the MCP SDK's declared ^1.19.9 — GHSA-frvp-7c67-39w9 is patched only in 2.0.5 and the 1.x line has no fix. Safe here: the SDK pulls @hono/node-server in for its server-side streamableHttp transport, which this project never imports (we use StreamableHTTPClientTransport, the client side, in src/services/mcp-client-manager.ts). v2 keeps the same serve/getRequestListener API. Revisit if this project ever serves MCP over HTTP, or drop the override once the SDK moves to ^2."
|
|
75
75
|
},
|
|
76
76
|
"overrides": {
|
|
77
|
-
"js-yaml": "^4.
|
|
77
|
+
"js-yaml": "^4.3.1",
|
|
78
78
|
"lodash": "^4.17.23",
|
|
79
79
|
"lodash-es": "^4.17.23",
|
|
80
|
-
"hono": "^4.
|
|
80
|
+
"hono": "^4.13.1",
|
|
81
81
|
"@hono/node-server": "^2.0.5",
|
|
82
|
-
"fast-uri": "^3.1.
|
|
82
|
+
"fast-uri": "^3.1.5",
|
|
83
83
|
"postcss": "^8.5.18",
|
|
84
|
-
"ip-address": "^10.
|
|
84
|
+
"ip-address": "^10.3.1",
|
|
85
|
+
"express-rate-limit": "^8.6.2",
|
|
85
86
|
"qs": "^6.15.2",
|
|
86
87
|
"npm": "^11.16.0",
|
|
87
|
-
"
|
|
88
|
+
"nanoid@3.x": "^3.3.17",
|
|
89
|
+
"undici@6.x": "^6.28.0",
|
|
90
|
+
"undici@7.x": "^7.29.0",
|
|
91
|
+
"brace-expansion@1.x": "^1.1.18",
|
|
92
|
+
"brace-expansion@2.x": "^2.1.4"
|
|
88
93
|
}
|
|
89
94
|
}
|
|
@@ -54,6 +54,39 @@ export class FunctionBridge {
|
|
|
54
54
|
Object.entries(trustedToolsByServer).forEach(([serverName, tools]) => {
|
|
55
55
|
this.trustedToolsByServer.set(serverName, new Set(tools));
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
this.warnIfGlobalWildcard();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A global trusted-tools list containing '*' trusts nothing: the global list is
|
|
63
|
+
* matched literally in handleFunctionCall, so every call still hits the approval
|
|
64
|
+
* gate. That fail-closed behaviour is deliberate — honouring a global wildcard
|
|
65
|
+
* would silently switch off every approval prompt on upgrade — but it is invisible
|
|
66
|
+
* to a user who believes they disabled the prompts, so say so loudly instead.
|
|
67
|
+
*/
|
|
68
|
+
private warnIfGlobalWildcard(): void {
|
|
69
|
+
// In 'never' mode nothing is gated at all, so the message would be pure noise.
|
|
70
|
+
if (this.approvalMode === 'never' || !this.trustedTools.has('*')) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 'always' mode never consults trusted lists, so recommending a per-server list
|
|
75
|
+
// on its own would send the user to a setting that changes nothing for them.
|
|
76
|
+
const remedy =
|
|
77
|
+
this.approvalMode === 'always'
|
|
78
|
+
? 'This mode ignores trusted tools entirely: set MCP_APPROVAL_MODE=trusted first, then ' +
|
|
79
|
+
'use MCP_TRUSTED_TOOLS_<SERVER> (mcp_bridge.trusted_tools_by_server) to trust one ' +
|
|
80
|
+
'server — or use MCP_APPROVAL_MODE=never to skip approval entirely.'
|
|
81
|
+
: 'To trust every tool of one server use MCP_TRUSTED_TOOLS_<SERVER> ' +
|
|
82
|
+
'(mcp_bridge.trusted_tools_by_server); to skip approval entirely use ' +
|
|
83
|
+
'MCP_APPROVAL_MODE=never.';
|
|
84
|
+
|
|
85
|
+
logger.warn(
|
|
86
|
+
"Ignoring '*' in the global trusted tools list (MCP_TRUSTED_TOOLS, config key " +
|
|
87
|
+
'mcp_bridge.trusted_tools): a global wildcard is matched literally, trusts no tool, ' +
|
|
88
|
+
`and approval is still required. ${remedy}`
|
|
89
|
+
);
|
|
57
90
|
}
|
|
58
91
|
|
|
59
92
|
async getFunctionDefinitions(): Promise<FunctionDefinition[]> {
|
|
@@ -392,6 +425,7 @@ export class FunctionBridge {
|
|
|
392
425
|
): void {
|
|
393
426
|
this.trustedTools = new Set(trustedTools);
|
|
394
427
|
logger.info(`Updated global trusted tools list: ${Array.from(this.trustedTools).join(', ')}`);
|
|
428
|
+
this.warnIfGlobalWildcard();
|
|
395
429
|
|
|
396
430
|
if (trustedToolsByServer) {
|
|
397
431
|
this.trustedToolsByServer.clear();
|
|
@@ -2,6 +2,9 @@ import { describe, it, expect, jest, beforeEach, afterEach } from '@jest/globals
|
|
|
2
2
|
import { ApprovalService } from '../src/services/approval';
|
|
3
3
|
import { FunctionBridge } from '../src/services/function-bridge';
|
|
4
4
|
import { MCPClientManager } from '../src/services/mcp-client-manager';
|
|
5
|
+
// Real logger singleton: `jest.mock(path)` below is a no-op under this repo's
|
|
6
|
+
// ts-jest ESM config, so warning assertions must spy on the real object.
|
|
7
|
+
import { logger } from '../src/utils/logger.js';
|
|
5
8
|
|
|
6
9
|
// Mock loggers to avoid console noise during tests
|
|
7
10
|
jest.mock('../src/utils/logger');
|
|
@@ -193,3 +196,356 @@ describe('ApprovalService.consumeApproval (AC-R5S9MH.1)', () => {
|
|
|
193
196
|
expect(service.consumeApproval(request.id)).toBe(false);
|
|
194
197
|
});
|
|
195
198
|
});
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Tool-argument schema validation (FunctionBridge.validateToolArguments).
|
|
202
|
+
*
|
|
203
|
+
* Exercised through the public surface: getFunctionDefinitions() caches each
|
|
204
|
+
* MCP tool's inputSchema, then handleFunctionCall() validates the cleaned args
|
|
205
|
+
* against it before dispatching to the MCP server.
|
|
206
|
+
*
|
|
207
|
+
* This is the project's only Ajv surface, and Ajv resolves `$ref` URIs through
|
|
208
|
+
* fast-uri — so these tests also pin the behaviour that the `fast-uri` override
|
|
209
|
+
* in package.json governs. Approval mode is 'never' so every call reaches the
|
|
210
|
+
* validation branch without an approval round-trip.
|
|
211
|
+
*/
|
|
212
|
+
describe('FunctionBridge tool-argument validation', () => {
|
|
213
|
+
let approvalService: ApprovalService;
|
|
214
|
+
let mcpManager: MCPClientManager;
|
|
215
|
+
let functionBridge: FunctionBridge;
|
|
216
|
+
|
|
217
|
+
const toolWithRefSchema = {
|
|
218
|
+
serverName: 'files',
|
|
219
|
+
name: 'read_file',
|
|
220
|
+
description: 'Read a file',
|
|
221
|
+
inputSchema: {
|
|
222
|
+
type: 'object',
|
|
223
|
+
properties: {
|
|
224
|
+
path: { $ref: '#/$defs/nonEmptyString' },
|
|
225
|
+
maxBytes: { type: 'integer', minimum: 1 },
|
|
226
|
+
},
|
|
227
|
+
required: ['path'],
|
|
228
|
+
$defs: {
|
|
229
|
+
nonEmptyString: { type: 'string', minLength: 1 },
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
beforeEach(async () => {
|
|
235
|
+
approvalService = new ApprovalService(300);
|
|
236
|
+
mcpManager = new MCPClientManager([]);
|
|
237
|
+
functionBridge = new FunctionBridge(mcpManager, approvalService, [], 'never');
|
|
238
|
+
|
|
239
|
+
jest.spyOn(mcpManager, 'listAllTools').mockResolvedValue([toolWithRefSchema]);
|
|
240
|
+
// Populates the internal schema cache keyed by `${serverName}:${name}`
|
|
241
|
+
await functionBridge.getFunctionDefinitions();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
afterEach(() => {
|
|
245
|
+
approvalService.shutdown();
|
|
246
|
+
jest.restoreAllMocks();
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('compiles a $ref/$defs schema and accepts valid arguments', async () => {
|
|
250
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
251
|
+
|
|
252
|
+
const result = await functionBridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
253
|
+
path: '/etc/hosts',
|
|
254
|
+
maxBytes: 1024,
|
|
255
|
+
_mcp_server: 'files',
|
|
256
|
+
_mcp_tool: 'read_file',
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
expect(result.success).toBe(true);
|
|
260
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'read_file', {
|
|
261
|
+
path: '/etc/hosts',
|
|
262
|
+
maxBytes: 1024,
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it('rejects arguments that violate the schema and does not call the tool', async () => {
|
|
267
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
268
|
+
|
|
269
|
+
// `path` resolves through $ref to { minLength: 1 } — an empty string fails
|
|
270
|
+
const result = await functionBridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
271
|
+
path: '',
|
|
272
|
+
_mcp_server: 'files',
|
|
273
|
+
_mcp_tool: 'read_file',
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
expect(result.success).toBe(false);
|
|
277
|
+
expect(result.error).toContain('Invalid arguments for files:read_file');
|
|
278
|
+
expect(callToolSpy).not.toHaveBeenCalled();
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('rejects a missing required property', async () => {
|
|
282
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
283
|
+
|
|
284
|
+
const result = await functionBridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
285
|
+
maxBytes: 10,
|
|
286
|
+
_mcp_server: 'files',
|
|
287
|
+
_mcp_tool: 'read_file',
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
expect(result.success).toBe(false);
|
|
291
|
+
expect(result.error).toContain('Invalid arguments for files:read_file');
|
|
292
|
+
expect(callToolSpy).not.toHaveBeenCalled();
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it("strips unknown properties before dispatch (Ajv removeAdditional: 'all')", async () => {
|
|
296
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
297
|
+
|
|
298
|
+
const result = await functionBridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
299
|
+
path: '/etc/hosts',
|
|
300
|
+
smuggled: 'should-not-reach-the-server',
|
|
301
|
+
_mcp_server: 'files',
|
|
302
|
+
_mcp_tool: 'read_file',
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
expect(result.success).toBe(true);
|
|
306
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'read_file', { path: '/etc/hosts' });
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it('skips validation when no schema is cached for the tool', async () => {
|
|
310
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
311
|
+
|
|
312
|
+
// `files:write_file` was never returned by listAllTools, so no schema exists
|
|
313
|
+
const result = await functionBridge.handleFunctionCall('duckA', 'mcp__files__write_file', {
|
|
314
|
+
anything: 123,
|
|
315
|
+
_mcp_server: 'files',
|
|
316
|
+
_mcp_tool: 'write_file',
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
expect(result.success).toBe(true);
|
|
320
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'write_file', { anything: 123 });
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* FR 8WGQ4P — trusted-tool resolution (issue #129).
|
|
326
|
+
*
|
|
327
|
+
* A global `'*'` is matched literally and therefore trusts nothing; that
|
|
328
|
+
* fail-closed behaviour is deliberate and stays. What is missing is a loud
|
|
329
|
+
* warning (AC.1/AC.2). AC.3/AC.4 pin the surrounding resolution rules — the
|
|
330
|
+
* per-server list *replaces* the global one, and `always` mode ignores trust
|
|
331
|
+
* entirely — so a future refactor cannot quietly loosen them.
|
|
332
|
+
*
|
|
333
|
+
* Every case asserts both the returned result shape and the `callTool` spy, so
|
|
334
|
+
* no test can pass vacuously. Bridges are built inside each test (not in
|
|
335
|
+
* `beforeEach`) because the warning fires at construction time and the
|
|
336
|
+
* `logger.warn` spy has to be installed first.
|
|
337
|
+
*/
|
|
338
|
+
describe('trusted-tool resolution', () => {
|
|
339
|
+
let approvalService: ApprovalService;
|
|
340
|
+
let mcpManager: MCPClientManager;
|
|
341
|
+
let warnSpy: ReturnType<typeof jest.spyOn>;
|
|
342
|
+
|
|
343
|
+
// The wildcard warning must name both routes the global list can arrive by.
|
|
344
|
+
const ENV_KEY = 'MCP_TRUSTED_TOOLS';
|
|
345
|
+
const CONFIG_KEY = 'mcp_bridge.trusted_tools';
|
|
346
|
+
|
|
347
|
+
/** Flattened text of every logger.warn call, for substring assertions. */
|
|
348
|
+
const warnings = (): string[] =>
|
|
349
|
+
warnSpy.mock.calls.map((call) => (call as unknown[]).map((arg) => String(arg)).join(' '));
|
|
350
|
+
|
|
351
|
+
const wildcardWarnings = (): string[] =>
|
|
352
|
+
warnings().filter((text) => text.includes(ENV_KEY) || text.includes(CONFIG_KEY));
|
|
353
|
+
|
|
354
|
+
beforeEach(() => {
|
|
355
|
+
approvalService = new ApprovalService(300);
|
|
356
|
+
mcpManager = new MCPClientManager([]);
|
|
357
|
+
// Installed before any bridge is constructed, so constructor-time warnings are captured.
|
|
358
|
+
warnSpy = jest.spyOn(logger, 'warn').mockImplementation(() => logger);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
afterEach(() => {
|
|
362
|
+
approvalService.shutdown();
|
|
363
|
+
jest.restoreAllMocks();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// ---- AC-8WGQ4P.1: fail closed on a global wildcard, and say so -----------
|
|
367
|
+
|
|
368
|
+
it('AC.1 refuses a call when the global list is ["*"] in trusted mode', async () => {
|
|
369
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
370
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, ['*'], 'trusted');
|
|
371
|
+
|
|
372
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
373
|
+
path: '/a.txt',
|
|
374
|
+
_mcp_server: 'files',
|
|
375
|
+
_mcp_tool: 'read_file',
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
expect(result.success).toBe(false);
|
|
379
|
+
expect(result.needsApproval).toBe(true);
|
|
380
|
+
expect(result.approvalId).toBeDefined();
|
|
381
|
+
expect(callToolSpy).not.toHaveBeenCalled();
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
it('AC.1 warns exactly once at construction, naming MCP_TRUSTED_TOOLS and mcp_bridge.trusted_tools', () => {
|
|
385
|
+
new FunctionBridge(mcpManager, approvalService, ['*'], 'trusted');
|
|
386
|
+
|
|
387
|
+
const matched = wildcardWarnings();
|
|
388
|
+
expect(matched).toHaveLength(1);
|
|
389
|
+
expect(matched[0]).toContain(ENV_KEY);
|
|
390
|
+
expect(matched[0]).toContain(CONFIG_KEY);
|
|
391
|
+
// No other warning noise from construction.
|
|
392
|
+
expect(warnSpy).toHaveBeenCalledTimes(1);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
it('AC.1 emits no wildcard warning for a non-wildcard global list', () => {
|
|
396
|
+
new FunctionBridge(mcpManager, approvalService, ['read_file', 'files:write_file'], 'trusted');
|
|
397
|
+
|
|
398
|
+
expect(wildcardWarnings()).toHaveLength(0);
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
// ---- AC-8WGQ4P.2: the warning is mode-aware and not constructor-only -----
|
|
402
|
+
|
|
403
|
+
it('AC.2 suppresses the wildcard warning in never mode', () => {
|
|
404
|
+
new FunctionBridge(mcpManager, approvalService, ['*'], 'never');
|
|
405
|
+
|
|
406
|
+
expect(wildcardWarnings()).toHaveLength(0);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
it('AC.2 warns when updateTrustedTools swaps in a global wildcard at runtime', () => {
|
|
410
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, ['read_file'], 'trusted');
|
|
411
|
+
expect(wildcardWarnings()).toHaveLength(0);
|
|
412
|
+
|
|
413
|
+
bridge.updateTrustedTools(['*']);
|
|
414
|
+
|
|
415
|
+
const matched = wildcardWarnings();
|
|
416
|
+
expect(matched).toHaveLength(1);
|
|
417
|
+
expect(matched[0]).toContain(ENV_KEY);
|
|
418
|
+
expect(matched[0]).toContain(CONFIG_KEY);
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
// In 'always' mode the per-server remedy is inert on its own (AC.4 pins that
|
|
422
|
+
// trusted lists are ignored there), so the warning must lead with the mode switch.
|
|
423
|
+
it('AC.2 tells an always-mode user to switch mode before recommending a per-server list', () => {
|
|
424
|
+
new FunctionBridge(mcpManager, approvalService, ['*'], 'always');
|
|
425
|
+
|
|
426
|
+
const matched = wildcardWarnings();
|
|
427
|
+
expect(matched).toHaveLength(1);
|
|
428
|
+
expect(matched[0]).toContain('MCP_APPROVAL_MODE=trusted');
|
|
429
|
+
expect(matched[0]).toContain('ignores trusted tools entirely');
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// ---- AC-8WGQ4P.3: per-server resolution shadows the global list ----------
|
|
433
|
+
|
|
434
|
+
it('AC.3 per-server ["*"] auto-approves any tool on that server', async () => {
|
|
435
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
436
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, [], 'trusted', {
|
|
437
|
+
files: ['*'],
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__delete_file', {
|
|
441
|
+
path: '/a.txt',
|
|
442
|
+
_mcp_server: 'files',
|
|
443
|
+
_mcp_tool: 'delete_file',
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
expect(result.success).toBe(true);
|
|
447
|
+
expect(result.needsApproval).toBeUndefined();
|
|
448
|
+
expect(callToolSpy).toHaveBeenCalledTimes(1);
|
|
449
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'delete_file', { path: '/a.txt' });
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('AC.3 per-server list naming the tool exactly auto-approves it', async () => {
|
|
453
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
454
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, [], 'trusted', {
|
|
455
|
+
files: ['read_file'],
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
459
|
+
path: '/a.txt',
|
|
460
|
+
_mcp_server: 'files',
|
|
461
|
+
_mcp_tool: 'read_file',
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
expect(result.success).toBe(true);
|
|
465
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'read_file', { path: '/a.txt' });
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
it('AC.3 per-server list that omits the tool requires approval', async () => {
|
|
469
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
470
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, [], 'trusted', {
|
|
471
|
+
files: ['read_file'],
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__write_file', {
|
|
475
|
+
path: '/a.txt',
|
|
476
|
+
_mcp_server: 'files',
|
|
477
|
+
_mcp_tool: 'write_file',
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
expect(result.success).toBe(false);
|
|
481
|
+
expect(result.needsApproval).toBe(true);
|
|
482
|
+
expect(callToolSpy).not.toHaveBeenCalled();
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it('AC.3 a per-server list replaces the global list rather than extending it', async () => {
|
|
486
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
487
|
+
// `write_file` is globally trusted, but `files` has its own (narrower) list.
|
|
488
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, ['write_file'], 'trusted', {
|
|
489
|
+
files: ['read_file'],
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__write_file', {
|
|
493
|
+
path: '/a.txt',
|
|
494
|
+
_mcp_server: 'files',
|
|
495
|
+
_mcp_tool: 'write_file',
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
expect(result.success).toBe(false);
|
|
499
|
+
expect(result.needsApproval).toBe(true);
|
|
500
|
+
expect(callToolSpy).not.toHaveBeenCalled();
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
// ---- AC-8WGQ4P.4: global key forms, and `always` ignores trust -----------
|
|
504
|
+
|
|
505
|
+
it('AC.4 global list auto-approves a bare tool name', async () => {
|
|
506
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
507
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, ['read_file'], 'trusted');
|
|
508
|
+
|
|
509
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
510
|
+
path: '/a.txt',
|
|
511
|
+
_mcp_server: 'files',
|
|
512
|
+
_mcp_tool: 'read_file',
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
expect(result.success).toBe(true);
|
|
516
|
+
expect(result.needsApproval).toBeUndefined();
|
|
517
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'read_file', { path: '/a.txt' });
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('AC.4 global list auto-approves a server:tool composite key', async () => {
|
|
521
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
522
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, ['files:read_file'], 'trusted');
|
|
523
|
+
|
|
524
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
525
|
+
path: '/a.txt',
|
|
526
|
+
_mcp_server: 'files',
|
|
527
|
+
_mcp_tool: 'read_file',
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
expect(result.success).toBe(true);
|
|
531
|
+
expect(callToolSpy).toHaveBeenCalledWith('files', 'read_file', { path: '/a.txt' });
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
it('AC.4 always mode ignores trusted lists even with a per-server wildcard', async () => {
|
|
535
|
+
const callToolSpy = jest.spyOn(mcpManager, 'callTool').mockResolvedValue({ ok: true });
|
|
536
|
+
const bridge = new FunctionBridge(mcpManager, approvalService, ['*'], 'always', {
|
|
537
|
+
files: ['*'],
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
const result = await bridge.handleFunctionCall('duckA', 'mcp__files__read_file', {
|
|
541
|
+
path: '/a.txt',
|
|
542
|
+
_mcp_server: 'files',
|
|
543
|
+
_mcp_tool: 'read_file',
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
expect(result.success).toBe(false);
|
|
547
|
+
expect(result.needsApproval).toBe(true);
|
|
548
|
+
expect(result.approvalId).toBeDefined();
|
|
549
|
+
expect(callToolSpy).not.toHaveBeenCalled();
|
|
550
|
+
});
|
|
551
|
+
});
|