Skip to content

Reject malformed integer environment variables - #1501

Merged
aomarks merged 3 commits into
google:mainfrom
mukeshr06:fix/strict-integer-env-options
Sep 25, 2026
Merged

aomarks merged 3 commits into
google:mainfrom
mukeshr06:fix/strict-integer-env-options

Conversation

@mukeshr06

@mukeshr06 mukeshr06 commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

WIREIT_PARALLEL and WIREIT_CACHE_MAX_ENTRIES use parseInt, so malformed values such as 2abc are silently accepted as 2. This can hide a configuration error instead of reporting the documented positive-integer requirement.

Parse the complete decimal value for both options and reject nonpositive or unsafe integers. Preserve surrounding whitespace, an optional leading +, leading zeroes, and the existing case-insensitive infinity handling.

The new user-facing regressions fail on the previous implementation and pass with this change. Compatibility cases run through npm, node --run, Yarn Classic, and pnpm; the original cache-limit case remains covered.

Validation on Node.js 24.19.0 (with node_modules/.bin on PATH):

  • Build, ESLint, Prettier, and git diff --check: passed.
  • Full CLI options suite: 92 passed, 4 intentional skips.
  • New invalid-usage regressions: 2 passed.
  • The full errors-usage suite has 7 existing IPC cleanup failures on this Node version. A baseline comparison reproduces the same 7 failures; only the two new malformed-value failures are fixed here.

@google-cla

google-cla Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@aomarks aomarks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. Added a commit that extends the check to all integer environment variables, and added a CHANGELOG entry.

@aomarks
aomarks merged commit bc4b3c1 into google:main Sep 25, 2026
20 checks 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