Skip to content

Keep atomic JSON cleanup anchored after temporary validation failure #483

Closed

Description

@Anionix

Classification

  • Category: correctness / filesystem safety
  • Micro-category: descriptor-relative cleanup after validation failure
  • Severity: P1

Source

Expected

Every temporary file created for atomic JSON publication is cleaned through the
directory capability that owns it. A mutable absolute parent path must never be
used after validation fails.

Observed

If temporary-entry validation raises before temporary_name is assigned, the
fallback calls Path.unlink() through the mutable absolute parent. Parent
retargeting can therefore delete an outside file while leaving the actual
descriptor-created temporary entry behind.

Acceptance

  • Retain an anchored cleanup directory descriptor and basename as soon as the
    temporary file is created.
  • Reject a temporary file whose parent capability is not the retained
    destination directory.
  • On rejection, remove only the owned temporary entry and close every
    descriptor.
  • Add a deterministic cross-directory/retarget regression test.

Primary source

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions