ikie is close to launch, so before that we reviewed the whole service for security. The scope:
- The web app and the public API (140-odd paths under
/api/v1) - MCP for a connected Claude, tool sign-in (OAuth), work-log keys
- Sign-in and sessions
- External calendar and task-source connections, webhooks, cron jobs
- The data layer (SQL, secret storage), payments, the admin screen, the iOS app
The method was reading code and testing locally. We reproduced issues on an empty database (PGlite) with the real sign-in library (Better Auth), and sent not a single request to the production server (ikie.app).
This post covers only what we blocked and with what structure. It doesn't say how anything could have been exploited before the fix, since that could become a how-to for attacking other services with the same mistakes.
What we found, and the order we fixed it
There were 4 high, 9 medium and several low issues. Apart from three that needed a person's decision, we fixed them right away without asking.
- #751Round 1: sign-in and linking flows, items inside private events, recurrence rules, consent screen, payments, .ics fetching, headers
- #755Round 2: tie push devices to sessions, people who left a group, length limits on input, key lists
- #758iOS: memo owner, open only web addresses, hide on the lock screen, clean up on sign-out
- #762A setting to turn Siri and Shortcuts on or off (a person decided)
- #764Encrypt external service tokens in the database (a person decided)
All five PRs merged within an hour and a half, late at night. Rate limits went into Vercel firewall rules rather than app code.
Put together, the fixes fell under a handful of principles.
1. The same decision, whichever door you come in by
ikie has many doors. The web, iOS, a connected Claude and external calendars like Google and iCloud all create and change the same items. If only one door checks, values that come in through another door skip the check.
Recurrence rules were like that. A broken or overly dense rule can tie up whatever expands occurrences for a long time. Now one function in the calculation layer decides whether a rule can be expanded: it must be readable and no denser than once a day.
- Saving rejects a rule with that function.
- Expanding shows a bad rule as a single occurrence instead of throwing.
- Whether a person writes it, Claude writes it or an external calendar sends it, it goes through the same function.
Checks live in one decision, not at the doors. Adding doors doesn't add decisions.
2. Visibility is one SQL condition
Who sees what was decided in one SQL condition from the start. The board, search, nested items and public subscription feeds all filter rows with it. So fixing it meant fixing one place.
The fact we added this time is that privacy carries inward. ikie lets you nest items inside events and tasks, any number of levels deep. A task inside a private event counts as private even if its own field says public. That fact is written once, and the visibility condition, busy-only views, public feeds and exports all read it.
Leaving the other person's calendar name off shared items, and showing only a name instead of an email on public pages, happened in the same place.
3. Compute state instead of storing it
When someone who shared a calendar with a group left the group, the share stayed and kept reaching people. We could have deleted the share rows, but then nothing would come back if they rejoined.
So whether a share reaches anyone isn't stored; it's computed on every read. It reaches only while the person who shared it is in that group now. Rejoin and it comes back on its own. Group invitations use the same decision. A rule ikie follows from the start, "don't attach state to what's computed", turned out to fit security too.
4. Tie each flow to whoever started it
Sign-in and account linking are flows that bounce back and forth: they start in the app, go to the browser and come back to the app. The last step of such a flow has to confirm who started it.
- App sign-in sets a flow cookie at the start, and the last step creates a token only when that cookie is present.
- Account linking doesn't start just by opening a link. A confirmation screen shows which ikie account gets what linked, and only a same-origin press is accepted.
- While linking, the browser is left with no sign-in session cookie, only the state cookie the flow needs.
5. Trust only verified identity
- Email: whether you're the admin, and whether data from before sign-in gets carried over, is decided only by a verified email.
- The consent screen for connected tools: names and logos that a tool writes about itself aren't trusted. Only known official tools show their name and logo; others show "name · host". External logo images aren't fetched. iOS uses the same names.
- Payments: App Store transactions record when they were signed, and only a transaction signed later replaces an earlier one.
6. Keep outbound requests narrow
ikie's server sends requests outward in a few places: fetching .ics addresses users give it, and sending web push. Those places must not let the server be pulled toward internal addresses.
- .ics fetching checks the address at the moment it connects, not when the name was looked up, and checks again on every redirect.
- Web push goes only to known push service addresses.
- Links and meeting addresses accept only
httpandhttps. That's one function too, and iOS opens links with a function that means the same thing.
7. Lock secrets away, and end what has ended
Tokens for external services like Google, Outlook and Slack are now encrypted in the database (XChaCha20-Poly1305). We turned on the sign-in library's token encryption, and rows still in plain text from before are sealed by a cron job before it syncs. Rows that got a fresh token in the meantime aren't overwritten.
Notifications kept going to devices whose session had ended. We tied push devices to sign-in sessions: when a session is deleted, its device row goes with it, and a device someone else is still using can't be taken over.
Incoming text now has length limits: 2000 characters for a title, 1000 for a recurrence rule, 20 alerts, 200 characters for a calendar name.
On iPhone
We looked at the iOS app with the same principles.
- A dictated memo records who dictated it and is resent only while that person is signed in. Signing out deletes it.
- External addresses from items open only if they're web addresses.
- An outside link never starts a recording. It only puts the cursor in the memo field; the person taps the mic.
- Event titles in the Today widget are hidden on the lock screen.
- Signing out deletes exported files and the widget's last board.
What a person decided
Where there was more than one way to fix something, a person decided.
- External service tokens: encrypt them. The price is that changing the server secret means reconnecting every account.
- Siri and Shortcuts: rather than only blocking the lock screen, make the whole feature a setting you can turn off. On by default.
- Rate limits: add them. Sign-in, connected tools, work-log keys and adding friends are limited per IP in one-minute windows.
What was solid from the start
Some things needed no fix. Most of them came from the structure.
- All SQL takes parameters. User values never become table names or sort keys.
- Nowhere puts raw HTML on screen.
- Cookie-authenticated requests are accepted only from the same origin, and CORS stays closed.
- The admin screen checks for the owner in every use case.
- Webhooks are verified by signature or channel token, and cron jobs refuse to run without a secret.
- MCP sign-in uses PKCE and exact redirect addresses; a read token can't write, and revoking consent cuts it off at once.
- Work-log keys are stored only as hashes. iOS tokens sit in a Keychain item that opens only on this device.
What we learned
- One decision means one place to fix. With visibility, editing and recurrence rules decided in one place, most findings ended with fixing one function or one SQL condition.
- State you don't store can't go stale. Like shares from people who left a group, computed state fixes itself when the facts change.
- As doors multiply, move checks out of the doors. A connected Claude and external calendars should come in the same way a person does.
- When there's more than one fix, ask a person. They're the one who pays the cost.
The principle of splitting layers and keeping each decision in one place is in the principles post.