Skip to content

AirDropped files keep their origin mark on the other computer - #17

Draft
betoxf wants to merge 1 commit into
mainfrom
fix/airdrop-origin-mark
Draft

betoxf wants to merge 1 commit into
mainfrom
fix/airdrop-origin-mark

Conversation

@betoxf

@betoxf betoxf commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

A file AirDropped to the Mac and relayed to the other computer was saved into Downloads without the "came from another device" mark AirDrop had put on it, and the marked original on the Mac is deleted after the transfer. So SmartScreen, Office Protected View and Gatekeeper never checked it. This is the open finding from the security review on #9 (#9 (comment)).

The receiver now marks the file itself, before it gets its final name:

  • Windows: a Zone.Identifier stream with ZoneId=3.
  • macOS: com.apple.quarantine set to 0081;<time>;MagicInput;. The agent is MagicInput and not sharingd, so the AirDrop relay on a receiving Mac doesn't treat the file as a new AirDrop and send it back.

Everything that arrives on this path is an AirDrop from the other computer, so the receiver can always mark it. That keeps the change to receive_file in src/net.rs with no new message field.

If the mark can't be written (a Downloads folder on exFAT or FAT32), the file is still saved and the log gets a warning. Refusing the file would break a relay that works today.

User-visible behavior

  • Before: relayed files opened with no check, like files created locally.
  • After: relayed files behave like downloads. On the PC, Office documents open in Protected View and executables get the SmartScreen check. On a Mac that receives one, Gatekeeper checks it.

Validation

  • cargo test --locked on macOS: 20 passed. file_travels_in_pieces_and_lands_under_a_free_name now does a loopback transfer and reads the mark back from the saved file under its final name (photo (2).heic), on both systems.
  • macOS reads the mark as a quarantine record: NSURLQuarantinePropertiesKey returns agent "MagicInput" for a file marked with the same string.
  • cargo clippy --all-targets --locked: the same 4 warnings as main.
  • cargo check --target x86_64-pc-windows-gnu --all-targets --locked: passes with no warnings.
  • The Windows assertion has not run locally; it runs on windows-latest in CI on this PR.
  • Tested on real hardware: not done. No SmartScreen, Protected View or Gatekeeper prompt has been seen on screen, and no Mac-to-PC AirDrop was run with this build.
  • No pairing codes or personal content in logs or screenshots.

Risk

  • Protocol change (bump PROTOCOL_VERSION?): None. Only the computer that receives the file needs this version; a PC on 0.6.2 keeps saving unmarked files.
  • Permissions, signing or packaging: None.
  • Merge order: conflicts with Update notice and Report a problem link #15 and Harden device pairing #16 in CHANGELOG.md only (each adds an Unreleased section). src/net.rs merges cleanly with Harden device pairing #16, and the merged tree passes cargo test --locked on macOS (26 passed) and cargo check --target x86_64-pc-windows-gnu --all-targets --locked.

🤖 Generated with Claude Code

A file relayed from the Mac was saved into Downloads without the mark
AirDrop had put on it, so SmartScreen, Office Protected View and
Gatekeeper never checked it. The receiver now marks it before it gets
its final name: Zone.Identifier (zone 3) on Windows, com.apple.quarantine
on macOS, with MagicInput as the agent so the AirDrop relay doesn't send
it back. If the drive can't hold the mark the file is still saved, with
a warning in the log.

No protocol change; only the receiving computer needs the update.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.

1 participant