Skip to content

feat: explicit consent for /etc/wsl.conf — opk wsl-add-opencode-1-fix - #103

Merged
steffenmaechtel merged 2 commits into
masterfrom
feature/wsl-conf-user-consent
Sep 25, 2026
Merged

steffenmaechtel merged 2 commits into
masterfrom
feature/wsl-conf-user-consent

Conversation

@steffenmaechtel

Copy link
Copy Markdown
Owner

What

The kit never writes /etc/wsl.conf on its own anymore. A new explicit
command, sudo opk wsl-add-opencode-1-fix, is the only code path that
writes the file — install/update deploy the browser-bridge stand-in tree
and strip kit-owned legacy content, nothing more.

Why

Issue #100 showed what an implicit wsl.conf write costs when it goes
wrong: WSL aborted parsing the whole file and the user's own settings
silently stopped applying. A yes/no prompt buried in the install flow is
not informed consent for editing user-owned system config either — the
[automount] hardening was written after exactly such a prompt.
Policy record: docs/design/wsl-conf-consent.md; repo rule added to
AGENTS.md.

Changes

  • sh/wsl-browser-bridge.sh refactored: deploy_tree (tree only),
    strip_legacy (0.0.36 regression cleanup, never writes), install =
    tree + strip, write_conf reserved for the explicit command. Existing
    carriers are never touched by updates.
  • new opk wsl-add-opencode-1-fix (bin/opk): deploys the stand-in and
    writes the pure-comment carrier block (WSL-silent on every version,
    issue opencode permission kit 0.0.36 issue with /etc/wsl.conf #100); idempotent; falls back to carrier-only when an older
    deploy already has the tree. Fixed along the way: install.sh/update.sh
    now actually deploy bin/browser-bridge into the library (it was only
    in the fetch lists, so the command errored on real installs).
  • the [automount] /mnt/c hardening is no longer prompted+written by
    install.sh — it prints the ready-to-run snippet (resolved uid/gid)
    instead; final warning and wrapper/status hints adapted.
  • opk status distinguishes "stand-in only" from "fully active" and
    names the command; the wrapper and update.sh point at it too.
  • uninstall asks before removing kit-owned wsl.conf content (default
    yes, --yes assumes yes); declining prints the exact line range to
    delete by hand — after uninstall there is no opk left to do it.

Validation

  • make test (28 browser-bridge tests incl. all three parser
    simulations and the consent assertions, 45 wsl-exposure checks),
    make lint — green
  • make e2e (269 passed), make e2e-rootless (47 passed)
  • live on a hardened WSL install: opk status shows "stand-in only —
    no wsl.conf carrier" with the fix hint, sudo opk wsl-add-opencode-1-fix
    writes the block, login flow survives via the stand-in

Follow-up of #100 (its carrier mechanism is unchanged — only who writes
it, when).

The kit never writes /etc/wsl.conf on its own anymore (policy:
docs/design/wsl-conf-consent.md, rule in AGENTS.md):

- install.sh/update.sh deploy only the browser-bridge stand-in tree and
  strip kit-owned legacy content (the broken 0.0.36 section); the wsl.conf
  carrier block is never written implicitly. An existing carrier stays
  untouched and keeps working.
- new 'sudo opk wsl-add-opencode-1-fix' (bin/opk): the single command
  that writes wsl.conf — deploys the stand-in and writes the pure-comment
  carrier block (WSL-silent, issue #100). status.sh distinguishes
  stand-in-only from fully active and names the command; the wrapper and
  update.sh point at it too.
- the [automount] /mnt/c hardening is no longer prompted+written by
  install.sh — it prints the ready-to-run snippet (resolved uid/gid)
  instead; the kit never edits the file.
- uninstall asks before removing kit-owned wsl.conf content (default yes,
  --yes assumes yes); declining prints the exact line range to delete by
  hand. The stand-in tree always goes.

Docs: design record, security model, files/cli/troubleshooting/uninstall
pages, AGENTS rule. Tests: consent-policy coverage (install leaves
wsl.conf byte-for-byte untouched, legacy strip, uninstall prompt), parser
simulations unchanged. make test / lint green; e2e 269 passed,
e2e-rootless 47 passed.
…s older deploys

The wsl-add-opencode-1-fix command sourced the stand-in from
$LIBDIR/bin/browser-bridge — a file neither install.sh nor update.sh ever
deployed (only the fetch lists carried it; the stand-in went straight
into the wsl/ tree), so the command errored out on every real install.

- install.sh + update.sh now deploy bin/browser-bridge (755) with the
  library
- the command redeploy from the library when present, falls back to
  write-only when just the tree exists (updates from older kits), and
  only errors when neither is there
- files.md row updated; static deploy-list check added

@steffenmaechtel steffenmaechtel left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

@steffenmaechtel
steffenmaechtel merged commit 081428c into master Sep 25, 2026
6 checks passed
@steffenmaechtel
steffenmaechtel deleted the feature/wsl-conf-user-consent branch September 25, 2026 20:02
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