fix: app/server hardening follow-ups (4 of 5) #12
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/issue-6-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #6. Four of the five hardening follow-ups. Item D is intentionally not included -- see below.
Done
A. Report currency + prior net worth threaded over gRPC. They were dropped on the gRPC path, so the dashboard's currency scope and the change-since-last-session delta were lost. Added
currency+prior_net_worthtoGetReportRequestand threaded them throughLedgerClient.report, thegetReporthandler, and the app'sloadReport.B. Live-push reconnect resumes from the last seq + debounces. On a flap the consume loop reset
lastSeqto 0 and replayed the wholechange_log(onereload()per historical entry).changes()now takes afromSeq(the stream yields seq strictly greater than it); the loop resubscribes from the last processed seq and debounces reconnects with capped exponential backoff (0.25s -> 10s, reset on a healthy stream).C. Bearer token moved to the Keychain. It lived in UserDefaults (a world-readable plist). Now stored in the Keychain, migrating any legacy UserDefaults value once. The
COMMONS_GRPC_TOKENenv var still wins for dev.E. Plaintext non-loopback guard. The app's only transport is plaintext h2c (TLS is terminated at the edge). It now refuses a plaintext connection to a non-loopback host (
GRPCEndpoint.isLoopbackguard), so a bearer token is never sent in the clear over the network.Deferred
D. Namespace idempotency keys by principal -- not changed. The current first-writer-wins behavior is a deliberate, documented semantic, flagged in
WriterExecutor.postTransactionas pending a human decision (it only matters once clients choose their own keys; today keys are server-generated per proposal). Changing money-path dedup semantics shouldn't be done unilaterally, so #6 stays open for that item.Tests
GRPCEndpoint.isLoopbackunit tests (loopback vs non-loopback hosts).changes(fromSeq:)signature update across both sources + the controller.Full gate green: 188 SwiftPM tests + the Xcode app oracle (
** TEST SUCCEEDED **).buf lint/buf format/buf buildclean on the proto change.