Skip to content

fix(id-sync): prevent forged archive refs from deleting another file's archive #8815

Closed

Description

@dezren39

Problem

A write-authorized id-sync peer can attach an archive.rename or archive.replace tag to one file while naming an archive owned by a different file. Deleting the first file then hard-deletes that unrelated archive and its metadata.

Evidence (fresh origin/main 671088b42ce21882f6e40f77288e758847fcaaf6)

  • pkgs/id/crates/id-sync/src/protocol.rs:691-699 gates SetTag and Delete on write authorization; :792-800 forwards arbitrary SetTag subject, key, and value to TagStore::set_tag without reserving archive-reference keys or checking ownership.
  • pkgs/id/crates/id-store/src/tags.rs:811-847 stores the supplied subject/key/value without archive-reference validation.
  • pkgs/id/crates/id-sync/src/fileops.rs:602-615 accepts any reference whose value has the general <name>.archive.<digits> shape; it does not require the archive name to belong to the file being deleted.
  • fileops.rs:661-676 then deletes each referenced archive tag and all metadata for that archive name.

Reproduction shape

  1. Create a normal archive for other-file (for example other-file.archive.123) so its tag and metadata exist.
  2. Through MetaRequest::SetTag, set archive.replace = "other-file.archive.123" on my-file from a peer granted write access.
  3. Through MetaRequest::Delete, delete my-file.
  4. The unrelated archive tag and its metadata are removed, although other-file was not renamed or deleted. The archive blob tag is lost and its blob may later be garbage-collected.

This differs from #4761 (now closed), which fixed normal FileOps::copy duplicating internally generated source references. This path allows an authorized protocol client to forge a cross-file ownership reference through the general metadata write endpoint. It is a concrete follow-up to the Rule 3 ownership audit in #4766/#4767.

Acceptance criteria

  • Protocol metadata writes cannot create or change an archive ownership reference to an archive not owned by that subject; choose and document an explicit policy for reserved archive.rename/archive.replace keys.
  • Regression test covers a write-authorized peer attempting the cross-file reference, then deleting my-file; other-file's archive tag and metadata remain intact.
  • Existing FileOps-generated archive references and legitimate rename/delete behavior continue to work.
  • Focused id-sync protocol/FileOps tests pass.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    on Nov 12, 2026
  2. developing-today commented on Nov 12, 2026

    @developing-today
    Contributor
  3. added
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/sSmall: expected under 2 hours of work
    on Nov 12, 2026
  4. dezren39 commented on Nov 12, 2026

    @dezren39
    MemberAuthor

    Reproduced on current main 639b961: an authorized peer could set a foreign archive reference, and deleting the subject could remove another file’s archive and metadata. The fix reserves archive.rename/archive.replace for FileOps, refuses protocol SetTag/DelTag on those keys, and makes deletion ignore references outside the subject’s own archive namespace. Regression coverage exercises the protocol handler and confirms pre-existing foreign archives survive. PR #8845 is open; focused tests pass, required CI is queued.

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

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions