Skip to content

[Audit] Record: 7-day review of 3e479f2..4e78771, the items that held up #197

Closed

Description

@saworbit

Context

This is a record of a review of the changes merged in the 7 days from Nov 7, 2026, 12:05 PM to Nov 14, 2026 (AEDT, UTC+11): 27 commits, 3e479f2 (#127) through 4e78771 (#189). They cover the format 1 data log and capsule journal, journal and data log compaction, storage roots, the persisted scrub schedule, the store key, and the S3 changes (#156, #163, #164, #171, #177).

The defects I found are filed separately: #194 (missing space.journal), #195 (scrub results lost on restart) and #196 (unchecked PUT integrity and protection headers). This issue lists what held up, with how I checked each item, so the same ground isn't covered again.

Severity: informational. Nothing here needs a change unless noted.

Discovery Path

I read every commit in the range and ran cargo test --workspace (all pass, rustc 1.95.0). I also ran cargo audit, ran spacectl and serve-s3 against scratch stores, drove the server with curl and boto3 1.44.3, and added throwaway tests in a separate worktree.

Failure Mechanism

None for these items. Each is one of:

Verified correct

  1. cargo audit --deny warnings is clean at 4e78771 (cargo-audit 0.23.0, 1509 advisories loaded), so Clear the cargo audit advisories and audit dependencies in CI #145's three remaining ignores are the only ones the tree triggers.
  2. CI's actions/checkout@v7 is a current major. v7.0.0 was released on Jun 18, 2026 and v7.0.1 on Jul 20, 2026.
  3. Preconditions::check_read evaluates headers in RFC 9110 §13.2.2 order: If-Match, or else If-Unmodified-Since, gives 412, then If-None-Match, or else If-Modified-Since, gives 304. With boto3, a PUT with IfNoneMatch="*" to an existing key got 412.
  4. Journal compaction (Journal::compact_with) and data log compaction (NvramLog::compact_with) take a snapshot, copy without the lock, then catch up and rename under the lock. Records appended meanwhile are copied unchanged. A failed rename followed by a failed reopen sets lost, and appends and reads are then refused (Refuse data log reads and appends after a swap that can't recover #180). I checked this by reading the code and running the existing crash-step tests. [fold] One generation swap for data-log and journal compaction #191 covers folding the two swaps into one.
  5. When an overwrite or DELETE drops a capsule that a GET is still streaming, its segments are kept until the last reader's Lease drops (S3View::release), so downloads aren't cut short and compaction keeps those records.
  6. KEY records are refused inside a BATCH by the encoder and by commit. write_live writes the KEY record first, so compaction keeps the store's key. check_store_key refuses a different fingerprint.
  7. With boto3 1.44.3 over http://, these calls work as docs/guides/QUICKSTART_S3.md says: create_bucket, put_object (ContentType and Metadata round-trip through Store an S3 object's Content-Type and x-amz-meta-* headers with its key #189), head_object, get_object, a 1 MB upload_fileobj, list_objects_v2 and download_fileobj. A 9 MB upload_fileobj fails at CreateMultipartUpload with NotImplemented, which [Gap] S3 view has no ListBuckets, DeleteBucket, DeleteObjects or multipart upload #159 covers.

By design

  1. ByteRange::parse sends the whole object when a Range has several ranges or doesn't parse. RFC 9110 §14.2 allows a server to ignore Range.
  2. A policy file with encryption: Disabled stores that capsule unencrypted on a store that has a key, without SPACE_ALLOW_PLAINTEXT. It's an explicit per-capsule choice. SPACE_ALLOW_PLAINTEXT only covers opening without the key. I found this by reading the code and didn't run it.

Edge cases

  1. PolicyFile accepts any Zstd level, for example !Zstd { level: 99 } or level: -5000. adjusted_level clamps it to -5..=22 with a warning, but the capsule's stored policy keeps the requested level. I reproduced this with spacectl create --policy-file, which exits 0. Policy::validate could range-check it.
  2. listen(None, 0) binds ::1 on the port the OS picked for 127.0.0.1. If another process holds that port on ::1, serve-s3 --port 0 fails with AddrInUse instead of picking again, and the unit test serve_s3_listens_on_both_loopback_addresses_on_one_port could flake for the same reason. I found this by reading the code and didn't reproduce it.
  3. Journal compaction keeps BIND records whose capsule spacectl delete removed (Live::apply keeps every name), so those names stay in the journal for good. [CLI] Remove S3 keys when spacectl delete drops their capsule #138 covers this.
  4. PUT checks that the bucket exists before streaming the body and doesn't check again at the commit. That's safe only while there's no DeleteBucket ([Gap] S3 view has no ListBuckets, DeleteBucket, DeleteObjects or multipart upload #159). The comment in put_object_with says so, and the check will need to move under the pipeline lock when DeleteBucket lands.
  5. The CI push trigger ignores docs/**, but pull_request doesn't, so docs-only PRs run CI and docs-only pushes to main don't. It's harmless either way.

Reproducible Counterexample

Commands behind the reproduced items:

$ cargo audit --deny warnings          # 294 crate dependencies, no findings
$ printf 'compression: !Zstd { level: 99 }\n' > z.yaml
$ spacectl create -f in.bin --policy-file z.yaml   # exit 0
s3.put_object(Bucket="bkt", Key="a.txt", Body=b"x", IfNoneMatch="*")
# ClientError: PreconditionFailed
s3.upload_fileobj(io.BytesIO(b"z" * 9_000_000), "bkt", "d.bin")
# ClientError: NotImplemented ... CreateMultipartUpload ... POST /bkt/d.bin is not implemented

Upstream Reference & Modern Standard

Proposed Resolution

Nothing is required. Optional follow-ups:

  • Range-check the Zstd level in Policy::validate (item 10).
  • Retry the pair bind when ::1 is taken under --port 0 (item 11).
  • Recheck the bucket under the lock once DeleteBucket exists (item 13).

Activity

  1. added
    documentation
    on Nov 14, 2026
  2. saworbit commented on Nov 14, 2026

    @saworbit
    OwnerAuthor

    Recommend closing this once it's been read. It's the record of what held in the 3e479f2..4e78771 review, and the defects from the same pass are #194, #195 and #196. Leaving it open for now.

  3. saworbit commented on Nov 14, 2026

    @saworbit
    OwnerAuthor

    Closing. This was a record and asked for no change. Item 13 is done: since #202 a PUT checks its bucket again at the commit (crates/protocol-s3/src/lib.rs:603). Items 10 and 11 stay noted here as optional.

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

    documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions