Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(cli): handle trusted Linux system aliases during install activation

DavidHLP00411ce7bc41
diff --git a/src/cli/activation_transaction.c b/src/cli/activation_transaction.c
index 75f5eeaaf..9494b70de 100644
--- a/src/cli/activation_transaction.c
+++ b/src/cli/activation_transaction.c
@@ -890,8 +890,12 @@ static bool activation_posix_acl_empty(int descriptor) {
}
static char *activation_posix_walk_path(const char *directory) {
-#ifdef __APPLE__
- static const char *const aliases[] = {"/tmp", "/var"};
+#if defined(__APPLE__) || defined(__linux__)
+ /* macOS and immutable Linux layouts can expose writable trees through
+ * root-owned aliases (for example /tmp and /home on Atomic systems).
+ * Resolve only these trusted system aliases; arbitrary user symlinks must
+ * still fail the O_NOFOLLOW walk below. */
+ static const char *const aliases[] = {"/tmp", "/var", "/home"};
for (size_t index = 0; index < sizeof(aliases) / sizeof(aliases[0]); index++) {
const char *alias = aliases[index];
size_t alias_length = strlen(alias);
@@ -901,8 +905,13 @@ static char *activation_posix_walk_path(const char *directory) {
}
struct stat alias_status;
char resolved[4096];
- if (lstat(alias, &alias_status) != 0 || !S_ISLNK(alias_status.st_mode) ||
- alias_status.st_uid != 0 || !realpath(alias, resolved)) {
+ if (lstat(alias, &alias_status) != 0) {
+ return NULL;
+ }
+ if (!S_ISLNK(alias_status.st_mode)) {
+ continue;
+ }
+ if (alias_status.st_uid != 0 || !realpath(alias, resolved)) {
return NULL;
}
struct stat resolved_status;