Skip to content

version: ignore foreign npm_package_version in npx contexts#25

Merged
osolmaz merged 1 commit intoopenclaw:mainfrom
osolmaz:fix/version-from-wrong-npm-env
Feb 26, 2026
Merged

version: ignore foreign npm_package_version in npx contexts#25
osolmaz merged 1 commit intoopenclaw:mainfrom
osolmaz:fix/version-from-wrong-npm-env

Conversation

@dutifulbob
Copy link
Contributor

Summary

  • fix acpx --version when invoked via npx inside another repo
  • only trust npm_package_version if npm_package_name === "acpx"
  • otherwise resolve version from acpx package metadata (or fallback)
  • add regression tests for foreign npm env leakage

Root cause

npm exec/npx can expose caller-project env variables (for example npm_package_name=openclaw, npm_package_version=2026.2.25).
Our resolver previously trusted npm_package_version unconditionally, which could make acpx --version print the wrong project version.

Validation

  • npm run build:test && node --test dist-test/test/version.test.js
  • npm run build
  • npm run lint
  • npm run typecheck
  • repro check from another repo context:
    • npm_package_name=openclaw npm_package_version=999.999.999 npm exec --yes --package /home/bob/repos/acpx -- acpx --version
    • result: 0.1.0 (acpx version), not caller env version

@osolmaz osolmaz merged commit 1e0c168 into openclaw:main Feb 26, 2026
1 check passed
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