Skip to content

[release-7.4] BulkLoad: reject path-traversal in manifest file paths (#13665) - #14334

Open
ShreeChaturvedi wants to merge 1 commit into
apple:release-7.4from
ShreeChaturvedi:bulkload-path-traversal-7.4
Open

ShreeChaturvedi wants to merge 1 commit into
apple:release-7.4from
ShreeChaturvedi:bulkload-path-traversal-7.4

Conversation

@ShreeChaturvedi

@ShreeChaturvedi ShreeChaturvedi commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #13665 to release-7.4. release-8.0 already contains it.

A crafted bulk-load manifest could set [RelativePath], [DataFileName], or [ByteSampleFileName] to an absolute path or one containing .., driving resetFileFolder() → eraseDirectoryRecursive() and file writes outside the storage server's local staging root. The fix rejects such fields in BulkLoadFileSet::isValid() and adds a containment check right before the staging folder is reset in both the CP and blobstore transport paths.

The BulkLoading.h change applied cleanly. The fdbserver/core/BulkLoadUtil.cpp hunk conflicted only because release-7.4 has this code in fdbserver/BulkLoadUtil.actor.cpp; the same code was applied there, with the flow/UnitTest.h include placed before actorcompiler.h. No functional differences from main.

Validation:

  • fdbserver builds (clang, USE_WERROR=ON).
  • fdbserver -r unittests -f /fdbserver/BulkLoad/bulkLoadPathIsContained passes.
  • tests/fast/BulkLoading.toml and tests/fast/BulkDumping.toml pass; no SevError, and the new guard never fires on normal jobs.
  • Joshua: 20261020-222819-shreechaturvedi-cb016c5149db79d4: 100,000/100,000 passed, 0 failed.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

…pple#13665)

* BulkLoad: reject path-traversal in manifest file paths

A crafted bulk-load manifest could set [RelativePath], [DataFileName], or
[ByteSampleFileName] to an absolute path or one containing ".." components.
getFolder() joins these onto the local staging root and the result flows into
abspath() -> eraseDirectoryRecursive() (and subsequent file writes), so a
manifest such as "[RelativePath]: ../../../../var/lib/foundationdb" could make
every storage server running the job wipe and overwrite an arbitrary directory
(e.g. the FDB data directory or TLS material).

Add two layers of validation:

- Parse/construction time: BulkLoadFileSet::isValid() now rejects relativePath,
  manifestFileName, dataFileName, and byteSampleFileName that are absolute or
  contain a ".." component (bulkLoadPathIsContained). Bad manifests are refused
  before any local path is constructed.

- Sink guard: assertLocalFolderContained() verifies the resolved staging folder
  is at or under the resolved local root immediately before resetFileFolder(),
  in both bulkLoadTransportCP_impl and bulkLoadTransportBlobstore_impl.

Add unit test /fdbserver/BulkLoad/bulkLoadPathIsContained.

* Formatting

* BulkLoad: use std::string::starts_with in containment check

Address review feedback: C++20 starts_with() is clearer than the
size()+compare() prefix check.

(cherry picked from commit 8f09b3c)
@spraza
spraza force-pushed the bulkload-path-traversal-7.4 branch from 31b1d6b to f5f2ac5 Compare October 26, 2026 17:41
@spraza

spraza commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Change looks isolated to bulk load, so ok for 7.4 backport. Accepting.

@ShreeChaturvedi triggered rebase. Once CI is clear, feel free to merge.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: f5f2ac5
  • Duration 0:38:30
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr on Linux RHEL 9

  • Commit ID: f5f2ac5
  • Duration 0:46:54
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux RHEL 9

  • Commit ID: f5f2ac5
  • Duration 1:00:09
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests on Linux RHEL 9

  • Commit ID: f5f2ac5
  • Duration 1:39:51
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS 14.x

  • Commit ID: f5f2ac5
  • Duration 3:12:55
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

This comment has been minimized.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos on macOS 14.x

  • Commit ID: f5f2ac5
  • Duration 1:18:04
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants