Repository navigation
Commit b0ee1a6
committed
fix(git): sandbox validate_repo_path to cwd when --repository is unset
Closes the partial-bypass of CVE-2025-68145 (GHSA-j22h-9j4x-23w5)
by the `None` branch of `validate_repo_path` / `serve(repository: Path | None)`.
The CVE-2025-68145 patch (commit a37158b, 2025-12-17) added path
validation for the `--repository IS set` case but explicitly preserved
the unspec branch as 'backward compatibility when --repository is not set'
— making the bypass a known design choice.
Bug class first disclosed in modelcontextprotocol#604 (open
since 2025-02-07). Proposed fix in PR modelcontextprotocol#630 has been open for 17+ months
without merge.
Fix: when `allowed_repository is None`, fall back to `Path.cwd()` as
an implicit sandbox rather than accepting any git working tree on the
host. Operators who legitimately need cross-repo access should pass
`--repository` explicitly.
A warning is logged at server start when no `--repository` flag is
present so the default posture is visible to operators.
Cross-references:
- Issue modelcontextprotocol#604: modelcontextprotocol#604
- PR modelcontextprotocol#630: modelcontextprotocol#630
- CVE-2025-68145: GHSA-j22h-9j4x-23w5
- Analysis: https://github.com/ahmadfardan464-cmyk/servers/blob/fix/validate_repo_path-none-fallback/SECURITY-NOTE.md1 parent d31124c commit b0ee1a6
2 files changed
Lines changed: 42 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
254 | 266 | | |
255 | | - | |
| 267 | + | |
256 | 268 | | |
257 | 269 | | |
258 | 270 | | |
| |||
308 | 320 | | |
309 | 321 | | |
310 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
311 | 333 | | |
312 | 334 | | |
313 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
283 | | - | |
284 | | - | |
285 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
286 | 301 | | |
287 | 302 | | |
288 | 303 | | |
| |||
0 commit comments