T09 · Insecure Skill Coding Practices
- Location
scripts/vehicle-query.sh:182- Finding
Sensitive vehicle data is stored without restrictive file permissions
- Content
View full analysis
"$CACHE_FILE" << EOF { "accessToken": "$accessToken", "vehicleToken": "$vehicleToken", "last_updated": "$(date -Iseconds 2>/dev/null || date '+%Y-%m-%dT%H:%M:%S')" } EOF log_success "认证信息已保存" } ``` The history-writing function contains: ```bash save_history() { local response="$1" local query_type="$2" local timestamp=$(date +%s) local address=$(echo "$response" | jq -r '.data.vehiclePosition.address // "未知"') local history="[]" if [ -f "$HISTORY_FILE" ]; then history=$(jq '.queries // []' "$HISTORY_FILE" 2>/dev/null || echo "[]") fi local new_record=$(cat << EOF { "timestamp": $timestamp, "type": "$query_type", "address": "$address", "sn": "$(echo "$response" | jq -r '.data.sn // "未知"')" } EOF ) echo "$history" | jq --argjson new "$new_record" '. + [$new] | .[-10:]' > "${TMP_DIR}/history_tmp.json" jq -n --slurpfile queries "${TMP_DIR}/history_tmp.json" '{queries: $queries[0]}' > "$HISTORY_FILE" rm -f "${TMP_DIR}/history_tmp.json" } ``` File creation permissions are inherited from the process umask. Under a common umask of `022`, newly created regular files may have mode `0644`, allowing other local users to read them. The cache is designed to contain bearer and vehicle tokens. The history contains a vehicle address, serial number, query type, and timestamp. These values are security- and privacy-sensitive. The current `main` function does not call `save_tokens`, s ...[truncated 1544 chars]- Remediation
View remediation
