Skip to content

Permission problem with 0.7.0 #664

Done

Description

@Z0l

I was using 0.6.0 via docker (installed using the quickstart steps) and upgraded today by reissuing the quickstart steps; the container did not start and this was the error message in the logs:

 _    ____ _____ _______  __
   / \  |  _ \_   _| ____\ \/ /
  / _ \ | |_) || | |  _|  \  /
 / ___ \|  _ < | | | |___ /  \
/_/   \_\_| \_\|_| |_____/_/\_\
  AI autonomous penetration testing system
  version 0.7.0-367-gb8cd251  ·  linux/amd64  ·  go1.26.11  ·  listening on :8787

2026/11/28 17:30:24 INFO [config] snapshot {"version":"0.7.0-367-gb8cd251","config_file":"/app/config.json","config_file_found":false,"pg_dsn":"postgres://artex:xxxxx@postgres:5432/artex?sslmode=disable","pg_dsn_source":"environment variables ARTEX_PG_HOST/USER/PASSWORD/DBNAME","data_dir":"/app/data","skill_dir":"/app/skills","key_dir":"/app/keys","addr":":8787","proxy":":8788","noise_profile":"off","untrusted_boundary":true,"trusted_proxies":[]}
2026/11/28 17:30:24 [exec] agent processes run as uid 10001 gid 10001; the run directories under /app/data/tasks are shared with that group
2026/11/28 17:30:24 ERROR [config] enforce isolation failed err="agent isolation self-test failed: the file tools can read /app/data/traffic/_ca/mitmproxy-ca.pem; Bash can read /app/data/traffic/_ca/mitmproxy-ca.pem. A Linux server running as root with the privilege drop does not start without agent isolation: fix the cause above, or pass -dev-insecure-no-isolation for development only"
[artex] abnormal exit (code=1), restarting in 60s

Adding the -dev-insecure-no-isolation parameter to the start.sh script allow the container to start but I get a red warning message on top stating "Agent isolation is degraded: agent shells, tools and file tools run with the server's identity and may read its keys, config and database credentials."

Here are the permissions:

root@cde505d8b487:/app/data/traffic/_ca# ls -al
total 15
drwxr-xr-x 2 root root    5 Nov 19 12:40 .
drwxr-xr-x 5 root root    5 Nov 19 12:40 ..
-rw-r--r-- 1 root root 1257 Nov 19 12:40 mitmproxy-ca-cert.cer
-rw-r--r-- 1 root root 1257 Nov 19 12:40 mitmproxy-ca-cert.pem
-rw------- 1 root root 2961 Nov 19 12:40 mitmproxy-ca.pem
root@cde505d8b487:/app/data/traffic/_ca#

Activity

  1. github-actions commented on Nov 28, 2026

    @github-actions

    Thanks — this is a bug: the startup isolation self-test detects that /app/data/traffic/_ca/mitmproxy-ca.pem is readable by the agent identity (uid/gid 10001), and the server fails closed instead of starting. Using -dev-insecure-no-isolation only masks it, as the warning says.

    To reproduce and fix we still need:

    • the image tag/digest you pulled and how you ran it (docker-compose.yml variant, start.sh, or plain docker run), plus the diff from your 0.6.0 setup
    • the relevant compose/run options: volume mounts for /app/data, user:, group_add, read_only, umask
    • output of ls -lnaR /app/data/traffic/_ca and stat on the data dir, inside the container
    • whether the existing data directory was created by 0.6.0 and carried over (old ownership/permissions), or freshly initialized
    • host OS, docker/containerd version, and whether SELinux/AppArmor or rootless Docker is in play

    I'm not certain from the summary which code path owns the CA-directory permissions, so the above details matter.


    🤖 automated reply from the repo bot. A human maintainer reads everything. Ping me in any comment with @artex-bot.

  2. added
    bug
    on Nov 28, 2026
  3. Dukotah commented on Nov 28, 2026

    @Dukotah
    Contributor

    The permissions in that listing are already correct, which I think points this away from a permissions fix and at the self-test's access check.

    -rw------- 1 root root 2961 Nov 19 12:40 mitmproxy-ca.pem
    

    0600 root:root is exactly what traffic.Open sets (traffic/traffic.go:352), and uid 10001 should not be able to open it. So the mode bits and the self-test disagree.

    Why I do not think this is ARTEX's privilege drop

    Both probes failed, and they reach the filesystem by two unrelated mechanisms:

    • the file tools probe switches fsuid/fsgid/setgroups on a locked thread (agent/filetools_identity_linux.go), and a non-zero fsuid is what clears CAP_DAC_OVERRIDE / CAP_DAC_READ_SEARCH for that thread
    • the Bash probe goes out through the shim as a real uid

    enterFileIdentity also reads the ids back and fails loudly if they did not take, and that is not the error reported here — the ids took, and the open still succeeded. Two independent mechanisms agreeing that a 0600 root:root file is readable is more consistent with the filesystem not enforcing the mode than with the drop being broken.

    The tell in that listing

    drwxr-xr-x 2 root root    5 Nov 19 12:40 .
    drwxr-xr-x 5 root root    5 Nov 19 12:40 ..
    

    The directory's st_size is 5, which is the number of entries (., .., three files), not a block size like 4096. Reporting directory size as the dirent count is characteristic of ZFS. The parent showing 5 for its own five entries fits the same pattern.

    That matters because on ZFS access can be granted by NFSv4 ACLs that the mode bits do not describe, and ls -l shows no trailing + for them unless the dataset is acltype=posixacl. A dataset carrying a permissive inherited ACL would display -rw------- and still allow uid 10001 to open the file — which is exactly the contradiction in this report.

    I want to be clear this is a hypothesis from one ls output, not something I have reproduced.

    Commands that would settle it

    Inside the container, with the data volume mounted:

    # 1. what filesystem is actually under the data dir
    stat -f -c '%T %i' /app/data/traffic/_ca
    findmnt -no FSTYPE,SOURCE,OPTIONS --target /app/data
    
    # 2. what the kernel thinks the mode is, not what ls renders
    stat -c '%A %u:%g %n' /app/data/traffic/_ca /app/data/traffic/_ca/mitmproxy-ca.pem
    
    # 3. any ACL the mode bits do not show
    getfacl -p /app/data/traffic/_ca/mitmproxy-ca.pem 2>/dev/null || echo "getfacl unavailable"
    
    # 4. the decisive one: can the executor actually read it
    setpriv --reuid=10001 --regid=10001 --clear-groups cat /app/data/traffic/_ca/mitmproxy-ca.pem >/dev/null \
      && echo "READABLE as 10001 - filesystem is not enforcing the mode" \
      || echo "refused as 10001 - the mode is enforced, so the probe is the problem"
    
    # 5. capabilities the container holds
    grep Cap /proc/self/status

    Step 4 splits the two possibilities cleanly. If it prints READABLE, the data directory is on a filesystem or ACL configuration that does not enforce the mode, and the self-test is right to fail closed — the fix is on the volume, not in ARTEX. If it prints refused, the self-test has a false positive and the bug is in the probe.

    On the host, also worth having: zfs get acltype,aclmode,aclinherit,xattr <dataset> if this is ZFS, and whether the ./data path in the compose file is a bind mount onto that dataset.

    A suggestion either way

    Whichever way step 4 goes, the current message sends a reporter to the wrong place. It names the path and says the file tools can read it, which reads as "your permissions are wrong" — and here the permissions are right, so the reporter reasonably went to ls, found nothing wrong, and reached for -dev-insecure-no-isolation.

    I would include in the failure what made the read succeed: the fsuid/fsgid actually in effect for the probe, st_mode/st_uid/st_gid as stat() returned them, and the filesystem type from statfs. For this report that would have printed something like fsuid=10001 mode=0600 uid=0 gid=0 fs=zfs, which states the contradiction outright and points at the volume instead of at the file.

    That is a small, self-contained change to fileToolIsolationFailures and its Bash counterpart. Happy to send it as a PR if it is wanted — it is useful independently of what is causing this particular report, since right now a false positive and a genuinely unenforced volume produce the same message.

  4. Z0l commented on Nov 29, 2026

    @Z0l
    Author

    Thanks for the detailed response, please find below the output of the 5 commands. An additional note on my setup: ARTEX is running in a docker container inside an lxc container on proxmox. Let me know if there is anything else I can help with.

    root@dev:~# docker exec -it artex-artex-1 /bin/sh
    # stat -f -c '%T %i' /app/data/traffic/_ca
    zfs 7c7568d400565026
    # findmnt -no FSTYPE,SOURCE,OPTIONS --target /app/data
    zfs    rpool/data/subvol-110-disk-0[/root/ARTEX/data] rw,relatime,xattr,posixacl
    # stat -c '%A %u:%g %n' /app/data/traffic/_ca /app/data/traffic/_ca/mitmproxy-ca.pem
    drwxr-xr-x 0:0 /app/data/traffic/_ca
    -rw------- 0:0 /app/data/traffic/_ca/mitmproxy-ca.pem
    # getfacl -p /app/data/traffic/_ca/mitmproxy-ca.pem 2>/dev/null || echo "getfacl unavailable"
    getfacl unavailable
    # setpriv --reuid=10001 --regid=10001 --clear-groups cat /app/data/traffic/_ca/mitmproxy-ca.pem >/dev/null \
      && echo "READABLE as 10001 - filesystem is not enforcing the mode" \
      || echo "refused as 10001 - the mode is enforced, so the probe is the problem"> >
    cat: /app/data/traffic/_ca/mitmproxy-ca.pem: Permission denied
    refused as 10001 - the mode is enforced, so the probe is the problem
    # grep Cap /proc/self/status
    CapInh:	0000000000000000
    CapPrm:	00000000a80425fb
    CapEff:	00000000a80425fb
    CapBnd:	00000000a80425fb
    CapAmb:	0000000000000000
    #
    
  5. jamesKhor commented on Nov 30, 2026

    @jamesKhor
    Contributor

    Thanks @Z0l for checking the key as uid 10001. We haven’t reproduced the failure on your Docker-in-LXC/ZFS setup. We found that the two startup probes report success opening the path for reading. The directory fixture we tested in #700 doesn't establish what happened with your regular CA key.

    One detail that might explain the different observations is timing. In your build (b8cd251), the isolation check runs before the traffic store opens. Opening the store sets the existing CA key to 0600. Did you run stat and setpriv before or after the first successful start with the development flag? If you’ve since restarted the same image with the same volume and the flag removed, did the error recur?

    If you already have a pre-upgrade snapshot, this command in its ARTEX data directory prints just the old permissions and ownership: stat -c 'mode=%a owner=%u:%g type=%F' traffic/_ca/mitmproxy-ca.pem. No need to restore a snapshot or share the key itself. We’re keeping #700 focused on reporting what the probes saw at startup.

  6. Z0l commented on Nov 30, 2026

    @Z0l
    Author

    I ran the stat and setpriv commands after the first successful start. As I don't have a pre-upgrade snapshot, I have edited start.sh and removed the development flag and can confirm the container starts successfully and the warning message is gone.

  7. added 2 commits that reference this issue on Dec 1, 2026
  8. BaaRai commented on Dec 1, 2026

    @BaaRai
    Owner

    Fixed on main by #763, and it will be in the next release. The startup lockdown now tightens /app/data/traffic/_ca/mitmproxy-ca.pem to 0600 before the isolation self-test runs, so a CA key left 0644 by an older version (the /app/d... path in your log) no longer fails the start after an upgrade. A symlinked CA key is refused and still fails closed. Workaround on 0.7.0/0.7.1 until that release: stop the stack, run chmod 600 data/traffic/_ca/mitmproxy-ca.pem on the host, then start it again. Your existing data directory is kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions