Repository navigation
fix: privacy and transport hardening from the October review - #10
Merged
Merged
Conversation
Opting out now takes effect at once: the flush loop checks the switch before every batch, and turning it off cancels the upload in flight. Payload values are cleaned of control characters before they are scrubbed (they used to split an address past the patterns and be removed afterwards), cut to 2,000 characters first, and the patterns' leading runs are bounded so a long value scrubs fast. Shortened IPv6 addresses and card numbers grouped with dots or non-breaking spaces are scrubbed too, and payload keys that look like they hold a secret (password, token, auth, key, card, cookie, cvv, ssn) are dropped with their values. Transport: http:// is refused except for localhost and debug builds, redirects are not followed, answers over 64 KB are ignored and a request has 60 seconds in all. Only Keen Kestrel's own 202 answer counts as delivered; other 2xx answers retry with backoff, as do 405, 407 and 410 instead of dropping the batch. 401, 403 and 404 pause sending for an hour instead of until relaunch. The command stream is bounded to 1,000 commands, and a full queue file is appended to and compacted now and then instead of rewritten for every signal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes from the October privacy review (KS-01 to KS-07, apart from KS-08).
Opt-out (KS-01). The flush loop checks
isEnabledbefore every batch and after every upload.Kestrel.isEnabled = falsecancels the upload in flight at once instead of waiting for the engine, and nothing more is sent.Scrubbing (KS-02, KS-03, KS-04).
john@exa<TAB>mple.comor a card number split by a newline is caught.2001:db8::1,::1) and card numbers separated by dots or non-breaking spaces are scrubbed.pass,secret,token,auth,key,card,cookie,cvv, orssnas a word, are dropped with their values.name=valuepatterns have bounded runs. A 20k-character value scrubs in milliseconds.Transport (KS-05, KS-07).
http://is refused except forlocalhostand debug builds. Redirects are not followed, answers over 64 KB are ignored,timeoutIntervalForResourceis 60 s.202with{"accepted": n}counts as delivered. Other 2xx, 3xx, 405, 407, 408 and 410 keep the batch and retry with backoff. 401, 403 and 404 pause sending for an hour instead of until relaunch.Queue (KS-06). The command stream is bounded to 1,000 (oldest dropped, waiters released, an opt-out is never lost). A full queue file is appended to and compacted after a batch of drops instead of rewritten per signal.
Behaviour changes for apps: payload keys that contain
key,auth,passand so on (keyboard_layout,author) are dropped;http://endpoints stop working in release builds except for localhost; a wrong key no longer silences the SDK until relaunch.Tests:
swift teston Linux (Swift 6.2): 86 passed. The redirect test is Apple-only (swift-corelibs traps on redirects from a mock protocol), so the macOS job covers it, along with the delegate signatures.