GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Stop embedding build-time environment variables in _sysconfigdata by youknowone · Pull Request #8813 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Sep 24, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #8802

crates/vm/build.rs dumped every environment variable of the build process into OUT_DIR/env_vars.rs, and _sysconfigdata include!d that file into build_time_vars. This is worse than the issue describes: the variables were not only cached in target/, they were compiled into the binary as string literals and readable at runtime via sysconfig.get_config_vars(). Any secret present in the build environment (CI tokens, cloud credentials) shipped inside the resulting binary.

Changes:

  • Remove the environment dump from build.rs and the include! from _sysconfigdata.rs. build_time_vars now contains only the explicit entries.
  • Drop the now unused itertools build-dependency.

None of the keys the stdlib reads through sysconfig.get_config_var were sourced from build-time environment variables, so no allowlist was needed.

Verified:

  • cargo clippy -p rustpython-vm --all-targets clean
  • Built with LEAKCHECK_SECRET set: sysconfig.get_config_vars() no longer contains HOME/PATH/the secret, and strings on the binary finds no trace of it
  • test_sysconfig, test_site, test_venv pass

Note for maintainers: previously published release binaries still contain the environment of the machine that built them. It is worth checking whether any CI secrets were exposed in past release builds.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Behavior Changes
    • The _sysconfigdata output no longer includes values captured from the build environment. It now reports the statically defined configuration values and runtime-dependent paths, including the installation prefix and binary directory. This may change which configuration variables are available to applications that inspect system configuration.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@youknowone
Stop embedding build-time environment variables in _sysconfigdata
9c0675c
crates/vm/build.rs wrote every environment variable of the build
process into OUT_DIR/env_vars.rs, and _sysconfigdata included that file
into build_time_vars. All build-machine environment variables ended up
as string literals in the binary and were readable at runtime through
sysconfig.get_config_vars().

Remove the dump and the include, and drop the now unused itertools
build-dependency. build_time_vars keeps only the explicit entries.

Fixes RustPython#8802

Assisted-by: Claude:claude-fable-5-1
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: RustPython/RustPython/.coderabbit.yml

Review profile: CHILL

Plan: Advanced

Run ID: ee2c3fdb-f35d-4efe-9401-79f573760850

📥 Commits

Reviewing files that changed from the base of the PR and between e56dfa1 and 9c0675c.

📒 Files selected for processing (3)
  • crates/vm/Cargo.toml
  • crates/vm/build.rs
  • crates/vm/src/stdlib/_sysconfigdata.rs
💤 Files with no reviewable changes (2)
  • crates/vm/Cargo.toml
  • crates/vm/src/stdlib/_sysconfigdata.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The VM build script no longer generates env_vars.rs from process environment variables, and _sysconfigdata no longer includes that file. The itertools build dependency is removed; its regular dependency remains.

Changes

VM environment export removal

Layer / File(s) Summary
Remove generated environment entries
crates/vm/Cargo.toml, crates/vm/build.rs, crates/vm/src/stdlib/_sysconfigdata.rs
The build dependency and build-script code for generating env_vars.rs are removed. _sysconfigdata no longer includes that file and retains its static and runtime entries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: joshuamegnauth54

Merge Risk: ⚪ Minimal · up to 9c067

The change removes the build-environment export path that could expose build-machine values through sysconfig. No actionable remaining merge risk is evident from the reviewed changes.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: removing build-time environment variables from _sysconfigdata.
Linked Issues check ✅ Passed Issue [#8802] requires removing the build-time exposure of environment variables. crates/vm/build.rs no longer writes OUT_DIR/env_vars.rs. _sysconfigdata.rs no longer includes that generated fil…
Out of Scope Changes check ✅ Passed The changes are limited to the environment-variable dump, its _sysconfigdata inclusion, and removal of the now-unused itertools build dependency. These changes directly support the fix for issue […
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone merged commit 33182c4 into RustPython:main Sep 24, 2026
30 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone deleted the fix-build-env-leak branch September 24, 2026 23:20
@fanninpm

fanninpm commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@Eh2406 does this resolve your concern?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Eh2406

Eh2406 commented Sep 25, 2026

Copy link
Copy Markdown

looks good. Thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 19, 2026
rustpython-vm < 0.6.0: build environment compiled into the library and readable at runtime rustsec/advisory-db#3405
Closed
Publish an advisory for the build environment leak fixed in #8813? #9236
Open
rustpython-vm < 0.6.0: build environment leaked into shipped artifacts rustsec/advisory-db#3438
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Potentially sensitive environment variables logged during build

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@youknowone @fanninpm @Eh2406
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.