Feeder follow-ups from the #58 reviews: scan gaps, the D1 stall and test gaps #62

Open
opened 2026-11-15 02:23:57 +00:00 by svc-agent-writer · 0 comments

Security review of ea8b70c (round 1), not fixed in #61

The review found no blocker. Each item below is also missed by the base fdfc45a.

Scan gaps (SHOULD-FIX)

  1. Outbound paths the source scan misses. Data(contentsOf:) and String(contentsOf:) accept a remote URL. NWConnectionGroup, NWBrowser and NWListener.Service are Network types that the pattern \bNWConnection\. does not match. Add each one to FORBIDDEN in tests/test_feeder_package.py, with a self-test sample for each.
  2. Old file-mutator selectors. removeFileAtPath:handler:, movePath:toPath:handler:, copyPath:toPath:handler:, linkPath:toPath:handler: and changeFileAttributes:atPath: reach a write through performSelector. Add them to the binary selector deny list, with a sample for each.
  3. Function references evade the call-syntax pins. A reference such as let f = unlink and a later f(path) passes test_only_the_listener_unlinks_or_changes_a_mode. The same holds for chmod, socket and connect. Fix: an nm -u check per object file. Only Listener.swift.o (or FeederCore.o) imports _unlink, _chmod, _socket and _connect, and no object imports _dlsym.

Test gaps

  1. child() in tests/test_feeder_real.py sends stdout to DEVNULL. A print() of a path or a message text passes every test. Capture stdout and assert that it is empty, or ban print( in feeder/Sources.
  2. The bind-retry pattern E[A-Z0-9]+ is looser than the closed errno table. Pin it to the table.
  3. The LC_RPATH entries of the binary are not pinned. Pin the expected set (@loader_path and the toolchain path) or assert that no entry points into a writable directory.

Notes

  1. D1 stall, triggerable by any sender. A message body of about 2.8 MB of control characters encodes to more than 16 MiB, because each one becomes a six-byte \uXXXX escape. That row then answers 503 on every request, and sync stops at its position for good. Anyone who can send the Owner a message can trigger it. It does no harm today, because the Feeder serves no real history before #10. It must be fixed before #10 serves one.
  2. The Members list that policy.admits(chat:) receives has no cap. #10 must not assume a bound.
  3. A token file of 4096 characters plus a final newline is refused. Decide whether the newline counts.
  4. Eight idle connections hold all slots for 10 s on a TCP address. This existed before #61.

Correctness review of ea8b70c (round 1), not fixed in #61

The review found no blocker and no should-fix item. It ran 15 extra mutations, and all were killed.

  1. Test name. testAResponseIsEncodedOnceAndAFailureIs503 (FeederCoreTests.swift:764) claims an encode failure. WireValue has no Double, so JSONEncoder cannot fail. The test repeats the progress-guard 503. Rename it to say what it tests.
  2. The watchdog skips teardown. The test watchdog calls exit(1), so tearDownWithError does not run and a timed-out test leaves /private/tmp/feeder-unit.* behind. That directory holds the synthetic token. Remove the directory before the exit, or create it under a path the watchdog cleans.
  3. pageBytesLimit can be a let. It is an internal var (Operations.swift:41-42) that only tests set. A value above responseBytes brings back the 503 stall. Make it an init parameter with the default.
  4. Encode cost. PageBytes encodes each item once more to measure it, so encode CPU doubles. Peak memory is about 2 × 16 MiB, because Response.http copies the header and the body.
  5. Fixed temp root. The Swift and black-box suites must write under /private/tmp, because the fixtures hard-code it and the history rule at Config.swift:105 accepts only ~/Library/Messages, /private/tmp or /tmp.

Spec follow-ups, carried from the #58 spec

  1. A time page with no item has no scan budget (OR-1 B). Add a cheap walk once #10 adds a deny policy.
  2. The token floor accepts a short repeated pattern (OR-2).
  3. The handle-unfit metric counts a cut row twice.
  4. A 2-argument open with a numeric write flag passes the scans. The correctness review measured it: the demangled 2-argument Darwin.open does not match the deny patterns. No write primitive is linked today.
  5. The listener does not check the address family of its socket at runtime.

Order

Item 7 must be fixed before #10 serves a real history. This issue therefore blocks #10.

Blocked by

  • none

Filed under: operator word "I grant authority to merge T4 through 21:00 aedt" sha256:cec4dd4fecbd

## Security review of `ea8b70c` (round 1), not fixed in #61 The review found no blocker. Each item below is also missed by the base `fdfc45a`. ### Scan gaps (SHOULD-FIX) 1. **Outbound paths the source scan misses.** `Data(contentsOf:)` and `String(contentsOf:)` accept a remote URL. `NWConnectionGroup`, `NWBrowser` and `NWListener.Service` are Network types that the pattern `\bNWConnection\.` does not match. Add each one to `FORBIDDEN` in `tests/test_feeder_package.py`, with a self-test sample for each. 2. **Old file-mutator selectors.** `removeFileAtPath:handler:`, `movePath:toPath:handler:`, `copyPath:toPath:handler:`, `linkPath:toPath:handler:` and `changeFileAttributes:atPath:` reach a write through `performSelector`. Add them to the binary selector deny list, with a sample for each. 3. **Function references evade the call-syntax pins.** A reference such as `let f = unlink` and a later `f(path)` passes `test_only_the_listener_unlinks_or_changes_a_mode`. The same holds for `chmod`, `socket` and `connect`. Fix: an `nm -u` check per object file. Only `Listener.swift.o` (or `FeederCore.o`) imports `_unlink`, `_chmod`, `_socket` and `_connect`, and no object imports `_dlsym`. ### Test gaps 4. `child()` in `tests/test_feeder_real.py` sends stdout to `DEVNULL`. A `print()` of a path or a message text passes every test. Capture stdout and assert that it is empty, or ban `print(` in `feeder/Sources`. 5. The bind-retry pattern `E[A-Z0-9]+` is looser than the closed errno table. Pin it to the table. 6. The `LC_RPATH` entries of the binary are not pinned. Pin the expected set (`@loader_path` and the toolchain path) or assert that no entry points into a writable directory. ### Notes 7. **D1 stall, triggerable by any sender.** A message body of about 2.8 MB of control characters encodes to more than 16 MiB, because each one becomes a six-byte `\uXXXX` escape. That row then answers `503` on every request, and `sync` stops at its position for good. Anyone who can send the Owner a message can trigger it. It does no harm today, because the Feeder serves no real history before #10. **It must be fixed before #10 serves one.** 8. The Members list that `policy.admits(chat:)` receives has no cap. #10 must not assume a bound. 9. A token file of 4096 characters plus a final newline is refused. Decide whether the newline counts. 10. Eight idle connections hold all slots for 10 s on a TCP address. This existed before #61. ## Correctness review of `ea8b70c` (round 1), not fixed in #61 The review found no blocker and no should-fix item. It ran 15 extra mutations, and all were killed. 11. **Test name.** `testAResponseIsEncodedOnceAndAFailureIs503` (`FeederCoreTests.swift:764`) claims an encode failure. `WireValue` has no `Double`, so `JSONEncoder` cannot fail. The test repeats the progress-guard 503. Rename it to say what it tests. 12. **The watchdog skips teardown.** The test watchdog calls `exit(1)`, so `tearDownWithError` does not run and a timed-out test leaves `/private/tmp/feeder-unit.*` behind. That directory holds the synthetic token. Remove the directory before the exit, or create it under a path the watchdog cleans. 13. **`pageBytesLimit` can be a `let`.** It is an internal `var` (`Operations.swift:41-42`) that only tests set. A value above `responseBytes` brings back the 503 stall. Make it an `init` parameter with the default. 14. **Encode cost.** `PageBytes` encodes each item once more to measure it, so encode CPU doubles. Peak memory is about 2 × 16 MiB, because `Response.http` copies the header and the body. 15. **Fixed temp root.** The Swift and black-box suites must write under `/private/tmp`, because the fixtures hard-code it and the history rule at `Config.swift:105` accepts only `~/Library/Messages`, `/private/tmp` or `/tmp`. ## Spec follow-ups, carried from the #58 spec 16. A time page with no item has no scan budget (OR-1 B). Add a cheap walk once #10 adds a deny policy. 17. The token floor accepts a short repeated pattern (OR-2). 18. The `handle-unfit` metric counts a cut row twice. 19. A 2-argument `open` with a numeric write flag passes the scans. The correctness review measured it: the demangled 2-argument `Darwin.open` does not match the deny patterns. No write primitive is linked today. 20. The listener does not check the address family of its socket at runtime. ## Order Item 7 must be fixed before #10 serves a real history. This issue therefore blocks #10. ## Blocked by - none --- Filed under: operator word "I grant authority to merge T4 through 21:00 aedt" sha256:cec4dd4fecbd
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dev/messages-mind-mcp#62
No description provided.