Phase 21 final : Fix remaining typescript errors - #2737
Merged
Conversation
- Enhanced input validation in getBinaryPath(): - Added validation for binary name parameters (length, suspicious chars) - Implemented path traversal prevention (block .., /, \) - Added command injection prevention (block ;, |, &, `, $) - Added file type validation (ensure regular files only) - Enhanced path resolution and security checks - Secured process spawning in startGoosed(): - Added directory path sanitization and validation - Implemented binary path verification with multiple validation layers - Added allowed directory enforcement (app/resources/cwd only) - Used hardcoded, safe arguments for spawn calls - Explicitly disabled shell execution (shell: false) - Added file existence and type verification - Implemented PID validation for taskkill operations - Enhanced environment variable security: - Added sensitive data redaction in logs (SECRET/PASSWORD/TOKEN) - Improved environment isolation and controlled variable passing - Secured process termination: - Added regex validation for process IDs (/^\d+$/) - Used validated arguments for all taskkill commands - Disabled shell for all spawn operations Security principles applied: - Input validation and sanitization - Path traversal prevention - Command injection prevention - Principle of least privilege - Defense in depth - Fail secure approach Resolves command injection vulnerability in child_process.spawn() calls.
- Fixed AddModelModal.tsx formattedModelOptions array typing:
- Added explicit type annotation for complex nested array structure
- Type: { options: { value: string; label: string; provider: string }[] }[]
- Fixed main.ts pendingDeepLink variable typing:
- Changed from implicit any to explicit string | null type
- Ensures type safety for deep link URL handling
Phase 22 Results:
- TS7005 errors: 6 → 0 (100% elimination)
- Total errors: 51 → 43 (8 errors eliminated)
- Linting: Zero warnings maintained
- Fixed App.tsx unused event parameters (4 fixes): - handleOpenSharedSession: event → _event - handleFatalError: event → _event - handleSetView: event → _event - handleAddExtension: event → _event - Fixed main.ts unused event parameter: - context-menu handler: event → _event - Fixed urlUtils.ts unused parameter: - filter callback: url → _url Technical approach: Used underscore prefix convention to indicate intentionally unused parameters while maintaining correct function signatures. Phase 23 Results: - TS6133 errors: 6 → 0 (100% elimination) - Total errors: 43 → 37 (6 errors eliminated) - Linting: Zero warnings maintained - Progress: 90% reduction (363+ errors eliminated)
- Fixed ConfigureBuiltInExtensionModal.tsx (3 fixes): - Changed extension.env_keys?.length > 0 to explicit null check - Removed optional chaining in map after null validation - Improved TypeScript inference for env_keys access - Fixed ConfigureExtensionModal.tsx (3 fixes): - Applied same pattern for extension.env_keys validation - Consistent null safety approach across both modals Technical approach: Replaced optional chaining with explicit conditional checks (&&) for better TypeScript inference when accessing nested properties after validation. Phase 24 Results: - TS18048 errors: 6 → 0 (100% elimination) - Total errors: 37 → 31 (6 errors eliminated) - Linting: Zero warnings maintained - Progress: 92% reduction (369+ errors eliminated)
Base automatically changed from
fix/typescript-errors-phase20-argument-type-mismatches
to
fix/typescript-errors-phase19-type-assignments
May 30, 2025 14:47
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.
Overview
Fixed remaining TypeScript compilation errors in the ui/desktop project and ensured ESLint passes with zero warnings.
Key Changes
Import and Path Fixes
../ui/selectto../ui/Select@/src/Appto relative path../../../App@/src/apito relative path../../../apiProviderDetailsandConfigKeytypes from APIType Safety Improvements
as unknown aspattern forSharedSessionDetailsSearchContainerElementdeleteoperator with object destructuring to avoid optional property errorsRecord<string, unknown>toRecord<string, string>Component Fixes
_RecipeConfiginterfaceparentView,setView) toModeSelectionItemNode.js and Electron Compatibility
Bufferfromnode:stream,ProcessEnvfromnode:process)Bufferimport fromnode:bufferunref()method call with proper existence checkglobalShortcut.registervoid return type handlingas unknown aspattern for dialog type castingCode Quality
@ts-expect-errordirectives