T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/booking-api.sh:45
- Finding
- Sensitive Patient Data Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/booking-api.sh:45-55`; documented usage in `SKILL.md:132-133` **Vulnerability Type**: Sensitive-data exposure through process arguments and command logging **Risk Level**: High ### Vulnerable Code ```bash book|book-dry) json="${1:-}" [ -z "$json" ] && error "Usage: klarity-api.sh book '<json-payload>'" url="${BASE_URL}/api/v1/book" [ "$command" = "book-dry" ] && url="${url}?mode=dry_run" curl -s -X POST \ -H "Content-Type: application/json" \ -d "$json" \ "$url" | python3 -m json.tool ``` The documented invocation explicitly places the complete patient record in a command-line argument: ```bash scripts/booking-api.sh book '{"provider_id":"...","session_id":"...","service":"...","slot":"...","patient_first_name":"...","patient_last_name":"...","patient_email":"...","patient_phone":"...","patient_dob":"...","patient_state":"...","insurance_carrier":"...","insurance_member_id":"..."}' ``` ### Technical Analysis The booking interface accepts the entire JSON patient record through `$1`. This record can include the patient's name, date of birth, email address, telephone number, state, insurance carrier, insurance member ID, selected mental-health service, provider identifier, and appointment time. Command-line arguments may be exposed through process inspection facilities, execution telemetry, shell debugging, audit frameworks, terminal scrollback, command histories, or Agent tool-call logs. Quoting the argument prevents shell word splitting but does not provide confidentiality. This design conflicts with the instruction in `SKILL.md` that patient information must never be stored. Even if the script itself does not write a file, upstream command recording or process monitoring can retain the payload. ### Attack Path 1. A patient supplies identity, contact, health-service, and insurance information to the Agent. 2. The Agent constructs the documented `boo ...[truncated 958 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Accept booking JSON through standard input rather than a command-line argument. For example: ```bash payload="$(cat)" curl --fail --silent --show-error \ -X POST \ -H "Content-Type: application/json" \ --data-binary @- \ "$url" <<<"$payload" ``` - Change the documented interface to an invocation such as: ```bash printf '%s' "$payload" | scripts/booking-api.sh book ``` - Prefer streaming standard input directly to `curl` where validation requirements permit, reducing the number of in-memory copies. - Ensure the Agent runtime redacts booking payloads from tool-call logs, traces, error reports, and observability systems. - Do not enable shell tracing with `set -x` around booking operations. - Avoid temporary files. If one is unavoidable, create it with restrictive permissions, prevent backups, and securely remove it immediately after use. - Minimize the fields sent to the service and clearly obtain user consent before transmitting sensitive patient and insurance information. ]]>
