GeezerVison is showing github.com — fix(browser): end the sign-in mirror cleanly and keep loopback cookies on their machine by Hona · Pull Request #486 · anomalyco/opencode-rune
Conversation
Fixes READER-12's critical #14 on #353, "Share sign-ins with remote servers" (notes/review-rd294.md, item 14). #353 is in published builds since dev-455.
The mirror is two-way, as official's is
Official packages/gui-plugins/src/browser/profile/link.ts:8-12,85-96 (at db2d889c) mirrors the person's profile and each remote server's partition both ways, with no host filter. The review assumed it was one-way; it is not.
Orchestrator decision: keep it two-way (parity), and never let loopback cookies cross. This is recorded in ours.md 4.1a.
Changes (apps/browser-engine/src/cookies.rs)
- (a) Turning sharing off while a sync is running:
- Each remote partition's mirror now has a cancel state (still sharing / sharing turned off / signed out everywhere), set by
set_share_sign_ins(false), clear_all and on_partition_dropped.
- A sync in progress checks it after reading both stores and before every write, as official checks
state.stopped (link.ts:51,55).
- When the last write of a cancelled batch has landed, the batch wipes the remote partition again. Official also waits for in-flight writes before removing cookies (
stop(forget) waits for its queues, link.ts:104-115).
- After a sign-out, the batch also removes the cookies it wrote into the person's profile.
- Turning sharing off now also clears each remote partition's HTTP sign-ins.
- (b) Loopback cookies: cookies for
localhost, *.localhost, 127.0.0.0/8 and ::1 never cross in either direction. A remote server's localhost belongs to that other machine, not to the person's own localhost.
- (c) Caller guard:
require_settings_caller (apps/desktop/.../browser/cookies.rs) also requires scope.in_flight.is_empty(), as extensions.rs and history.rs already do.
Proof (proof/previews/share-hardening/)
prove-share.ts runs against a scratch engine profile only, with a loopback page server and a loopback tunnel proxy. It runs 1500 profile cookies and 1500 remote cookies:
- A: sharing turned off at 0, 20, 60, 150, 400 and 1000 ms after turning it on.
- B: loopback cookies seeded on both sides.
- C: "Sign out everywhere" at 0 to 400 ms into a remote-to-profile sync.
Results:
| Case |
Before (#286 engine) |
After (this PR) |
| A: cookies left in the remote partition after turning sharing off |
167 (at 0 ms); 0 at the other gaps |
0 at every gap |
| B: remote loopback cookies copied into the profile |
3 |
0 |
| B: the person's loopback cookies copied to the remote |
2 |
0 |
| B: a normal remote cookie copied into the profile (two-way kept) |
yes |
yes |
| C: cookies left in the profile / remote after sign-out |
0 / 0 |
0 / 0 |
- C did not reproduce the race before the fix at these timings. It stays covered by the same cancel state.
- Files:
result-before.json, result-after.json.
Engine revision: no bump. The published engine is revision 4 and dev is already at 5.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…s on their machine (READER-12 #14)
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|