altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

refactor: consolidate loopback OAuth-callback pattern (altimate.ts + browser-handoff.ts)

Open anandgupta42 opened this issue 3 months ago • 0 comments

Found during v0.9.7 release review (Tech Lead persona), referencing the deliberate duplication called out in eb1124ee8c (#1100)'s own commit message ('shared-helper refactor is a follow-up ticket once both flows have prod experience').

packages/opencode/src/altimate/workspace/browser-handoff.ts duplicates the loopback-listener pattern from altimate.ts's gateway sign-in flow. In the process, browser-handoff.ts added a DNS-rebinding Host-header guard that altimate.ts does NOT have (confirmed via git log v0.9.6..HEAD -- .../altimate.ts = empty, i.e. altimate.ts is unchanged this release).

Scope this refactor to:

  1. Extract a shared loopback-listener helper both flows call.
  2. Backport the Host-header DNS-rebinding check into altimate.ts's sign-in flow so it gets the same hardening.

Not urgent — both flows currently work correctly on their own, this is a maintainability/consistency cleanup.

anandgupta42 avatar Aug 25 '26 23:08 anandgupta42