Repository navigation
fix: handle omi:// custom scheme for task sharing deep link - #4761
Conversation
…tern Follow the same pattern as unlimited page (omi://h.omi.me/unlimited) so the app's existing pathSegments routing works without changes. Co-Authored-By: Claude Opus 4.6 <[email protected]>
cc620e1 to
1645af4
Compare
|
lgtm |
There was a problem hiding this comment.
Code Review
This pull request fixes an issue with deep link handling for task sharing using the "omi://" custom scheme. However, it introduces a potential path traversal vulnerability by passing an unvalidated token from the deep link to API request constructors. Additionally, the change introduces code duplication, as the logic is very similar to an existing block for handling other task sharing URIs, which could impact maintainability. This also violates the rule of preferring existing helper functions over inlining logic.
I am having trouble creating individual review comments. Click here to see my feedback.
app/lib/core/app_shell.dart (99)
Vulnerability Alert: The token extracted from the deep link is used without validation to construct an API URL in getSharedActionItems. This creates a potential path traversal vulnerability, allowing an attacker to manipulate API requests. It is critical to validate the token format (e.g., ensuring it is alphanumeric) before use.Additionally, this code block introduces duplication with existing logic (lines 90-95), which can lead to maintenance issues. Consider extracting common logic into a private helper method for improved maintainability. This refactoring could be addressed in a follow-up PR.
final token = uri.pathSegments.first;
if (!RegExp(r'^[a-zA-Z0-9_-]+$').hasMatch(token)) return;
References
- Prefer using existing helper functions over inlining their logic, especially when they handle complex cases like fallbacks or error handling. Inlining can introduce subtle bugs by missing parts of the original logic.
Summary
"Open in Omi" button on the task share page opens the app but nothing happens — no bottom sheet appears.
Root cause
omi://tasks/{token}URI parsing treats "tasks" asuri.host, not a path segment:uri.host="tasks"uri.pathSegments=["{token}"]The existing check
uri.pathSegments.first == 'tasks'never matches. This is the same pattern used by otheromi://handlers (uri.host == 'todoist',uri.host == 'asana', etc).Fix
Add
uri.host == 'tasks'handler inapp_shell.dart, consistent with otheromi://callback handlers.Test plan
🤖 Generated with Claude Code