Back to all posts
Day 138Thursday, June 18, 20264 min read

An iOS Companion for My Local Agent, Private by Design

cybersecurityiostailscaleremoteaccessswiftuilearningprocess
View original post

๐Ÿ”„ Topic

Building an iOS companion app to control the laptop's local agent remotely, without exposing anything to the public internet.


๐ŸŽฏ Goal

Get a phone-to-laptop control channel that works over a private network, and polish the app into something worth showing.


๐Ÿ›  What I Did

I worked on an iOS companion app (SwiftUI) that talks to the local agent daemon on the laptop. The connection runs over Tailscale, so the agent endpoint is a private HTTPS service on the tailnet instead of a port on the public internet. I made provider handling daemon-driven, improved the command center, task list, and new-task flow, and even ran an autonomous coding agent in a persistent session to do polish passes on the app itself. Along the way I checked honestly whether marketing phrases like "works with private HTTPS endpoints" were actually true of the code or still aspirational.

Main areas covered:

  • SwiftUI companion app architecture
  • daemon-driven provider handling
  • Tailscale private HTTPS endpoints
  • command center and task flow polish
  • autonomous agent doing supervised UI passes
  • honest capability claims vs aspirations

๐Ÿ”— Key Cybersecurity Connections

Remote control of a machine that runs an agent with tool access is a high-value target. Keeping the channel on a private overlay network instead of the public internet is a deliberate attack-surface decision, and verifying claimed capabilities is basic security honesty.


๐Ÿ” Investigation Questions

  • Is the agent endpoint reachable only on the tailnet?
  • How does the app authenticate to the daemon?
  • What could a stolen phone do to the laptop?
  • Are agent commands from the phone logged?
  • Do the marketing claims match the implemented code?

๐Ÿšจ Detection Opportunities

Potential monitoring ideas:

  • connections to the daemon from unknown devices
  • commands issued outside normal hours
  • tailnet device list changes
  • failed authentication attempts against the daemon
  • agent tasks started remotely without a matching session

Example:

project=ios-agent-companion
change_type=remote_control_channel
risk_area=private_endpoint_exposure
triage=verify_endpoint_not_publicly_reachable

๐Ÿงญ MITRE ATT&CK Techniques

Possible mappings depending on confirmed behavior:

  • T1021 โ€” Remote Services
  • T1133 โ€” External Remote Services
  • T1078 โ€” Valid Accounts

๐Ÿ—บ Visual Investigation Diagram

iPhone app
    โ†“

Tailscale tailnet โ†“ Private HTTPS endpoint โ†“ Agent daemon โ†“ Laptop actions


โš  Challenges

The challenge was the gap between "it demos well" and "the claim is true." One sentence about supporting private HTTPS endpoints turned into real work to make the code actually deserve the sentence.


๐Ÿ“š What I Learned

I learned that remote access design is mostly about what you refuse to expose. Starting from a private overlay network made every later decision safer by default.


โžก Next Steps

  • Tighten authentication between app and daemon
  • Add logging for remotely issued commands
  • Keep productizing the companion as a remote agent hub
  • Re-test claims after every capability change

๐Ÿง  Reflection

This was useful because it combined building with threat thinking: every convenience feature for me is also a convenience feature for whoever steals my phone.


๐Ÿงฉ Lessons Learned

What worked

Private-by-design networking from the first commit.

What broke

A capability claim that the code did not yet support.

Why it broke

Positioning text was written before the implementation existed.

Fix / takeaway

Verify every security-relevant claim against the code before repeating it.


๐Ÿ“ˆ Skill Progression Context

This supports my cybersecurity progression because secure remote access, endpoint exposure decisions, and honest capability assessment are daily concerns in real security engineering.


๐Ÿ˜„ TL;DR

Phone controls laptop; internet not invited.