Skip to content

fix(skills): guard canonical stores from mirror aliases - #3714

Merged
miga-heygen merged 1 commit into
mainfrom
magi/fix-skills-mirror-alias
Sep 8, 2026
Merged

fix(skills): guard canonical stores from mirror aliases#3714
miga-heygen merged 1 commit into
mainfrom
magi/fix-skills-mirror-alias

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

Summary

Global skill mirroring now proves that each agent target is filesystem-distinct from the canonical Claude and universal stores before creating, deleting, copying, or linking anything. Symlink aliases and unresolvable loops are skipped and reported, so an update cannot delete the source skill through an alias and replace it with a self-pointing link.

The guard resolves missing tails through their nearest existing ancestor, compares canonical path overlap and device/inode identity, and rechecks immediately before each destructive per-skill operation. A final per-skill symlink remains safe and supported because removal unlinks that entry without traversing its target; this preserves normal Unix idempotency and Windows copy refreshes.

Validation

  • Skills mirror suite: 14/14 tests passed, including absolute, relative, intermediate-directory, and ELOOP aliases.
  • Skills command suite: 40/40 tests passed.
  • Targeted strict TypeScript check for the mirror and generated agent-directory table passed.
  • Changed-file format, lint, and diff checks passed.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Fallow audit report

Found 1 finding.

Details
Severity Rule Location Description
minor fallow/high-cognitive-complexity packages/cli/src/utils/skillsMirror.ts:244 'mirrorGlobalSkills' has cognitive complexity 17 (threshold: 15)

Generated by fallow.

@miga-heygen miga-heygen 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.

Reviewed: symlink-alias safety hardening for skill mirror. targetSafety correctly fails closed using realpath resolution, inode comparison, and path overlap detection. Self-loop and intermediate alias cases tested. Important safety fix. — Miga

@miga-heygen
miga-heygen enabled auto-merge (squash) September 8, 2026 18:09
@miga-heygen
miga-heygen merged commit e5a6023 into main Sep 8, 2026
48 of 49 checks passed
@miga-heygen
miga-heygen deleted the magi/fix-skills-mirror-alias branch September 8, 2026 18:10
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.

2 participants