Skip to content

Packs: compare destinations the way the gateway reads them; say what a rename brings - #361

Merged
fylorn merged 1 commit into
feat/sync-backupfrom
feat/pack-fixes-3
Oct 19, 2026
Merged

fylorn merged 1 commit into
feat/sync-backupfrom
feat/pack-fixes-3

Conversation

@fylorn

@fylorn fylorn commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Third round of review fixes for reusing local secrets on import, plus a safe-mode restore gap.

Destinations

  • export::destination() now parses with the url crate, the same parser reqwest uses. A backslash separates the path exactly as it does when the request goes out (https://evil.example\@relay.example/v1 is evil.example), hosts are normalized (case, IDN to punycode, IPv6 and IPv4 canonical forms), and default ports are filled in. A trailing dot is kept: a single-label name with and without it may resolve differently.
  • tw-config refuses upstream addresses that contain a backslash (config.base_url_backslash) or a user name or password before the host (config.base_url_userinfo; the message leaves the address out because that part is a password). A configuration that already has such an address loads in safe mode after the upgrade.
  • The outbound proxy an upstream goes through is part of its destination: direct, system, or the referenced proxy's type and address (looked up in the pack first, then here). Same address but a different route means the keys here are not reused.

Import preview

  • ImportRow.rename_flags: ImportFlag[] lists the flags an item gets when imported under another name, which never takes the keys or sign-ins here. It is set on rows that have suggested_name and empty otherwise. The CLI prints it for conflicts and when a rename is chosen, and now prints flags for new items too.

Restore

  • A whole restore (safe mode) of a version from the sync location brings back the upstreams in sync.exclude and the items that follow them (groups, routes, aliases, gateway keys), copied as written, sign-ins included, from the current text or the newest readable version. Plugins are not brought back.

Tests

Regression tests: backslash and userinfo addresses (destination and import errors), destination normalization (case, default port, IDN, IPv6, IPv4 forms, trailing dot, userinfo), a new or moved outbound proxy versus the same proxy under another name, truthful rename flags in the preview and on the wire, and the safe-mode whole restore keeping non-synced upstreams with their routes and keys.

🤖 Generated with Claude Code

…a rename brings

- destination() parses with the url crate, the parser reqwest uses: a
  backslash separates the path as it does when the request goes out, and
  hosts are normalized (case, punycode, IPv6/IPv4 forms) with default ports
  filled in. A trailing dot stays a different name.
- Upstream addresses with a backslash or a user name/password before the
  host are refused (config.base_url_backslash, config.base_url_userinfo).
- The outbound proxy an upstream goes through is part of its destination:
  direct, system, or the proxy's type and address. A different route keeps
  this machine's keys out.
- ImportRow.rename_flags tells what an item brings when imported under
  another name (it never takes the keys or sign-ins here); the CLI says so.
- A whole restore of a version from the sync location brings back the
  upstreams this machine does not sync, and what follows them, from the
  configuration here or the newest readable version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the feat/pack-fixes-3 branch from 7b776af to 39682ed Compare October 19, 2026 12:30
@fylorn
fylorn merged commit 1314b1a into feat/sync-backup Oct 19, 2026
7 checks passed
@fylorn
fylorn deleted the feat/pack-fixes-3 branch October 19, 2026 12:48
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant