Skip to content

Remote Sources via git clone ​

Sharing a team ULIS config should not require every user to clone a repository by hand and then point ULIS at the checkout. --source and preset refs accept a git repository URL over HTTPS or SSH. One primitive does the work: shallow-clone the repository into a temporary directory, then hand that directory to the existing code paths, so build, validate, install, prune, and the ownership manifest are unchanged and nothing after the clone knows the source was remote.

We clone rather than download. An HTTPS archive download unpacked with tar was rejected because it needs a streaming download, byte caps against decompression bombs, and a tarball path-traversal guard, and it supports neither private repositories nor SSH remotes. A per-file API crawl was rejected as host-specific and slow. A preset registry was rejected as far more product than the problem requires. Cloning deletes all of that machinery and inherits the user's existing git credentials.

Refs are branches and tags only; a commit SHA is rejected, because SHA checkout needs init plus fetch plus checkout rather than clone --branch. This is a known weakness, not merely an unbuilt feature: a branch is mutable, so a source reviewed yesterday and a source that runs today can differ without anything in the consent machinery noticing. The trust gate re-shows the commands on every run, which bounds the damage to what a command list reveals, but it does not make a remote source reproducible. A branch name shaped like a short SHA is refused too, since nothing local can tell the two apart before the clone.

Remote sources execute code the user did not write, so a trust gate stands between a pasted URL and the destination: it shows every command a remote source will run and what it installs that a host agent later executes on its own, and requires confirmation. The first versions enumerated the parsed source (declared hooks, declared MCP servers), and every bypass found in review lived in the gap between what a source declares and what a generator emits: a hook derived from a security policy, an unrecognised key carried verbatim into YAML, a TOML table header spliced out of a server name. So the gate now generates the configs and reads the bytes about to be installed. Two consequences are deliberate: structural output is never built by concatenating source-controlled text, so a value cannot end its own construct; and the enumeration is treated as best-effort, so the gate is armed by the presence of a remote source rather than by a non-empty list, and says "nothing recognised" rather than "nothing to run". The TUI owns the terminal and cannot prompt on stdin, so its install review screen shows the same plan, and proceeding from it is the consent.

The gate has exactly one escape hatch: -y/--yes accepts it along with the overwrite prompt, because a non-interactive run has nobody to ask and an unanswerable prompt would only hang. A piped y does not answer it, so the hatch is a flag the user typed, never something stdin can supply. It conflates two consents (overwrite my files, run this repo's code) into one flag; a second --trust-remote flag was judged not worth the surface when the user is already naming a URL on the command line.

Consent is bound to what actually runs. The TUI review is bound to the settings it was generated from, but that is only as good as the list of settings someone remembered to include, so the installer also re-plans at execution time and refuses to run anything that differs from the command list the user saw. Settings binding catches a changed source or destination, which a command list does not describe; the command comparison catches everything else, including drift nobody anticipated.

The same "remote input is hostile" premise drives the smaller rules. Remote text is escaped before the trust gate runs, because those logs are what the user reads while deciding. On Windows, argv containing shell metacharacters or spaces is refused rather than escaped: .cmd shims force shell: true, where Node concatenates arguments, so pkg & calc would run a second command the preview renders as one harmless argument. A URL may carry user:password@ and git echoes the remote verbatim in its errors, so every displayed or persisted URL is redacted, and URL shapes redaction cannot reliably strip are rejected rather than printed.

Consequences ​

  • git becomes a hard runtime dependency for remote sources. There is no archive fallback, because a fallback would resurrect everything this decision deletes.
  • A failed clone of a github.com repository is retried once through gh repo clone when gh is on PATH, since gh carries a token plain git may not see. It is optional, not a second hard dependency.
  • A branch name containing / needs the #<ref> fragment form, because the web-URL form takes the first path segment as the ref.
  • Nothing is cached. Every run clones and the temporary directory is always removed, so there is no cache invalidation question and no diverged local copy.
  • Clones fail fast rather than hang on a credential prompt, and committed symlinks are rejected since they could point outside the clone.
  • A remote source installs to the current directory, or home with --global, because a temporary directory has no meaningful parent. build --source <url> is rejected: build writes into the source tree, which is then discarded.
  • Byte caps were deliberately not added. A hostile repository can still fill a disk within the clone timeout, which is equally true of the git clone the user would otherwise run by hand.

Revisit if ​

  • Git-less environments need remote sources, which would require reopening the archive-download path along with its size caps and traversal guard.
  • Users need to pin a source to an exact commit. This is the weakness above rather than a request to wait for: it would replace clone --branch with init plus fetch plus checkout, and would also give the SHA-shaped-branch check something better to do than refuse.

Released under the ISC License.