Skip to content

Fix: omarchy plugin clone can generate a colliding plugin id - #1

Closed
baron-hines wants to merge 1 commit into
quattrofrom
03-plugin-clone-id-collision
Closed

baron-hines wants to merge 1 commit into
quattrofrom
03-plugin-clone-id-collision

Conversation

@baron-hines

Copy link
Copy Markdown
Owner

Problem

omarchy plugin clone <builtin> derives the new clone's id from $USER as roughly <username>.<plugin>. When the username matches the namespace of a built-in plugin, the generated id collides with the built-in itself.

Concrete case — the stock Omarchy VM's default username is literally omarchy, so:

omarchy plugin clone omarchy.weather

generates the clone id omarchy.weather — the same id as the built-in weather plugin. The clone can't be distinguished from what it was cloned from. This is not hypothetical: any user cloning an omarchy.* built-in on a stock install hits it.

Fix

After computing the candidate id, check it against every id in omarchy-plugin-catalog (built-in or already-cloned) and against any existing plugin directory, and suffix a counter until the id is free. The directory-existence guard is folded into the same check so a clone never clobbers an existing one.

  • Normal usernames are unaffected (baron.weather, etc.).
  • The collision case now yields omarchy.weather2 instead of shadowing the built-in.

Testing

# as user "omarchy":
omarchy plugin clone omarchy.weather   # -> clone id omarchy.weather2 (was: omarchy.weather)
# as any other user:
omarchy plugin clone omarchy.weather   # -> <user>.weather, unchanged

🤖 Generated with Claude Code

`omarchy plugin clone <builtin>` derives the clone id from the username as
`<user>.<plugin>`. When the username matches a built-in namespace this can
equal a built-in's own id. The stock Omarchy VM user is literally `omarchy`,
so `omarchy plugin clone omarchy.weather` generated the id `omarchy.weather` —
identical to the built-in weather plugin — leaving the clone indistinguishable
from what it was cloned from.

Check the candidate id against every catalog id (built-in or already-cloned)
and against any existing plugin directory, and suffix a counter until the id
is unique. Normal usernames are unaffected; the collision case now yields
`omarchy.weather2` instead of shadowing the built-in.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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