T09 · Insecure Skill Coding Practices
- Location
scripts/todo.sh:138- Finding
Ambiguous Fuzzy Matching Allows Unintended Reminder Modification or Deletion
- Content
View full analysis
Vulnerability Details
File Location:
scripts/todo.sh, lines 138–216; vulnerable matching and mutation operations occur at lines 146–159, 182–183, and 205–207.
Vulnerability Type: Ambiguous object selection and missing input validation in destructive operations
Risk Level: MediumComplete Vulnerable Code Snippets
Completion operation (
scripts/todo.sh, lines 146–161):applescript repeat with rem in reminders of default list if name of rem contains searchTitle then set completed of rem to true set completion date of rem to current date set found to true return "Completed: " & name of rem end if end repeat -- Search all lists if not found if not found then repeat with aList in lists repeat with rem in reminders of aList if name of rem contains searchTitle then set completed of rem to true set completion date of rem to current date return "Completed: " & name of rem & " (in '" & name of aList & "')" end if end repeat end repeat end ifUncompletion operation (
scripts/todo.sh, lines 180–187):applescript repeat with aList in lists repeat with rem in reminders of aList if name of rem contains searchTitle then set completed of rem to false set completion date of rem to missing value return "Uncompleted: " & name of rem end if end repeat end repeatDeletion operation (
scripts/todo.sh, lines 203–210):applescript repeat with aList in lists repeat with rem in reminders of aList if name of rem contains searchTitle then set remName to name of rem delete rem return "Deleted: " & remName end if end repeat end repeatTechnical Analysis
The
complete,uncomplete, anddeleteactions select a reminder using the AppleScriptcontainsoperator and ...[truncated 2464 chars]- Remediation
View remediation
Remediation Suggestions
-
Reject missing and empty search terms before invoking AppleScript:
bash if [[ -z "${1:-}" ]]; then echo "Error: A non-empty reminder title or identifier is required." >&2 exit 2 fi -
Search for an exact title match before performing substring matching.
-
If substring matching produces more than one result, do not mutate any reminder. Return the matching reminders with their list names and stable identifiers, then require the caller to select one explicitly.
-
Use a stable Reminders identifier for
complete,uncomplete, anddeleteoperations rather than relying solely on a mutable, non-unique title. -
Require explicit confirmation before deletion, particularly when the match was not exact. For noninteractive automation, support an explicit flag such as
--confirmor require the exact reminder identifier. -
Return a nonzero exit status for empty input, missing reminders, ambiguous matches, invalid arguments, and unsuccessful mutations so callers can reliably detect failure.
-
Add regression tests covering empty strings, duplicate titles, common substrings, reminders in multiple lists, exact matches, and deletion cancellation.
-
