Follow-up from review of #6045.
The Android allowlist validator (RNSentryModuleImpl.isAllowedUri) ships in #6045 with 17 unit tests in RNSentryUriValidationTest. The equivalent iOS function — RNSentryIsPathUnderAllowedRoots in packages/core/ios/RNSentry.mm — has no unit tests in that PR.
The RNSentryCocoaTester workspace exists and is wired into native-tests.yml, so the infrastructure is already in place. What's needed:
- Expose the file-scope
static BOOL RNSentryIsPathUnderAllowedRoots(NSString *) to tests via a thin Obj-C class-method wrapper on RNSentry, declared in RNSentry+Test.h (matches the existing +captureReplayWithReturnValue pattern).
- Add
RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryUriValidationTests.m covering:
- empty path → NO
- path containing
.. component → NO
- path under
NSTemporaryDirectory() → YES
- path under caches dir → YES
- path under documents dir → YES
- path under
Library/ (e.g., Library/Cookies) → NO
- absolute path outside sandbox (
/etc/passwd) → NO
- symlink inside tmp pointing outside the sandbox → NO (uses
NSFileManager createSymbolicLinkAtURL in setUp/tearDown)
- Wire the new file into
RNSentryCocoaTester.xcodeproj (Xcode UI or xcodeproj ruby gem).
Mirrors the Android coverage so both platforms have parity.
Follow-up from review of #6045.
The Android allowlist validator (
RNSentryModuleImpl.isAllowedUri) ships in #6045 with 17 unit tests inRNSentryUriValidationTest. The equivalent iOS function —RNSentryIsPathUnderAllowedRootsinpackages/core/ios/RNSentry.mm— has no unit tests in that PR.The
RNSentryCocoaTesterworkspace exists and is wired intonative-tests.yml, so the infrastructure is already in place. What's needed:static BOOL RNSentryIsPathUnderAllowedRoots(NSString *)to tests via a thin Obj-C class-method wrapper onRNSentry, declared inRNSentry+Test.h(matches the existing+captureReplayWithReturnValuepattern).RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryUriValidationTests.mcovering:..component → NONSTemporaryDirectory()→ YESLibrary/(e.g.,Library/Cookies) → NO/etc/passwd) → NONSFileManager createSymbolicLinkAtURLinsetUp/tearDown)RNSentryCocoaTester.xcodeproj(Xcode UI orxcodeprojruby gem).Mirrors the Android coverage so both platforms have parity.