Skip to content

fix: explicit env var passthrough for sudo on env_reset distros - #87

Closed
murilovarela wants to merge 1 commit into
VantaInc:mainfrom
murilovarela:PER-10076-fix-sudo-env-passthrough
Closed

fix: explicit env var passthrough for sudo on env_reset distros#87
murilovarela wants to merge 1 commit into
VantaInc:mainfrom
murilovarela:PER-10076-fix-sudo-env-passthrough

Conversation

@murilovarela

@murilovarela murilovarela commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Problem

On distros with env_reset in sudoers (like we've seen in Ubuntu 26.04 as reported: https://vanta.atlassian.net/browse/PER-10076), sudo -E does not reliably pass through VANTA_KEY, VANTA_OWNER_EMAIL, or VANTA_REGION. The env_reset policy strips the environment regardless of the -E flag, so the dpkg/rpm postinst script never sees the required variables and installation fails silently.

Solution

Replace sudo -E with plain sudo and explicitly forward only the required variables via sudo env VAR=value .... This sidesteps env_reset entirely — the variables are passed as arguments to env rather than inherited through sudo.

VANTA_NOSTART is forwarded conditionally using shell parameter expansion so it is only included when set.

Changes

  • install-linux.sh: Replace sudo -E with sudo and pass env vars explicitly to the install command

Fixes PER-10076

On distros with env_reset in sudoers (RHEL, Fedora, Amazon Linux, etc.),
sudo -E does not reliably pass through VANTA_KEY, VANTA_OWNER_EMAIL, or
VANTA_REGION to the dpkg/rpm postinst. Replace sudo -E with plain sudo
and forward only the required vars explicitly via sudo env.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@murilovarela
murilovarela marked this pull request as ready for review June 11, 2026 14:31
anani112
anani112 previously approved these changes Jun 11, 2026
@anani112
anani112 dismissed their stale review June 11, 2026 15:42

resubmit PR from vantainc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants