Skip to content

Add test-only security and restore regressions - #23

Merged
loverustfs merged 1 commit into
mainfrom
cursor/security-adversarial-regressions-121e
Nov 19, 2026
Merged

loverustfs merged 1 commit into
mainfrom
cursor/security-adversarial-regressions-121e

Conversation

@loverustfs

Copy link
Copy Markdown
Contributor

Summary

This pull request is test-only. It does not change product code or product behavior, and this work does not merge it.

Full TLS, mutual TLS, RBAC, and audit logging are out of scope. A green CI run is not a first-ship pass. This change does not claim that a first-ship security gate passed, that an official 1,000,000-operation load passed, or any throughput number. Paper figures in arXiv:2610.32247v1 are Baidu production numbers, not results from this repository.

crates/metadb-raft/src/backup.rs is not modified. .github/workflows/ci.yml is not modified. Files already changed by #19 and #21, including auth_fail_closed.rs, prefix_load.rs, backup_restore.rs, and docs/en/{configuration,operations,testing}.md, are not modified. Stress and topology tests are not modified.

Tests

crates/metadb-server/tests/security_adversarial_regressions.rs

  • persisted_non_loopback_advertise_without_secret_fails_closed starts once on 0.0.0.0:0 with a non-empty secret so a non-loopback advertise address is saved, shuts down, then restarts the same data directory on 127.0.0.1:0 with an empty secret. Startup fails closed with a refusing-to-serve error. A later 127.0.0.1 plus empty-secret start does not prove this path.
  • loopback_whitespace_secret_is_not_treated_as_empty records a consistency gap and does not fix it. reject_unauthenticated_bind trims the secret, and BearerAuth does not. On loopback, a whitespace-only shared_secret still starts. A missing bearer is rejected. A different whitespace bearer is rejected. Only the literal whitespace bearer authenticates. Add fail-closed auth regressions and a CI-scale prefix load #21 already records that a whitespace secret starts and an anonymous call is rejected. This test adds the separate finding that only the literal whitespace token succeeds.
  • uid_is_not_an_authorization_boundary uses one valid bearer to create and look up files whose request uid fields differ (1 and 2). uid is not an identity or tenant boundary. A green result documents that gap. It is not a first-ship pass.

This pull request does not repeat the #21 cases for loopback plus an empty secret, or for unknown non-security TOML keys.

crates/metadb-server/tests/restore_safety.rs

Restore coverage is in this new file, not in backup.rs. The artifact is a real backup from PersistentMetaDbCluster::create_backup. Private helpers in backup.rs stay private.

  • restore_rejects_non_empty_destination restores into a destination that already has a file. Restore fails, and the pre-existing file is unchanged.
  • restore_rejects_unsafe_manifest_paths replaces one manifest path with .., an absolute path, a backslash, a . component, or a .. component. restore_backup rejects each case with a relative-path error and does not write the destination. The absolute path used here is under the test temporary directory.

CI

.github/workflows/security-adversarial-regressions.yml is a separate workflow. It does not edit ci.yml. It runs only:

  • cargo test -p metadb-server --test security_adversarial_regressions --locked -- --test-threads=1
  • cargo test -p metadb-server --test restore_safety --locked -- --test-threads=1

That job is not an official load, a first-ship gate, or a locked pass.

Remaining gaps

  • Loopback plus an empty shared_secret still serves unauthenticated traffic.
  • Unknown non-security TOML keys are still ignored.
  • There is no RBAC or tenant isolation. uid is not an authorization boundary.
  • The backup path is a local filesystem trust model.
  • BearerAuth does not trim the secret, while startup does.
  • This change does not add TLS, mutual TLS, RBAC, or an audit log.

A green run of these leftover-risk tests is not a first-ship pass.

Open in Web Open in Cursor 

Cover persisted non-loopback fail-closed startup, the whitespace bearer comparison gap, uid not being an authorization boundary, and restore refusal for a non-empty destination and unsafe manifest paths.

Co-authored-by: RustFS <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block the test-only security and restore regression additions.

No open issues 🎉

What changed in this PR

Adds test-only security and restore regressions, extending the coverage from #19 and #21 without changing product behavior. Passing these tests documents current safeguards and remaining gaps; it is not a first-ship security pass.

Changes:

  • Covers fail-closed restart with a persisted non-loopback address, literal whitespace bearer matching, and the lack of a uid authorization boundary.
  • Tests that restore rejects non-empty destinations and unsafe manifest paths using a real backup artifact.
  • Adds a separate CI workflow that runs only the two new regression suites.
File Description
crates/​metadb-server/​tests/​security_adversarial_regressions.rs Adds restart, bearer-token, and uid regression tests.
crates/​metadb-server/​tests/​restore_safety.rs Adds destination-preservation and unsafe-path rejection tests.
.github/​workflows/​security-adversarial-regressions.yml Runs both new suites without modifying the existing CI workflow.

Review effort: Balanced

@loverustfs
loverustfs merged commit fe9c94e into main Nov 19, 2026
11 of 15 checks passed
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.

3 participants