fix: do not surface hidden options in implications error (#2540) - #2587
Closed
shehjaddev wants to merge 1 commit into
Closed
shehjaddev wants to merge 1 commit into
shehjaddev wants to merge 1 commit into
Conversation
shehjaddev
force-pushed
the
fix/hidden-implies-leak
branch
from
September 3, 2026 13:57
b0e998e to
730b5cb
Compare
Hidden options are internal and should not be disclosed in user-facing validation errors. Skip implications where either the key or value is a hidden option, matching how hidden options are already excluded from help and completion. Fixes #2540
shehjaddev
force-pushed
the
fix/hidden-implies-leak
branch
from
September 3, 2026 14:00
730b5cb to
7f0ce3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
yargs.implications()(used by.implies()) currently includes the names of hidden options in its "Implications failed" error. Hidden options are markedhidden: trueprecisely so they stay out of user-facing output (help, completion), so leaking their names in a validation error is a bug. Reported in #2540.Reproduction
Before this change, the failure message was:
disclosing both internal option names.
Fix
In
lib/validation.ts,self.implications()now skips any implication where either the key or the value is a hidden option, using the sameyargs.getOptions().hiddenOptionssource of truth that help and completion already use. Hidden options are internal, so they should not produce (or appear in) user-facing validation errors.Test
Added a regression test in
test/validation.mjsasserting that an implication involving only hidden options does not surface their names (and raises no error).npm testpasses — 833 passing, lint clean.