Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Stop embedding build-time environment variables in _sysconfigdata - #8813

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowone:fix-build-env-leak
Sep 24, 2026
Merged

youknowone merged 1 commit into
RustPython:mainfrom
youknowone:fix-build-env-leak

Conversation

@youknowone

@youknowone youknowone commented Sep 24, 2026 •

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.

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

Copy link
Copy Markdown

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

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

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

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

@youknowone
youknowone merged commit 33182c4 into RustPython:main Sep 24, 2026
30 checks passed
@youknowone
youknowone deleted the fix-build-env-leak branch September 24, 2026 23:20
@fanninpm

Copy link
Copy Markdown
Contributor

@Eh2406 does this resolve your concern?

@Eh2406

Eh2406 commented Sep 25, 2026

Copy link
Copy Markdown

looks good. Thank you!

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.

Potentially sensitive environment variables logged during build

3 participants