Repository navigation
Commit 3463f09
fix: ledger redaction — preserve write paths and close a curl -u credential leak introduced by #1117
`SessionCompaction.redactLedgerDetail` called `Telemetry.maskString` before
its own curl-credential redaction. #1117 added a filesystem-path masking
pass to `maskString` that collapses any 2+ segment path — including
`/usr/bin/curl` — to the literal `<path>` before the curl-context lookback
ran. Two consequences:
- Every write path in the ledger collapsed to `<path>`, so the ledger could
no longer report which file was written (4 failing tests).
- With the `curl` token gone, the curl-context lookback found nothing, so a
path-qualified curl invocation's space-separated `-u user password`
(non-colon-shaped, so not otherwise flagged as credential-shaped) passed
through `redactLedgerDetail` unredacted — a real credential leaking into
ledger text that is later persisted into a model prompt across compaction.
Fix:
- `Telemetry.maskString` gains an opt-out for its path-masking pass
(`maskPaths`, default `true`, unchanged for every existing caller). Every
other mask (api keys, bearer tokens, emails, internal hosts, quote
collapsing) still applies regardless.
- `redactLedgerDetail` calls `maskString(value, { maskPaths: false })`,
restoring write-path fidelity and, because the `curl` token survives,
restoring the curl-context lookback.
- Belt-and-suspenders: `redactLedgerDetail`'s curl-context detection is also
derived independently from the pre-mask raw value (correlated ordinally
against the masked-string matches), so it no longer depends solely on
`maskPaths:false` — a future masking rule that happens to eat the command
name can't quietly reopen this leak.
Adds an explicit adversarial test reproducing the leak
(`/usr/bin/curl -u alice hunter2 ...` and the `curl.exe` path-qualified
variant); confirmed it fails against pre-fix code via `git stash` and passes
after. #1117's own telemetry path-masking is untouched for its other callers
(mcp/index.ts, sql-execute.ts, tool.ts, prompt.ts, register.ts, dispatcher.ts,
registry.ts, warehouse-add.ts, project-scan.ts) — confirmed via
test/telemetry/mask-file-paths.test.ts still green.
Fixes broken main: origin/main's TypeScript CI job has been red since
~2026-09-04 07:28Z on these 5 tests, blocking all PRs. The leak itself is
main-only — not present in v0.10.0 or any released version.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VqnuBDGkh1ZT65Ti7e6DHZ1 parent 9361e0b commit 3463f09
3 files changed
Lines changed: 88 additions & 12 deletions
File tree
- packages/opencode
- src
- altimate/telemetry
- session
- test/session
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1558 | 1558 | | |
1559 | 1559 | | |
1560 | 1560 | | |
1561 | | - | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1562 | 1568 | | |
1563 | 1569 | | |
1564 | 1570 | | |
1565 | 1571 | | |
1566 | 1572 | | |
1567 | 1573 | | |
1568 | | - | |
| 1574 | + | |
1569 | 1575 | | |
1570 | 1576 | | |
1571 | 1577 | | |
| |||
1583 | 1589 | | |
1584 | 1590 | | |
1585 | 1591 | | |
1586 | | - | |
1587 | | - | |
| 1592 | + | |
| 1593 | + | |
1588 | 1594 | | |
1589 | 1595 | | |
1590 | 1596 | | |
1591 | 1597 | | |
1592 | 1598 | | |
1593 | 1599 | | |
| 1600 | + | |
1594 | 1601 | | |
1595 | 1602 | | |
1596 | | - | |
| 1603 | + | |
1597 | 1604 | | |
1598 | 1605 | | |
1599 | 1606 | | |
| |||
1604 | 1611 | | |
1605 | 1612 | | |
1606 | 1613 | | |
1607 | | - | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
1608 | 1621 | | |
1609 | 1622 | | |
1610 | 1623 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
670 | 684 | | |
671 | 685 | | |
672 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
673 | 713 | | |
674 | 714 | | |
675 | 715 | | |
676 | 716 | | |
677 | 717 | | |
678 | 718 | | |
679 | 719 | | |
680 | | - | |
| 720 | + | |
681 | 721 | | |
682 | 722 | | |
683 | 723 | | |
| |||
690 | 730 | | |
691 | 731 | | |
692 | 732 | | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
693 | 737 | | |
694 | 738 | | |
695 | 739 | | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
700 | 744 | | |
701 | 745 | | |
702 | 746 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
442 | 461 | | |
443 | 462 | | |
444 | 463 | | |
| |||
0 commit comments