Repository navigation
Add test-only security and restore regressions - #23
Merged
Merged
Conversation
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]>
There was a problem hiding this comment.
🟢 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
uidauthorization 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rsis not modified..github/workflows/ci.ymlis not modified. Files already changed by #19 and #21, includingauth_fail_closed.rs,prefix_load.rs,backup_restore.rs, anddocs/en/{configuration,operations,testing}.md, are not modified. Stress and topology tests are not modified.Tests
crates/metadb-server/tests/security_adversarial_regressions.rspersisted_non_loopback_advertise_without_secret_fails_closedstarts once on0.0.0.0:0with a non-empty secret so a non-loopback advertise address is saved, shuts down, then restarts the same data directory on127.0.0.1:0with an empty secret. Startup fails closed with a refusing-to-serve error. A later127.0.0.1plus empty-secret start does not prove this path.loopback_whitespace_secret_is_not_treated_as_emptyrecords a consistency gap and does not fix it.reject_unauthenticated_bindtrims the secret, andBearerAuthdoes not. On loopback, a whitespace-onlyshared_secretstill 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_boundaryuses one valid bearer to create and look up files whose requestuidfields differ (1 and 2).uidis 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.rsRestore coverage is in this new file, not in
backup.rs. The artifact is a real backup fromPersistentMetaDbCluster::create_backup. Private helpers inbackup.rsstay private.restore_rejects_non_empty_destinationrestores into a destination that already has a file. Restore fails, and the pre-existing file is unchanged.restore_rejects_unsafe_manifest_pathsreplaces one manifest path with.., an absolute path, a backslash, a.component, or a..component.restore_backuprejects 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.ymlis a separate workflow. It does not editci.yml. It runs only:cargo test -p metadb-server --test security_adversarial_regressions --locked -- --test-threads=1cargo test -p metadb-server --test restore_safety --locked -- --test-threads=1That job is not an official load, a first-ship gate, or a locked pass.
Remaining gaps
shared_secretstill serves unauthenticated traffic.uidis not an authorization boundary.BearerAuthdoes not trim the secret, while startup does.A green run of these leftover-risk tests is not a first-ship pass.