Skip to content

feat(ios): add a custom payload redactor - #292

Merged
easyhooon merged 2 commits into
mainfrom
feat/ios-payload-redactor
Nov 12, 2026
Merged

easyhooon merged 2 commits into
mainfrom
feat/ios-payload-redactor

Conversation

@easyhooon

@easyhooon easyhooon commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

Lets iOS apps rewrite messages before they reach the desktop app, matching Android's Dari.setPayloadRedactor. Closes #287.

Changes

  • Dari.shared.setPayloadRedactor(_:) takes a @Sendable (DariMessage) throws -> DariMessage; nil removes it.
  • New public DariMessage / DariMessageDirection. requestData, responseData and pageUrl are editable; id, handler name, display name, direction, tag and request id are read-only. A public init lets apps unit-test their redactors.
  • InspectorSession runs it after PayloadMasker for list, detail, search and observe, so search matches the redacted text like Android. Recorded messages are untouched.
  • A throwing redactor hides that message only: payloads become [dari: payload hidden, redactor failed] and pageUrl is dropped.
  • sample-ios masks email in the signIn scenario; docs in ios/index.mdx, masking.mdx (+ ko) and the README table.

Notes for reviewers

  • Differs from Android on failure: Android lets the exception fail the whole list/detail op or end the observe stream; iOS fails closed per message instead.
  • Handler names can't be rewritten on iOS (Android's copy allows it); masking.mdx says so.
  • The closure is @Sendable because it runs on the session read thread and the writes queue at once. Without it, a Swift 6 app registering from @MainActor hits an isolation trap (reproduced during review).
  • swift test passes (new PayloadRedactorTests, plus detail-after-masking and search session tests). The sample builds for the Simulator; not run on a device.
  • feat(ios): inspect Protocol Buffers payloads #293 (protobuf) is stacked on this PR and drops raw protobuf previews while a redactor is set. Merge this one first.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between b1de59f and 9583b6b.

Files selected for processing: 13

  • README.ko.md
  • README.md
  • dari-ios/Sources/Dari/Dari.swift
  • dari-ios/Sources/Dari/InspectorSession.swift
  • dari-ios/Sources/Dari/PayloadRedactor.swift
  • dari-ios/Tests/DariTests/InspectorSessionTests.swift
  • dari-ios/Tests/DariTests/PayloadRedactorTests.swift
  • documentation/content/docs/ios/index.mdx
  • documentation/content/docs/ko/ios/index.mdx
  • documentation/content/docs/ko/masking.mdx
  • documentation/content/docs/masking.mdx
  • sample-ios/DariSample/DariSampleApp.swift
  • sample-ios/DariSample/bridge.html
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@easyhooon
easyhooon marked this pull request as ready for review November 12, 2026 06:34
@easyhooon
easyhooon merged commit 8aaa190 into main Nov 12, 2026
8 checks passed
@easyhooon
easyhooon deleted the feat/ios-payload-redactor branch November 12, 2026 06:35
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.

feat(ios): add a custom payload redactor

1 participant