Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(integrations): don't send full env to subprocess #3251

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

sentrivana
Copy link
Contributor

During the arguments modification to subprocess.Popen.__init__, an explicitly empty environment of {} is incorrectly confused with a None environment. This causes sentry to pass the entire environment of the parent process instead of sending just the injected environment variables.

Fix it by only replacing the environment with os.environ if the variable is None, and not just falsy.

During the arguments modification to `subprocess.Popen.__init__`,
an explicitly empty environment of `{}` is incorrectly confused with a `None`
environment. This causes sentry to pass the entire environment of the
parent process instead of sending just the injected environment variables.

Fix it by only replacing the environment with `os.environ` if the variable
is None, and not just falsy.
@sentrivana sentrivana enabled auto-merge (squash) July 5, 2024 18:04
@sentrivana sentrivana closed this Jul 5, 2024
auto-merge was automatically disabled July 5, 2024 18:19

Pull request was closed

@sentrivana sentrivana reopened this Jul 8, 2024
Copy link

codecov bot commented Jul 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.34%. Comparing base (31efa62) to head (cf7b459).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3251      +/-   ##
==========================================
- Coverage   79.34%   79.34%   -0.01%     
==========================================
  Files         132      132              
  Lines       14227    14227              
  Branches     2987     2987              
==========================================
- Hits        11289    11288       -1     
  Misses       2093     2093              
- Partials      845      846       +1     
Files Coverage Δ
sentry_sdk/integrations/stdlib.py 93.12% <ø> (ø)

... and 1 file with indirect coverage changes

@sentrivana sentrivana enabled auto-merge (squash) July 8, 2024 07:26
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.

None yet

3 participants