Skip to content

Fix omarchy-windows-vm username/password handling for dollar signs - #4882

Closed
ajkingio wants to merge 1 commit into
omacom:quattrofrom
ajkingio:dev
Closed

ajkingio wants to merge 1 commit into
omacom:quattrofrom
ajkingio:dev

Conversation

@ajkingio

@ajkingio ajkingio commented Mar 3, 2026 •

Copy link
Copy Markdown

The Issue

omarchy-windows-vm doesn't escape $ symbols in passwords so it thinks they are variables. It sets a chopped up version of the password in the Windows VM but uses the full password you passed in the docker compose file.

I noticed these messages during the omarchy-windows-vm install process, which tipped me off.

Starting Windows VM with docker-compose...
WARN[0000] The "t3rD" variable is not set. Defaulting to a blank string.
WARN[0000] The "R" variable is not set. Defaulting to a blank string.

So the manual fix was:

  1. omarchy-windows-vm remove
  2. omarchy-windows-vm install
  3. Use a password without dollar signs.

The Fix

Fixed omarchy-windows-vm to properly handle $ in usernames/passwords by escaping dollar signs before writing docker-compose.yml, so Docker Compose doesn’t treat them as variable interpolation. Then on launch, it unescapes when reading credentials back for RDP login. This keeps the Windows account password and the stored compose config consistent.

Copilot AI review requested due to automatic review settings March 3, 2026 00:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Sep 27, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 32be21e against dev (b9ddccf). The bug is real and this fixes it on dev.

Reproduced on a disposable Omarchy worker. I ran install and then launch -k with the prompts, Docker and xfreerdp3 stubbed, and resolved the generated compose with the real Docker Compose. A busybox container confirmed that Compose delivers $$ to the container as $.

  • On dev, a typed password pa$t3rD$R! reaches the container as pa! while RDP sends the full string. ${HOME}x becomes the home path, and a username us$er becomes us.
  • With this PR, the container and RDP get exactly what was typed in every case, including a$$b and a trailing $.
  • With the commit reverted, the mismatch comes back.

dev's test/omarchy-cli-test.sh passes with the PR merged onto current dev. The PR's own base predates test/, and no CI ran on it.

One thing outside this diff has to land first. dev is now the 3.x line that upgrades to Quattro, and on upgrade quattro's migrate_legacy_compose copies the password out of ~/.config/windows/docker-compose.yml as raw text. With this PR, that text is $$-escaped, so after the upgrade RDP sends pa$$t3rD$$R! to a guest whose password is pa$t3rD$R!, and logins fail. That also hits passwords that work on dev today, like pa$ or a$!b. I opened #13432 against quattro to decode $$ during that migration, with a test. It also fixes legacy files that already contain $$.

quattro itself already handles $, " and \ in new installs, so this change is only needed on dev.

Claude Opus 5.5 did the review, and Codex Medium reviewed it as a second opinion. Codex agreed that the escaping round-trips for any run of $ and independently traced the upgrade path to the same result; independence isn't guaranteed. It also pointed out that " and \ in a password still break the YAML on dev. That problem predates this PR and isn't changed by it.

Nothing is needed from you. This waits on the maintainer: whether dev should still take this fix, and #13432 landing before or with it.

@omarchybot
omarchybot changed the base branch from dev to quattro September 28, 2026 05:52
@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Sep 28, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Rechecked now that this targets quattro (at 324f0ba). quattro already fixes this bug, so I didn't port the change, and I recommend closing this pull request.

quattro's bin/omarchy-windows-vm was rewritten in b5ded31 (#8056), and the code this diff changes is gone:

  • The compose writer escapes \, " and then $ → $$ before writing PASSWORD (write_compose_atomically), so a password like pa$t3rD$R! reaches the guest unchanged.
  • Usernames are validated to [A-Za-z0-9_-], so a $ can't get into one.
  • Launch reads the RDP credentials from a private credentials file that stores them unescaped, and only falls back to unescape() on the compose.
  • test/shell.d/windows-vm-compose-test.sh covers a password containing $$, $HOME, a quote and a backslash round-tripping.

Porting this diff onto that code would make things worse: its unconditional $$ → $ on launch would corrupt a legitimate $$ password read from the credentials file.

This was a read of quattro against the diff; nothing was run on a worker this pass, since nothing is being ported. Claude Opus 5.5 did the check and Codex Medium reviewed it as a second opinion. Codex reached the same verdict from the code and history, and it added the point about launch-side unescaping; independence isn't guaranteed.

#13432 is separate and still open. It makes the Quattro migration decode a legacy ~/.config/windows/docker-compose.yml that already contains $$. The maintainer decides whether it's still worth taking without this change on dev.

Nothing is needed from you, and thanks for the report and fix. This waits on the maintainer to close it.

@omarchybot

Copy link
Copy Markdown
Collaborator

Thank you for this, @ajkingio. quattro already fixes this: b5ded31 (#8056) changed how omarchy-windows-vm handles the credentials, so a $ in the password no longer breaks it, and this branch's change no longer applies to the script there.

Closed at the maintainer's request. The review above has the details; it was done by Claude Opus 5.5 with Codex Medium as a second opinion, whose agreement is not independent.

@omarchybot omarchybot closed this Sep 28, 2026
omarchybot added a commit that referenced this pull request Oct 31, 2026
…igration (#13432)

* Undo Compose's $$ escaping when migrating a legacy Windows VM password

The legacy compose under ~/.config/windows holds the password as Compose reads it, so a $$ there reached the guest as $. Migration copied the raw text into the RDP credentials and re-escaped it for the new compose, leaving RDP and the new container environment with $$ while the existing guest, whose disk is preserved, still has $. Decoding $$ at the migration boundary keeps both on the password the guest actually has. This also makes #4882 safe to land on dev, which writes every $ in the password as $$.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Undo the legacy password's YAML escapes too when migrating

Compose parses the legacy PASSWORD as a YAML double-quoted string before it interpolates $$, so a legacy "a\\b\"c$$d" reached the guest as a\b"c$d. Decoding only $$ left \\ and \" in the RDP credential and the rewritten compose. unescape() already reverses exactly these layers for every other read of the compose, so use it here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: omarchybot <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Omarchybot <[email protected]>
AndrewGaspar pushed a commit to AndrewGaspar/omedora that referenced this pull request Nov 4, 2026
…igration (#13432)

* Undo Compose's $$ escaping when migrating a legacy Windows VM password

The legacy compose under ~/.config/windows holds the password as Compose reads it, so a $$ there reached the guest as $. Migration copied the raw text into the RDP credentials and re-escaped it for the new compose, leaving RDP and the new container environment with $$ while the existing guest, whose disk is preserved, still has $. Decoding $$ at the migration boundary keeps both on the password the guest actually has. This also makes omacom/omarchy#4882 safe to land on dev, which writes every $ in the password as $$.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Undo the legacy password's YAML escapes too when migrating

Compose parses the legacy PASSWORD as a YAML double-quoted string before it interpolates $$, so a legacy "a\\b\"c$$d" reached the guest as a\b"c$d. Decoding only $$ left \\ and \" in the RDP credential and the rewritten compose. unescape() already reverses exactly these layers for every other read of the compose, so use it here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: omarchybot <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: Omarchybot <[email protected]>
(cherry picked from commit 51b348bbe74483f7c1d24d6463764b96a5fef022)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants