Repository navigation
Commit 29ceaf4
authored
fix(model): resolve CLI exec paths for Windows .cmd shims (#250)
* fix(model): resolve CLI exec paths for Windows .cmd shims
- Resolve codex/claude/cursor/copilot exec paths via shutil.which at config
load so bare npm .cmd shims spawn on Windows (bare 'codex' -> codex.CMD;
CreateProcess does not search PATHEXT, so bare names raise WinError 2).
- os.symlink uses target_is_directory + copytree/copy2 fallback (OfficeQA
on Windows).
- Add tests for _resolve_cli_path.
* fix(model): fail closed on symlink collisions; redact Copilot JSONL
Address maintainer review on #250:
- prepare_workspace symlink fallback fails closed: re-raise when the
destination already exists (lexists), never copytree into an existing dst,
and only fall back for the Windows symlink-privilege-not-held error.
Prevents a colliding extra_files or duplicate link_dirs entry from mutating
source data outside the work dir.
- Sanitize Copilot stdout/stderr structurally (mapping-key aware) so JSON
objects carrying a token/secret field are redacted even when the value is
a quoted mapping (which the string-level redactor missed).
- Add tests: symlink privilege fallback, existing/duplicate dst, non-privilege
re-raise, and Copilot JSONL secret-field redaction.
* fix(model): key-aware redaction of quoted JSON in copilot/cursor traces
- Fold quoted-JSON whole-value capture into the shared _redact_cursor_error
(run first) so a quoted value with spaces is scrubbed whole instead of
truncating at the first space and leaking the remainder. One change covers
the copilot fallback, the cursor stderr paths, and all string-leaf callers.
- Regressions: prefixed/multiline quoted JSON, space-in-value, cursor parity.
* fix(model): endswith-based secret-key detection in quoted-JSON redaction
- The substring regex over-scrubbed diagnostics like token_count / token_budget /
secret_version. Decide with the project's endswith-based rule (matching
_is_secret_mapping_key) so only real credential keys are redacted, while a
quoted value that contains spaces is still captured whole.
- Regressions: token-count diagnostic retention + nested secret key.
* fix(model): also treat bare "bearer" key as a credential
- Add "bearer" to the exact secret-key set so a standalone "bearer": <value>
JSON key is scrubbed (the common "Authorization": "Bearer ..." form was
already covered via the authorization key).
- Regression: bare bearer key redaction.
* fix(model): unify copilot redaction key policy + unbounded embedded-JSON parsing
- _redact_copilot_json now uses the same endswith-based _is_copilot_secret_key as
the embedded-JSON fallback, so camelCase keys like githubToken are redacted.
- Replace the single-level regex and line-by-line parsing with a bracket-matched,
unbounded-nesting embedded-JSON scan, so deeply nested / pretty-printed JSON in
non-JSON text is structurally redacted.
- Add run-level regressions (success trace + error detail) for camelCase keys and
deep-nested embedded JSON.
---------
Co-authored-by: WODE25500 <WODE25500@users.noreply.github.com>1 parent eb8c1e7 commit 29ceaf4
5 files changed
Lines changed: 513 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
37 | 51 | | |
38 | 52 | | |
39 | 53 | | |
40 | | - | |
| 54 | + | |
41 | 55 | | |
42 | 56 | | |
43 | 57 | | |
| |||
49 | 63 | | |
50 | 64 | | |
51 | 65 | | |
52 | | - | |
| 66 | + | |
53 | 67 | | |
54 | 68 | | |
55 | 69 | | |
56 | | - | |
| 70 | + | |
57 | 71 | | |
58 | | - | |
| 72 | + | |
59 | 73 | | |
60 | 74 | | |
61 | 75 | | |
| |||
222 | 236 | | |
223 | 237 | | |
224 | 238 | | |
225 | | - | |
| 239 | + | |
226 | 240 | | |
227 | 241 | | |
228 | 242 | | |
| |||
361 | 375 | | |
362 | 376 | | |
363 | 377 | | |
364 | | - | |
| 378 | + | |
365 | 379 | | |
366 | 380 | | |
367 | 381 | | |
| |||
398 | 412 | | |
399 | 413 | | |
400 | 414 | | |
401 | | - | |
| 415 | + | |
402 | 416 | | |
403 | 417 | | |
404 | 418 | | |
| |||
433 | 447 | | |
434 | 448 | | |
435 | 449 | | |
436 | | - | |
| 450 | + | |
437 | 451 | | |
438 | 452 | | |
439 | 453 | | |
| |||
478 | 492 | | |
479 | 493 | | |
480 | 494 | | |
481 | | - | |
| 495 | + | |
482 | 496 | | |
483 | 497 | | |
484 | 498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
76 | 96 | | |
77 | 97 | | |
78 | 98 | | |
| |||
120 | 140 | | |
121 | 141 | | |
122 | 142 | | |
123 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
124 | 159 | | |
125 | 160 | | |
126 | 161 | | |
| |||
1479 | 1514 | | |
1480 | 1515 | | |
1481 | 1516 | | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
1482 | 1622 | | |
1483 | | - | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
1484 | 1626 | | |
1485 | 1627 | | |
1486 | 1628 | | |
| |||
1505 | 1647 | | |
1506 | 1648 | | |
1507 | 1649 | | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1508 | 1686 | | |
1509 | 1687 | | |
1510 | 1688 | | |
| |||
1771 | 1949 | | |
1772 | 1950 | | |
1773 | 1951 | | |
1774 | | - | |
| 1952 | + | |
1775 | 1953 | | |
1776 | | - | |
| 1954 | + | |
| 1955 | + | |
1777 | 1956 | | |
1778 | 1957 | | |
1779 | 1958 | | |
1780 | 1959 | | |
1781 | | - | |
| 1960 | + | |
1782 | 1961 | | |
1783 | 1962 | | |
1784 | 1963 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
0 commit comments