Skip to content

Releases

localinstaller-v1.1.0

Choose a tag to compare

@github-actions github-actions released this 08 Sep 16:34
3939b47
feat(core): let a server manifest declare service environment variables

* feat(core): let a server manifest declare service environment variables

Server manifests could not influence the environment of the native
service the platform adapters register (systemd on Ubuntu, launchd on
macOS, the Windows Service registry Environment value). Products that
need the installed service to start with extra process environment
variables — for example, an automated-validation opt-out flag a
product's own smoke tests set — had no way to get them there.

Add LocalInstallerArtifactManifest.EnvironmentVariables (empty by
default) and thread it through ProductComponent, the runtime
ProductManifest.ServerEnvironmentVariables accessor, and each platform
adapter:

- Ubuntu writes a systemd drop-in override (<unit>.d/10-environment.conf)
  next to the shipped unit file instead of mutating it directly.
- macOS adds entries to the launchd plist's existing EnvironmentVariables
  dict.
- Windows writes the service's registry Environment (REG_MULTI_SZ) value
  after the service is created and before it is started.

LocalInstaller has no opinion on the keys or values a product declares.

* fix(test): assert on the drop-in file, not the harmless cleanup rm -rf

ExecuteInstallAsync always removes a stale <unit>.d directory for
idempotency, even when the manifest declares no environment variables
this run. The "no drop-in" test asserted the script never mentions
".service.d" at all, which the cleanup line trips. Assert on the
drop-in file and its [Service] header instead — what actually
distinguishes "no environment variables declared".

* fix(core): harden Ubuntu service environment override

Address CodeRabbit findings on the systemd drop-in:

- Quote and escape each Environment= assignment per systemd.exec(5)
  config quoting rules so values with spaces, quotes, or backslashes
  parse correctly, and reject values containing newlines/control
  characters that could inject a config line or terminate the
  SERVICE_ENVIRONMENT heredoc early.
- Remove only the drop-in file this code owns (10-environment.conf)
  on reinstall/uninstall instead of the whole <unit>.d directory,
  which could hold unrelated admin- or package-manager-owned overrides.
- Restart the service after enabling it. `enable --now` only starts
  an inactive unit; on an upgrade of an already-running service, a
  changed drop-in environment would otherwise never take effect.

* fix(test): fix unterminated verbatim string literal

EnvironmentOverrideConf_escapesEmbeddedQuotes was one closing quote
short in its hand-typed verbatim string literal, so the literal never
terminated and swallowed the rest of the file, producing cascading
CS1003/CS1056 syntax errors on a genuinely clean checkout. Build the
expected string from a quote constant instead of hand-counting
adjacent escaped quotes, and verified the exact output by simulating
the verbatim-string grammar rather than eyeballing it again.

* fix(test): assert on the drop-in write, not the always-present cleanup

The prior CodeRabbit fix changed cleanup from rm -rf <service.d> to
rm -f <service.d>/10-environment.conf so it only removes the file this
code owns. That cleanup line runs unconditionally, so it legitimately
contains "10-environment.conf" even when no environment variables are
declared - the "no drop-in" test's negative assertion on that string
was checking the wrong thing. Assert on the mkdir -p that only happens
when content is actually written instead.

* fix(security): validate environment variable keys, not just values

SystemdAssignment validated the value for control characters but wrote
the key straight into a root-run SERVICE_ENVIRONMENT heredoc. A key
containing a newline (e.g. ending in the heredoc's own terminator)
could inject arbitrary content into a script that runs as root.
Validate the key the same way, and escape the whole key=value
assignment together rather than the value alone. Add a regression
test using a key that embeds the heredoc terminator.

---------

Co-authored-by: Claude <noreply@anthropic.com>

localinstaller-v1.0.2

Choose a tag to compare

fix: explicit repository root definition

localinstaller-v1.0.1

Choose a tag to compare

fix: import missing packaging test from agent-up

localinstaller-v1.0.0

Choose a tag to compare