Skip to content

search: the redaction fast path lets through every text sessionpipe-core 0.19 redacts - #277

Open
connorburgess wants to merge 4 commits into
spacesheep-dev:mainfrom
connorburgess:fix/search-fastpath-core-019
Open

connorburgess wants to merge 4 commits into
spacesheep-dev:mainfrom
connorburgess:fix/search-fastpath-core-019

Conversation

@connorburgess

@connorburgess connorburgess commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Updated against v0.8.19 / main e8bfe999 on 2026-12-05. Current validation and refresh details.

What

Search's redaction fast path (server/search/sources/text.ts) now sends every text that sessionpipe-core 0.18 and later can redact through redactSecrets. Those versions added cookie, named-value and link-query rules under the same ruleset id, secrets@1. Once the core bump in #271 lands, the search index will no longer keep a cookie or a ?sig= value that core itself removes.

On main today nothing leaks: the pinned core 0.17.0 does not redact these texts, so skipping them changes nothing. This PR gets the fast path ready for #271 and does not bump the dependency.

Why

redact() skips redactSecrets when MAYBE_SECRET finds no trigger and RULESET_SECRETS === "secrets@1". Core kept that id while adding text rules:

  • f31fc51, 556a8c0: cookies (Cookie:, Set-Cookie, HTTP_COOKIE, --cookie, curl's -b '…', added cookie …), plus a value named Authorization or a cookie in an object ({"name":"sid","value":"…","domain":"…","path":"/"}, addCookies([…])).
  • c410cf4: a link's query key (?k=, sig, signature, x-amz-signature, x-goog-signature, after ?, & or &).

None of these words was a trigger. With core 0.19.1, each of the 16 samples now in LATER in redact.test.ts is changed by redactSecrets but was skipped by the old fast path. The guard "is bound to the ruleset" counts only TOKEN_PATTERNS, which those commits did not touch. That is why it passes on #271's CI run.

Triggers added, chosen to be the narrowest that still match core:

  • cookie, authorization, -b\s
  • (?:[?&]|&)(?:k|sig|signature|x-amz-signature|x-goog-signature)= (key was already a trigger). Bare sig would match "signal" and "design", so it is not a trigger.
  • the Kelvin sign U+212A. Core lower-cases names, and U+212A becomes k, so "cooKie" written with it is a cookie key to core.
  • a text that holds name, value and one of domain|path|expires|httponly|secure|samesite. Core needs a name or key, a value and two attributes, so this check also lets through some texts core would leave alone.

The test changes:

  • LATER holds a sample of every text rule 0.18 added. Only parity with core is asserted for them, because 0.17.0 leaves them alone.
  • The mixed-text fuzz now also draws from LATER.
  • The guard now pins the core versions this list was checked on (0.17.0, 0.19.1). A later bump has to add its rules' samples and its version.

When #271 rebases onto this, it needs no change here: 0.19.1 is already on the list.

An entry is now included under Unreleased in CHANGELOG.md. Other open PRs also add release notes; those entries may need combining as the PRs land.

Original proof (before the v0.8.18 refresh)

I ran redact.test.ts on both core versions, with and without the fix. Core 0.19.1 was installed only in a scratch copy of the tree; package.json and the lock file are unchanged.

core text.ts redact.test.ts
0.19.1 main's 2 failed | 3 passed (5)
0.19.1 this branch's 5 passed (5)
0.17.0 (pinned) main's 5 passed (5) (nothing to catch on 0.17.0)
0.17.0 (pinned) this branch's 5 passed (5)

The failures with main's text.ts on 0.19.1:

AssertionError: expected 'Cookie: sessionid=Wdkry5CJQXelsz6D' to be 'Cookie: [redacted]' // Object.is equality
AssertionError: expected 'webhook curl -H \'Set-Cookie: sid=Wdk…' to be 'webhook curl -H \'Set-Cookie: [redact…' // Object.is equality
      Tests  2 failed | 3 passed (5)

The other checks:

$ npm run typecheck
> tsc -p tsconfig.json --noEmit && tsc -p web/tsconfig.json --noEmit
(no errors)

$ npm run lint
Checked 983 files in 178ms. No fixes applied.
Found 135 warnings.
Found 1 info.
(the same warnings as main; none in the two changed files)

$ npx vitest run server/search/sources
 Test Files  8 passed (8)
      Tests  69 passed (69)
$ npm test
 Test Files  248 passed (248)
      Tests  3368 passed | 2 skipped (3370)

(On an earlier run of this branch, server/control/remote.parity.test.ts once hit its 15 s timeout while the whole suite was running. Run alone it passes, 11 tests, on main and on this branch. It does not touch search.)

Checklist

  • Every commit is signed off (git commit -s): the DCO is the only paperwork.
  • npm run typecheck && npm run lint && npm test pass; npm run test:e2e for a UI change. (No UI change.)
  • New source files start with // SPDX-License-Identifier: Apache-2.0. (No new files.)
  • No secret, real address, hostname or home path in code, fixtures or screenshots (screenshots come from --demo). (The samples are generated strings.)
  • A change to shared/* names the wire-contract change in the description. (No shared/* change.)
  • A line under Unreleased in CHANGELOG.md.

…ore 0.19 redacts

Symptom: with sessionpipe-core 0.19.1 (the bump in spacesheep-dev#271), the search index keeps
`Cookie: sessionid=…`, `curl -b 'sid=…'`, `GET /x?sig=…`,
`fetch('/dl?X-Amz-Signature=…')` and `{"name": "Authorization", "value": "…"}`
as they are, while core's own redactSecrets cuts each of them. On main (core
0.17.0) core redacts none of them, so nothing leaks today.

Cause: redact() skips redactSecrets when MAYBE_SECRET finds no trigger and the
ruleset id is secrets@1. Core 0.18 added cookie, named-value and link-query rules
under the same id (f31fc51, 556a8c0, c410cf4), and none of their words is a
trigger. redact.test.ts's guard counts only TOKEN_PATTERNS, which did not
change, so it passes on 0.19.1 too.

Fix: MAYBE_SECRET also takes `cookie`, `authorization`, `-b ` and the query keys
core reads after `?`, `&` or `&` (`k`, `sig`, `signature`,
`x-amz-signature`, `x-goog-signature`; `key` was one already), and the Kelvin
sign, which core's lower-casing turns into `k`. A text with `name` and `value`
beside a cookie attribute takes the full path too. redact.test.ts gets a sample
of every rule 0.18 added (parity only: 0.17.0 leaves them alone) and pins the
core versions the list was checked on, so the next bump has to look at it.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

The redaction fast-path compatibility fix for core 0.19.1 still applies to SessionPipe GUI v0.8.18. Merged current main (d16a2c01) into this branch; the refreshed head is 0612019c. The affected files have not changed upstream, and the original change is preserved.

Added the previously deferred Unreleased changelog entry.

Validation on this head, macOS / Node 22.23.2:

  • npm run typecheck, npm run lint, and npm run build passed. Lint has the same 135 warnings and one informational diagnostic as current main, with no errors.
  • npx vitest run --maxWorkers=2 server/search/sources/redact.test.ts: 5 tests passed.

GitHub CI run 47453784345 for head 0612019c is not green. Passed: typecheck · lint · unit · build, e2e (control channel), e2e (phone · duo), e2e (desktop 2/3), e2e (desktop 1/3). Failed: e2e (desktop 3/3), typecheck · lint · unit · build · e2e.

The desktop shard 3 failure is test/e2e/split.spec.ts:662, “covering the page locks both and

with zero background scrollbar and restores window.scrollY on close”: the restored scroll position differs by more than 2 px. Neither this PR nor its refresh changes that test or the split-panel UI. On unmodified main d16a2c01, npx playwright test test/e2e/split.spec.ts --project=desktop --grep "covering the page locks" --repeat-each=6 --workers=2 reproduced four first-attempt failures; all four passed on retry, with two other repetitions passing initially. This establishes baseline flakiness, but does not turn the failed PR run green.

A maintainer needs to rerun the failed job (and aggregate gate), or resolve the baseline flake, before merging. The job-rerun API rejected this account with HTTP 403: “Must have admin rights to Repository.”

Also checked the combined source/test changes from all 19 refreshed PRs on the same main: no source conflicts; typecheck, lint and build passed; all 252 unit-test files passed (3,439 tests, two skipped). This was a local integration check, separate from the individual PR run above. Release-note entries may still need combining as PRs land.

Additionally tested against sessionpipe-core@0.19.1 in an isolated checkout: all five redaction tests passed. Substituting current main's text.ts makes two of those tests fail. The production pin and conformance fixtures remain at 0.17.0; this fix is preparation for #271 and should land before that dependency upgrade.

Signed-off-by: Connor Burgess <connorburgesscodes@gmail.com>
@connorburgess

Copy link
Copy Markdown
Contributor Author

Merged current main (e8bfe999, v0.8.19) into this branch; the head is now 001c6a49. The merge needed one resolution, in CHANGELOG.md: this PR's Unreleased entry stays above the new 0.8.19 section. No source file of this PR changed upstream.

CI run 47499579175 for head 001c6a49 passed every job: typecheck · lint · unit · build, e2e (desktop 1/3), e2e (desktop 2/3), e2e (desktop 3/3), e2e (phone · duo), e2e (control channel) and the aggregate typecheck · lint · unit · build · e2e gate.

It took three runs on this head to get there, and I closed and reopened the PR twice to start them, since I cannot rerun jobs here. The two failed runs, and the one on the previous head, each failed a single browser test, none of which this PR touches (it changes only server/search/sources/text.ts and its test):

Locally on 001c6a49 (macOS, Node 22.23.2): npm run typecheck, npm run lint (135 warnings, no errors, as on main) and npm run build passed; npx vitest run server/search/sources/redact.test.ts: 5 tests passed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant