fix(app): hardening — crash prevention, thread safety, filename sanitization#59
Merged
fix(app): hardening — crash prevention, thread safety, filename sanitization#59
Conversation
If Application Support directory is unavailable (e.g. restricted sandbox), the app previously crashed at launch. Now falls back to ~/.MeetingTranscriber/ and logs an error instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Invalid regex patterns previously crashed the app at init time. Now uses compactMap with do-catch to skip invalid patterns and log the error, allowing the app to continue with remaining patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The static `hasPromptedAccessibility` flag was unprotected, allowing a race condition if ensureAccessibilityAccess() was called concurrently from multiple threads — the prompt could be shown multiple times. Replace with OSAllocatedUnfairLock for atomic check-and-set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… handles - ProtocolGenerator: strip invalid filename characters (/ : \ NUL), cache DateFormatter as static property - PipelineQueue: use defer for FileHandle.closeFile() - Helpers: cache mach_timebase_info (constant per boot, was re-queried on every call) - Update roadmap with refined custom words implementation details Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ling - 5 tests for ProtocolGenerator filename sanitization (/, :, \, NUL) - 2 tests for MeetingDetector graceful handling of invalid regex patterns
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.
Summary
Cherry-picked hardening fixes from execsumo/meeting-transcriber fork:
fatalErrorwith fallback to~/.MeetingTranscriber/when Application Support unavailabletry!withdo/catchfor regex compilation — invalid patterns are silently skipped instead of crashingOSAllocatedUnfairLockfor thread-safe accessibility prompt guard/ : \ NUL), cacheDateFormatteras static propertydeferforFileHandle.closeFile()to prevent resource leaksmach_timebase_info(constant per boot, was re-queried on every call)Test plan
/ : \ NUL+ combined)