Skip to main content
Menu
Advisories

veans init follows repo symlinks when writing files

GHSA-RXWP-Q2QG-98VWPublished Updated GitHub

Description

Affects all veans versions (veans has no tagged release yet).

Summary

A hostile repo ships symlinks so that veans init writes outside the repo. The attacker can't control the content, so the result is file destruction or a stray global hook, not code execution. Three variants:

  • .veans.yml → ~/.bashrc: the target is overwritten on "y"; a dangling link's target is created with no prompt.
  • .claude → ~/.claude: a hook is added to the global settings.json.
  • .opencode → a global plugin is installed.

Details

There is no Lstat, O_NOFOLLOW or EvalSymlinks in veans/internal. The writes are at veans/internal/config/config.go:151-154 and veans/internal/bootstrap/hooks.go:231-234,269-281, and the overwrite check uses link-following os.Stat (veans/internal/bootstrap/bootstrap.go:320).

Impact

Loss of a user file reachable via symlink, or veans hooks/plugins installed globally for every agent session. Requires the victim to run veans init in the hostile checkout.

Fix

veans is on Go 1.27, so use os.OpenRoot(repoRoot) once and route writes through root.MkdirAll/root.WriteFile with repo-relative paths. Route the preceding reads through it too: the settings.json merge read, and os.Stat → root.Lstat. Test that outside targets error and stay untouched, and that an in-repo link still works. credentials/file.go (global XDG) is out of scope.

This is unrelated to the planned veans trust gate, because the user chose to run init in that repo.

Found via internal security review (deep #34).

Affected versions

References

GitHub · go-vikunja/vikunja