Skip to content

Isolate the filesystem of the server at startup - #128412

Merged
alexey-milovidov merged 58 commits into
masterfrom
filesystem-isolation
Nov 14, 2026
Merged

alexey-milovidov merged 58 commits into
masterfrom
filesystem-isolation

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

The server can now confine itself to a private view of the filesystem at startup, like a container: a new mount namespace whose root is an empty read-only tmpfs, with only the paths it needs bind-mounted at their usual locations, and the original root removed with pivot_root. An attacker who gets code execution in the server process finds no shell or other program to run, and no files of the host outside the server's own directories. This complements the seccomp filter, which is installed right after and refuses the system calls that would undo the isolation (mount, pivot_root, unshare, setns, ...).

The set of visible paths is derived from the configuration: path, tmp_path, user_files_path, the disks of storage_configuration, Keeper storage, logs, pid file, the configuration directory, included files and the targets of symbolic links among the configuration files, users_config, user_scripts_path (read-only and executable), TLS certificates and keys (their directories, so renewed certificates are seen), Kerberos keytab, clickhouse-odbc-bridge, plus the executable with its loader and the shared libraries mapped into the process (with the SONAME links that name them), /proc, a read-only /sys, /dev/{null,zero,full,random,urandom}, a private devpts instance at /dev/pts with /dev/ptmx (for the web terminal and the SSH server), the directory of jemalloc's prof_prefix, the network/timezone/CA files of /etc and /usr/share, the NOTIFY_SOCKET of systemd, and a private empty /tmp. Writable mounts are noexec, all mounts are nosuid. Extra paths go into <filesystem_isolation_paths> with <read_only> / <read_write> - needed, for example, for the interpreters of executable UDF scripts and for ODBC drivers.

  • The isolation runs in a new BaseDaemon::beforeStartingThreads hook, right after the configuration is loaded and before any thread is started (a mount namespace is per thread, and a multithreaded process cannot enter a user namespace). The background threads of jemalloc, started by its compiled-in background_thread:true, are joined first and restarted by Jemalloc::setup right after. A process with more than one thread at that point is a LOGICAL_ERROR exception.
  • With CAP_SYS_ADMIN (e.g. root, or CAP_SYS_ADMIN granted by the systemd unit), only a mount namespace is created and the process keeps the capabilities it uses (CAP_NET_BIND_SERVICE, CAP_IPC_LOCK, CAP_SYS_NICE, CAP_NET_ADMIN, ...), dropping those that could undo the isolation (CAP_SYS_ADMIN, CAP_SYS_CHROOT, CAP_SYS_PTRACE, CAP_DAC_READ_SEARCH, CAP_SETUID, CAP_SETGID, CAP_MKNOD, ...). Without it, a user namespace mapping only the current user and group is created as well, and the capabilities of the initial namespace are lost - a warning names them. PR_SET_NO_NEW_PRIVS is set in both cases.
  • Whether the namespaces can be created and mounted in is checked in a forked child first, so best_effort does not leave the server in a user namespace without its capabilities when, e.g., Ubuntu's kernel.apparmor_restrict_unprivileged_userns or Docker refuses it. Any failure after the server has entered the namespace stops the startup in both modes.
  • An open directory file descriptor would be a way out, so the isolation refuses to run if one is open.
  • Modes: disabled (the code default, so existing configurations do not change behavior on upgrade), best_effort (the shipped config.xml), enforce. system.server_settings reports the mode in force; a changed value in a reloaded configuration logs a warning, as for seccomp.
  • Known limitation: the /proc of the host stays visible (a fresh one requires a PID namespace, which needs a fork and changes the main PID that systemd and the watchdog rely on), so /proc/<pid>/root of other processes of the same user outside the isolation is reachable. This is documented; a PID namespace could be a follow-up.

Tests: the stateless tests run with enforce (they run as root in a privileged container) and with /bin, /usr, /lib*, /etc visible for the executable dictionaries and UDFs that run shell commands; a new test checks that a program run by the server sees a read-only tmpfs root without the original root. The integration tests strip the element from the main config and keep the isolation disabled, since whether it applies depends on the container and it would hide the ODBC drivers and interpreters many of them use.

Manually verified on Linux 7.0 aarch64: as root (mount namespace path) the server starts, only the planned paths exist under /proc/<pid>/root, / is read-only, /bin/sh is absent (a shell UDF fails), with the test paths it works again, CapEff lacks the dropped capabilities, NoNewPrivs is 1, seccomp is applied on top; as an unprivileged user on a host with kernel.apparmor_restrict_unprivileged_userns = 1, best_effort logs a warning and runs without the isolation. The unprivileged user namespace path has not been exercised at runtime yet.

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

New server setting filesystem_isolation: at startup, the server moves into a new mount namespace where only the paths it needs according to its configuration are visible - in particular, no shell - which makes exploitation of a remote code execution harder. It is enabled as best_effort in the default config.xml; extra paths, such as interpreters for executable user defined functions, can be listed in filesystem_isolation_paths.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/128412]

Version info

  • Merged into: 26.11.1.2324-master (included in 26.11 and later)

Add the `filesystem_isolation` server setting (`disabled`, `best_effort`,
`enforce`). At startup, while the process has a single thread and before the
`seccomp` filter is installed, the server moves into a new mount namespace whose
root is an empty read-only `tmpfs`, bind-mounts only the paths it needs
according to its configuration (data, logs, configuration, certificates, a few
system files, the executable and its libraries) plus the paths listed in
`filesystem_isolation_paths`, and removes the original root with `pivot_root`.
Writable mounts are `noexec`, every mount is `nosuid`, `/tmp` is private. There
is no shell inside, which makes it harder to turn a remote code execution into
anything else.

With `CAP_SYS_ADMIN` only a mount namespace is created and the capabilities
that could undo the isolation are dropped; without it a user namespace is
created as well, and the lost capabilities are reported. Whether the namespaces
can be created is checked in a child process first, so that `best_effort` does
not leave the server in a namespace without its capabilities.

The shipped `config.xml` enables `best_effort`; the code default stays
`disabled`, so existing configurations keep working after an upgrade. The
stateless tests run with `enforce`; the integration tests keep it disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6fae18a]

Summary: ✅


AI Review

Summary

Adds startup filesystem isolation with configuration-derived mounts and capability restrictions. Reviewed the current diff and all 44 discussion threads at 6fae18ace56866a84cb5cbc5ba391b507a979ac3. The recent path fixes passed focused isolated-server runs, but the previously reported daemon-directory regression remains reproducible.

Findings

❌ Blockers

  • programs/server/FilesystemIsolationPaths.cpp:741: A basename-only log still gives daemon paths the wrong base. [dismissed by author -- https://github.com/Isolate the filesystem of the server at startup #128412#discussion_r4566566611] The current binary still starts with isolation disabled and fails with enforce, so the author-resolved finding remains valid.

    For --daemon with logger.log=server.log, BaseDaemon::initialize removes the filename, gets an empty log directory, and changes to /tmp. The collector instead returns startup_directory. Consequently a relative core_path is mounted at a different location, and runtime paths are also collected against that incorrect base. The reproduction used an existing core directory outside the other mounts: disabled mode reached readiness there; enforce failed with Read-only file system while creating the actual core directory, then failed creating its /opt fallback. Both runs used the current PR's CI binary in private namespaces.

    Determine the configured log's directory before making it absolute, using /tmp when that directory is empty, consistently with BaseDaemon::initialize. Extend 05631_filesystem_isolation_daemon_directories with a basename-only log and a relative core directory outside the other mounts. This dismissed finding is retained in the summary only.

Final Verdict

❌ Block — Correct the basename-log directory calculation and add the focused daemon regression case. No genuinely new inline findings were identified.

@clickhouse-gh clickhouse-gh Bot added the pr-feature Pull request with new product feature label Oct 31, 2026
@alexey-milovidov
alexey-milovidov marked this pull request as ready for review October 31, 2026 22:25
@clickhouse-gh clickhouse-gh Bot added the comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... label Oct 31, 2026
alexey-milovidov and others added 3 commits November 2, 2026 04:31
…s namespaces

The fast test runs in a container that is not privileged, where `unshare` of a
mount or user namespace fails with `EPERM`, so the server refused to start with
`filesystem_isolation` set to `enforce`. `install.sh` now probes with `unshare`
and links `config.d/filesystem_isolation.xml` only when it succeeds, and the test
`05473_filesystem_isolation` is tagged `no-fasttest`.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=a0e331182c0d2bbde8868144e39acbbd86d8be87&name_0=PR&name_1=Fast%20test
#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread programs/server/Server.cpp Resolved
@clickhouse-gh

clickhouse-gh Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 6fae18ace with master 03df3cd6d (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

⚠️ Significant changes: object file sizes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes ⚠️

13 object files changed (+767.27 KiB total), 2 added.

Object file Master PR Δ
src/CMakeFiles/clickhouse_common_io.dir/Common/FilesystemIsolation.cpp.o new 449.19 KiB +449.19 KiB
programs/server/CMakeFiles/clickhouse-server-lib.dir/FilesystemIsolationPaths.cpp.o new 237.25 KiB +237.25 KiB
programs/server/CMakeFiles/clickhouse-server-lib.dir/Server.cpp.o 1.60 MiB 1.64 MiB +36.79 KiB (+2.24%)
src/CMakeFiles/dbms.dir/Core/SettingsEnums.cpp.o 2.28 MiB 2.30 MiB +22.57 KiB (+0.97%)
src/CMakeFiles/dbms.dir/Core/ServerSettings.cpp.o 960.96 KiB 977.75 KiB +16.79 KiB (+1.75%)

711 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse ×0.61, programs/clickhouse-keeper ×0.72 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse DB::registerFunctionConversion(DB::FunctionFactory&) 6.0 s 11.8 s +8.1 s (+221%)
programs/clickhouse _ZN6detail10static_forITk7is_enumN2DB23AttributeUnderlyingTypeEZNS1_29callOnDictionaryAttributeType… 3.5 s 7.4 s +5.3 s (+248%)
Compile time of recompiled translation units

1224 translation units recompiled, 8758 s compile time in total, 1222 of them have a recent master baseline.

Job report

alexey-milovidov and others added 3 commits November 3, 2026 07:22
…onfiguration

`beforeStartingThreads` ran before `ConfigProcessor::savePreprocessedConfig`, which has two
consequences:

- The encrypted elements of the configuration were not decrypted yet, and loading all server
  settings to read `filesystem_isolation` failed to parse the ciphertext of
  `max_table_size_to_drop` in `test_config_decryption`, even with the isolation disabled.
- `savePreprocessedConfig` writes into the `path` of the configuration file, not the one overridden
  on the command line, and that directory was already hidden: the stateless tests failed to start
  the server with `Read-only file system ["/var/lib/clickhouse/preprocessed_configs"]`.

Now the hook runs after `savePreprocessedConfig` (and before `Jemalloc::setup`, as before), and it
reads only the `filesystem_isolation` setting instead of loading all server settings.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=228464365d153278ad73b68c1943b9fdd6f50ede&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=228464365d153278ad73b68c1943b9fdd6f50ede&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20targeted%29
#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…state directory visible

- For a file from the configuration, such as a certificate, also make visible the directories of
  the targets of its chain of symbolic links: a Let's Encrypt `live/<domain>/fullchain.pem` points
  to `../../archive/<domain>/fullchain<N>.pem`.
- Make visible the directory of the Keeper state file, derived as in
  `KeeperContext::getStatePathFromConfig`: without `storage_path` and `state_storage_disk`, the
  parent of `snapshot_storage_path` or of `log_storage_path`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread src/Core/ServerSettings.cpp Resolved
…s, fix the style check

Do not make the paths from `TZDIR`, `SSL_CERT_FILE` and `SSL_CERT_DIR` visible: they do not need to be supported.

Use `FS::isSymlinkNoThrow` and `FS::readSymlink` instead of `std::filesystem::is_symlink` and `std::filesystem::read_symlink`, which the style check forbids.

Clarify in the documentation of `filesystem_isolation` that the watchdog runs inside the isolation, and which processes `/proc` still exposes.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=cdf8576cf820ecc1193d4e94fd37f7f002e8b130&name_0=PR&name_1=Style%20check
#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread src/Common/FilesystemIsolation.cpp Resolved
alexey-milovidov and others added 4 commits November 6, 2026 00:30
…fig targets, default named collection storage type

- Follow the symbolic links of the main configuration file, of `users_config` and of the
  files merged into them from `<name>.d` and `conf.d`, so that a reload does not find
  dangling links to targets outside the configuration directory.
- Enumerate all the entries of `user_directories` with the same type names as
  `AccessControl::addStoragesFromUserDirectoriesConfig`, including `local_directory[N]`.
- Use `local` as the default type of `named_collections_storage`, as
  `NamedCollectionsMetadataStorage::create` does.
- Keep the directory of jemalloc's `opt.prof_prefix` visible and writable, so that heap
  profiles (`system.jemalloc_profile_text`, `SYSTEM JEMALLOC FLUSH PROFILE`) can be written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lesystem

- Mount a new instance of `devpts` at `/dev/pts` with `/dev/ptmx` linked to it, so that
  the web terminal and the SSH server can open pseudoterminals (`posix_openpt`). The
  probe in the forked child checks that it can be mounted.
- Recreate the symbolic links next to the mapped libraries that name them (SONAME links
  such as `libc.so.6 -> libc-2.31.so`), so that a new process of a dynamically linked
  executable, such as the ODBC bridge or the OOM canary, finds its libraries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… isolation

Tests such as `02051_symlinks_to_user_files`, `02455_one_row_from_csv_memory_usage` and
`05042_glob_globstar_path_virtual_column` link files in the tests directory and in
`CLICKHOUSE_TMP` from `user_files`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=c505781d14f42df7521069f2d54d6aec86aa6c24&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29
PR: #128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master and fixed the stateless test failures that the isolation caused in enforce mode:

  • webterminal tests: the server had no /dev/ptmx, so posix_openpt failed. A private devpts instance is now mounted at /dev/pts and linked from /dev/ptmx, and the namespace probe checks that it can be mounted.
  • jemalloc tests (03925, 05023, 05238, 05446): CI sets MALLOC_CONF=prof_prefix:<tmp>/jemalloc_profiles/..., and that directory was not visible. The directory of opt.prof_prefix is now mounted read-write.
  • 02051_symlinks_to_user_files, 02455_one_row_from_csv_memory_usage, 05042_glob_globstar_path_virtual_column: these tests link files in the tests directory and in CLICKHOUSE_TMP from user_files. tests/config/install.sh now adds tests/queries as <read_write> in the test configuration.

I also addressed the bot review: the targets of symbolic links among config files, every user_directories entry, the default named_collections_storage.type, and the SONAME links of mapped libraries. I verified it manually as root with enforce. The unprivileged user namespace path and the SONAME links (which need a dynamic build) are still not tested at runtime. The PID namespace question in the /proc thread is left open for you to decide.

@clickhouse-gh clickhouse-gh Bot added comp-config Server configuration infrastructure: XML/YAML config parsing, preprocessor (includes, substitutio... and removed comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... labels Nov 6, 2026
alexey-milovidov and others added 4 commits November 7, 2026 10:42
…in the functional tests

With `DBReplicated`, the replicas share `jemalloc_profiles`, and every start removed and recreated it with
`Utils.clean_dir`. A replica that was already running isolates its filesystem (`filesystem_isolation`), so it
keeps a bind mount of the directory it saw at startup, which was then deleted, and jemalloc could not create its
heap profiles there. `system.jemalloc_profile_text` and the other tests reading the profiles failed with
`FILE_DOESNT_EXIST`. Empty the directory in place instead.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=5b4b97bf799708460a7424221e4ff95f0dde25f2&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29
#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e filesystem

The runtime of the thread sanitizer starts its background thread in the child of every `fork`, even if the parent
did not have one, and it cannot be stopped then (`__sanitizer_sandbox_on_notify` stops it only if the parent
started it). The process that `--daemon` forks therefore has two threads before the isolation, and the server
aborted with a `LOGICAL_ERROR` before creating its log, so the stress tests with TSan could not start it. A mount
namespace can be entered with this thread, and a user namespace cannot, which the probe in a child reports.

Reproduced locally with the `arm_tsan` binary of the CI and `clickhouse server --daemon`.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=5b4b97bf799708460a7424221e4ff95f0dde25f2&name_0=PR&name_1=Stress%20test%20%28amd_tsan%29
#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s `include_from`, local object storage locations and SSH host keys visible

- With `allow_experimental_webassembly_udf`, `WasmModuleManager` creates and writes the subdirectory `wasm` of
  `user_scripts_path`, which is otherwise mounted read-only. Keep it read-write.
- A users configuration in a separate file is processed by its own `ConfigProcessor`, which reads its own
  `include_from`. Load it the same way and keep that substitutions file visible.
- An object storage disk with `locations` creates a separate object storage for each of them; keep the `path` of
  the local ones.
- Keep `ssh_server.host_rsa_key`, `ssh_server.host_ecdsa_key` and `ssh_server.host_ed25519_key` visible, as the
  TLS keys are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits November 14, 2026 09:25
…user_scripts_path` before the isolation

A link in a CA directory through a directory that is a link back into it, as
`0123abcd.0 -> /opt/ca-link/root.pem` with `/opt/ca-link -> /srv/ca`, was skipped because its
target is inside the CA directory, so `/opt/ca-link` was not recreated and the link was dangling.
Now only a location that is inside the directory as the link names it is skipped. The tests
`05636` and `05637` now read the certificates inside the isolated server, with `file` in a startup
script, because an absolute link seen from outside, through `/proc/<pid>/root`, leads to the root
of the observer, and `05636` covers this case.

A `user_scripts_path` that did not exist at the startup, as in a new data directory, was not
mounted, so the scripts added later were on the `noexec` mount of `path` and could not run. Now it
is created before the isolation. The new test `05638_filesystem_isolation_user_scripts_created`
checks that it is a read-only executable mount of its own.

#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… leads outside

A link in a CA directory whose target is named inside the directory but leads outside through a
link to a directory and `..`, as `0123abcd.0 -> nested/via/../root.pem` with
`nested/via -> /opt/trust/active`, was skipped as inside, so `/opt/trust` was hidden. Now a target
is skipped only if it is inside the directory both as the link names it and with the links
resolved; otherwise `resolvePath` follows it as the kernel does. `05636` covers this layout, read
inside the isolated server.

#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 5 commits November 14, 2026 10:39
…`backups.allowed_path` as the backup engine does

A relative link in a CA directory that leaves it with `..` and comes back through a link, as
`0123abcd.0 -> ../current/root.pem` with `current -> ca`, was skipped as inside the directory, so
`current` was not recreated. The decision by the spelling of the path cannot be right for every
layout, so now every target location is kept as the link names it, and `resolvePath` recreates the
links on the way; a location that is visible anyway is dropped by `planMounts`. `05636` covers
this layout too.

`backups.allowed_path` is resolved by the `File` backup engine relative to `path` and normalized
lexically, before the links are followed, so with `path` a link to another directory, `../backups`
is next to the link. The collector followed the link first, and the real directory of the backups
was hidden. Now it resolves the path as the backup engine does. The new test
`05639_filesystem_isolation_backup_allowed_path` makes a backup with such a `path`.

#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lative one resolved

`getCanonicalPath` resolves the links of a relative `path` (`weakly_canonical` relative to the
original working directory) and keeps an absolute one as it is written, and the paths relative to
it, as `backups.allowed_path` in the `File` backup engine, are resolved against that. The collector
kept a relative `path` as written, so with `path` `data-link/`, a link to `/srv/storage/data`,
`../backups` was `/srv/work/backups` instead of `/srv/storage/backups`, which was hidden. Now the
collector makes `path` the same way. `05639_filesystem_isolation_backup_allowed_path` covers a
relative `path` that is a link, next to an absolute one.

#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the server inside

`Server::main` resolves `path` again with `getCanonicalPath` after the isolation, so for a
relative `path` with a link and `..`, as `link/../data/`, the link has to be in the isolated
filesystem, but the collector mounted only the canonical path since `getDataPath`, and the server
opened `work/data/status` instead of `storage/data/status`. Now `path` as it is written, relative
to the original working directory, goes through `resolvePath` too, which recreates its links, and
the canonical one stays the base of the paths relative to `path`, as `backups.allowed_path`.
`05628_filesystem_isolation_symlink_parent` covers the first, `05639` the second.

#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…th glibc

`getExecutableDependencies` and the functions it uses are defined only with glibc, but it was
called unconditionally. A build with musl is linked statically, as the programs it starts are, so
there is nothing to collect there.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128412&sha=bef29e937e18176e1338e4cfeb23ea416afaf789&name_0=PR&name_1=Build%20%28amd_musl%29
#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov alexey-milovidov self-assigned this Nov 14, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 14, 2026
Merged via the queue into master with commit b7a5400 Nov 14, 2026
204 checks passed
@alexey-milovidov
alexey-milovidov deleted the filesystem-isolation branch November 14, 2026 23:12
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 14, 2026
sanjaibalajee pushed a commit to sanjaibalajee/ClickHouse that referenced this pull request Nov 15, 2026
`clickhouse-test` gives every process a profile path relative to its
working directory (`clickhouse-client-proc{N}-%c%2m.profraw`, continuous
mode). The test starts its own server from `$DIR/work`, so in a coverage
build the profiling runtime creates the profile there and maps it
(`MAP_SHARED`) before `main`. Filesystem isolation keeps every file mapped
into the process visible, read-only, so the listing of the working
directory inside the server's root printed the profile next to
`definitions`, and the test failed in every `amd_llvm_coverage` stateless
job on master since ClickHouse#128412 (the PR's own CI has no coverage jobs).

Leave `*.profraw` out of that listing. Everything else of the working
directory, such as `secret`, must still be invisible: with the working
directory made visible through `access_control_path`, the changed test
still fails with `working directory: definitions secret`.

Validated as root with the CI binaries of 52d3d52: coverage, unchanged
test FAIL 3/3 with the CI line, changed test PASS 10/10; amd_release PASS
10/10, and the unchanged test passes there too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexbakharew

Copy link
Copy Markdown
Contributor

@Algunenano
Hi, do you think that a proper fix will be just to revert this PR?

@Algunenano

Copy link
Copy Markdown
Member

@Algunenano
Hi, do you think that a proper fix will be just to revert this PR?

Fix for what?

@alexbakharew

Copy link
Copy Markdown
Contributor

@Algunenano
Hi, do you think that a proper fix will be just to revert this PR?

Fix for what?

For this security issue: https://github.com/ClickHouse/clickhouse-private/issues/89131

We also have bunch of issues by groenai and clickgap, they could be also resolved by just reverting this change.

Actually I am not sure whether we need this change at all

@Algunenano

Copy link
Copy Markdown
Member

@alexbakharew The security issue is about hardening this feature even more. The issues from groeneai and clickgap are minor. The default (no setting) is disabled, although the default configf.xml sets it as best effort. This is an inconsistency we should address @alexey-milovidov

Actually I am not sure whether we need this change at all

We do

thevar1able pushed a commit to actueleai/ClickHouse that referenced this pull request Nov 23, 2026
In Kubernetes, the server with the isolated filesystem could not read the token of
the service account for the IAM roles of EKS: `Can't open token file:
/var/run/secrets/eks.amazonaws.com/serviceaccount/token`.

Keep visible, read-only: `/run/secrets` and `/var/run/secrets`, where Kubernetes
projects the tokens of the service accounts and Docker mounts its secrets, the files
named by `AWS_WEB_IDENTITY_TOKEN_FILE`, `AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE`,
`AWS_CONFIG_FILE`, `AWS_SHARED_CREDENTIALS_FILE` and `AZURE_FEDERATED_TOKEN_FILE`,
and `~/.aws`. The directories of the files and of the targets of the links are
mounted, so that a token that the kubelet rotates (by pointing `..data` at a new
directory) is seen.

Related: ClickHouse#128412

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... pr-feature Pull request with new product feature pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants