Repository navigation
fix(strix/runtime/docker_client.py): Set HOME=/root when STRIX_HOST_UID is set to avoid Caido sidecar panic for system service accounts - #1548
Conversation
…ID is set to avoid Caido sidecar panic for system service accounts Signed-off-by: cf3901646 <cf3901646@users.noreply.github.com>
[Medium impact] The change affects containers created through Strix's Docker sandbox path. The PR should not merge until Findings
Fix with agent prompt### Issue 1
strix/runtime/docker_client.py:203-204
`_host_identity_env()` supplies `STRIX_HOST_UID` for every Linux user, including `"1000"` and `"0"`. This condition therefore sets `HOME=/root` for ordinary users too. The image runs as `pentester`, and the entrypoint skips changing users for those values, leaving a non-root process using root's home.
Caido cannot write there. Even if it starts, the entrypoint's append to `~/.bashrc` fails under `set -e`, stopping the container. Use `/home/pentester`, which the entrypoint already prepares for the scan user, rather than `/root`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR sets
Reviews (1) · Last reviewed commit: "fix(strix/runtime/docker_client.py): Set..." · Reviewed by Greptile |
| if "STRIX_HOST_UID" in environment and environment["STRIX_HOST_UID"]: | ||
| environment["HOME"] = "/root" |
There was a problem hiding this comment.
_host_identity_env() supplies STRIX_HOST_UID for every Linux user, including "1000" and "0". This condition therefore sets HOME=/root for ordinary users too. The image runs as pentester, and the entrypoint skips changing users for those values, leaving a non-root process using root's home.
Caido cannot write there. Even if it starts, the entrypoint's append to ~/.bashrc fails under set -e, stopping the container. Use /home/pentester, which the entrypoint already prepares for the scan user, rather than /root.
Prompt To Fix With AI
This is a comment left during a code review.
Path: strix/runtime/docker_client.py
Line: 203-204
Comment:
**Linux scans fail at startup**
`_host_identity_env()` supplies `STRIX_HOST_UID` for every Linux user, including `"1000"` and `"0"`. This condition therefore sets `HOME=/root` for ordinary users too. The image runs as `pentester`, and the entrypoint skips changing users for those values, leaving a non-root process using root's home.
Caido cannot write there. Even if it starts, the entrypoint's append to `~/.bashrc` fails under `set -e`, stopping the container. Use `/home/pentester`, which the entrypoint already prepares for the scan user, rather than `/root`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary of Changes
When strix runs as a system service account (uid < 1000), the Caido sidecar fails to start because the demoted uid lacks a writable HOME directory. The issue is caused by
STRIX_HOST_UID/STRIX_HOST_GIDbeing injected into the container environment without settingHOME. This leads tocaido-clipanicking when trying to write to an inaccessible directory.Motivation & Context
Closes #1514
Verification
To verify the fix:
uid=997,nologin).--scan-mode quick -n.loginAsGuestsucceeds on the first attempt without bootstrap failures.