T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:5- Finding
Potentially Sensitive SQL Is Persisted Without Enforced Access Controls
- Content
View full analysis
> "$DATA_DIR/history.log"; } ``` Core commands subsequently persist the complete input in both a command-specific log and the unified history log. For example: ```bash check) shift if [ $# -eq 0 ]; then echo "Recent check entries:" tail -20 "$DATA_DIR/check.log" 2>/dev/null || echo " No entries yet. Use: sqlformat check " else local input="$*" local ts=$(date '+%Y-%m-%d %H:%M') echo "$ts|$input" >> "$DATA_DIR/check.log" local total=$(wc -l < "$DATA_DIR/check.log") echo " [Sqlformat] check: $input" echo " Saved. Total check entries: $total" _log "check" "$input" fi ;; ``` The same storage pattern is repeated for the other core commands through line 286. ### Technical Analysis The script stores complete SQL input in plaintext under the user's home directory. It does not set a restrictive `umask`, explicitly create the data directory with mode `0700`, or explicitly create log files with mode `0600`. The effective permissions therefore depend on the caller's current umask and any pre-existing directory or file permissions. Under a permissive environment, the resulting files may be readable by other local users or processes. SQL text can contain sensitive information, including: - Database names and schema details - Customer or operational data embedded in statements - Authentication tokens or passwords embedded in connection or migration queries - Proprietary business logic - Internal table and column names Each input is duplicated: once in the command-specific log and again in `history.log`. ...[truncated 1172 chars]- Remediation
View remediation
