-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
in-progressIssue is being actively worked onIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processing
Description
Issue
The provision.sh script parses cloud driver output using regex and directly exports variables without sufficient validation (lines 59-65).
Location
sh/e2e/lib/provision.sh:59-65
Code
while IFS= read -r _env_line; do
if [[ "${_env_line}" =~ ^export[[:space:]]+([A-Za-z_][A-Za-z0-9_]*)=\"(.*)\"$ ]]; then
export "${BASH_REMATCH[1]}"="${BASH_REMATCH[2]}"
fi
done <<CLOUD_ENV
$(cloud_headless_env "${app_name}" "${agent}")
CLOUD_ENVImpact
If a cloud driver implementation has a bug or is compromised, it could inject malicious export lines that:
- Override critical environment variables (PATH, LD_PRELOAD)
- Inject commands via variable values that are later evaluated
- Bypass the regex with edge cases
Recommendation
- Validate variable names against a strict whitelist (only known cloud-specific vars)
- Validate variable values (reject shell metacharacters)
- Use a safer parsing method (e.g., JSON output from cloud drivers instead of shell export lines)
Example:
ALLOWED_VARS="LIGHTSAIL_SERVER_NAME AWS_DEFAULT_REGION LIGHTSAIL_BUNDLE DO_DROPLET_NAME ..."
# Validate BASH_REMATCH[1] is in ALLOWED_VARS before export-- security/shell-scanner
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in-progressIssue is being actively worked onIssue is being actively worked onsafe-to-workSecurity triage: safe for automated processingSecurity triage: safe for automated processing