T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/gcal_core.py:337
- Finding
- Calendar Mutations Execute Without Enforced User Confirmation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/gcal_core.py:337-353`, `scripts/gcal_core.py:381-384`, `scripts/gcal_core.py:457-472`, and `scripts/gcal_core.py:515-525` **Vulnerability Type**: Fail-open authorization and confirmation control **Risk Level**: High ### Vulnerable Code Event creation: ```python # Confirmation check if not confirmed: print(f"\n📅 Create event:") print(f" Title: {summary}") print(f" When: {format_datetime(start)} - {format_datetime(end)}") if location: print(f" Where: {location}") if attendees: print(f" With: {', '.join(attendees)}") # In actual skill use, Clawdbot will handle confirmation # This is for CLI testing try: event = service.events().insert( calendarId=calendar_id, body=event_body, sendUpdates="all" if attendees else "none" ).execute() ``` Quick-add creation: ```python try: event = service.events().quickAdd( calendarId=calendar_id, text=text ).execute() ``` Event update: ```python # Confirmation if not confirmed: print(f"\n✏️ Update event: {event.get('summary')}") if summary: print(f" New title: {summary}") if start: print(f" New start: {format_datetime(start)}") if end: print(f" New end: {format_datetime(end)}") try: updated = service.events().update( calendarId=calendar_id, eventId=event_id, body=event ).execute() ``` Event deletion: ```python if not confirmed: print(f"\n🗑️ Delete event:") print(f" Title: {parsed.get('summary')}") print(f" When: {format_datetime(parsed.get('start_dt'))}") print(f"\n ⚠️ This action cannot be undone!") try: service.events().delete( calendarId=calendar_id, eventId=event_id ).execute() ``` ### Technical Analysis The `confirmed` argument is presented as a safety control, but setting it to `False` only causes event details or a warni ...[truncated 2113 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make all mutation methods fail closed when confirmation has not been supplied: ```python if not confirmed: display_proposed_change(...) return None ``` For deletion, return `False` rather than continuing. 2. Add an explicit confirmation parameter to `quick_add()` and prevent the API request unless it is true. 3. Prefer a two-phase transaction: - Phase one prepares and displays the exact mutation. - Phase two accepts a short-lived confirmation token tied to the operation, event ID, calendar ID, and proposed values. 4. Do not treat a generic prior confirmation as authorization for a later or modified request. 5. Require fresh confirmation when the selected event, time, attendees, or other material fields change. 6. Add unit tests using a mocked Calendar API to verify that `insert()`, `quickAdd()`, `update()`, and `delete()` are never called when confirmation is absent or false. 7. Consider using `sendUpdates="none"` by default and separately confirm operations that send invitations or notifications. ]]>
