Skip to content

fix(python): scope env to exported vars only, drop shell-local variable merge#2059

Closed
chaliy wants to merge 1 commit into
mainfrom
fix/pr-2044-python-env-scope
Closed

fix(python): scope env to exported vars only, drop shell-local variable merge#2059
chaliy wants to merge 1 commit into
mainfrom
fix/pr-2044-python-env-scope

Conversation

@chaliy

@chaliy chaliy commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Superseded by #2058 — implementation change and test updates combined into one PR covering both issues #2043 and #2044.

Copilot AI review requested due to automatic review settings June 12, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent unexported shell-local variables from being visible to embedded Python (so os.getenv() / os.environ reflect exported env only), aligning behavior with bash semantics and reducing information disclosure risk.

Changes:

  • Updates the spec-case to distinguish exported vs unexported variable visibility from Python.
  • Tightens the integration test unexported_var_not_leaked to assert the unexported variable is not visible.
  • (Per PR description) expects the Python builtin to stop merging shell-local variables into the Python environment, but that implementation change is not included in the files changed by this PR.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/bashkit/tests/spec_cases/python/env_leak.test.sh Adjusts spec coverage to require exported vars visible and unexported vars not visible.
crates/bashkit/tests/integration/python_security_tests.rs Strengthens the regression assertion to require INTERNAL_VAR is not visible from Python.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +615 to +616
assert_eq!(r.exit_code, 0);
assert_eq!(r.stdout.trim(), "none");
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit e8e283e Commit Preview URL

Branch Preview URL
Jun 12 2026, 10:04 AM

@chaliy chaliy closed this Jun 12, 2026
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