T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Persistent Storage of User Input Without Restrictive Permissions
- Content
View full analysis
> "$DATA_DIR/history.log"; } ``` A representative command stores the supplied input in both a command-specific log and the shared history log: ```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: regexr 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 " [Regexr] check: $input" echo " Saved. Total check entries: $total" _log "check" "$input" fi ;; ``` The same storage pattern is repeated for `validate`, `generate`, `format`, `lint`, `explain`, `convert`, `template`, `diff`, `preview`, `fix`, and `report`. ### Technical Analysis The script persistently records arbitrary user-provided patterns, descriptions, and sample text under `~/.local/share/regexr`. It does not set a restrictive `umask`, explicitly create the data directory with mode `0700`, or create log files with mode `0600`. Consequently, access permissions depend entirely on the invoking environment. With a common `022` umask, a newly created directory can be mode `0755` and newly created log files can be mode `0644`, making the records readable by other local users. Each submitted value is also duplicated: once in its command-specific log and once in `history.log`. Inputs to regex-oriented tools may contain proprietary source fragments, identifiers, test records, credentials used as test data, o ...[truncated 1102 chars]- Remediation
View remediation
