Skip to content

Security pass: private morning/review, own history after a swap, throttles, bounded export - #114

Merged
ncbudd merged 3 commits into
mainfrom
security-pass
Nov 27, 2026
Merged

ncbudd merged 3 commits into
mainfrom
security-pass

Conversation

@ncbudd

@ncbudd ncbudd commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Root cause

A security review of the server's routes found several gaps. Most need an account in the household (a partner or
view-only account); none lets a stranger in.

  • A partner or view-only account could read the other person's morning cards and night review: time in bed, check-in
    notes and the AI review. Their nights, stages and insights were already private.
  • After the sides were swapped, a partner's own-side history also returned what the other person had recorded on that
    side before the swap.
  • The login throttle counted " alex" and "alex" as different names, although both sign in to the same account.
  • Changing your password had no limit on guesses of the current one.
  • An unknown name cost two password hashes and a known one cost one, a small timing difference.
  • GET /api/export took any hours, so one request could load the whole history into memory. Imported stage
    timelines could start in 1970, with the same effect.
  • Studio's Home Assistant test sent its entity ID unchecked into the request path, and accepted any URL (owner only).
  • A saved push-server token and a saved poll header could follow a changed address or a downgrade to http (owner only).
  • The phone's push test could report a failure from a different provider or person. Some notification errors could
    include a URL with a secret in it.

Fix

  • /morning and /review join the private reads (auth.PRIVATE_READS); the app only ever loads your own.
  • /api/history reads non-owners' rows by person (store.history(person=...)); non-finite hours fall back to the default.
  • The login throttle uses the same stripped name it checks. Password changes allow 5 wrong current passwords per 5
    minutes. The dummy hash for unknown names is made once.
  • Export is capped at 400 days (non-finite values fall back to 30 days); imported stages older than 400 days are refused.
  • The HA test checks the entity ID's shape (domain.object_id) and the address (http/https, never link-local), and its
    errors no longer echo exception text.
  • A saved push token is kept only when scheme, host and port are unchanged; poll headers follow the same rule.
  • The push test reports only that test's own failure; notification errors have URLs removed.
  • Not changed: the old ?token= live-feed sign-in stays for older app versions; it can go once those have updated.

Verification

  • New tests/test_security_pass.py (9 tests), one for each change.
  • test_auth.py, the notification tests, test_studio_sweep.py and test_cloud.py still pass (116 tests together).
  • publish_check.py: 0 hits.

Release note

Security: a partner or view-only account can no longer read the other person's morning summary and review, and history
after swapping sides shows only your own nights. Sign-in and password changes are harder to guess at, and a few
owner-only settings check their addresses more strictly.

…ier sign-in throttles, bounded export and imports, stricter owner addresses
Comment thread core/embertide/studio_api.py Fixed
@ncbudd
ncbudd merged commit 5d3e88b into main Nov 27, 2026
15 checks passed
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.

2 participants