T09 · Insecure Skill Coding Practices
- Location
scripts/htp.sh:74- Finding
Live Account Mutations Do Not Enforce the Documented Confirmation Gate
- Content
View full analysis
Vulnerability Details
File Location:
scripts/htp.sh:74-94
Vulnerability Type: Missing authorization confirmation for destructive or state-changing operations
Risk Level: MediumThe corresponding confirmation requirement appears in
SKILL.md:39-41, but it is not enforced by the executable helper.Vulnerable Code
bash complete|skip) d=$(day "${1:-}"); p=$(uuid "${2:-}") status=$([[ "$cmd" == complete ]] && echo completed || echo skipped) req PATCH "/api/plans/$p/days/$d" "{\"status\":\"$status\"}" | jq . ;; log-session) body="${1:?JSON body required}" jq -e 'type == "object" and .planId and .sessionId and .dayDate and .sessionType' <<<"$body" >/dev/null \ || { echo "body must be a JSON object with planId, sessionId, dayDate, sessionType" >&2; exit 2; } req PUT /api/session-logs "$body" | jq . ;; session-logs) p=$(uuid "${1:-}"); d=$(day "${2:-}") req GET "/api/session-logs?planId=$p&dayDate=$d" | jq . ;; maxes) req GET /api/exercise-maxes | jq '[.maxes[] | {displayName, exerciseKey, oneRepMaxKg, source, updatedAt}] | sort_by(.displayName)' ;; set-max) name="${1:?exercise name required}"; kg="${2:?weight in kg required}" body=$(jq -n --arg n "$name" --argjson kg "$kg" '{exerciseName: $n, oneRepMaxKg: $kg}') req PUT /api/exercise-maxes "$body" | jq . ;;The documented rule in
SKILL.md:39-41states:markdown - Write commands change the user's live account. Run one only when the user asked for that change. Before running it, say in one line exactly what will change (day, session, sets, weights) and wait for their OK, unless they just gave every value themselves.Technical Analysis
The Skill documentation establishes user confirmation as the authorization boundary for write operations. However, the helper immediately sends authenticated
PATCHorPUTrequests when any write command is invoked. It does not require a confirmation f ...[truncated 2138 chars]- Remediation
View remediation
Remediation Suggestions
Enforce authorization in the executable helper rather than relying exclusively on Skill instructions:
- Require an explicit confirmation option for every write operation, such as
--confirmed. - Reject
complete,skip,log-session, andset-maxunless that option is present. - Prefer a two-stage workflow:
- First generate and display a normalized summary of the proposed mutation.
- Then require a short-lived confirmation token bound to the command, target plan, date, and mutation values.
- For interactive use, prompt for confirmation through a terminal and fail closed when no terminal is attached.
- Provide a dry-run mode that prints the HTTP method, API path, and sanitized request body without exposing the API key.
- Validate the full
log-sessionschema, including UUID/date formats, numeric ranges, and permitted session types, before requesting confirmation. - Preserve the existing instruction that credentials must never be printed or passed on the command line.
- Require an explicit confirmation option for every write operation, such as
