Repository navigation
AirDrop to the PC - #9
Conversation
| let name = safe_name(name); | ||
| let part = dir.join(format!("{name}.{}.magicinput", PART.fetch_add(1, Ordering::SeqCst))); | ||
| let r = (|| -> Res<PathBuf> { | ||
| let mut file = File::create(&part)?; |
There was a problem hiding this comment.
🔒 Agentic Security Review
Severity: MEDIUM
Inbound AirDrop files are written into Downloads with File::create and then revealed in Explorer/Finder. The send path only relays files that already carry a macOS sharingd quarantine mark, but that origin mark is not copied onto the saved file (no Windows Zone.Identifier / MOTW, no com.apple.quarantine on the receiver). After a successful receipt the Mac copy is deleted, so the quarantined original is gone.
Impact: A nearby AirDrop sender (including AirDrop set to Everyone) can land an executable or Office/HTML payload in the PC Downloads folder without SmartScreen, Office Protected View, or Gatekeeper seeing an origin mark, while MagicInput highlights the unmarked file.
Reviewed by Cursor Security Reviewer for commit 58f5969. Configure here.
…oads The Mac watches ~/Downloads for new files marked by sharingd (AirDrop). Once one stops growing it is offered to the PC over a connection of its own (Offer instead of a hello, then Data pieces and a Received receipt), so a big file never holds up the pointer. The PC takes it when the Mac's user is working on the PC (the pointer or the keyboard is there) or when its own input was used more recently than the Mac's, saves it to Downloads under a safe, free name and shows it in Explorer. The Mac removes its copy after the receipt. airdrop = auto | always | never in the Mac's config. The control connection is unchanged, so no protocol bump; an older PC just leaves files on the Mac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58f5969 to
bc138ef
Compare




Stacked on #8 (it builds on that branch; GitHub retargets this to
mainwhen #8 merges).What changes
Files AirDropped to the Mac move on to the PC's Downloads folder when you were working on the PC. Windows can't receive AirDrop, so the Mac relays it:
~/Downloadsfor new files that AirDrop marked (quarantine agentsharingd). Normal downloads are left alone, and so is anything that was there before MagicInput started.photo (2).heicif taken) and shows it in Explorer. After the PC confirms it has the whole file, the Mac removes its copy. If anything fails, the file stays on the Mac.airdrop = "auto" | "always" | "never"in the Mac's config (defaultauto).Transport: each file goes over a TCP connection of its own, with the same pairing-code encryption. It opens with
Offerinstead of a hello, then sendsDatapieces and gets aReceivedreceipt back, so a big file never holds up the pointer. The control connection doesn't change and there's no protocol bump. A PC on 0.5.0 rejects the offer, and the file stays on the Mac.Validation
cargo test: 20 passed. New tests: a 150 KB file crosses in pieces and lands under a free name with no part file left over; a declined offer leaves the file with the sender; unsafe names (../,:*?,CON) are cleaned.cargo check --target x86_64-pc-windows-gnu: no warnings.sharingdquarantine mark) moved from the Mac's Downloads to the PC's within a few seconds with the same SHA-256. The PC logged its decision (used 14 s ago here, 30 min ago there). A file without the mark stayed on the Mac. A real AirDrop from an iPhone is still to be tried.🤖 Generated with Claude Code